Jump to content

Module:Country2nationality

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ahecht (talk | contribs) at 20:00, 15 August 2024 (Fix St. always being Sao Tome). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}
local data = {
	england = "English",
	scotland = "Scottish",
	wales = "Welsh",
	catalonia = "Catalan",
	kosovo = "Kosovan",
}

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 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