-
Notifications
You must be signed in to change notification settings - Fork 2
/
localization.lua
63 lines (57 loc) · 2.67 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---@class XLootAddon
local XLoot = select(2, ...)
local function CompileLocales(locales)
local L = locales[GetLocale()] and locales[GetLocale()] or locales.enUS
if L ~= locales.enUS then
setmetatable(L, { __index = locales.enUS })
for k, v in pairs(L) do
if type(v) == 'table' then
setmetatable(v, { __index = locales.enUS[k] })
end
end
end
return L
end
-- locales expects table: { enUS = {...}, ... }
function XLoot:Localize(name, locales)
-- We need to extract the root namespace due to how Curse is currently doing localizations.
for _,t in pairs(locales) do
if t[name] then
for k, v in pairs(t[name]) do
t[k] = v
end
t[name] = nil
end
end
self["L_"..name] = CompileLocales(locales)
end
local locales = {
enUS = {
skin_svelte = "XLoot: Svelte",
skin_legacy = "XLoot: Legacy",
skin_smooth = "XLoot: Smooth",
anchor_hide = "hide",
anchor_hide_desc = "Lock this module in position\nThis will hide the anchor,\nbut it can be shown again from the options",
},
-- Possibly localized
ptBR = {},
frFR = {},
deDE = {},
koKR = {},
esMX = {},
ruRU = {},
zhCN = {},
esES = {},
zhTW = {},
}
-- Automatically inserted translations
--@localization(locale="ptBR", format="lua_additive_table", table-name="locales.ptBR", handle-subnamespaces="subtable", handle-unlocalized="ignore", namespace="Core")@
--@localization(locale="frFR", format="lua_additive_table", table-name="locales.frFR", handle-subnamespaces="subtable", handle-unlocalized="ignore", namespace="Core")@
--@localization(locale="deDE", format="lua_additive_table", table-name="locales.deDE", handle-subnamespaces="subtable", handle-unlocalized="ignore", namespace="Core")@
--@localization(locale="koKR", format="lua_additive_table", table-name="locales.koKR", handle-subnamespaces="subtable", handle-unlocalized="ignore", namespace="Core")@
--@localization(locale="esMX", format="lua_additive_table", table-name="locales.esMX", handle-subnamespaces="subtable", handle-unlocalized="ignore", namespace="Core")@
--@localization(locale="ruRU", format="lua_additive_table", table-name="locales.ruRU", handle-subnamespaces="subtable", handle-unlocalized="ignore", namespace="Core")@
--@localization(locale="zhCN", format="lua_additive_table", table-name="locales.zhCN", handle-subnamespaces="subtable", handle-unlocalized="ignore", namespace="Core")@
--@localization(locale="esES", format="lua_additive_table", table-name="locales.esES", handle-subnamespaces="subtable", handle-unlocalized="ignore", namespace="Core")@
--@localization(locale="zhTW", format="lua_additive_table", table-name="locales.zhTW", handle-subnamespaces="subtable", handle-unlocalized="ignore", namespace="Core")@
XLoot.L = CompileLocales(locales)