JavaScript根据国家二字码获取国家全称

时间:2024-06-24 08:34:38
 function getCountryNameByCode(code) {
var countryName = '';
switch(code) {
case "US":
countryName = "United State";
break;
case "GB":
countryName = "United Kingdom";
break;
case "DE":
countryName = "Germany";
break;
case "CA":
countryName = "Canada";
break;
case "JP":
countryName = "Japan";
break;
case "ES":
countryName = "Spain";
break;
case "FR":
countryName = "France";
break;
case "IT":
countryName = "Italy";
break;
case "CN":
countryName = "China";
break;
case "AT":
countryName = "Austria";
break;
case "AU":
countryName = "Australian";
break;
case "CH":
countryName = "Switzerland";
break;
case "EG":
countryName = "Egypt";
break;
case "FI":
countryName = "Finland";
break;
case "IN":
countryName = "India";
break;
case "IE":
countryName = "Ireland";
break;
case "ID":
countryName = "Indonesia";
break;
case "KH":
countryName = "Cambodia";
break;
case "KR":
countryName = "Korea";
break;
case "MX":
countryName = "Mexico";
break;
case "NL":
countryName = "Holland";
break;
case "NO":
countryName = "Norway";
break;
case "MM":
countryName = "Burma";
break;
case "PH":
countryName = "Philippines";
break;
case "BE":
countryName = "Belgium";
break;
case "GY":
countryName = "Guyana";
break;
case "SE":
countryName = "Sweden";
break;
case "PY":
countryName = "Paraguay";
break;
case "UA":
countryName = "Ukraine";
break;
case "PE":
countryName = "Peru";
break;
case "AE":
countryName = "United Arab Emirates";
break;
case "VN":
countryName = "Vietnam";
break;
case "SO":
countryName = "Somalia";
break;
case "LA":
countryName = "Laos";
break;
case "KW":
countryName = "Kuwait";
break;
case "MY":
countryName = "Malaysia";
break;
case "DK":
countryName = "Denmark";
break;
case "PK":
countryName = "Pakistan";
break;
case "TH":
countryName = "Thailand";
break;
case "HU":
countryName = "HUNGARY";
break;
case "LV":
countryName = "Latvia";
break;
case "RU":
countryName = "Russia";
break;
case "CZ":
countryName = "Czech Republic";
break;
case "PL":
countryName = "Poland";
break;
case "BY":
countryName = "Belarus";
break;
case "LT":
countryName = "Lithuania";
break;
case "LU":
countryName = "Luxembourg";
break;
case "AD":
countryName = "Andorra";
break;
case "AG":
countryName = "Antigua and Barbuda";
break;
case "RO":
countryName = "Romania";
break;
case "AM":
countryName = "Armenia";
break;
case "CV":
countryName = "Cape Verde";
break;
case "DZ":
countryName = "Algeria";
break;
case "RT":
countryName = "Rota (Northern Mariana Islands)";
break;
case "TL":
countryName = "Timor-Leste";
break;
case "MU":
countryName = "Mauritius";
break;
case "ZM":
countryName = "Zambia";
break;
case "BL":
countryName = "St. Barthelemy";
break;
case "SX":
countryName = "St. Maarten, St. Martin";
break;
case "BH":
countryName = "Bahrain";
break;
case "GM":
countryName = "Gambia";
break;
case "MV":
countryName = "Maldives";
break;
case "CK":
countryName = "Cook Islands";
break;
case "RE":
countryName = "Reunion Island";
break;
case "IQ":
countryName = "Iraq";
break;
case "GD":
countryName = "Grenada";
break;
case "FM":
countryName = "Micronesia, Federated States of";
break;
case "VE":
countryName = "Venezuela";
break;
case "NC":
countryName = "New Caledonia";
break;
case "NP":
countryName = "Nepal";
break;
case "MD":
countryName = "Moldova";
break;
case "VA":
countryName = "Vatican City (Italy)";
break;
case "GP":
countryName = "Guadeloupe";
break;
case "GU":
countryName = "Guam";
break;
case "NA":
countryName = "Namibia";
break;
case "QA":
countryName = "Qatar";
break;
case "YT":
countryName = "Mayotte";
break;
case "ME":
countryName = "Montenegro";
break;
case "BT":
countryName = "Bhutan";
break;
case "UZ":
countryName = "Uzbekistan";
break;
case "WF":
countryName = "Wallis & Futuna Islands";
break;
case "JO":
countryName = "Jordan";
break;
case "MK":
countryName = "Macedonia (FYROM)"
break;
case "BF":
countryName = "Burkina Faso";
break;
case "NE":
countryName = "Niger";
case "WL":
countryName = "Wales (United Kingdom)";
break;
case "GE":
countryName = "Georgia";
break;
case "IS":
countryName = "Iceland";
break;
case "ER":
countryName = "Eritrea";
break;
case "KM":
countryName = "Comoros";
break;
case "SN":
countryName = "Senegal";
break;
case "EE":
countryName = "Estonia";
break;
case "MO":
countryName = "Macau";
break;
case "SI":
countryName = "Slovenia";
break;
case "UG":
countryName = "Uganda";
break;
case "ZW":
countryName = "Zimbabwe";
break;
case "TD":
countryName = "Chad";
break;
case "GL":
countryName = "Greenland";
break;
case "AF":
countryName = "Afghanistan";
break;
case "CD":
countryName = "Congo, Democratic Republic of";
break;
case "MN":
countryName = "*";
break;
case "MR":
countryName = "Mauritania";
break;
case "CO":
countryName = "Colombia";
break;
case "TT":
countryName = "Trinidad & Tobago";
break;
case "SF":
countryName = "Scotland (United Kingdom)";
break;
case "CF":
countryName = "Central African Republic";
break;
case "GI":
countryName = "Gibraltar";
break;
case "KY":
countryName = "Cayman Islands";
break;
case "NI":
countryName = "Nicaragua";
break;
case "TG":
countryName = "Togo";
break;
case "GQ":
countryName = "Equatorial Guinea";
break;
case "KN":
countryName = "St. Kitts and Nevis";
break;
case "ZZ":
countryName = "Tortola (British Virgin Islands)";
break;
case "TZ":
countryName = "Tanzania, United Republic of";
break;
case "KE":
countryName = "Kenya";
break;
case "MH":
countryName = "Marshall Islands";
break;
case "KZ":
countryName = "Kazakhstan";
break;
case "SA":
countryName = "Saudi Arabia";
break;
case "BN":
countryName = "Brunei Darussalam";
break;
case "SY":
countryName = "Syrian Arab Republic";
break;
case "HN":
countryName = "Honduras";
break;
case "PG":
countryName = "Papua New Guinea";
break;
case "HT":
countryName = "Haiti";
break;
case "SM":
countryName = "San Marino";
break;
case "MW":
countryName = "Malawi";
break;
case "CM":
countryName = "Cameroon";
break;
case "MG":
countryName = "Madagascar";
break;
case "PT":
countryName = "Portugal";
break;
case "CR":
countryName = "Costa Rica";
break;
case "BM":
countryName = "Bermuda";
break;
case "SR":
countryName = "Suriname";
break;
case "SB":
countryName = "Solomon Islands";
break;
case "TA":
countryName = "Tahiti (French Polynesia)";;
break;
case "CW":
countryName = "Curacao";
break;
case "TW":
countryName = "*";
break;
case "SL":
countryName = "Sierra Leone";
break;
case "TU":
countryName = "Truk (Micronesia, Federated States of)";
break;
case "UI":
countryName = "Union Islands (St. Vincent & the Grenadines)";
break;
case "VL":
countryName = "St. Thomas (U.S. Virgin Islands)";
break;
case "NF":
countryName = "Norfolk Island (Australia)";
break;
case "GT":
countryName = "Guatemala";
break;
break;
case "BG":
countryName = "Bulgaria";
break;
break;
case "PO":
countryName = "Ponape (Micronesia, Federated States of)";
break;
case "AW":
countryName = "Aruba";
break;
case "EC":
countryName = "Ecuador";
break;
case "RS":
countryName = "Serbia";
break;
case "BS":
countryName = "Bahamas";
break;
case "BO":
countryName = "Bolivia";
break;
case "PW":
countryName = "Palau";
break;
case "KG":
countryName = "Kirghizia (Kyrgyzstan)";
break;
case "TC":
countryName = "Turks & Caicos Islands";
break;
case "LC":
countryName = "St. Lucia";
break;
case "AZ":
countryName = "Azerbaijan";
break;
case "MT":
countryName = "Malta";
break;
case "BI":
countryName = "Burundi"
break;
case "AO":
countryName = "Angola";
break;
case "CY":
countryName = "Cyprus";
break;
case "BR":
countryName = "Brazil";
break;
case "WS":
countryName = "Samoa Western";
break;
case "AX":
countryName = "Aland Island (Finland)";
break;
case "LR":
countryName = "Liberia";
break;
case "FO":
countryName = "Faroe Islands";
break;
case "UV":
countryName = "St. John (U.S. Virgin Islands)";
break;
case "SG":
countryName = "Singapore";
break;
case "NG":
countryName = "Nigeria";
break;
case "PA":
countryName = "Panama";
break;
case "DJ":
countryName = "Djibouti";
break;
case "SZ":
countryName = "Swaziland";
break;
case "DO":
countryName = "Dominican Republic";
break;
case "KO":
countryName = "Kosrae (Micronesia, Federated States of)";
break;
case "MZ":
countryName = "Mozambique";
break;
case "AS":
countryName = "American Samoa";
break;
case "UY":
countryName = "Uruguay";
break;
case "KT":
countryName = "republic of ivory coast";
break;
case "AL":
countryName = "Albania";
break;
case "CG":
countryName = "Congo";
break;
case "AI":
countryName = "Anguilla";
break;
case "RW":
countryName = "Rwanda";
break;
case "GR":
countryName = "Greece";
break;
case "BW":
countryName = "Botswana";
break;
case "HR":
countryName = "Croatia";
break;
case "SC":
countryName = "Seychelles";
break;
case "NZ":
countryName = "New Zealand";
break;
case "PF":
countryName = "French Polynesia";
break;
case "ML":
countryName = "Mali";
break;
case "VU":
countryName = "Vanuatu";
break;
case "MP":
countryName = "Northern Mariana Islands";
break;
case "TR":
countryName = "Turkey";
break;
case "BA":
countryName = "Bosnia and Herzegovina";
break;
case "LY":
countryName = "Libyan Arab Jamahiriya";
break;
case "SV":
countryName = "El Salvador";
break;
case "TN":
countryName = "Tunisia";
break;
case "SW":
countryName = "St. Christopher (St. Kitts)";
break;
case "AR":
countryName = "Argentina";
break;
case "YE":
countryName = "Yemen, Republic of";
break;
case "TJ":
countryName = "Tajikistan";
break;
case "GA":
countryName = "Gabon";
break;
case "FJ":
countryName = "Fiji";
break;
case "GN":
countryName = "Guinea";
break;
case "GH":
countryName = "Ghana";
break;
case "BD":
countryName = "Bangladesh";
break;
case "TV":
countryName = "Tuvalu";
break;
case "YA":
countryName = "Yap (Micronesia, Federated States of)";
break;
case "LI":
countryName = "Liechtenstein";
break;
case "SP":
countryName = "Saipan (Northern Mariana Islands)";
break;
case "LB":
countryName = "Lebanon";
break;
case "MQ":
countryName = "Martinique";
break;
case "ZA":
countryName = "South Africa";
break;
case "BJ":
countryName = "Benin";
break;
case "OM":
countryName = "Oman";
break;
case "TO":
countryName = "Tonga";
break;
case "SK":
countryName = "Slovakia";
break;
case "BB":
countryName = "Barbados";
break;
case "MA":
countryName = "Morocco";
break;
case "IL":
countryName = "Israel";
break;
case "LK":
countryName = "Sri Lanka";
break;
case "BQ":
countryName = "Bonaire, St. Eustatius, Saba";
break;
case "PR":
countryName = "Puerto Rico";
break;
case "MS":
countryName = "Montserrat";
break;
case "TM":
countryName = "Turkmenistan";
break;
case "KI":
countryName = "Kiribati";
break;
case "GW":
countryName = "Guinea-Bissau";
break;
case "IC":
countryName = "Canary Islands (Spain)";
break;
case "GF":
countryName = "French Guiana";
break;
case "LS":
countryName = "Lesotho";
break;
case "JE":
countryName = "Jersey (Channel Islands)";
break;
case "DM":
countryName = "Dominica";
break;
case "ET":
countryName = "Ethiopia";
break;
case "BZ":
countryName = "Belize";
break;
case "GG":
countryName = "Guernsey (Channel Islands)"
case "JM":
countryName = "Jamaica";
break;
case "NB":
countryName = "Northern Ireland (United Kingdom)";
break;
case "CL":
countryName = "Chile";
break;
case "SD":
countryName = "Sudan";
break;
case "CI":
countryName = "ivory coast";
break;
case "AN":
countryName = "NETHERLANDS ANTILLES";
break;
case "CC":
countryName = "COCOS(KEELING) ISLANDS";
break;
case "CU":
countryName = "CUBA";
break;
case "MC":
countryName = "Monaco";
break;
case "VC":
countryName = "St. Vincent & the Grenadines";
break;
case "HK":
countryName = "HONGKONG";
break;
default:
countryName = code;
break;
};
if(countryName) {
return countryName.toUpperCase();
};
return countryName;
};