local translations =
-- known languages (except for English)
local languages =
local ENGLISH_TAG = "en"local ENGLISH = "English"
function orderedKeys(dict) local keys = local result = for k, v in pairs(dict) do table.insert(keys, k) end table.sort(keys) for i, k in ipairs(keys) do table.insert(result, k) end return resultend
function NZ(value, valueifNil) if value
-- the modulelocal p =
function p.getLanguageName(frame) return languages(frame.args[1])end
-- Returns the translation of specific keyword (English)-- with the provided language tag,-- or nil, if no such translation is found.function p.translate(frame) local term = frame.args[1] local language = frame.args[2] -- Bypass English. if language
-- Generates a full glossary function p.glossaryTable local colhdr = mw.html.create("table") :attr("class", "wikitable") :css("float", "left") :css("margin", "0") :css("margin-right", "-1px") local body = mw.html.create("div") :css("overflow-x", "auto") :css("white-space", "nowrap") :tag("table") :attr("class", "wikitable") :css("margin", "0") :tag("tr") colhdr:tag("tr"):tag("th"):wikitext(ENGLISH) local langs = orderedKeys(languages) for i, langTag in ipairs(langs) do body:tag("th"):wikitext(languages[langTag]) end body = body:done; local transKeys = orderedKeys(translations) for i, key in ipairs(transKeys) do colhdr:tag("tr"):tag("th"):wikitext(key) body = body:tag("tr") local trans = translations[key] for i, langTag in ipairs(langs) do t = trans[langTag] if t
-- Generates a table of translations of a specific English term.-- Returns nil if no such term exists in the dictionary.function p.translationTable(frame) local term = frame.args[1] local trans = translations[term] if trans
return p