Пример #1
0
 public function validateAction()
 {
     $data_translations = array("required" => $this->_("This field is required."), "remote" => $this->_("Please fix this field."), "email" => $this->_("Please enter a valid email address."), "url" => $this->_("Please enter a valid URL."), "date" => $this->_("Please enter a valid date."), "dateISO" => $this->_("Please enter a valid date (ISO)."), "number" => $this->_("Please enter a valid number."), "digits" => $this->_("Please enter only digits."), "creditcard" => $this->_("Please enter a valid credit card number."), "equalTo" => $this->_("Please enter the same value again."), "maxlength" => $this->_("Please enter no more than {0} characters."), "minlength" => $this->_("Please enter at least {0} characters."), "rangelength" => $this->_("Please enter a value between {0} and {1} characters long."), "range" => $this->_("Please enter a value between {0} and {1}."), "max" => $this->_("Please enter a value less than or equal to {0}."), "min" => $this->_("Please enter a value greater than or equal to {0}."));
     $datas = array("languagecode" => current(explode("_", Core_Model_Language::getCurrentLocale())), "translations" => $data_translations);
     die(json_encode($datas));
 }
Пример #2
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);
 }
Пример #3
0
 protected function _initLocale()
 {
     $locale = Core_Model_Language::DEFAULT_LOCALE;
     if ($this->getRequest()->isApplication()) {
         $locale = $this->getApplication()->getLocale();
     } else {
         $locale = new Zend_Locale(Core_Model_Language::getCurrentLocale());
     }
     Zend_Registry::set('Zend_Locale', new Zend_Locale($locale));
 }