When I save countries into my database I use the international abbreviation.
How do I convert this abbreviation with zend_locale
to the full country name?
When I save countries into my database I use the international abbreviation.
How do I convert this abbreviation with zend_locale
to the full country name?
Use Zend_Locale::getTranslationList()
or Zend_Locale::getTranslation()
. See example #7 in the manual.
You can use functionality from the intl
extension which is bundled as of PHP 5.3.0, or as a PECL extension as of PHP 5.2.0.
To display a region using a locale:
<?php
print \Locale::getDisplayRegion('da_DK') . "\n";
print \Locale::getDisplayRegion('en_US') . "\n";
print \Locale::getDisplayRegion('ru_RU', 'ru_RU') . "\n";
?>
Will output:
Denmark
United States
Россия
Here is the method. It tries to use the browser's locale and defaults to US English if that fails.