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


PHP i18n::register_translator方法代码示例

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


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

示例1: tearDown

 public function tearDown()
 {
     SS_TemplateLoader::instance()->popManifest();
     SS_ClassLoader::instance()->popManifest();
     i18n::set_locale($this->originalLocale);
     Config::inst()->update('Director', 'alternate_base_folder', null);
     Config::inst()->update('SSViewer', 'theme', $this->_oldTheme);
     i18n::register_translator($this->origAdapter, 'core');
     parent::tearDown();
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:10,代码来源:i18nSSLegacyAdapterTest.php

示例2: tearDown

 public function tearDown()
 {
     SS_TemplateLoader::instance()->popManifest();
     SS_ClassLoader::instance()->popManifest();
     i18n::set_locale($this->originalLocale);
     Director::setBaseFolder(null);
     SSViewer::set_theme($this->_oldTheme);
     i18n::register_translator($this->origAdapter, 'core');
     parent::tearDown();
 }
开发者ID:normann,项目名称:sapphire,代码行数:10,代码来源:i18nSSLegacyAdapterTest.php

示例3: testMultipleTranslators

 public function testMultipleTranslators()
 {
     // Looping through modules, so we can test the translation autoloading
     // Load non-exclusive to retain core class autoloading
     $classManifest = new SS_ClassManifest($this->alternateBasePath, true, true, false);
     SS_ClassLoader::instance()->pushManifest($classManifest);
     // Changed manifest, so we also need to unset all previously collected messages.
     // The easiest way to do this it to register a new adapter.
     $adapter = new Zend_Translate(array('adapter' => 'i18nRailsYamlAdapter', 'locale' => i18n::default_locale(), 'disableNotices' => true));
     i18n::register_translator($adapter, 'core');
     i18n::set_locale('en_US');
     $this->assertEquals(i18n::_t('i18nTestModule.ENTITY'), 'Entity with "Double Quotes"');
     $this->assertEquals(i18n::_t('AdapterEntity1', 'AdapterEntity1'), 'AdapterEntity1', 'Falls back to default string if not found');
     // Add a new translator
     $translator = new Zend_Translate(array('adapter' => 'i18nTest_CustomTranslatorAdapter', 'disableNotices' => true));
     i18n::register_translator($translator, 'custom', 11);
     $this->assertEquals(i18n::_t('i18nTestModule.ENTITY'), 'i18nTestModule.ENTITY CustomAdapter (en_US)', 'Existing entities overruled by adapter with higher priority');
     $this->assertEquals(i18n::_t('AdapterEntity1', 'AdapterEntity1'), 'AdapterEntity1 CustomAdapter (en_US)', 'New entities only defined in new adapter are detected');
     // Add a second new translator to test priorities
     $translator = new Zend_Translate(array('adapter' => 'i18nTest_OtherCustomTranslatorAdapter', 'disableNotices' => true));
     i18n::register_translator($translator, 'othercustom_lower_prio', 5);
     $this->assertEquals(i18n::_t('i18nTestModule.ENTITY'), 'i18nTestModule.ENTITY CustomAdapter (en_US)', 'Adapter with lower priority loses');
     // Add a third new translator to test priorities
     $translator = new Zend_Translate(array('adapter' => 'i18nTest_OtherCustomTranslatorAdapter', 'disableNotices' => true));
     i18n::register_translator($translator, 'othercustom_higher_prio', 15);
     $this->assertEquals(i18n::_t('i18nTestModule.ENTITY'), 'i18nTestModule.ENTITY OtherCustomAdapter (en_US)', 'Adapter with higher priority wins');
     i18n::unregister_translator('custom');
     i18n::unregister_translator('othercustom_lower_prio');
     i18n::unregister_translator('othercustom_higher_prio');
     SS_ClassLoader::instance()->popManifest();
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:31,代码来源:i18nTest.php


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