Module:trans-top
Appearance
- De neikommende dokumintaasje stiet op Module:trans-top/dokumintaasje. [bewurkje]
Generearet in part fan 'e tekst mei opmaak fan Berjocht:trans-top.
p = {}
function p.main(frame)
local args = frame:getParent().args
local lang = ""
local names = {}
local text = ""
local m_languages = require("Module:languages")
for k, v in pairs(args) do
if type(k) == "string" and k ~= "n" and k ~= "kopke" and k ~= "kolom" and k ~= "klap" and k ~= "kleur" then
lang = m_languages.getByCode(k)
if type(lang) ~= "nil" then
names[lang:getCanonicalName()] = {[1] = k, [2] = v}
else
local m_families = require("Module:families")
local fam = m_families.getByCode(k)
if type(fam) ~= "nil" then
names[fam:getCanonicalName()] = {[1] = k, [2] = v}
else
names[k] = {[1] = '?', [2] = '<strong class="error">Lua-flater yn Module:trans-top: De taal- of famyljekoade "' .. k .. '" is net jildich.</strong>[[Kategory:Siden mei skriptflaters]]'}
end
end
end
end
local filter = {"frr", "ofs", "qst", "stq"}
for k, v in ipairs(filter) do
lang = m_languages.getByCode(v)
names[lang:getCanonicalName()] = nil
end
lang = m_languages.getByCode("fy")
local function sort(item1, item2)
local sort1, sort2 = lang:makeSortKey(item1), lang:makeSortKey(item2)
return sort1 < sort2
end
local sortedPairs = require("Module:table").sortedPairs
for k, v in sortedPairs(names, sort) do
text = text .. '<li><span title="' .. names[k][1] .. '">' .. k .. '</span>: ' .. names[k][2] .. '</li>'
end
return text
end
return p