Module:languages: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 38: | Line 38: | ||
end | end | ||
function export. | function export.getByCode(frame) | ||
local code = frame.args[1] | local code = frame.args[1] | ||
local field = frame.args[2] | local field = frame.args[2] |
Revision as of 12:04, 5 August 2023
local export = {}
local languages = {
-- Proto-Laenkean
["lnk-pro"] = {name = "Proto-Laenkean", code = "lnk-pro", link = ":Category:Proto-Laenkean roots", proto = true},
-- Balavic
["bal"] = {name = "Balavic", code = "bal", link = ":Category:Balavic lemmas", proto = false},
-- Kilitic
["kil"] = {name = "Kilitic", code = "kil", link = ":Category:Kilitic lemmas", proto = false},
-- Laefevian
["lfv-pro"] = {name = "Proto-Laefevic", code = "lfv-pro", link = ":Category:Proto-Laefevic lemmas", proto = true},
["lfv"] = {name = "Lafevian", code = "lfv", link = ":Category:Laefevian lemmas", proto = false},
-- Radestrian
["rad-pro"] = {name = "Proto-Radic", code = "rad-pro", link = ":Category:Proto-Radic lemmas", proto = true},
["rad"] = {name = "Radestrian", code = "rad", link = ":Category:Radestrian lemmas", proto = false},
-- Riyan
["ryn-o"] = {name = "Old Riyan", code = "ryn-o", link = ":Category:Old Riyan lemmas", proto = false},
["ryn-m"] = {name = "Middle Riyan", code = "ryn-m", link = ":Category:Middle Riyan lemmas", proto = false},
["ryn"] = {name = "Riyan", code = "ryn", link = ":Category:Riyan lemmas", proto = false}
}
function export.get_by_code(code)
if type(code) ~= "string" then
error("Language code must be a string")
end
local l = languages[code]
if l == nil then
error("No such language code")
end
return l
end
function export.get_field_by_code(code, field)
if type(field) ~= "string" then
error("Desired field must be a string")
end
local l = export.get_by_code(code)
return l[field]
end
function export.getByCode(frame)
local code = frame.args[1]
local field = frame.args[2]
if type(field) == "string" then
return export.get_field_by_code(code, field)
end
return export.get_by_code(code)
end
return export