Module:languages/errorGetBy

< Module:languages
Revision as of 12:55, 18 June 2023 by Sware (talk | contribs) (Created page with "local export = {} function export.code(code, paramForError, allowEtymLang, allowFamily) local codetext = nil if allowEtymLang and allowFamily then codetext = "language, etymology language or family code" elseif allowEtymLang then codetext = "language or etymology language code" elseif allowFamily then codetext = "language or family code" else codetext = "language code" end require("Module:languages/error")(code, paramForError, codetext) end function expo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:languages/errorGetBy/doc

local export = {}

function export.code(code, paramForError, allowEtymLang, allowFamily)
	local codetext = nil
	if allowEtymLang and allowFamily then
		codetext = "language, etymology language or family code"
	elseif allowEtymLang then
		codetext = "language or etymology language code"
	elseif allowFamily then
		codetext = "language or family code"
	else
		codetext = "language code"
	end
	require("Module:languages/error")(code, paramForError, codetext)
end

function export.canonicalName(name, allowEtymLang, allowFamily)
	local text
	if allowEtymLang and allowFamily then
		text = "language, etymology language or family name"
	elseif allowEtymLang then
		text = "language or etymology language name"
	elseif allowFamily then
		text = "language or family name"
	else
		text = "language name"
	end
	error("The " .. text .. " \"" .. name .. "\" is not valid.")
end

return export