Logo Search packages:      
Sourcecode: zendframework version File versions  Download package

static Zend_Locale::findLocale ( locale = null ) [static]

Finds the proper locale based on the input Checks if it exists, degrades it when necessary Detects registry locale and when all fails tries to detect a automatic locale Returns the found locale as string

Zend_Locale_ExceptionWhen the given locale is no locale or the autodetection fails

Definition at line 799 of file Locale.php.

References _prepareLocale(), Zend_Registry::get(), isLocale(), and Zend_Registry::isRegistered().

Referenced by Zend_Translate_Adapter::_addTranslationData(), Zend_Locale_Format::_checkOptions(), Zend_Translate_Adapter::addTranslation(), getQuestion(), getTranslation(), getTranslationList(), Zend_Date::isDate(), Zend_Validate_PostCode::setLocale(), Zend_Validate_Iban::setLocale(), Zend_Validate_Float::setLocale(), Zend_Validate_Int::setLocale(), Zend_Validate_Date::setLocale(), Zend_Date::setLocale(), Zend_Currency::setLocale(), and Zend_Translate_Adapter::setLocale().

        if ($locale === null) {
            require_once 'Zend/Registry.php';
            if (Zend_Registry::isRegistered('Zend_Locale')) {
                $locale = Zend_Registry::get('Zend_Locale');

        if ($locale === null) {
            $locale = new Zend_Locale();

        if (!Zend_Locale::isLocale($locale, true, false)) {
            if (!Zend_Locale::isLocale($locale, false, false)) {
                require_once 'Zend/Locale/Exception.php';
                throw new Zend_Locale_Exception("The locale '$locale' is no known locale");

            $locale = new Zend_Locale($locale);

        $locale = self::_prepareLocale($locale);
        return $locale;

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  Doxygen 1.6.0   Back to index