Module:families/templates
Appearance
Documentation for this module may be created at Module:families/templates/doc
local export = {}
function export.exists(frame)
local args = frame.args
local fam = args[1] or error("Xeerka qoyska aan la cayimay. Fadlan mari Halbeegga 1 ilaa ogyn qaybtan.")
fam = require("Module:families").getByCode(fam)
if fam then
return "1"
else
return ""
end
end
function export.getByCode(frame)
local args = frame.args
local fam = args[1] or error("Xeerka qoyska (halbeegga 1) aan la cayimay.")
local itemname = args[2] or error("Fansaar inuu u soo yeedho (halbeegga 2) aan la cayimay.")
fam = require("Module:families").getByCode(fam) or error("Xeerka qoyska '" .. fam .. "' run ma aha.")
-- Shayga in wacaha doonayay in kor eega
if itemname == "getCanonicalName" then
return fam:getCanonicalName()
elseif itemname == "getOtherNames" then
local index = args[3]; if index == "" then index = nil end
index = tonumber(index or error("Murdisada tiro shayga la doonayo in liiska (halbeegga 3) aan la cayimay."))
return fam:getOtherNames()[index] or ""
elseif itemname == "getFamily" then
return fam:getFamily():getCode()
elseif itemname == "getCategoryName" then
return fam:getCategoryName()
else
error("Haddii ay codsi ka jirin magaca shayga \"" .. itemname .. "\".")
end
end
function export.getByCanonicalName(frame)
local args = frame.args
local famname = args[1] or error("Magaca qoyska aan la cayimay. Fadlan mari halbeegga 1 ilaa ogyn qaybtan.")
local fam = require("Module:families").getByCanonicalName(famname)
if fam then
return fam:getCode()
else
return ""
end
end
return export