当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Locale::findLocale方法代码示例

本文整理汇总了PHP中Zend_Locale::findLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Locale::findLocale方法的具体用法?PHP Zend_Locale::findLocale怎么用?PHP Zend_Locale::findLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Locale的用法示例。


在下文中一共展示了Zend_Locale::findLocale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     if (null !== ($locale = $request->getParam('locale'))) {
         if (strtoupper($locale) === 'NULL') {
             setcookie('openskos_locale', '', time() - 3600, '/');
             $this->_redirect();
         } else {
             try {
                 $newLocale = Zend_Locale::findLocale($locale);
             } catch (Zend_Locale_Exception $e) {
                 $this->_redirect();
             }
             $this->_setLocale($newLocale);
             setcookie('openskos_locale', $locale, time() + 60 * 60 * 24 * 30, '/');
             $this->_redirect();
         }
     } elseif (isset($_COOKIE['openskos_locale']) && ($locale = $_COOKIE['openskos_locale'])) {
         try {
             $newLocale = Zend_Locale::findLocale($locale);
         } catch (Zend_Locale_Exception $e) {
             setcookie('openskos_locale', '', time() - 3600, '/');
             return;
         }
         $this->_setLocale($newLocale);
     }
 }
开发者ID:olhsha,项目名称:OpenSKOS2tempMeertens,代码行数:26,代码来源:Locale.php

示例2: _initTranslate

 public function _initTranslate()
 {
     $locale = new Zend_Locale(Zend_Locale::findLocale());
     $localeName = $locale->getLanguage();
     if (!in_array($localeName, array('en', 'ru'))) {
         $localeName = 'en';
     }
     $translate = new Zend_Translate(array('adapter' => 'tmx', 'content' => APPLICATION_PATH . '/configs/lang.xml', 'locale' => $localeName));
     Zend_Registry::set('Zend_Translate', $translate);
 }
开发者ID:HardSkript,项目名称:unsee.cc,代码行数:10,代码来源:Bootstrap.php

示例3: trlStaticExecute

 public function trlStaticExecute($language = null)
 {
     parent::trlStaticExecute($language);
     $locale = Kwf_Trl::getInstance()->trlcKwf('locale', 'C', array(), $language);
     if ($locale == 'C') {
         $locale = 'en_US';
     }
     $l = Zend_Locale::findLocale($locale);
     $this->_floatValidator->setLocale($l);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:10,代码来源:NumberField.php

示例4: loginButton

 /**
  * Generates the button used for Facebook Connect
  *
  * @param mixed $fb_params A string or array of Facebook parameters for login
  * @param string $connect_with_facebook The string to display inside the button
  * @return String Generates HTML code for facebook login button
  */
 public static function loginButton($connect_with_facebook = 'Connect with Facebook', $prevent_reload = false)
 {
     $settings = Engine_Api::_()->getApi('settings', 'core');
     $facebook = self::getFBInstance();
     $fb_params = array('display' => 'page', 'req_perms' => array());
     switch ($settings->core_facebook_enable) {
         case 'login':
             break;
         case 'publish':
             $fb_params['req_perms'][] = 'email';
             $fb_params['req_perms'][] = 'user_birthday';
             $fb_params['req_perms'][] = 'user_status';
             $fb_params['req_perms'][] = 'publish_stream';
             break;
         case 'none':
         default:
             return;
     }
     $fb_params['req_perms'] = implode(',', $fb_params['req_perms']);
     $fb_href = $facebook->getLoginUrl($fb_params);
     $fb_onclick = "FB.login(null, {perms:'{$fb_params['req_perms']}'});return false;";
     return '
   <div id="fb-root"></div>
   <script type="text/javascript">
   //<![CDATA[
     (function(){
       var e = document.createElement("script");
           e.async = true;
           e.src = document.location.protocol + "//connect.facebook.net/' . Zend_Locale::findLocale() . '/all.js";
       document.getElementById("fb-root").appendChild(e);
     }());
     window.fbAsyncInit = function() {
       FB.init({
         appId: "' . $settings->core_facebook_appid . '",
         status: true,
         cookie: true,
         xfbml: true
       });
       FB.Event.subscribe(\'auth.sessionChange\', function(response) {
         ' . ($prevent_reload ? '' : 'if (-1 != document.cookie.search(/^(.*; ?)fbs_/)) window.location.reload();') . '
         }); };
       (function() {
         var e = document.createElement("script"); e.async = true; e.src = document.location.protocol + "//connect.facebook.net/' . Zend_Locale::findLocale() . '/all.js";
         document.getElementById("fb-root").appendChild(e);
       }());
   //]]>
   </script>
   <a href="' . $fb_href . '" target="_blank" onclick="' . $fb_onclick . '"><img src="http://static.ak.fbcdn.net/rsrc.php/z38X1/hash/6ad3z8m6.gif" border="0" alt="' . $connect_with_facebook . '" /></a>
   ';
 }
