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 21:38, 4 February 2025 (Use strip function from "Module:ISO 3166" to normalize names in override table). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}
local data = {
	CATALONIA = "Catalan",
	GUINEABISSAU = "Bissau-Guinean",
	KOSOVO = "Kosovan",
	TIMORLESTE = "East Timorese",
    WESTGERMANY = "West German"
}

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

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

return p