I have a list of countries (i.e. 'de' => 'Deutschland'
, 'at' => 'Austria'
).
What I now need is to get the locale string ('de_DE'
or 'de_AT'
) from the countrycode.
I need this for the validation of the postcode by the selected country. To achieve this, the postcode validator needs a locale string with region ('de_AT'
or 'en_US'
). 'de'
or 'en'
does'nt work.
Is there any simple way to do that?
An other solution:
$contry = 'at';
$locale = Zend_Locale::getLocaleToTerritory($contry);
$validator = new Zend_Validate_PostCode($locale);
Zend_Locale::getLocaleToTerritory()
retrieve the correct locale by default. (like 'US' give 'en_US')