Modul:language utilities
Penampilan
- Modul ini kekurangan sublaman pendokumenan. Sila mencipta laman pendokumenan berkaitan.
- Pautan berguna: senarai sublaman • pautan • transklusi • kes ujian • kotak pasir
--local export = {}
-- Look up an item from the table of language data, and return it.
-- This function allows templates to access this data.
-- Returns an empty string if the item does not exist.
--function export.lookup_language(frame)
-- local languages = mw.loadData("Modul:languages")
--
-- local args = frame.args
-- local lang = args[1] or error("Language code has not been specified. Please pass parameter 1 to the module invocation.")
-- local langinfo = languages[lang] or error("The language code \"" .. lang .. "\" is not valid.")
-- The item that the caller wanted to look up
-- local itemname = args[2] or error("Type of information to look up has not been specified. Please pass parameter 2 to the module invocation.")
-- local item = langinfo[itemname] or ""
-- if type(item) == "table" then
-- return item[tonumber(args[3] or 1)] or ""
-- else
-- return item or ""
-- end
--end
--function export.lookup_family(frame)
-- local families = mw.loadData("Modul:families")
-- local args = frame.args
-- local fam = args[1] or error("Family code has not been specified. Please pass parameter 1 to the module invocation.")
-- local faminfo = families[fam] or error("The family code \"" .. fam .. "\" is not valid.")
-- -- The item that the caller wanted to look up
-- local itemname = args[2] or error("Type of information to look up has not been specified. Please pass parameter 2 to the module invocation.")
-- local item = faminfo[itemname] or ""
-- if type(item) == "table" then
-- return item[tonumber(args[3] or 1)] or ""
-- else
-- return item or ""
-- end
--end
--function export.language_exists(frame)
-- local languages = mw.loadData("Modul:languages")
-- local args = frame.args
-- local lang = args[1] or error("Language code has not been specified. Please pass parameter 1 to the module invocation.")
-- if languages[lang] then
-- return "1"
-- else
-- return ""
-- end
--end
--function export.family_exists(frame)
-- local families = mw.loadData("Modul:families")
-- local args = frame.args
-- local fam = args[1] or error("Family code has not been specified. Please pass parameter 1 to the module invocation.")
-- if families[fam] then
-- return "1"
-- else
-- return ""
-- end
--end
--return export