Přeskočit na obsah

Modul:Data státu

Z Wikipedie, otevřené encyklopedie
local data = mw.loadData("Modul:Data státu/Data")
local localization = mw.loadData("Module:Data státu/Lokalizace")

function getLocalName(englishName)
	for iLocal, iEnglish in pairs(localization) do
		if iEnglish == englishName then return iLocal end
	end
	return englishName
end

return { getData = function(args)
	local result = { flag = "None" }
	if not args[1] or args[1] == "" then return result end

	local englishName = localization[args[1]] or data.shortcuts[args[1]] or args[1]
	result.name = localization[args[1]] and args[1] or getLocalName(englishName)
	result.article = result.name
	result.flag = data.flags[englishName] or englishName
	if not string.find(result.flag, ":") then
		result.flag = "File:Flag of " .. result.flag .. ".svg"
	end
	
	return result
end }