Issues

ZF-9488: only use the region part (instead of locale) if only the region is needed (Iban, PostCode)

Description

The validators Zend_Validate_Iban & Zend_Validate_PostCode need (or can use) a region code to validate a value. But they don't need the a complete local!

Additionally The language part is not in evidence if your application only knows a region. -> For example the region of china is CN but cn_CN isn't a valid locale. You have to use zh_CN.

I see Zend_Validate_PostCode uses the locale:


$format = Zend_Locale::getTranslation(
    $locale->getRegion(),
    'postaltoterritory',
    $this->_locale
);

I don't tested it if there is a way to get the format of the post code but i don't know why a post code could be specific by a language as by the region.

Comments

There is no way to get the data from a locale only by region without a full qualified locale.

This is already described within the manual.

Implemented by another feature.

Note: "They need no complete locale" is wrong. A locale always consist of language and region. The region alone is no locale. Therefor the region alone can not be seen as locale. Components which are based on localization must work according to this rule.

I doesn't say that IBAN and PostCode validators are localized. They aren't. They are based on territory. I understand if you say there is no way to get the PostCode only from a region but to select a locale from a territory to get it is more a workaround as a fix. Additionally there are special territories without having a locale (e.g. Hong Kong)

Wikipedia: In February 2005, 117 of the 190 member countries of the Universal Postal Union had postal code systems. Countries that do not have national systems include Ireland and Panama. Although Hong Kong and Macau are now Special Administrative Regions of China, each maintain their own long-established postal system, which does not utilize postal codes for domestic mail.