Modul:lect
A modult a Modul:lect/doc lapon tudod dokumentálni
local export = {}
local m_languages = require("Module:languages")
local m_etym_languages = require("Module:etymology languages")
function export.show(frame)
local params = {
[1] = { required = true },
[2] = { required = true, list = true }
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = args[1]
local lect = args[2]
local lectNames = {}
if mw.title.getCurrentTitle().nsText == "Template" then
if not lang then
lang = "en"
end
if not lect then
lect = { "en-GB", "en-US" }
end
end
lang = m_languages.getByCode(lang)
or require("Module:families").getByCode(lang)
or m_languages.err(lang, 1)
local getNonEtymological = require("Module:etymology").getNonEtymological
for i in pairs(lect) do
local lectName = m_etym_languages.getByCode(lect[i])
or m_etym_languages.getByCode(lang:getCode().."-"..lect[i])
or m_languages.err(lect[i], i + 1)
table.insert(lectNames, lectName:getCanonicalName())
end
local output = { table.concat(lectNames, ', ') }
return table.concat(output)
end
return export