Skip to content

Commit

Permalink
Split out internal strings and app-specific strings, so package devel…
Browse files Browse the repository at this point in the history
…opers

 don't have to track our changes to keep their localizations up to date.
  • Loading branch information
icculus committed Jan 20, 2008
1 parent 60c401f commit 340991f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua_glue.c
Expand Up @@ -1620,8 +1620,9 @@ boolean MojoLua_initLua(void)
free(binarypath);
free(homedir);

// Set up localization table, if possible.
// Set up localization tables, if possible.
MojoLua_runFile("localization");
MojoLua_runFile("app_localization");

// Transfer control to Lua to setup some APIs and state...
if (!MojoLua_runFile("mojosetup_init"))
Expand Down
4 changes: 4 additions & 0 deletions scripts/localization.lua
Expand Up @@ -6,6 +6,10 @@

-- Lines starting with "--" are comments in this file.
--
-- You should add your installer's strings to app_localization.lua, not this
-- file. This file is for strings internal to MojoSetup, and we change it all
-- the time. Your app can override any individual string in this file, though.
--
-- NOTE: If you care about Unicode or ASCII chars above 127, this file _MUST_
-- be UTF-8 encoded! If you think you're using a certain high-ascii codepage,
-- you're wrong!
Expand Down
15 changes: 15 additions & 0 deletions scripts/mojosetup_init.lua
Expand Up @@ -130,6 +130,21 @@ if type(MojoSetup.localization) ~= "table" then
MojoSetup.localization = nil
end

-- Merge the applocalization table into localization.
if type(MojoSetup.applocalization) == "table" then
for k,v in pairs(MojoSetup.applocalization) do
if MojoSetup.localization[k] == nil then
MojoSetup.localization[k] = v -- just take the whole table as-is.
else
-- This can add or overwrite entries...
for lang,str in pairs(MojoSetup.applocalization) do
MojoSetup.localization[k][lang] = str
end
end
end
end
MojoSetup.applocalization = nil -- done with this; garbage collect it.

-- Map some legacy language identifiers into updated equivalents.
local lang_remap =
{
Expand Down

0 comments on commit 340991f

Please sign in to comment.