Search code examples
zend-frameworkzend-validatepostal-code

zend_validate_postcode via country?


i have a registration form which contains a postalcode and a country drop down given those two values i want to validate the postcode via zend_validate_postcode

this validator wants a zend_locale in the constructor now i dont know how to create a zend_locale only ba a given country which means i would have to create from an US user new Zend_Locale('en_US'); or swiss de_CH but i only have the country part of this locale, how do i get the language part for a country?

thx


Solution

  • Zend_Locale::getLocaleToTerritory($country) e.g returns 'en_US' for country US or. de_CH for CH