Zelda Wiki

Want to contribute to this wiki?
Sign up for an account, and get started!

Come join the Zelda Wiki community Discord server!

READ MORE

Zelda Wiki
Advertisement

local p = {}
local utilsTable = require("Module:UtilsTable")
CODE_SORT_ORDER = {"enBr", "ja", "zhS", "zhT", "nl", "fi", "frC", "frF", "de", "hu", "it", "ko", "no", "pl", "ptB", "ptP", "ru", "esS", "esL"}

--Returns the full formatted name of a language from the provided code
function p.CodeToLanguage(code)
	local result = "Unknown"
	
	if code == "ja" then
		result = "Japanese"	
	elseif code == "zhS" then
		result = "Chinese<sup><span class='explain' title='Simplified' style='color:yellow;'>SI</sup>"	
	elseif code == "zhT" then
		result = "Chinese<sup><span class='explain' title='Traditional' style='color:yellow;'>TR</sup>"	
	elseif code == "nl" then
		result = "Dutch"	
	elseif code == "fi" then
		result = "Finnish"	
	elseif code == "frC" then
		result = "French<sup><span class='explain' title='Canadian' style='color:yellow;'>CA</sup>"	
	elseif code == "frF" then
		result = "French<sup><span class='explain' title='European' style='color:yellow;'>EU</sup>"	
	elseif code == "de" then
		result = "German"	
	elseif code == "hu" then
		result = "Hungarian"	
	elseif code == "it" then
		result = "Italian"	
	elseif code == "ko" then
		result = "Korean"	
	elseif code == "no" then
		result = "Norwegian"	
	elseif code == "pl" then
		result = "Polish"	
	elseif code == "ptB" then
		result = "Portuguese<sup><span class='explain' title='Brazilian' style='color:yellow;'>BR</sup>"	
	elseif code == "ptP" then
		result = "Portuguese<sup><span class='explain' title='European' style='color:yellow;'>EU</sup>"	
	elseif code == "ru" then
		result = "Russian"	
	elseif code == "esS" then
		result = "Spanish<sup><span class='explain' title='European' style='color:yellow;'>EU</sup>"	
	elseif code == "esL" then
		result = "Spanish<sup><span class='explain' title='Latin American' style='color:yellow;'>LA</sup>"	
	end

	return result
end

--Returns a small flag image of the corresponding language code.
function p.CodeToFlag(code)
	local result = "Unknown"
	
	if code == "frC" then
		result =  "[[File:Canada Flag.png|Canada|20px|link=]]"
	end
	
	return result
end

-- Orders a list of languages in nomenclature table order.
function p.OrderCodes(codes)
	local orderedCodes = {}
	
	for key, value in pairs(CODE_SORT_ORDER) do
		if utilsTable.keyOf(codes, value) then
			table.insert(orderedCodes, value)
		end
	end
	
	return orderedCodes
end

return p
Advertisement