Module:Country2nationality/sandbox
Appearance
![]() | This is the module sandbox page for Module:Country2nationality (diff). |
Implements {{Country2nationality}}.
![]() | This module depends on the following other modules: |
Usage
{{#invoke:Country2nationality||country_name}}
Customizing for defunct countries
To use this module for a defunct country such as West Germany or British India, add a custom entry to the data
section, copying the existing format. Capitalize the country name and remove all punctuation. Please ensure that an article exists for the country.
local p = {}
local data = {
CATALONIA = "Catalan",
CZECHOSLOVAKIA = "Czech",
DUTCHEASTINDIES = "Dutch East Indian",
EASTGERMANY = "East German",
GUINEABISSAU = "Bissau-Guinean",
KOSOVO = "Kosovan",
REPUBLICOFVIETNAM = "Vietnamese",
SFRYUGOSLAVIA = "Yugoslavian",
SOVIETUNION = "Soviet",
TIMORLESTE = "East Timorese",
WESTGERMANY = "West German",
USSR = "Soviet",
YUGOSLAVIA = "Yugoslavian"
}
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