public function setLocale($locale = null)
    {

        $this->_locale = Zend_Locale::findLocale($locale);
        $locale        = new Zend_Locale($this->_locale);
        $region        = $locale->getRegion();
        if (empty($region)) {

            throw new Zend_Validate_Exception("Unable to detect a region for the locale '$locale'");
        }

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

        if (empty($format)) {

            throw new Zend_Validate_Exception("Unable to detect a postcode format for the region '{$locale->getRegion()}'");
        }

        $this->setFormat($format);
        return $this;
    }
public function setLocale($locale = null)
    {

        $this->_locale = Zend_Locale::findLocale($locale);
        $locale        = new Zend_Locale($this->_locale);
        $region        = $locale->getRegion();
        if (empty($region)) {

            throw new Zend_Validate_Exception("Unable to detect a region for the locale '$locale'");
        }

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

        if (empty($format)) {

            throw new Zend_Validate_Exception("Unable to detect a postcode format for the region '{$locale->getRegion()}'");
        }

        $this->setFormat($format);
        return $this;
    }
public function setLocale ( $ locale = null ) { $ this -> _locale = Zend_Locale :: findLocale ( $ locale ) ; $ locale = new Zend_Locale ( $ this -> _locale ) ; $ region = $ locale -> getRegion ( ) ; if ( empty ( $ region ) ) { throw new Zend_Validate_Exception ( "Unable to detect a region for the locale '$locale'" ) ; } $ format = Zend_Locale :: getTranslation ( $ locale -> getRegion ( ) , 'postaltoterritory' , $ this -> _locale ) ; if ( empty ( $ format ) ) { throw new Zend_Validate_Exception ( "Unable to detect a postcode format for the region '{$locale->getRegion()}'" ) ; } $ this -> setFormat ( $ format ) ; return $ this ; }
Sets the locale to use

@param string|Zend_Locale $locale
@throws Zend_Validate_Exception On unrecognised region
@throws Zend_Validate_Exception On not detected format
@return Zend_Validate_PostCode  Provides fluid interface
Sets the locale to use