Module:languages/errorGetBy

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