local export = {}

function export.exists(frame)
	local args = frame.args
	local fam = args[1] or error("Family code has not been specified. Please pass parameter 1 to the module invocation.")
	
	fam = require("Module:families").getByCode(fam)
	
	if fam then
		return "1"
	else
		return ""
	end
end

function export.getByCode(frame)
	local args = frame.args
	local fam = args[1] or error("Family code (parameter 1) has not been specified.")
	fam = require("Module:families").getByCode(fam) or error("The family code '" .. fam .. "' is not valid.")

	return require("Module:language-like").templateGetByCode(fam, args)
end

function export.getByCanonicalName(frame)
	local args = frame.args
	local famname = args[1] or error("Family name has not been specified. Please pass parameter 1 to the module invocation.")
	
	local fam = require("Module:families").getByCanonicalName(famname)
	
	if fam then
		return fam:getCode()
	else
		return ""
	end
end

return export