Skip to content

Instantly share code, notes, and snippets.

@bryanltobing
Last active February 7, 2024 09:25
Show Gist options
  • Save bryanltobing/de95713620360efc0a1fc137d744f231 to your computer and use it in GitHub Desktop.
Save bryanltobing/de95713620360efc0a1fc137d744f231 to your computer and use it in GitHub Desktop.
Country name for libphonenumber-js
import { CountryCode } from 'libphonenumber-js';
import { AppLocale } from './i18n';
export const countriesWithLocale: Record<AppLocale, Record<CountryCode, string>> = {
en: {
AC: 'Ascension Island',
AD: 'Andorra',
AE: 'United Arab Emirates',
AF: 'Afghanistan',
AG: 'Antigua and Barbuda',
AI: 'Anguilla',
AL: 'Albania',
AM: 'Armenia',
AO: 'Angola',
AR: 'Argentina',
AS: 'American Samoa',
AT: 'Austria',
AU: 'Australia',
AW: 'Aruba',
AX: 'Åland Islands',
AZ: 'Azerbaijan',
BA: 'Bosnia and Herzegovina',
BB: 'Barbados',
BD: 'Bangladesh',
BE: 'Belgium',
BF: 'Burkina Faso',
BG: 'Bulgaria',
BH: 'Bahrain',
BI: 'Burundi',
BJ: 'Benin',
BL: 'Saint Barthélemy',
BM: 'Bermuda',
BN: 'Brunei Darussalam',
BO: 'Bolivia',
BQ: 'Bonaire, Sint Eustatius and Saba',
BR: 'Brazil',
BS: 'Bahamas',
BT: 'Bhutan',
BW: 'Botswana',
BY: 'Belarus',
BZ: 'Belize',
CA: 'Canada',
CC: 'Cocos (Keeling) Islands',
CD: 'Congo, Democratic Republic of the',
CF: 'Central African Republic',
CG: 'Congo',
CH: 'Switzerland',
CI: "Cote d'Ivoire",
CK: 'Cook Islands',
CL: 'Chile',
CM: 'Cameroon',
CN: 'China',
CO: 'Colombia',
CR: 'Costa Rica',
CU: 'Cuba',
CV: 'Cape Verde',
CW: 'Curaçao',
CX: 'Christmas Island',
CY: 'Cyprus',
CZ: 'Czech Republic',
DE: 'Germany',
DJ: 'Djibouti',
DK: 'Denmark',
DM: 'Dominica',
DO: 'Dominican Republic',
DZ: 'Algeria',
EC: 'Ecuador',
EE: 'Estonia',
EG: 'Egypt',
EH: 'Western Sahara',
ER: 'Eritrea',
ES: 'Spain',
ET: 'Ethiopia',
FI: 'Finland',
FJ: 'Fiji',
FK: 'Falkland Islands',
FM: 'Federated States of Micronesia',
FO: 'Faroe Islands',
FR: 'France',
GA: 'Gabon',
GB: 'United Kingdom',
GD: 'Grenada',
GE: 'Georgia',
GF: 'French Guiana',
GG: 'Guernsey',
GH: 'Ghana',
GI: 'Gibraltar',
GL: 'Greenland',
GM: 'Gambia',
GN: 'Guinea',
GP: 'Guadeloupe',
GQ: 'Equatorial Guinea',
GR: 'Greece',
GT: 'Guatemala',
GU: 'Guam',
GW: 'Guinea-Bissau',
GY: 'Guyana',
HK: 'Hong Kong',
HN: 'Honduras',
HR: 'Croatia',
HT: 'Haiti',
HU: 'Hungary',
ID: 'Indonesia',
IE: 'Ireland',
IL: 'Israel',
IM: 'Isle of Man',
IN: 'India',
IO: 'British Indian Ocean Territory',
IQ: 'Iraq',
IR: 'Iran',
IS: 'Iceland',
IT: 'Italy',
JE: 'Jersey',
JM: 'Jamaica',
JO: 'Jordan',
JP: 'Japan',
KE: 'Kenya',
KG: 'Kyrgyzstan',
KH: 'Cambodia',
KI: 'Kiribati',
KM: 'Comoros',
KN: 'Saint Kitts and Nevis',
KP: 'North Korea',
KR: 'South Korea',
KW: 'Kuwait',
KY: 'Cayman Islands',
KZ: 'Kazakhstan',
LA: 'Laos',
LB: 'Lebanon',
LC: 'Saint Lucia',
LI: 'Liechtenstein',
LK: 'Sri Lanka',
LR: 'Liberia',
LS: 'Lesotho',
LT: 'Lithuania',
LU: 'Luxembourg',
LV: 'Latvia',
LY: 'Libya',
MA: 'Morocco',
MC: 'Monaco',
MD: 'Moldova',
ME: 'Montenegro',
MF: 'Saint Martin (French Part)',
MG: 'Madagascar',
MH: 'Marshall Islands',
MK: 'North Macedonia',
ML: 'Mali',
MM: 'Myanmar',
MN: 'Mongolia',
MO: 'Macao',
MP: 'Northern Mariana Islands',
MQ: 'Martinique',
MR: 'Mauritania',
MS: 'Montserrat',
MT: 'Malta',
MU: 'Mauritius',
MV: 'Maldives',
MW: 'Malawi',
MX: 'Mexico',
MY: 'Malaysia',
MZ: 'Mozambique',
NA: 'Namibia',
NC: 'New Caledonia',
NE: 'Niger',
NF: 'Norfolk Island',
NG: 'Nigeria',
NI: 'Nicaragua',
NL: 'Netherlands',
NO: 'Norway',
NP: 'Nepal',
NR: 'Nauru',
NU: 'Niue',
NZ: 'New Zealand',
OM: 'Oman',
PA: 'Panama',
PE: 'Peru',
PF: 'French Polynesia',
PG: 'Papua New Guinea',
PH: 'Philippines',
PK: 'Pakistan',
PL: 'Poland',
PM: 'Saint Pierre and Miquelon',
PR: 'Puerto Rico',
PS: 'Palestine',
PT: 'Portugal',
PW: 'Palau',
PY: 'Paraguay',
QA: 'Qatar',
RE: 'Reunion',
RO: 'Romania',
RS: 'Serbia',
RU: 'Russia',
RW: 'Rwanda',
SA: 'Saudi Arabia',
SB: 'Solomon Islands',
SC: 'Seychelles',
SD: 'Sudan',
SE: 'Sweden',
SG: 'Singapore',
SH: 'Saint Helena',
SI: 'Slovenia',
SJ: 'Svalbard and Jan Mayen',
SK: 'Slovakia',
SL: 'Sierra Leone',
SM: 'San Marino',
SN: 'Senegal',
SO: 'Somalia',
SR: 'Suriname',
SS: 'South Sudan',
ST: 'Sao Tome and Principe',
SV: 'El Salvador',
SX: 'Sint Maarten',
SY: 'Syria',
SZ: 'Swaziland',
TA: 'Tristan da Cunha',
TC: 'Turks and Caicos Islands',
TD: 'Chad',
TG: 'Togo',
TH: 'Thailand',
TJ: 'Tajikistan',
TK: 'Tokelau',
TL: 'Timor-Leste',
TM: 'Turkmenistan',
TN: 'Tunisia',
TO: 'Tonga',
TR: 'Turkey',
TT: 'Trinidad and Tobago',
TV: 'Tuvalu',
TW: 'Taiwan',
TZ: 'Tanzania',
UA: 'Ukraine',
UG: 'Uganda',
US: 'United States',
UY: 'Uruguay',
UZ: 'Uzbekistan',
VA: 'Holy See (Vatican City State)',
VC: 'Saint Vincent and the Grenadines',
VE: 'Venezuela',
VG: 'Virgin Islands, British',
VI: 'Virgin Islands, U.S.',
VN: 'Vietnam',
VU: 'Vanuatu',
WF: 'Wallis and Futuna',
WS: 'Samoa',
XK: 'Kosovo',
YE: 'Yemen',
YT: 'Mayotte',
ZA: 'South Africa',
ZM: 'Zambia',
ZW: 'Zimbabwe',
},
id: {
AC: 'Pulau Ascension',
AD: 'Andorra',
AE: 'Uni Emirat Arab',
AF: 'Afghanistan',
AG: 'Antigua dan Barbuda',
AI: 'Anguilla',
AL: 'Albania',
AM: 'Armenia',
AO: 'Angola',
AR: 'Argentina',
AS: 'Samoa Amerika',
AT: 'Austria',
AU: 'Australia',
AW: 'Aruba',
AX: 'Kepulauan Åland',
AZ: 'Azerbaijan',
BA: 'Bosnia dan Herzegovina',
BB: 'Barbados',
BD: 'Bangladesh',
BE: 'Belgia',
BF: 'Burkina Faso',
BG: 'Bulgaria',
BH: 'Bahrain',
BI: 'Burundi',
BJ: 'Benin',
BL: 'Saint Barthélemy',
BM: 'Bermuda',
BN: 'Brunei Darussalam',
BO: 'Bolivia',
BQ: 'Bonaire, Sint Eustatius dan Saba',
BR: 'Brasil',
BS: 'Bahama',
BT: 'Bhutan',
BW: 'Botswana',
BY: 'Belarus',
BZ: 'Belize',
CA: 'Kanada',
CC: 'Kepulauan Cocos (Keeling)',
CD: 'Republik Demokratik Kongo',
CF: 'Republik Afrika Tengah',
CG: 'Kongo',
CH: 'Swiss',
CI: 'Pantai Gading',
CK: 'Kepulauan Cook',
CL: 'Chili',
CM: 'Kamerun',
CN: 'Tiongkok',
CO: 'Kolombia',
CR: 'Kosta Rika',
CU: 'Kuba',
CV: 'Tanjung Verde',
CW: 'Curaçao',
CX: 'Pulau Christmas',
CY: 'Siprus',
CZ: 'Republik Ceko',
DE: 'Jerman',
DJ: 'Djibouti',
DK: 'Denmark',
DM: 'Dominika',
DO: 'Republik Dominika',
DZ: 'Aljazair',
EC: 'Ekuador',
EE: 'Estonia',
EG: 'Mesir',
EH: 'Sahara Barat',
ER: 'Eritrea',
ES: 'Spanyol',
ET: 'Ethiopia',
FI: 'Finlandia',
FJ: 'Fiji',
FK: 'Kepulauan Falkland',
FM: 'Federasi Mikronesia',
FO: 'Kepulauan Faroe',
FR: 'Prancis',
GA: 'Gabon',
GB: 'Britania Raya',
GD: 'Grenada',
GE: 'Georgia',
GF: 'Guyana Prancis',
GG: 'Guernsey',
GH: 'Ghana',
GI: 'Gibraltar',
GL: 'Greenland',
GM: 'Gambia',
GN: 'Guinea',
GP: 'Guadeloupe',
GQ: 'Guinea Ekuatorial',
GR: 'Yunani',
GT: 'Guatemala',
GU: 'Guam',
GW: 'Guinea-Bissau',
GY: 'Guyana',
HK: 'Hong Kong',
HN: 'Honduras',
HR: 'Kroasia',
HT: 'Haiti',
HU: 'Hungaria',
ID: 'Indonesia',
IE: 'Irlandia',
IL: 'Israel',
IM: 'Pulau Man',
IN: 'India',
IO: 'Wilayah Samudra Hindia Britania',
IQ: 'Irak',
IR: 'Iran',
IS: 'Islandia',
IT: 'Italia',
JE: 'Jersey',
JM: 'Jamaika',
JO: 'Yordania',
JP: 'Jepang',
KE: 'Kenya',
KG: 'Kirgistan',
KH: 'Kamboja',
KI: 'Kiribati',
KM: 'Komoro',
KN: 'Saint Kitts dan Nevis',
KP: 'Korea Utara',
KR: 'Korea Selatan',
KW: 'Kuwait',
KY: 'Kepulauan Cayman',
KZ: 'Kazakstan',
LA: 'Laos',
LB: 'Lebanon',
LC: 'Saint Lucia',
LI: 'Liechtenstein',
LK: 'Sri Lanka',
LR: 'Liberia',
LS: 'Lesotho',
LT: 'Lituania',
LU: 'Luksemburg',
LV: 'Latvia',
LY: 'Libya',
MA: 'Maroko',
MC: 'Monako',
MD: 'Moldova',
ME: 'Montenegro',
MF: 'Saint Martin (Bagian Perancis)',
MG: 'Madagaskar',
MH: 'Kepulauan Marshall',
MK: 'Makedonia Utara',
ML: 'Mali',
MM: 'Myanmar',
MN: 'Mongolia',
MO: 'Makau',
MP: 'Kepulauan Mariana Utara',
MQ: 'Martinik',
MR: 'Mauritania',
MS: 'Montserrat',
MT: 'Malta',
MU: 'Mauritius',
MV: 'Maladewa',
MW: 'Malawi',
MX: 'Meksiko',
MY: 'Malaysia',
MZ: 'Mozambik',
NA: 'Namibia',
NC: 'Kaledonia Baru',
NE: 'Niger',
NF: 'Pulau Norfolk',
NG: 'Nigeria',
NI: 'Nikaragua',
NL: 'Belanda',
NO: 'Norwegia',
NP: 'Nepal',
NR: 'Nauru',
NU: 'Niue',
NZ: 'Selandia Baru',
OM: 'Oman',
PA: 'Panama',
PE: 'Peru',
PF: 'Polinesia Perancis',
PG: 'Papua Nugini',
PH: 'Filipina',
PK: 'Pakistan',
PL: 'Polandia',
PM: 'Saint Pierre dan Miquelon',
PR: 'Puerto Riko',
PS: 'Palestina',
PT: 'Portugal',
PW: 'Palau',
PY: 'Paraguay',
QA: 'Qatar',
RE: 'Réunion',
RO: 'Rumania',
RS: 'Serbia',
RU: 'Rusia',
RW: 'Rwanda',
SA: 'Arab Saudi',
SB: 'Kepulauan Solomon',
SC: 'Seychelles',
SD: 'Sudan',
SE: 'Swedia',
SG: 'Singapura',
SH: 'Saint Helena',
SI: 'Slovenia',
SJ: 'Svalbard dan Jan Mayen',
SK: 'Slowakia',
SL: 'Sierra Leone',
SM: 'San Marino',
SN: 'Senegal',
SO: 'Somalia',
SR: 'Suriname',
SS: 'Sudan Selatan',
ST: 'Sao Tome dan Principe',
SV: 'El Salvador',
SX: 'Sint Maarten',
SY: 'Suriah',
SZ: 'Swaziland',
TA: 'Tristan da Cunha',
TC: 'Kepulauan Turks dan Caicos',
TD: 'Cad',
TG: 'Togo',
TH: 'Thailand',
TJ: 'Tajikistan',
TK: 'Tokelau',
TL: 'Timor Leste',
TM: 'Turkmenistan',
TN: 'Tunisia',
TO: 'Tonga',
TR: 'Turki',
TT: 'Trinidad dan Tobago',
TV: 'Tuvalu',
TW: 'Taiwan',
TZ: 'Tanzania',
UA: 'Ukraina',
UG: 'Uganda',
US: 'Amerika Serikat',
UY: 'Uruguay',
UZ: 'Uzbekistan',
VA: 'Kota Vatikan',
VC: 'Saint Vincent dan Grenadines',
VE: 'Venezuela',
VG: 'Kepulauan Virgin Britania',
VI: 'Kepulauan Virgin Amerika',
VN: 'Vietnam',
VU: 'Vanuatu',
WF: 'Wallis dan Futuna',
WS: 'Samoa',
XK: 'Kosovo',
YE: 'Yaman',
YT: 'Mayotte',
ZA: 'Afrika Selatan',
ZM: 'Zambia',
ZW: 'Zimbabwe',
},
};
@bryanltobing
Copy link
Author

select like this countriesWithLocale[locale][countryCode]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment