Module:Country2nationality: Difference between revisions

From Osolia Wiki
m Protected "Module:Country2nationality": High-risk template or module: 40330 transclusions (more info) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
 
m 1 revision imported
 
(No difference)

Latest revision as of 18:31, 5 December 2024

Documentation for this module may be created at Module:Country2nationality/doc

local p = {}
local data = {
	catalonia = "Catalan",
	['guinea-bissau'] = "Bissau-Guinean",
	kosovo = "Kosovan",
	['timor-leste'] = "East Timorese"
}

function p.c2n(country)
	country = mw.ustring.gsub( mw.text.trim(country), "^St. ", "Saint " )
	local iso = require("Module:ISO 3166").code({country})
	if #iso == 2 or #iso == 6 then
		return require("Module:Iso2nationality").i2n(iso)
	elseif data[mw.ustring.lower(country)] then
		return data[mw.ustring.lower(country)]
	end
	return country
end

p[''] = function (frame) return p.c2n(frame.args[1]) end

return p