From e45cf33c301dddc5f3aa9ae102447412f8646ef0 Mon Sep 17 00:00:00 2001 From: Rahelno Date: Sun, 19 Jan 2025 11:14:10 +0100 Subject: [PATCH] Add support for ALPHA-3 country code to country_name Extended getCountryName() to support ALPHA-3 country codes. --- IntlExtension.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/IntlExtension.php b/IntlExtension.php index 43fd1c6..95e2d4e 100644 --- a/IntlExtension.php +++ b/IntlExtension.php @@ -198,6 +198,9 @@ public function getCountryName(?string $country, ?string $locale = null): string } try { + if(mb_strlen($country) == 3) { + return Countries::getAlpha3Name($country); + } return Countries::getName($country, $locale); } catch (MissingResourceException $exception) { return $country;