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


PHP Zend_Translate::getLocale方法代码示例

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


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

示例1: getValues

 public static function getValues(Zend_Translate $lang)
 {
     $countries = Zend_Locale::getTranslationList('Territory', $lang->getLocale(), 2);
     $continents = Zend_Locale::getTranslationList('Territory', $lang->getLocale(), 1);
     array_unshift($countries, current($continents));
     return $countries;
 }
开发者ID:HardSkript,项目名称:unsee.cc,代码行数:7,代码来源:Countries.php

示例2: testSetLocale

 public function testSetLocale()
 {
     $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en');
     $lang->addTranslation('ru', array('msg1' => 'Message 1 (ru)'));
     $this->assertEquals($lang->getLocale(), new Zend_Locale('en'));
     $lang->setLocale('ru');
     $this->assertEquals($lang->getLocale(), new Zend_Locale('ru'));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:8,代码来源:TranslateTest.php

示例3: addSiteInterfaceLanguage

 /** Loads the site interface locale.
  * @param string $locale = null The locale to load (for instance: 'en_US'). If empty we'll use the currently active locale
  */
 public function addSiteInterfaceLanguage($locale = null)
 {
     if (is_object($this->translate)) {
         if (!(is_string($locale) && strlen($locale))) {
             $locale = $this->translate->getLocale();
         }
         $path = DIR_LANGUAGES_SITE_INTERFACE . '/' . $locale . '.mo';
         if (is_file($path)) {
             $this->translate->addTranslation($path, $locale);
         }
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:15,代码来源:localization.php

示例4: testSetLocaleAsOption

 /**
  * Tests if setting locale as options sets locale
  */
 public function testSetLocaleAsOption()
 {
     $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en');
     $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'ru');
     $lang->setOptions(array('locale' => 'ru'));
     $this->assertEquals('ru', $lang->getLocale());
     $lang->setOptions(array('locale' => 'en'));
     $this->assertEquals('en', $lang->getLocale());
 }
开发者ID:sasezaki,项目名称:mirror-zf1-tests,代码行数:12,代码来源:TranslateTest.php

示例5: _initDb

 /**
  * Init the db
  */
 protected function _initDb()
 {
     if (!Zend_Registry::isRegistered('db')) {
         #         $config = new Zend_Config_Ini( APPLICATION_PATH . '/config.ini', APPLICATION_ENV );
         $config = new Zend_Config_Ini(APPLICATION_PATH . '/config.ini', ENVIRONMENT);
         $db = Zend_Db::factory($config->resources->db);
         Zend_Db_Table_Abstract::setDefaultAdapter($db);
         Zend_Registry::set('db', $db);
     }
     //   setup language
     if (!Zend_Registry::isRegistered('translate')) {
         $translate = new Zend_Translate('csv', SERVER_BASE . LANGUAGES . 'en.csv', 'en');
         $actual = $translate->getLocale();
         //          $language  = get_session( 'language' );
         $language = Zend_Registry::isRegistered('language') ? Zend_Registry::get('language') : '';
         if ($language == '' or $language == '*') {
             $language = substr(get_ip(), 0, 3) == '58.' ? 'zh-Hans' : LANGUAGE;
             //               set_session( 'language', $language );
             Zend_Registry::set('language', $language);
         }
         $translate->addTranslation(SERVER_BASE . LANGUAGES . $language . '.csv', substr($language, 0, 2));
         $locale = new Zend_Locale('en_US');
         Zend_Registry::set('translate', $translate);
     }
 }
开发者ID:shadobladez,项目名称:erp2,代码行数:28,代码来源:Bootstrap.php

示例6:

 function __($msg)
 {
     if (!Zend_Registry::isRegistered('translate')) {
         $translate = new Zend_Translate('array', __DIR__ . '/Zyon.lang.php', 'auto');
         if (is_file($file = APPLICATION_PATH . '/languages/' . $translate->getLocale() . '.php')) {
             $translate->addTranslation($file);
         }
         Zend_Registry::set('translate', $translate);
     }
     $msg = (string) $msg;
     $ret = (string) Zend_Registry::get('translate')->getAdapter()->translate($msg, null);
     if (func_num_args() > 1) {
         $args = func_get_args();
         $args[0] = $ret;
         return call_user_func_array('sprintf', $args);
     }
     return $ret;
 }
开发者ID:null-1,项目名称:fangtaitong,代码行数:18,代码来源:Zyon.conf.php

示例7: array

<?php

$options = array('scan' => Zend_Translate::LOCALE_FILENAME);
$translate = new Zend_Translate('array', APPPATH . 'languages/', null, $options);
// $translate->setLocale('en_US');
// $translate->setLocale('nl');
var_dump($translate->getList());
var_dump($translate->getLocale());
echo $translate->_('ADMIN');
开发者ID:jaywilliams,项目名称:ultralite,代码行数:9,代码来源:test-translation.php

示例8: _initTranslate

 protected function _initTranslate()
 {
     $translate = new Zend_Translate(array('adapter' => 'array', 'content' => ROOT_PATH . '/languages/admin_nl.php', 'locale' => 'nl'));
     $session = new Zend_Session_Namespace('Lang');
     if (isset($session->language)) {
         $translate->setLocale($session->language);
     } else {
         $session->language = $translate->getLocale();
     }
     Zend_Registry::set('Zend_Translate', $translate);
     return $translate;
 }
开发者ID:jtietema,项目名称:Fizzy,代码行数:12,代码来源:Bootstrap.php

示例9: getValues

 public static function getValues(Zend_Translate $lang)
 {
     return Zend_Locale::getTranslationList('Territory', $lang->getLocale(), 1);
 }
开发者ID:HardSkript,项目名称:unsee.cc,代码行数:4,代码来源:Continents.php


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