Module:Country adjective

From TWC Archive
Jump to navigation Jump to search

Module:Country adjective can be used to retrieve a country's name from its adjective or a country's adjective from its name. The list is based on List of adjectival and demonymic forms for countries and nations.

Usage

local data = mw.loadData('Module:Country adjective')
data.getCountryFromAdj[adjective]

Function and parameter list

Function Parameter Explanation
getAdjFromCountry <country name> Retrieves the country adjective from a country name.
getCountryFromAdj <country adjective> Retrieves the country name from a country adjective.

-- Returns a list of country adjectives based on the list at https://en.wikipedia.org/wiki/List_of_adjectival_and_demonymic_forms_for_countries_and_nations.
local adjFromCountryList = {
	["Abkhazia"] = "Abkhazian",
	["Afghanistan"] = "Afghan",
	["Albania"] = "Albanian",
	["Algeria"] = "Algerian",
	["American Samoa"] = "American Samoan",
	["Andorra"] = "Andorran",
	["Angola"] = "Angolan",
	["Anguilla"] = "Anguillan",
	["Antigua and Barbuda"] = "Antigua and Barbuda",
	["Argentina"] = "Argentine",
	["Armenia"] = "Armenian",
	["Aruba"] = "Aruban",
	["Australia"] = "Australian",
	["Austria"] = "Austrian",
	["Azerbaijan"] = "Azerbaijani",
	["Bahamas"] = "Bahamian",
	["Bahrain"] = "Bahraini",
	["Bangladesh"] = "Bangladeshi",
	["Barbados"] = "Barbadian",
	["Belarus"] = "Belarusian",
	["Belgium"] = "Belgian",
	["Belize"] = "Belizean",
	["Benin"] = "Beninese",
	["Bermuda"] = "Bermudian",
	["Bhutan"] = "Bhutanese",
	["Bolivia"] = "Bolivian",
	["Bonaire"] = "Bonaire",
	["Bosnia and Herzegovina"] = "Bosnia and Herzegovina",
	["Botswana"] = "Botswanan",
	["Brazil"] = "Brazilian",
	["British Indian Ocean Territory"] = "British Indian Ocean Territory",
	["Brunei"] = "Bruneian",
	["Bulgaria"] = "Bulgarian",
	["Burkina Faso"] = "Burkinabé",
	["Myanmar"] = "Burmese",
	["Burundi"] = "Burundian",
	["Cape Verde"] = "Cape Verdean",
	["Cambodia"] = "Cambodian",
	["Cameroon"] = "Cameroonian",
	["Canada"] = "Canadian",
	["Cayman Islands"] = "Caymanian",
	["Central African Republic"] = "Central African",
	["Chad"] = "Chadian",
	["Chile"] = "Chilean",
	["China"] = "Chinese",
	["Colombia"] = "Colombian",
	["Comoros"] = "Comorian",
	["Democratic Republic of the Congo"] = "Congolese",
	["Republic of the Congo"] = "Congolese",
	["Cook Islands"] = "Cook Island",
	["Costa Rica"] = "Costa Rican",
	["Croatia"] = "Croatian",
	["Cuba"] = "Cuban",
	["Curaçao"] = "Curaçaoan",
	["Cyprus"] = "Cypriot",
	["Czech Republic"] = "Czech",
	["Czechoslovakia"] = "Czechoslovak",
	["Denmark"] = "Danish",
	["Djibouti"] = "Djiboutian",
	["Dominica"] = "Dominica",
	["Dominican Republic"] = "Dominican Republic",
	["East Timor"] = "East Timorese",
	["Ecuador"] = "Ecuadorian",
	["Egypt"] = "Egyptian",
	["El Salvador"] = "Salvadoran",
	["Equatorial Guinea"] = "Equatoguinean",
	["Eritrea"] = "Eritrean",
	["Estonia"] = "Estonian",
	["Eswatini"] = "Swazi",
	["Ethiopia"] = "Ethiopian",
	["Falkland Islands"] = "Falkland Islands",
	["Faroe Islands"] = "Faroese",
	["Fiji"] = "Fijian",
	["Finland"] = "Finnish",
	["France"] = "French",
	["French Guiana"] = "French Guianan",
	["French Polynesia"] = "French Polynesian",
	["Gabon"] = "Gabonese",
	["Gambia"] = "Gambian",
	["Georgia"] = "Georgian",
	["Germany"] = "German",
	["Ghana"] = "Ghanaian",
	["Greece"] = "Greek",
	["Greenland"] = "Greenlandic",
	["Grenada"] = "Grenadian",
	["Guadeloupe"] = "Guadeloupean",
	["Guam"] = "Guamanian",
	["Guatemala"] = "Guatemalan",
	["Guernsey"] = "Guernsey",
	["Guinea"] = "Guinean",
	["Guinea-Bissau"] = "Bissau-Guinean",
	["Guyana"] = "Guyanese",
	["Haiti"] = "Haitian",
	["Honduras"] = "Honduran",
	["Hong Kong"] = "Hong Kong",
	["Hungary"] = "Hungarian",
	["Iceland"] = "Icelandic",
	["India"] = "Indian",
	["Indonesia"] = "Indonesian",
	["Iran"] = "Iranian",
	["Iraq"] = "Iraqi",
	["Ireland"] = "Irish",
	["Isle of Man"] = "Manx",
	["Israel"] = "Israeli",
	["Italy"] = "Italian",
	["Ivory Coast"] = "Ivorian",
	["Jamaica"] = "Jamaican",
	["Jan Mayen"] = "Jan Mayen",
	["Japan"] = "Japanese",
	["Jersey"] = "Jersey",
	["Jordan"] = "Jordanian",
	["Kazakhstan"] = "Kazakhstani",
	["Kenya"] = "Kenyan",
	["Kiribati"] = "I-Kiribati",
	["North Korea"] = "North Korean",
	["South Korea"] = "South Korean",
	["Kosovo"] = "Kosovan",
	["Kuwait"] = "Kuwaiti",
	["Kyrgyzstan"] = "Kyrgyzstani",
	["Laos"] = "Laotian",
	["Latvia"] = "Latvian",
	["Lebanon"] = "Lebanese",
	["Lesotho"] = "Basotho",
	["Liberia"] = "Liberian",
	["Libya"] = "Libyan",
	["Liechtenstein"] = "Liechtensteiner",
	["Lithuania"] = "Lithuanian",
	["Luxembourg"] = "Luxembourgish",
	["Macau"] = "Macanese",
	["Republic of Macedonia"] = "Macedonian",
	["Madagascar"] = "Malagasy",
	["Malawi"] = "Malawian",
	["Malaysia"] = "Malaysian",
	["Maldives"] = "Maldivian",
	["Mali"] = "Malian",
	["Malta"] = "Maltese",
	["Marshall Islands"] = "Marshallese",
	["Martinique"] = "Martiniquais",
	["Mauritania"] = "Mauritanian",
	["Mauritius"] = "Mauritian",
	["Mexico"] = "Mexican",
	["Federated States of Micronesia"] = "Micronesian",
	["Moldova"] = "Moldovan",
	["Mongolia"] = "Mongolian",
	["Montenegro"] = "Montenegrin",
	["Montserrat"] = "Montserratian",
	["Morocco"] = "Moroccan",
	["Mozambique"] = "Mozambican",
	["Namibia"] = "Namibian",
	["Nauru"] = "Nauruan",
	["Nepal"] = "Nepalese",
	["Netherlands"] = "Dutch",
	["New Caledonia"] = "New Caledonian",
	["New Zealand"] = "New Zealand",
	["Nicaragua"] = "Nicaraguan",
	["Niger"] = "Nigerien",
	["Nigeria"] = "Nigerian",
	["Niue"] = "Niuean",
	["Northern Mariana Islands"] = "Northern Mariana Islands",
	["Norway"] = "Norwegian",
	["Oman"] = "Omani",
	["Pakistan"] = "Pakistani",
	["Palau"] = "Palauan",
	["State of Palestine"] = "Palestinian",
	["Panama"] = "Panamanian",
	["Papua New Guinea"] = "Papua New Guinean",
	["Paraguay"] = "Paraguayan",
	["Peru"] = "Peruvian",
	["Philippines"] = "Philippine",
	["Pitcairn Islands"] = "Pitcairn Islands",
	["Poland"] = "Polish",
	["Portugal"] = "Portuguese",
	["Puerto Rico"] = "Puerto Rican",
	["Qatar"] = "Qatari",
	["Romania"] = "Romanian",
	["Russia"] = "Russian",
	["Rwanda"] = "Rwandan",
	["Saba"] = "Saba",
	["Saint Kitts and Nevis"] = "Saint Kitts and Nevis",
	["Saint Lucia"] = "Saint Lucian",
	["Saint Vincent and the Grenadines"] = "Saint Vincent and the Grenadines",
	["Samoa"] = "Samoan",
	["San Marino"] = "Sammarinese",
	["São Tomé and Príncipe"] = "São Tomé and Príncipe",
	["Saudi Arabia"] = "Saudi Arabian",
	["Senegal"] = "Senegalese",
	["Serbia"] = "Serbian",
	["Seychelles"] = "Seychellois",
	["Sierra Leone"] = "Sierra Leonean",
	["Singapore"] = "Singaporean",
	["Slovakia"] = "Slovak",
	["Slovenia"] = "Slovenian",
	["Solomon Islands"] = "Solomon Islands",
	["Somalia"] = "Somali",
	["Somaliland"] = "Somalilander",
	["South Africa"] = "South African",
	["South Sudan"] = "South Sudanese",
	["Spain"] = "Spanish",
	["Sri Lanka"] = "Sri Lankan",
	["Sudan"] = "Sudanese",
	["Suriname"] = "Surinamese",
	["Sweden"] = "Swedish",
	["Switzerland"] = "Swiss",
	["Syria"] = "Syrian",
	["Taiwan"] = "Taiwanese",
	["Tajikistan"] = "Tajikistani",
	["Tanzania"] = "Tanzanian",
	["Thailand"] = "Thai",
	["Togo"] = "Togolese",
	["Tokelau"] = "Tokelauan",
	["Tonga"] = "Tongan",
	["Trinidad and Tobago"] = "Trinidad and Tobago",
	["Tunisia"] = "Tunisian",
	["Turkey"] = "Turkish",
	["Turkmenistan"] = "Turkmen",
	["Turks and Caicos Islands"] = "Turks and Caicos Islands",
	["Tuvalu"] = "Tuvaluan",
	["Uganda"] = "Ugandan",
	["Ukraine"] = "Ukrainian",
	["United Arab Emirates"] = "Emirati",
	["United Kingdom"] = "British",
	["United States"] = "American",
	["Uruguay"] = "Uruguayan",
	["Uzbekistan"] = "Uzbekistani",
	["Vanuatu"] = "Vanuatuan",
	["Venezuela"] = "Venezuelan",
	["Vietnam"] = "Vietnamese",
	["British Virgin Islands"] = "British Virgin Islands",
	["United States Virgin Islands"] = "United States Virgin Islands",
	["Wallis and Futuna"] = "Wallis and Futuna",
	["Yemen"] = "Yemeni",
	["Zambia"] = "Zambian",
	["Zimbabwe"] = "Zimbabwean",
}

local countryFromAdj = {}

for k, v in pairs(adjFromCountryList) do
	countryFromAdj[v] = k
end
	
return {
	getAdjFromCountry = adjFromCountryList,
	getCountryFromAdj = countryFromAdj
	}