Browse Source

Use uniform initialization

adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
f993230582
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 511
      src/base/net/geoipmanager.cpp

511
src/base/net/geoipmanager.cpp

@ -129,266 +129,263 @@ QString GeoIPManager::lookup(const QHostAddress &hostAddr) const
QString GeoIPManager::CountryName(const QString &countryISOCode) QString GeoIPManager::CountryName(const QString &countryISOCode)
{ {
static QHash<QString, QString> countries; static const QHash<QString, QString> countries = {
static bool initialized = false; // ISO 3166-1 alpha-2 codes
// http://www.iso.org/iso/home/standards/country_codes/country_names_and_code_elements_txt-temp.htm
// ISO 3166-1 alpha-2 codes
// http://www.iso.org/iso/home/standards/country_codes/country_names_and_code_elements_txt-temp.htm
if (!initialized) {
// Officially assigned // Officially assigned
countries["AD"] = tr("Andorra"); {"AD", tr("Andorra")},
countries["AE"] = tr("United Arab Emirates"); {"AE", tr("United Arab Emirates")},
countries["AF"] = tr("Afghanistan"); {"AF", tr("Afghanistan")},
countries["AG"] = tr("Antigua and Barbuda"); {"AG", tr("Antigua and Barbuda")},
countries["AI"] = tr("Anguilla"); {"AI", tr("Anguilla")},
countries["AL"] = tr("Albania"); {"AL", tr("Albania")},
countries["AM"] = tr("Armenia"); {"AM", tr("Armenia")},
countries["AO"] = tr("Angola"); {"AO", tr("Angola")},
countries["AQ"] = tr("Antarctica"); {"AQ", tr("Antarctica")},
countries["AR"] = tr("Argentina"); {"AR", tr("Argentina")},
countries["AS"] = tr("American Samoa"); {"AS", tr("American Samoa")},
countries["AT"] = tr("Austria"); {"AT", tr("Austria")},
countries["AU"] = tr("Australia"); {"AU", tr("Australia")},
countries["AW"] = tr("Aruba"); {"AW", tr("Aruba")},
countries["AX"] = tr("Aland Islands"); {"AX", tr("Aland Islands")},
countries["AZ"] = tr("Azerbaijan"); {"AZ", tr("Azerbaijan")},
countries["BA"] = tr("Bosnia and Herzegovina"); {"BA", tr("Bosnia and Herzegovina")},
countries["BB"] = tr("Barbados"); {"BB", tr("Barbados")},
countries["BD"] = tr("Bangladesh"); {"BD", tr("Bangladesh")},
countries["BE"] = tr("Belgium"); {"BE", tr("Belgium")},
countries["BF"] = tr("Burkina Faso"); {"BF", tr("Burkina Faso")},
countries["BG"] = tr("Bulgaria"); {"BG", tr("Bulgaria")},
countries["BH"] = tr("Bahrain"); {"BH", tr("Bahrain")},
countries["BI"] = tr("Burundi"); {"BI", tr("Burundi")},
countries["BJ"] = tr("Benin"); {"BJ", tr("Benin")},
countries["BL"] = tr("Saint Barthelemy"); {"BL", tr("Saint Barthelemy")},
countries["BM"] = tr("Bermuda"); {"BM", tr("Bermuda")},
countries["BN"] = tr("Brunei Darussalam"); {"BN", tr("Brunei Darussalam")},
countries["BO"] = tr("Bolivia, Plurinational State of"); {"BO", tr("Bolivia, Plurinational State of")},
countries["BQ"] = tr("Bonaire, Sint Eustatius and Saba"); {"BQ", tr("Bonaire, Sint Eustatius and Saba")},
countries["BR"] = tr("Brazil"); {"BR", tr("Brazil")},
countries["BS"] = tr("Bahamas"); {"BS", tr("Bahamas")},
countries["BT"] = tr("Bhutan"); {"BT", tr("Bhutan")},
countries["BV"] = tr("Bouvet Island"); {"BV", tr("Bouvet Island")},
countries["BW"] = tr("Botswana"); {"BW", tr("Botswana")},
countries["BY"] = tr("Belarus"); {"BY", tr("Belarus")},
countries["BZ"] = tr("Belize"); {"BZ", tr("Belize")},
countries["CA"] = tr("Canada"); {"CA", tr("Canada")},
countries["CC"] = tr("Cocos (Keeling) Islands"); {"CC", tr("Cocos (Keeling) Islands")},
countries["CD"] = tr("Congo, The Democratic Republic of the"); {"CD", tr("Congo, The Democratic Republic of the")},
countries["CF"] = tr("Central African Republic"); {"CF", tr("Central African Republic")},
countries["CG"] = tr("Congo"); {"CG", tr("Congo")},
countries["CH"] = tr("Switzerland"); {"CH", tr("Switzerland")},
countries["CI"] = tr("Cote d'Ivoire"); {"CI", tr("Cote d'Ivoire")},
countries["CK"] = tr("Cook Islands"); {"CK", tr("Cook Islands")},
countries["CL"] = tr("Chile"); {"CL", tr("Chile")},
countries["CM"] = tr("Cameroon"); {"CM", tr("Cameroon")},
countries["CN"] = tr("China"); {"CN", tr("China")},
countries["CO"] = tr("Colombia"); {"CO", tr("Colombia")},
countries["CR"] = tr("Costa Rica"); {"CR", tr("Costa Rica")},
countries["CU"] = tr("Cuba"); {"CU", tr("Cuba")},
countries["CV"] = tr("Cape Verde"); {"CV", tr("Cape Verde")},
countries["CW"] = tr("Curacao"); {"CW", tr("Curacao")},
countries["CX"] = tr("Christmas Island"); {"CX", tr("Christmas Island")},
countries["CY"] = tr("Cyprus"); {"CY", tr("Cyprus")},
countries["CZ"] = tr("Czech Republic"); {"CZ", tr("Czech Republic")},
countries["DE"] = tr("Germany"); {"DE", tr("Germany")},
countries["DJ"] = tr("Djibouti"); {"DJ", tr("Djibouti")},
countries["DK"] = tr("Denmark"); {"DK", tr("Denmark")},
countries["DM"] = tr("Dominica"); {"DM", tr("Dominica")},
countries["DO"] = tr("Dominican Republic"); {"DO", tr("Dominican Republic")},
countries["DZ"] = tr("Algeria"); {"DZ", tr("Algeria")},
countries["EC"] = tr("Ecuador"); {"EC", tr("Ecuador")},
countries["EE"] = tr("Estonia"); {"EE", tr("Estonia")},
countries["EG"] = tr("Egypt"); {"EG", tr("Egypt")},
countries["EH"] = tr("Western Sahara"); {"EH", tr("Western Sahara")},
countries["ER"] = tr("Eritrea"); {"ER", tr("Eritrea")},
countries["ES"] = tr("Spain"); {"ES", tr("Spain")},
countries["ET"] = tr("Ethiopia"); {"ET", tr("Ethiopia")},
countries["FI"] = tr("Finland"); {"FI", tr("Finland")},
countries["FJ"] = tr("Fiji"); {"FJ", tr("Fiji")},
countries["FK"] = tr("Falkland Islands (Malvinas)"); {"FK", tr("Falkland Islands (Malvinas)")},
countries["FM"] = tr("Micronesia, Federated States of"); {"FM", tr("Micronesia, Federated States of")},
countries["FO"] = tr("Faroe Islands"); {"FO", tr("Faroe Islands")},
countries["FR"] = tr("France"); {"FR", tr("France")},
countries["GA"] = tr("Gabon"); {"GA", tr("Gabon")},
countries["GB"] = tr("United Kingdom"); {"GB", tr("United Kingdom")},
countries["GD"] = tr("Grenada"); {"GD", tr("Grenada")},
countries["GE"] = tr("Georgia"); {"GE", tr("Georgia")},
countries["GF"] = tr("French Guiana"); {"GF", tr("French Guiana")},
countries["GG"] = tr("Guernsey"); {"GG", tr("Guernsey")},
countries["GH"] = tr("Ghana"); {"GH", tr("Ghana")},
countries["GI"] = tr("Gibraltar"); {"GI", tr("Gibraltar")},
countries["GL"] = tr("Greenland"); {"GL", tr("Greenland")},
countries["GM"] = tr("Gambia"); {"GM", tr("Gambia")},
countries["GN"] = tr("Guinea"); {"GN", tr("Guinea")},
countries["GP"] = tr("Guadeloupe"); {"GP", tr("Guadeloupe")},
countries["GQ"] = tr("Equatorial Guinea"); {"GQ", tr("Equatorial Guinea")},
countries["GR"] = tr("Greece"); {"GR", tr("Greece")},
countries["GS"] = tr("South Georgia and the South Sandwich Islands"); {"GS", tr("South Georgia and the South Sandwich Islands")},
countries["GT"] = tr("Guatemala"); {"GT", tr("Guatemala")},
countries["GU"] = tr("Guam"); {"GU", tr("Guam")},
countries["GW"] = tr("Guinea-Bissau"); {"GW", tr("Guinea-Bissau")},
countries["GY"] = tr("Guyana"); {"GY", tr("Guyana")},
countries["HK"] = tr("Hong Kong"); {"HK", tr("Hong Kong")},
countries["HM"] = tr("Heard Island and McDonald Islands"); {"HM", tr("Heard Island and McDonald Islands")},
countries["HN"] = tr("Honduras"); {"HN", tr("Honduras")},
countries["HR"] = tr("Croatia"); {"HR", tr("Croatia")},
countries["HT"] = tr("Haiti"); {"HT", tr("Haiti")},
countries["HU"] = tr("Hungary"); {"HU", tr("Hungary")},
countries["ID"] = tr("Indonesia"); {"ID", tr("Indonesia")},
countries["IE"] = tr("Ireland"); {"IE", tr("Ireland")},
countries["IL"] = tr("Israel"); {"IL", tr("Israel")},
countries["IM"] = tr("Isle of Man"); {"IM", tr("Isle of Man")},
countries["IN"] = tr("India"); {"IN", tr("India")},
countries["IO"] = tr("British Indian Ocean Territory"); {"IO", tr("British Indian Ocean Territory")},
countries["IQ"] = tr("Iraq"); {"IQ", tr("Iraq")},
countries["IR"] = tr("Iran, Islamic Republic of"); {"IR", tr("Iran, Islamic Republic of")},
countries["IS"] = tr("Iceland"); {"IS", tr("Iceland")},
countries["IT"] = tr("Italy"); {"IT", tr("Italy")},
countries["JE"] = tr("Jersey"); {"JE", tr("Jersey")},
countries["JM"] = tr("Jamaica"); {"JM", tr("Jamaica")},
countries["JO"] = tr("Jordan"); {"JO", tr("Jordan")},
countries["JP"] = tr("Japan"); {"JP", tr("Japan")},
countries["KE"] = tr("Kenya"); {"KE", tr("Kenya")},
countries["KG"] = tr("Kyrgyzstan"); {"KG", tr("Kyrgyzstan")},
countries["KH"] = tr("Cambodia"); {"KH", tr("Cambodia")},
countries["KI"] = tr("Kiribati"); {"KI", tr("Kiribati")},
countries["KM"] = tr("Comoros"); {"KM", tr("Comoros")},
countries["KN"] = tr("Saint Kitts and Nevis"); {"KN", tr("Saint Kitts and Nevis")},
countries["KP"] = tr("Korea, Democratic People's Republic of"); {"KP", tr("Korea, Democratic People's Republic of")},
countries["KR"] = tr("Korea, Republic of"); {"KR", tr("Korea, Republic of")},
countries["KW"] = tr("Kuwait"); {"KW", tr("Kuwait")},
countries["KY"] = tr("Cayman Islands"); {"KY", tr("Cayman Islands")},
countries["KZ"] = tr("Kazakhstan"); {"KZ", tr("Kazakhstan")},
countries["LA"] = tr("Lao People's Democratic Republic"); {"LA", tr("Lao People's Democratic Republic")},
countries["LB"] = tr("Lebanon"); {"LB", tr("Lebanon")},
countries["LC"] = tr("Saint Lucia"); {"LC", tr("Saint Lucia")},
countries["LI"] = tr("Liechtenstein"); {"LI", tr("Liechtenstein")},
countries["LK"] = tr("Sri Lanka"); {"LK", tr("Sri Lanka")},
countries["LR"] = tr("Liberia"); {"LR", tr("Liberia")},
countries["LS"] = tr("Lesotho"); {"LS", tr("Lesotho")},
countries["LT"] = tr("Lithuania"); {"LT", tr("Lithuania")},
countries["LU"] = tr("Luxembourg"); {"LU", tr("Luxembourg")},
countries["LV"] = tr("Latvia"); {"LV", tr("Latvia")},
countries["LY"] = tr("Libya"); {"LY", tr("Libya")},
countries["MA"] = tr("Morocco"); {"MA", tr("Morocco")},
countries["MC"] = tr("Monaco"); {"MC", tr("Monaco")},
countries["MD"] = tr("Moldova, Republic of"); {"MD", tr("Moldova, Republic of")},
countries["ME"] = tr("Montenegro"); {"ME", tr("Montenegro")},
countries["MF"] = tr("Saint Martin (French part)"); {"MF", tr("Saint Martin (French part)")},
countries["MG"] = tr("Madagascar"); {"MG", tr("Madagascar")},
countries["MH"] = tr("Marshall Islands"); {"MH", tr("Marshall Islands")},
countries["MK"] = tr("Macedonia, The Former Yugoslav Republic of"); {"MK", tr("Macedonia, The Former Yugoslav Republic of")},
countries["ML"] = tr("Mali"); {"ML", tr("Mali")},
countries["MM"] = tr("Myanmar"); {"MM", tr("Myanmar")},
countries["MN"] = tr("Mongolia"); {"MN", tr("Mongolia")},
countries["MO"] = tr("Macao"); {"MO", tr("Macao")},
countries["MP"] = tr("Northern Mariana Islands"); {"MP", tr("Northern Mariana Islands")},
countries["MQ"] = tr("Martinique"); {"MQ", tr("Martinique")},
countries["MR"] = tr("Mauritania"); {"MR", tr("Mauritania")},
countries["MS"] = tr("Montserrat"); {"MS", tr("Montserrat")},
countries["MT"] = tr("Malta"); {"MT", tr("Malta")},
countries["MU"] = tr("Mauritius"); {"MU", tr("Mauritius")},
countries["MV"] = tr("Maldives"); {"MV", tr("Maldives")},
countries["MW"] = tr("Malawi"); {"MW", tr("Malawi")},
countries["MX"] = tr("Mexico"); {"MX", tr("Mexico")},
countries["MY"] = tr("Malaysia"); {"MY", tr("Malaysia")},
countries["MZ"] = tr("Mozambique"); {"MZ", tr("Mozambique")},
countries["NA"] = tr("Namibia"); {"NA", tr("Namibia")},
countries["NC"] = tr("New Caledonia"); {"NC", tr("New Caledonia")},
countries["NE"] = tr("Niger"); {"NE", tr("Niger")},
countries["NF"] = tr("Norfolk Island"); {"NF", tr("Norfolk Island")},
countries["NG"] = tr("Nigeria"); {"NG", tr("Nigeria")},
countries["NI"] = tr("Nicaragua"); {"NI", tr("Nicaragua")},
countries["NL"] = tr("Netherlands"); {"NL", tr("Netherlands")},
countries["NO"] = tr("Norway"); {"NO", tr("Norway")},
countries["NP"] = tr("Nepal"); {"NP", tr("Nepal")},
countries["NR"] = tr("Nauru"); {"NR", tr("Nauru")},
countries["NU"] = tr("Niue"); {"NU", tr("Niue")},
countries["NZ"] = tr("New Zealand"); {"NZ", tr("New Zealand")},
countries["OM"] = tr("Oman"); {"OM", tr("Oman")},
countries["PA"] = tr("Panama"); {"PA", tr("Panama")},
countries["PE"] = tr("Peru"); {"PE", tr("Peru")},
countries["PF"] = tr("French Polynesia"); {"PF", tr("French Polynesia")},
countries["PG"] = tr("Papua New Guinea"); {"PG", tr("Papua New Guinea")},
countries["PH"] = tr("Philippines"); {"PH", tr("Philippines")},
countries["PK"] = tr("Pakistan"); {"PK", tr("Pakistan")},
countries["PL"] = tr("Poland"); {"PL", tr("Poland")},
countries["PM"] = tr("Saint Pierre and Miquelon"); {"PM", tr("Saint Pierre and Miquelon")},
countries["PN"] = tr("Pitcairn"); {"PN", tr("Pitcairn")},
countries["PR"] = tr("Puerto Rico"); {"PR", tr("Puerto Rico")},
countries["PS"] = tr("Palestine, State of"); {"PS", tr("Palestine, State of")},
countries["PT"] = tr("Portugal"); {"PT", tr("Portugal")},
countries["PW"] = tr("Palau"); {"PW", tr("Palau")},
countries["PY"] = tr("Paraguay"); {"PY", tr("Paraguay")},
countries["QA"] = tr("Qatar"); {"QA", tr("Qatar")},
countries["RE"] = tr("Reunion"); {"RE", tr("Reunion")},
countries["RO"] = tr("Romania"); {"RO", tr("Romania")},
countries["RS"] = tr("Serbia"); {"RS", tr("Serbia")},
countries["RU"] = tr("Russian Federation"); {"RU", tr("Russian Federation")},
countries["RW"] = tr("Rwanda"); {"RW", tr("Rwanda")},
countries["SA"] = tr("Saudi Arabia"); {"SA", tr("Saudi Arabia")},
countries["SB"] = tr("Solomon Islands"); {"SB", tr("Solomon Islands")},
countries["SC"] = tr("Seychelles"); {"SC", tr("Seychelles")},
countries["SD"] = tr("Sudan"); {"SD", tr("Sudan")},
countries["SE"] = tr("Sweden"); {"SE", tr("Sweden")},
countries["SG"] = tr("Singapore"); {"SG", tr("Singapore")},
countries["SH"] = tr("Saint Helena, Ascension and Tristan da Cunha"); {"SH", tr("Saint Helena, Ascension and Tristan da Cunha")},
countries["SI"] = tr("Slovenia"); {"SI", tr("Slovenia")},
countries["SJ"] = tr("Svalbard and Jan Mayen"); {"SJ", tr("Svalbard and Jan Mayen")},
countries["SK"] = tr("Slovakia"); {"SK", tr("Slovakia")},
countries["SL"] = tr("Sierra Leone"); {"SL", tr("Sierra Leone")},
countries["SM"] = tr("San Marino"); {"SM", tr("San Marino")},
countries["SN"] = tr("Senegal"); {"SN", tr("Senegal")},
countries["SO"] = tr("Somalia"); {"SO", tr("Somalia")},
countries["SR"] = tr("Suriname"); {"SR", tr("Suriname")},
countries["SS"] = tr("South Sudan"); {"SS", tr("South Sudan")},
countries["ST"] = tr("Sao Tome and Principe"); {"ST", tr("Sao Tome and Principe")},
countries["SV"] = tr("El Salvador"); {"SV", tr("El Salvador")},
countries["SX"] = tr("Sint Maarten (Dutch part)"); {"SX", tr("Sint Maarten (Dutch part)")},
countries["SY"] = tr("Syrian Arab Republic"); {"SY", tr("Syrian Arab Republic")},
countries["SZ"] = tr("Swaziland"); {"SZ", tr("Swaziland")},
countries["TC"] = tr("Turks and Caicos Islands"); {"TC", tr("Turks and Caicos Islands")},
countries["TD"] = tr("Chad"); {"TD", tr("Chad")},
countries["TF"] = tr("French Southern Territories"); {"TF", tr("French Southern Territories")},
countries["TG"] = tr("Togo"); {"TG", tr("Togo")},
countries["TH"] = tr("Thailand"); {"TH", tr("Thailand")},
countries["TJ"] = tr("Tajikistan"); {"TJ", tr("Tajikistan")},
countries["TK"] = tr("Tokelau"); {"TK", tr("Tokelau")},
countries["TL"] = tr("Timor-Leste"); {"TL", tr("Timor-Leste")},
countries["TM"] = tr("Turkmenistan"); {"TM", tr("Turkmenistan")},
countries["TN"] = tr("Tunisia"); {"TN", tr("Tunisia")},
countries["TO"] = tr("Tonga"); {"TO", tr("Tonga")},
countries["TR"] = tr("Turkey"); {"TR", tr("Turkey")},
countries["TT"] = tr("Trinidad and Tobago"); {"TT", tr("Trinidad and Tobago")},
countries["TV"] = tr("Tuvalu"); {"TV", tr("Tuvalu")},
countries["TW"] = tr("Taiwan"); {"TW", tr("Taiwan")},
countries["TZ"] = tr("Tanzania, United Republic of"); {"TZ", tr("Tanzania, United Republic of")},
countries["UA"] = tr("Ukraine"); {"UA", tr("Ukraine")},
countries["UG"] = tr("Uganda"); {"UG", tr("Uganda")},
countries["UM"] = tr("United States Minor Outlying Islands"); {"UM", tr("United States Minor Outlying Islands")},
countries["US"] = tr("United States"); {"US", tr("United States")},
countries["UY"] = tr("Uruguay"); {"UY", tr("Uruguay")},
countries["UZ"] = tr("Uzbekistan"); {"UZ", tr("Uzbekistan")},
countries["VA"] = tr("Holy See (Vatican City State)"); {"VA", tr("Holy See (Vatican City State)")},
countries["VC"] = tr("Saint Vincent and the Grenadines"); {"VC", tr("Saint Vincent and the Grenadines")},
countries["VE"] = tr("Venezuela, Bolivarian Republic of"); {"VE", tr("Venezuela, Bolivarian Republic of")},
countries["VG"] = tr("Virgin Islands, British"); {"VG", tr("Virgin Islands, British")},
countries["VI"] = tr("Virgin Islands, U.S."); {"VI", tr("Virgin Islands, U.S.")},
countries["VN"] = tr("Viet Nam"); {"VN", tr("Viet Nam")},
countries["VU"] = tr("Vanuatu"); {"VU", tr("Vanuatu")},
countries["WF"] = tr("Wallis and Futuna"); {"WF", tr("Wallis and Futuna")},
countries["WS"] = tr("Samoa"); {"WS", tr("Samoa")},
countries["YE"] = tr("Yemen"); {"YE", tr("Yemen")},
countries["YT"] = tr("Mayotte"); {"YT", tr("Mayotte")},
countries["ZA"] = tr("South Africa"); {"ZA", tr("South Africa")},
countries["ZM"] = tr("Zambia"); {"ZM", tr("Zambia")},
countries["ZW"] = tr("Zimbabwe"); {"ZW", tr("Zimbabwe")},
countries[QString()] = tr("N/A"); {{}, tr("N/A")}
initialized = true; };
}
return countries.value(countryISOCode, tr("N/A")); return countries.value(countryISOCode, tr("N/A"));
} }

Loading…
Cancel
Save