Module:languages: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 14: Line 14:
end
end


function export.get_by_canonical_name(name)
function export.get_by_name(name)
local lang = export.find_by_canonical_name(name)
local lang = export.find_by_canonical_name(name)
if lang == nil then error("No such language (" .. name .. ")") end
if lang == nil then error("No such language (" .. name .. ")") end
Line 20: Line 20:
end
end


function export.find_by_canonical_name(name)
function export.find_by_name(name)
local code = mw.loadData("Module:languages/canonical names")[name]
local code = mw.loadData("Module:languages/names")[name]
if code == nil then return nil end
if code == nil then return nil end
return export.find_by_code(code)
return export.find_by_code(code)