Pastes

Re: generic Localization.lua

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
I liked your single file idea, so I decided to use it, just a little differently.
The translations in the lua files must be correct English though,
since no changes to the English are made.
I prefer this way just in case I want to add more tables to the the AddonTable than just localizations.


----------> Place the following two lines at the top of every lua file in the addon except for the first loaded lua file:
local AddonName, AddonTable = ...
local L = AddonTable.Localize


----------> Name the first loaded lua file something like Localization.lua and place the following into it:
-- To update a translation please use the localization utility
-- at: http://www.wowace.com/projects/YOURADDON/localization/

local AddonName, AddonTable = ...
AddonTable.Localize = setmetatable({}, {__index = function(_, key) return key end})
local L = AddonTable.Localize

if GetLocale() == "frFR" then -- French
--@localization(locale="frFR", format="lua_additive_table")@
elseif GetLocale() == "deDE" then -- German
--@localization(locale="deDE", format="lua_additive_table")@
elseif GetLocale() == "koKR" then -- Korean
--@localization(locale="koKR", format="lua_additive_table")@
elseif GetLocale() == "esMX" then -- Latin American Spanish
--@localization(locale="esMX", format="lua_additive_table")@
elseif GetLocale() == "ruRU" then -- Russian
--@localization(locale="ruRU", format="lua_additive_table")@
elseif GetLocale() == "zhCN" then -- Simplified Chinese
--@localization(locale="zhCN", format="lua_additive_table")@
elseif GetLocale() == "esES" then -- Spanish
--@localization(locale="esES", format="lua_additive_table")@
elseif GetLocale() == "zhTW" then -- Traditional Chinese
--@localization(locale="zhTW", format="lua_additive_table")@
end

Facts

Date posted
08 Sep 2010
Language
Lua
Reply to
generic Localization.lua by Morsker

Poster