Beispiel #1
0
 protected function _initLocale()
 {
     $locale = new Zend_Locale();
     $locale_code = Core_Model_Language::DEFAULT_LOCALE;
     $is_installing = $this->getRequest()->isInstalling();
     if ($this->getRequest()->isApplication() && $this->getApplication()->getLocale()) {
         $locale_code = $this->getApplication()->getLocale();
     } else {
         if (!$is_installing) {
             $currency_code = System_Model_Config::getValueFor("system_currency");
             if ($currency_code) {
                 $currency = new Zend_Currency(null, $currency_code);
                 Core_Model_Language::setCurrentCurrency($currency);
             }
             $territory = System_Model_Config::getValueFor("system_territory");
             if ($territory) {
                 $locale_code = $locale->getLocaleToTerritory($territory);
             } else {
                 $locale_code = new Zend_Locale(Core_Model_Language::getCurrentLocale());
             }
         }
     }
     if (!$is_installing) {
         $timezone = System_Model_Config::getValueFor("system_timezone");
         if ($timezone) {
             date_default_timezone_set($timezone);
         }
     }
     $locale->setLocale($locale_code);
     Zend_Registry::set('Zend_Locale', $locale);
 }