2,788
edits
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
error("Language code must be string. Got " .. type(code)) | error("Language code must be string. Got " .. type(code)) | ||
end | end | ||
local l = | local l = mw.loadData("Module:languages/data")[code] | ||
if l == nil then | if l == nil then | ||
error("No such language code") | error("No such language code") | ||
end | end | ||
return l | return l | ||
end | |||
function export.get_by_canonical_name(name) | |||
local c = mw.loadData("Module:languages/canonical names")[name] | |||
if c == nil then | |||
error("No such language name") | |||
end | |||
return export.get_by_code(c) | |||
end | end | ||