Module:Languages/errorGetBy

From The Languages of David J. Peterson
Jump to navigation Jump to search

Documentation for this module may be created at Module:Languages/errorGetBy/documentation

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