Hello I need to retrieve full country names based on a country code and a locale in PHP. Since php-intl is now supposed to be able to do this I want to use that.
nl_NL
nl -> Nederland
uk -> Verenigd Koninkrijk
en_UK
nl -> The Netherlands
uk -> United Kindom
I think I need to use php-intl resource bundles somehow, but am unable to find any useful examples.
Exactly. The intl methods can help you with that.
You need to use Locale::getDisplayRegion
Object oriented style:
Procedural style:
Returns an appropriately localized display name for region of the input locale. If is NULL then the default locale is used.
So, in your case:
Remember that ‘GB’ is used for the United Kingdom instead of ‘UK’