Module:sandbox/labels/templates

Hello, you have come here looking for the meaning of the word Module:sandbox/labels/templates. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:sandbox/labels/templates, but we will also tell you about its etymology, its characteristics and you will know how to say Module:sandbox/labels/templates in singular and plural. Everything you need to know about the word Module:sandbox/labels/templates you have here. The definition of the word Module:sandbox/labels/templates will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:sandbox/labels/templates, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


local export = {}

--[=[
	Modules used:
	]
	]
	]
	]
	]
]=]

function export.show(frame)
	local parent_args = frame:getParent().args
	local compat = (frame.args or "") ~= "" and parent_args
	local term_mode = (frame.args or "") ~= ""
	
	local params = {
		 = {required = true},
		 = {list = true},
		 = {type = "boolean"},
		 = {},
		 = {},
		 = {},
		 = {},
	}
	
	if compat then
		params = params
		params = nil
		params = {required = true}
	end
	
	local args = require("Module:parameters").process(parent_args, params)
	
	-- Gather parameters
	local lang = args
	local labels = args
	local nocat = args
	local script = args
	local script2 = args
	local sort_key = args
	local sort_key2 = args

	if not lang then
		if mw.title.getCurrentTitle().nsText == "Template" then
			lang = "und"
		else
			error("Language code has not been specified. Please provide it to the template using the first parameter.")
		end
	end
	
	lang = require("Module:languages").getByCode(lang) or require("Module:languages").err(lang, compat and "lang" or 1)
	
	return require("Module:labels/sandbox").show_labels(labels, lang, script, script2, sort_key, sort_key2, nocat, term_mode)
end

--[[	temporary. intentionally undocumented.
		this function is only to be used in
		{{alternative spelling of}},
		{{eye dialect of}}
		and similar templates					]]
function export.show_from(frame)
	local froms = {}
	local categories = {}

	local iparams = {
		 = {},
		 = {type = "number"},
		 = {},
	}
	
	local iargs = require("Module:parameters").process(frame.args, iparams)
	local parent_args = frame:getParent().args
	local compat = iargs or parent_args

	local params = {
		 = {required = not iargs},
		 = {list = true},
		 = {type = "boolean"},
	}

	-- This is called by various form-of templates. They accept several params,
	-- and some templates accept additional params. To avoid having to list all
	-- of them, we just ignore unrecognized params. The main processing for the
	-- form-of template will catch true unrecognized params.
	local args = require("Module:parameters").process(parent_args, params, "allow unrecognized params")
	local lang = args or iargs or "und"
	local nocat = args
	local limit = iargs.limit or 99999
	
	local m_languages = require("Module:languages")
	lang = m_languages.getByCode(lang) or m_languages.err(lang, "lang")

	local already_seen = {}

	for i, k in ipairs(args) do
		if i > limit then
			break	
		end
		local ret = require("Module:labels/sandbox").get_label_info(k, lang, already_seen)
		if ret.label ~= "" then
			table.insert(froms, ret.label)
		end
		if ret.categories ~= "" then
			table.insert(categories, ret.categories)
		end
	end
	
	if #froms == 0 then
		return iargs.default
	end

	return require("Module:table").serialCommaJoin(froms) .. table.concat(categories)
end

return export