use intl js lib across all phone number fields

This commit is contained in:
johnnyq
2026-08-26 13:53:27 -04:00
parent cfafc385f0
commit 96f2c697c6
107 changed files with 492 additions and 10356 deletions

View File

@@ -773,3 +773,210 @@ $locales_array = [
'zu_ZA' => 'Zulu (South Africa)',
'zu' => 'Zulu',
];
// Country name -> ISO 3166-1 alpha-2, keyed by the exact strings in
// $countries_array above. intl-tel-input identifies countries by ISO2, so
// this is what turns the stored company_country into an initialCountry for
// the phone inputs. Sixteen of the names above do not match the library's
// own spelling and are aliased here rather than in JS: "Colombi" (a typo in
// the list), the "Saint X" / "St. X" pair, "Swaziland" -> Eswatini,
// "Macedonia" -> North Macedonia, "Serbia and Montenegro" -> Serbia, and
// the two Koreas. Keep this in step with $countries_array - a name here
// with no entry there is dead, and one there with no entry here falls back
// to the library default.
$country_iso2_array = array(
"Afghanistan" => "af",
"Albania" => "al",
"Algeria" => "dz",
"Andorra" => "ad",
"Angola" => "ao",
"Antigua and Barbuda" => "ag",
"Argentina" => "ar",
"Armenia" => "am",
"Australia" => "au",
"Austria" => "at",
"Azerbaijan" => "az",
"Bahamas" => "bs",
"Bahrain" => "bh",
"Bangladesh" => "bd",
"Barbados" => "bb",
"Belarus" => "by",
"Belgium" => "be",
"Belize" => "bz",
"Benin" => "bj",
"Bhutan" => "bt",
"Bolivia" => "bo",
"Bosnia and Herzegovina" => "ba",
"Botswana" => "bw",
"Brazil" => "br",
"Brunei" => "bn",
"Bulgaria" => "bg",
"Burkina Faso" => "bf",
"Burundi" => "bi",
"Cambodia" => "kh",
"Cameroon" => "cm",
"Canada" => "ca",
"Cape Verde" => "cv",
"Central African Republic" => "cf",
"Chad" => "td",
"Chile" => "cl",
"China" => "cn",
"Colombi" => "co",
"Comoros" => "km",
"Congo (Brazzaville)" => "cg",
"Congo" => "cd",
"Costa Rica" => "cr",
"Cote d'Ivoire" => "ci",
"Croatia" => "hr",
"Cuba" => "cu",
"Cyprus" => "cy",
"Czech Republic" => "cz",
"Denmark" => "dk",
"Djibouti" => "dj",
"Dominica" => "dm",
"Dominican Republic" => "do",
"East Timor (Timor Timur)" => "tl",
"Ecuador" => "ec",
"Egypt" => "eg",
"El Salvador" => "sv",
"Equatorial Guinea" => "gq",
"Eritrea" => "er",
"Estonia" => "ee",
"Ethiopia" => "et",
"Fiji" => "fj",
"Finland" => "fi",
"France" => "fr",
"Gabon" => "ga",
"Gambia, The" => "gm",
"Georgia" => "ge",
"Germany" => "de",
"Ghana" => "gh",
"Gibraltar" => "gi",
"Greece" => "gr",
"Grenada" => "gd",
"Guatemala" => "gt",
"Guinea" => "gn",
"Guinea-Bissau" => "gw",
"Guyana" => "gy",
"Haiti" => "ht",
"Honduras" => "hn",
"Hungary" => "hu",
"Iceland" => "is",
"India" => "in",
"Indonesia" => "id",
"Iran" => "ir",
"Iraq" => "iq",
"Ireland" => "ie",
"Israel" => "il",
"Italy" => "it",
"Jamaica" => "jm",
"Japan" => "jp",
"Jordan" => "jo",
"Kazakhstan" => "kz",
"Kenya" => "ke",
"Kiribati" => "ki",
"Korea, North" => "kp",
"Korea, South" => "kr",
"Kuwait" => "kw",
"Kyrgyzstan" => "kg",
"Laos" => "la",
"Latvia" => "lv",
"Lebanon" => "lb",
"Lesotho" => "ls",
"Liberia" => "lr",
"Libya" => "ly",
"Liechtenstein" => "li",
"Lithuania" => "lt",
"Luxembourg" => "lu",
"Macedonia" => "mk",
"Madagascar" => "mg",
"Malawi" => "mw",
"Malaysia" => "my",
"Maldives" => "mv",
"Mali" => "ml",
"Malta" => "mt",
"Marshall Islands" => "mh",
"Mauritania" => "mr",
"Mauritius" => "mu",
"Mexico" => "mx",
"Micronesia" => "fm",
"Moldova" => "md",
"Monaco" => "mc",
"Mongolia" => "mn",
"Morocco" => "ma",
"Mozambique" => "mz",
"Myanmar" => "mm",
"Namibia" => "na",
"Nauru" => "nr",
"Nepal" => "np",
"Netherlands" => "nl",
"New Zealand" => "nz",
"Nicaragua" => "ni",
"Niger" => "ne",
"Nigeria" => "ng",
"Norway" => "no",
"Oman" => "om",
"Pakistan" => "pk",
"Palau" => "pw",
"Panama" => "pa",
"Papua New Guinea" => "pg",
"Paraguay" => "py",
"Peru" => "pe",
"Philippines" => "ph",
"Poland" => "pl",
"Portugal" => "pt",
"Qatar" => "qa",
"Romania" => "ro",
"Russia" => "ru",
"Rwanda" => "rw",
"Saint Kitts and Nevis" => "kn",
"Saint Lucia" => "lc",
"Saint Vincent" => "vc",
"Samoa" => "ws",
"San Marino" => "sm",
"Sao Tome and Principe" => "st",
"Saudi Arabia" => "sa",
"Senegal" => "sn",
"Serbia and Montenegro" => "rs",
"Seychelles" => "sc",
"Sierra Leone" => "sl",
"Singapore" => "sg",
"Slovakia" => "sk",
"Slovenia" => "si",
"Solomon Islands" => "sb",
"Somalia" => "so",
"South Africa" => "za",
"Spain" => "es",
"Sri Lanka" => "lk",
"Sudan" => "sd",
"Suriname" => "sr",
"Swaziland" => "sz",
"Sweden" => "se",
"Switzerland" => "ch",
"Syria" => "sy",
"Taiwan" => "tw",
"Tajikistan" => "tj",
"Tanzania" => "tz",
"Thailand" => "th",
"Togo" => "tg",
"Tonga" => "to",
"Trinidad and Tobago" => "tt",
"Tunisia" => "tn",
"Turkey" => "tr",
"Turkmenistan" => "tm",
"Tuvalu" => "tv",
"Uganda" => "ug",
"Ukraine" => "ua",
"United Arab Emirates" => "ae",
"United Kingdom" => "gb",
"United States" => "us",
"Uruguay" => "uy",
"Uzbekistan" => "uz",
"Vanuatu" => "vu",
"Vatican City" => "va",
"Venezuela" => "ve",
"Vietnam" => "vn",
"Yemen" => "ye",
"Zambia" => "zm",
"Zimbabwe" => "zw",
);