Modul:number list/num2string
A modult a Modul:number list/num2string/doc lapon tudod dokumentálni
local export = {}
local m_languages = require('Module:languages')
function export.get_number(frame)
local params = {
[1] = {required = true},
[2] = {required = true},
["t"] = { type = "boolean" },
}
local cur_type = "cardinal"
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = m_languages.getByCode(args[1])
if not lang then
return string.format('<strong class="error">Ismeretlen nyelvkód: %s</strong>', args[1])
end
local cur_num = args[2]
cur_num = tonumber(cur_num)
local m_data = require("Module:number list/data/" .. lang:getCode())
local cur_data = m_data.numbers[cur_num]
if cur_data then
if cur_data[cur_type] then
local cur = cur_data[cur_type]
if args["t"] then
if type(cur) == "string" then
cur = { cur }
end
local m_translations = require("Module:translations")
for i, v in ipairs(cur) do
cur[i] = m_translations.show_terminfo{
lang = lang,
term = v
}
end
return table.concat(cur, ', ')
else
return cur
end
else
return '<strong class="error">Ismeretlen a tőszámnévi alak</strong>'
end
else
return string.format(
'<strong class="error">Ismeretlen a(z) %d szám a(z) %s nyelvben</strong>',
cur_num,
lang:getCanonicalName()
)
end
end
return export