开发者ID:robeendey,项目名称:ce,代码行数:57,代码来源:Facebook.php

示例5: localeAction

 public function localeAction()
 {
     $locale = $this->_getParam('locale');
     $language = $this->_getParam('language');
     $return = $this->_getParam('return', $this->_helper->url->url(array(), 'default', true));
     $viewer = Engine_Api::_()->user()->getViewer();
     if (!empty($locale)) {
         try {
             $locale = Zend_Locale::findLocale($locale);
         } catch (Exception $e) {
             $locale = null;
         }
     }
     if (!empty($language)) {
         try {
             $language = Zend_Locale::findLocale($language);
         } catch (Exception $e) {
             $language = null;
         }
     }
     if ($language && !$locale) {
         $locale = $language;
     }
     if (!$language && $locale) {
         $language = $locale;
     }
     if ($language && $locale) {
         // Set as cookie
         setcookie('en4_language', $language, time() + 86400 * 365, '/');
         setcookie('en4_locale', $locale, time() + 86400 * 365, '/');
         // Set as database
         if ($viewer && $viewer->getIdentity()) {
             $viewer->locale = $locale;
             $viewer->language = $language;
             $viewer->save();
         }
     }
     return $this->_helper->redirector->gotoUrl($return, array('prependBase' => false));
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:39,代码来源:UtilityController.php

示例6: _addTranslationData

 /**
  * Internal function for adding translation data
  *
  * This may be a new language or additional data for an existing language
  * If the options 'clear' is true, then the translation data for the specified
  * language is replaced and added otherwise
  *
  * @see    Zend_Locale
  * @param  array|Zend_Config $content Translation data to add
  * @throws Zend_Translate_Exception
  * @return Zend_Translate_Adapter Provides fluent interface
  */
 private function _addTranslationData($options = array())
 {
     if ($options instanceof Zend_Config) {
         $options = $options->toArray();
     } else {
         if (func_num_args() > 1) {
             $args = func_get_args();
             $options['content'] = array_shift($args);
             if (!empty($args)) {
                 $options['locale'] = array_shift($args);
             }
             if (!empty($args)) {
                 $options += array_shift($args);
             }
         }
     }
     if ($options['content'] instanceof Zend_Translate || $options['content'] instanceof Zend_Translate_Adapter) {
         $options['usetranslateadapter'] = true;
         if (!empty($options['locale']) && $options['locale'] !== 'auto') {
             $options['content'] = $options['content']->getMessages($options['locale']);
         } else {
             $content = $options['content'];
             $locales = $content->getList();
             foreach ($locales as $locale) {
                 $options['locale'] = $locale;
                 $options['content'] = $content->getMessages($locale);
                 $this->_addTranslationData($options);
             }
             return $this;
         }
     }
     try {
         $options['locale'] = Zend_Locale::findLocale($options['locale']);
     } catch (Zend_Locale_Exception $e) {
         #require_once 'Zend/Translate/Exception.php';
         throw new Zend_Translate_Exception("The given Language '{$options['locale']}' does not exist", 0, $e);
     }
     if ($options['clear'] || !isset($this->_translate[$options['locale']])) {
         $this->_translate[$options['locale']] = array();
     }
     $read = true;
     if (isset(self::$_cache)) {
         $id = 'Zend_Translate_' . md5(serialize($options['content'])) . '_' . $this->toString();
         $temp = self::$_cache->load($id);
         if ($temp) {
             $read = false;
         }
     }
     if ($options['reload']) {
         $read = true;
     }
     if ($read) {
         if (!empty($options['usetranslateadapter'])) {
             $temp = array($options['locale'] => $options['content']);
         } else {
             $temp = $this->_loadTranslationData($options['content'], $options['locale'], $options);
         }
     }
     if (empty($temp)) {
         $temp = array();
     }
     $keys = array_keys($temp);
     foreach ($keys as $key) {
         if (!isset($this->_translate[$key])) {
             $this->_translate[$key] = array();
         }
         if (array_key_exists($key, $temp) && is_array($temp[$key])) {
             $this->_translate[$key] = $temp[$key] + $this->_translate[$key];
         }
     }
     if ($this->_automatic === true) {
         $find = new Zend_Locale($options['locale']);
         $browser = $find->getEnvironment() + $find->getBrowser();
         arsort($browser);
         foreach ($browser as $language => $quality) {
             if (isset($this->_translate[$language])) {
                 $this->_options['locale'] = $language;
                 break;
             }
         }
     }
     if ($read and isset(self::$_cache)) {
         $id = 'Zend_Translate_' . md5(serialize($options['content'])) . '_' . $this->toString();
         if (self::$_cacheTags) {
             self::$_cache->save($temp, $id, array($this->_options['tag']));
         } else {
             self::$_cache->save($temp, $id);
         }
//.........这里部分代码省略.........
开发者ID:ankitsapient,项目名称:testgithubankit,代码行数:101,代码来源:Adapter.php

示例7: _startElement

 /**
  * Internal method, called by xml element handler at start
  *
  * @param resource $file   File handler
  * @param string   $name   Elements name
  * @param array    $attrib Attributes for this element
  */
 protected function _startElement($file, $name, $attrib)
 {
     if ($this->_seg !== null) {
         $this->_content .= "<" . $name;
         foreach ($attrib as $key => $value) {
             $this->_content .= " {$key}=\"{$value}\"";
         }
         $this->_content .= ">";
     } else {
         switch (strtolower($name)) {
             case 'header':
                 if (empty($this->_useId) && isset($attrib['srclang'])) {
                     if (Zend_Locale::isLocale($attrib['srclang'])) {
                         $this->_srclang = Zend_Locale::findLocale($attrib['srclang']);
                     } else {
                         if (!$this->_options['disableNotices']) {
                             if ($this->_options['log']) {
                                 $this->_options['log']->notice("The language '{$attrib['srclang']}' can not be set because it does not exist.");
                             } else {
                                 trigger_error("The language '{$attrib['srclang']}' can not be set because it does not exist.", E_USER_NOTICE);
                             }
                         }
                         $this->_srclang = $attrib['srclang'];
                     }
                 }
                 break;
             case 'tu':
                 if (isset($attrib['tuid'])) {
                     $this->_tu = $attrib['tuid'];
                 }
                 break;
             case 'tuv':
                 if (isset($attrib['xml:lang'])) {
                     if (Zend_Locale::isLocale($attrib['xml:lang'])) {
                         $this->_tuv = Zend_Locale::findLocale($attrib['xml:lang']);
                     } else {
                         if (!$this->_options['disableNotices']) {
                             if ($this->_options['log']) {
                                 $this->_options['log']->notice("The language '{$attrib['xml:lang']}' can not be set because it does not exist.");
                             } else {
                                 trigger_error("The language '{$attrib['xml:lang']}' can not be set because it does not exist.", E_USER_NOTICE);
                             }
                         }
                         $this->_tuv = $attrib['xml:lang'];
                     }
                     if (!isset($this->_data[$this->_tuv])) {
                         $this->_data[$this->_tuv] = array();
                     }
                 }
                 break;
             case 'seg':
                 $this->_seg = true;
                 $this->_content = null;
                 break;
             default:
                 break;
         }
     }
 }
开发者ID:netixx,项目名称:Stock,代码行数:66,代码来源:Tmx.php

示例8: setLocale

 /**
  * Sets the locale option
  *
  * @param  string|Zend_Locale $locale
  * @return Zend_Validate_Date provides a fluent interface
  */
 public function setLocale($locale = null)
 {
     $this->_locale = Zend_Locale::findLocale($locale);
     return $this;
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:11,代码来源:Date.php

示例9: setLocale

 /**
  * 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
  */
 public function setLocale($locale = null)
 {
     #require_once 'Zend/Locale.php';
     $this->_locale = Zend_Locale::findLocale($locale);
     $locale = new Zend_Locale($this->_locale);
     $region = $locale->getRegion();
     if (empty($region)) {
         #require_once 'Zend/Validate/Exception.php';
         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)) {
         #require_once 'Zend/Validate/Exception.php';
         throw new Zend_Validate_Exception("Unable to detect a postcode format for the region '{$locale->getRegion()}'");
     }
     $this->setFormat($format);
     return $this;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:26,代码来源:PostCode.php

示例10: editAction

 public function editAction()
 {
     $this->view->locale = $locale = $this->_getParam('locale');
     $this->view->page = $page = $this->_getParam('page');
     $translate = Zend_Registry::get('Zend_Translate');
     try {
         if (!$locale || !Zend_Locale::findLocale($locale)) {
             throw new Exception('missing locale ' . $locale);
         }
     } catch (Exception $e) {
         return $this->_helper->redirector->gotoRoute(array('action' => 'index', 'controller' => 'language'), 'admin_default', true);
     }
     // Process filter form
     $this->view->filterForm = $filterForm = new Core_Form_Admin_Language_Filter();
     $filterForm->isValid($this->_getAllParams());
     $filterValues = $filterForm->getValues();
     extract($filterValues);
     // search, show
     // Make query
     $filterValues = array_filter($filterValues);
     $this->view->values = $filterValues;
     $this->view->query = empty($filterValues) ? '' : '?' . http_build_query($filterValues);
     // Assign basic locale info
     $this->view->localeObject = $localeObject = new Zend_Locale($locale);
     $this->view->locale = $locale = $localeObject->toString();
     // Get locale translation info
     $localeLanguage = $localeObject->getLanguage();
     $localeRegion = $localeObject->getRegion();
     $this->view->localeLanguageTranslation = $localeLanguageTranslation = Zend_Locale::getTranslation($localeLanguage, 'language', Zend_Registry::get('Locale'));
     $this->view->localeRegionTranslation = $localeRegionTranslation = Zend_Locale::getTranslation($localeRegion, 'territory', Zend_Registry::get('Locale'));
     $translate = Zend_Registry::get('Zend_Translate');
     if ($localeLanguageTranslation && $localeRegionTranslation) {
         $this->view->localeTranslation = $localeLanguageTranslation . ' ' . sprintf($translate->translate('(%s)'), $localeRegionTranslation) . ' ' . sprintf($translate->translate('[%s]'), $locale);
     } else {
         if ($localeLanguageTranslation) {
             $this->view->localeTranslation = $localeLanguageTranslation . ' ' . sprintf($translate->translate('[%s]'), $locale);
         } else {
             $this->view->localeTranslation = sprintf($translate->translate('[%s]'), $locale);
         }
     }
     // Query plural system for max and sample space
     $sample = array();
     $max = 0;
     for ($i = 0; $i <= 1000; $i++) {
         $form = Zend_Translate_Plural::getPlural($i, $locale);
         $max = max($max, $form);
         if (@count($sample[$form]) < 3) {
             $sample[$form][] = $i;
         }
     }
     $this->view->pluralFormCount = $max + 1;
     $this->view->pluralFormSample = $sample;
     // Get initial and default values
     $baseMessages = $translate->getMessages('en');
     if ($translate->isAvailable($locale)) {
         $currentMessages = $translate->getMessages($locale);
     } else {
         $currentMessages = array();
         // @todo this should redirect or smth
     }
     // Get phrases that are not in the english pack?
     if (!empty($currentMessages) && $locale != 'en') {
         $missingBasePhrases = array_diff_key($currentMessages, $baseMessages);
         $missingBasePhrases = array_combine(array_keys($missingBasePhrases), array_keys($missingBasePhrases));
         $baseMessages = array_merge($baseMessages, $missingBasePhrases);
     }
     // Build the fancy array
     $resultantMessages = array();
     $missing = 0;
     $index = 0;
     foreach ($baseMessages as $key => $value) {
         // Build
         $composite = array('uid' => ++$index, 'key' => $key, 'original' => $value, 'plural' => (bool) is_array($value));
         // filters, plurals, and missing, oh my.
         if (isset($currentMessages[$key])) {
             if ('missing' == $show) {
                 continue;
             }
             if (is_array($value) && !is_array($currentMessages[$key])) {
                 $composite['current'] = array($currentMessages[$key]);
             } else {
                 if (!is_array($value) && is_array($currentMessages[$key])) {
                     $composite['current'] = current($currentMessages[$key]);
                 } else {
                     $composite['current'] = $currentMessages[$key];
                 }
             }
         } else {
             if ('translated' == $show) {
                 continue;
             }
             if (is_array($value)) {
                 $composite['current'] = array();
             } else {
                 $composite['current'] = '';
             }
             $missing++;
         }
         // Do search
         if ($search && !$this->_searchArrayRecursive($search, $composite)) {
//.........这里部分代码省略.........
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:101,代码来源:AdminLanguageController.php

示例11: getLogIndices

 public function getLogIndices()
 {
     $locale = null;
     if (\Zend_Registry::isRegistered('Zend_Locale')) {
         $locale = \Zend_Registry::get('Zend_Locale');
     } elseif (\Zend_Registry::isRegistered('locale')) {
         $locale = \Zend_Registry::get('locale');
     }
     if (!$locale instanceof \Zend_Locale) {
         $locale = \Zend_Locale::findLocale();
     }
     switch ($this->_logRotate) {
         case self::ROTATE_PER_MONTH:
             break;
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:16,代码来源:Log.php

示例12: preDispatch

 public function preDispatch(\Zend_Controller_Request_Abstract $request)
 {
     $locale = new Zend_Locale(Zend_Locale::findLocale());
     $this->getResponse()->setHeader('Content-Language', $locale->getLanguage());
 }
开发者ID:HardSkript,项目名称:unsee.cc,代码行数:5,代码来源:Headers.php

示例13: _addTranslationData

 /**
  * Internal function for adding translation data
  *
  * It may be a new language or additional data for existing language
  * If $clear parameter is true, then translation data for specified
  * language is replaced and added otherwise
  *
  * @see    Zend_Locale
  * @param  array|string       $data    Translation data
  * @param  string|Zend_Locale $locale  Locale/Language to add data for, identical with locale identifier,
  *                                     @see Zend_Locale for more information
  * @param  array              $options (optional) Option for this Adapter
  * @throws Zend_Translate_Exception
  * @return Zend_Translate_Adapter Provides fluent interface
  */
 private function _addTranslationData($data, $locale, array $options = array())
 {
     try {
         $locale = Zend_Locale::findLocale($locale);
     } catch (Zend_Locale_Exception $e) {
         require_once 'Zend/Translate/Exception.php';
         throw new Zend_Translate_Exception("The given Language '{$locale}' does not exist", 0, $e);
     }
     if ($options['clear'] || !isset($this->_translate[$locale])) {
         $this->_translate[$locale] = array();
     }
     $read = true;
     if (isset(self::$_cache)) {
         $id = 'Zend_Translate_' . md5(serialize($data)) . '_' . $this->toString();
         $temp = self::$_cache->load($id);
         if ($temp) {
             $read = false;
         }
     }
     if ($options['reload']) {
         $read = true;
     }
     if ($read) {
         $temp = $this->_loadTranslationData($data, $locale, $options);
     }
     if (empty($temp)) {
         $temp = array();
     }
     $keys = array_keys($temp);
     foreach ($keys as $key) {
         if (!isset($this->_translate[$key])) {
             $this->_translate[$key] = array();
         }
         if (array_key_exists($key, $temp) && is_array($temp[$key])) {
             $this->_translate[$key] = $temp[$key] + $this->_translate[$key];
         }
     }
     if ($this->_automatic === true) {
         $find = new Zend_Locale($locale);
         $browser = $find->getEnvironment() + $find->getBrowser();
         arsort($browser);
         foreach ($browser as $language => $quality) {
             if (isset($this->_translate[$language])) {
                 $this->_options['locale'] = $language;
                 break;
             }
         }
     }
     if ($read and isset(self::$_cache)) {
         $id = 'Zend_Translate_' . md5(serialize($data)) . '_' . $this->toString();
         self::$_cache->save($temp, $id, array('Zend_Translate'));
     }
     return $this;
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:69,代码来源:Adapter.php

示例14: _checkOptions

 /**
  * Internal function for checking the options array of proper input values
  * See {@link setOptions()} for details.
  *
  * @param  array  $options  Array of options, keyed by option name: format_type = 'iso' | 'php', fix_date = true | false,
  *                          locale = Zend_Locale | locale string, precision = whole number between -1 and 30
  * @throws Zend_Locale_Exception
  * @return Options array if no option was given
  */
 private static function _checkOptions(array $options = array())
 {
     if (count($options) == 0) {
         return self::$_options;
     }
     foreach ($options as $name => $value) {
         $name = strtolower($name);
         if ($name !== 'locale') {
             if (gettype($value) === 'string') {
                 $value = strtolower($value);
             }
         }
         switch ($name) {
             case 'number_format':
                 if ($value == Zend_Locale_Format::STANDARD) {
                     $locale = self::$_options['locale'];
                     if (isset($options['locale'])) {
                         $locale = $options['locale'];
                     }
                     $options['number_format'] = Zend_Locale_Data::getContent($locale, 'decimalnumber');
                 } else {
                     if (gettype($value) !== 'string' and $value !== NULL) {
                         // require_once 'Zend/Locale/Exception.php';
                         throw new Zend_Locale_Exception("Unknown number format type '" . gettype($value) . "'. " . "Format '{$value}' must be a valid number format string.");
                     }
                 }
                 break;
             case 'date_format':
                 if ($value == Zend_Locale_Format::STANDARD) {
                     $locale = self::$_options['locale'];
                     if (isset($options['locale'])) {
                         $locale = $options['locale'];
                     }
                     $options['date_format'] = Zend_Locale_Format::getDateFormat($locale);
                 } else {
                     if (gettype($value) !== 'string' and $value !== NULL) {
                         // require_once 'Zend/Locale/Exception.php';
                         throw new Zend_Locale_Exception("Unknown dateformat type '" . gettype($value) . "'. " . "Format '{$value}' must be a valid ISO or PHP date format string.");
                     } else {
                         if (isset($options['format_type']) === true and $options['format_type'] == 'php' or isset($options['format_type']) === false and self::$_options['format_type'] == 'php') {
                             $options['date_format'] = Zend_Locale_Format::convertPhpToIsoFormat($value);
                         }
                     }
                 }
                 break;
             case 'format_type':
                 if ($value != 'php' && $value != 'iso') {
                     // require_once 'Zend/Locale/Exception.php';
                     throw new Zend_Locale_Exception("Unknown date format type '{$value}'. Only 'iso' and 'php'" . " are supported.");
                 }
                 break;
             case 'fix_date':
                 if ($value !== true && $value !== false) {
                     // require_once 'Zend/Locale/Exception.php';
                     throw new Zend_Locale_Exception("Enabling correction of dates must be either true or false" . "(fix_date='{$value}').");
                 }
                 break;
             case 'locale':
                 $options['locale'] = Zend_Locale::findLocale($value);
                 break;
             case 'cache':
                 if ($value instanceof Zend_Cache_Core) {
                     Zend_Locale_Data::setCache($value);
                 }
                 break;
             case 'disablecache':
                 Zend_Locale_Data::disableCache($value);
                 break;
             case 'precision':
                 if ($value === NULL) {
                     $value = -1;
                 }
                 if ($value < -1 || $value > 30) {
                     // require_once 'Zend/Locale/Exception.php';
                     throw new Zend_Locale_Exception("'{$value}' precision is not a whole number less than 30.");
                 }
                 break;
             default:
                 // require_once 'Zend/Locale/Exception.php';
                 throw new Zend_Locale_Exception("Unknown option: '{$name}' = '{$value}'");
                 break;
         }
     }
     return $options;
 }
开发者ID:JaroslavRamba,项目名称:ex-facebook-bundle,代码行数:94,代码来源:Format.php

示例15: initTranslation

 protected function initTranslation(\Zend_Form $form, $id, $locale = null)
 {
     if ($locale === null) {
         $locale = \Zend_Locale::findLocale();
     }
     $trans = $this->translateForm($id, $locale);
     if ($locale != null && $locale != "") {
         if (null === $form->getTranslator()) {
             $form->setTranslator($trans);
         } else {
             $form->getTranslator()->addTranslation($trans);
         }
     }
 }
开发者ID:mkliche,项目名称:Zendformbuilder,代码行数:14,代码来源:Frontend.php


注:本文中的Zend_Locale::findLocale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。