local translations = {
["Warrior Cats"] =
{
de = "Warrior Cats",
fi = "Soturikissat",
fr = "La Guerre des Clans",
hu = "Harcosok Törzse",
jp = "ウォーリアーズ",
ko = "고양이 전사들",
lt = "Klanų Kariai",
nl = "Warrior Cats",
no = "Kattekrigerne",
pl = "Wojownicy",
ru = "Коты-воители",
cz = "Divoké kočky(first book) Válečníci(other books)",
es = "Los Gatos Guerreros",
zh_cn = "猫武士",
zh_tw = "貓戰士"
},
cat =
{
de = "Katze",
fi = "kissa",
fr = "chat",
hu = "macska",
jp = "猫",
ko = "고양이",
lt = "katinas",
nl = "kat",
no = "katt",
pl = "kot",
ru = "кот (tom-cat)/кошка (she-cat)",
cz = "kocour(tom-cat) kočka(she-cat)",
es = "gato",
zh_cn = "猫",
zh_tw = "貓"
},
leader =
{
de = "Anführer",
fi = "päällikkö",
fr = "chef",
hu = "vezér",
jp = "族長",
ko = "지도자",
lt = "vadas",
nl = "leider",
no = "leder",
pl = "przywódca",
ru = "предводитель (tom-cat)/предводительница (she-cat)",
cz = "velitel klanu",
es = "líder",
zh_cn = "族长",
zh_tw = "族長"
},
Leafpool =
{
de = "Blattsee",
fi = "Lehtilampi",
fr = "Feuille de Lune",
hu = nil,
jp = "リーフプール",
ko = nil,
lt = nil,
nl = "Loofpoel",
no = "Løvtjern",
pl = nil,
ru = "Листвичка",
cz = nil,
es = "Hojarasca Acuática",
zh_cn = "叶池",
zh_tw = nil
},
Bluestar =
{
de = "Blaustern",
fi = "Sinitähti",
fr = "Étoile Bleue",
hu = "Kékcsillag",
jp = "ブルスター",
ko = nil,
lt = nil,
nl = "Blauwster",
no = "Blåstjerne",
pl = nil,
ru = "Синяя Звезда",
cz = nil,
es = "Estrella Azul",
zh_cn = "蓝星",
zh_tw = nil
},
}
-- known languages
local languages = {
cz = "Czech",
de = "German",
es = "Spanish",
fi = "Finnish",
fr = "French",
gr = "Greek",
hu = "Hungarian",
hr = "Croatian",
it = "Italian",
ja = "Japanese",
ko = "Korean",
lt = "Lithuanian",
nl = "Dutch",
no = "Norwegian",
pl = "Polish",
pt = "Portuguese (Brazilian)",
ro = "Romanian",
ru = "Russian",
si = "Slovenian",
sk = "Slovakian",
tr = "Turkish",
vi = "Vietnamese",
zh_cn = "Chinese Simplified",
zh_tw = "Chinese Traditional",
}
function orderedLanguages()
local names = {}
local result = {}
for k, v in pairs(languages) do
tables.insert(names)
end
table.sort(names)
for i, k in ipairs(names) do
table.insert(result, k)
end
return result
end
-- the module
local p = { }
-- Returns the translation of specific keyword (English)
-- with the provided language tag,
-- or nil, if no such translation is found.
function p.translate(key, language)
-- Bypass English.
if language == "en" then return key end
return translations[key][language]
end
-- Generates a full glossary
function p.glossary()
local colhdr = mw.html.create("table")
:attr("class", "wikitable")
:css("float", "left")
:css("margin", "0")
local body = mw.html.create("table")
:attr("class", "wikitable")
:css("overflow-x", "auto")
:css("white-space", "nowrap")
:tag("tr")
local langs = orderedLanguages()
for i, langTag in ipairs(langs) do
body:tag("th"):wikitext(languages[langTag])
end
body = body:done();
for key, trans in pairs(translations) do
colhdr:tag("tr"):tag("th"):wikitext(key)
body = body:tag("tr")
for i, langTag in ipairs(langs) do
t = trans[langTag]
if t == nil then t = "-" end
body:tag("td"):wikitext(t)
end
body = body:done()
--print(key)
end
local div = mw.html.create("div")
:node(colhdr)
:node(body)
return tostring(div)
end
--print(p.glossary())
return p