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


PHP Translation::forLocale方法代码示例

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


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

示例1: testCreateLocaleSettings

 public function testCreateLocaleSettings()
 {
     $settings = array('basedOn' => 'no', 'nested' => false);
     $result = $this->Translation->createLocale('da', $settings);
     $expected = Translation::forLocale('no', $settings);
     $this->assertSame($expected, $result);
 }
开发者ID:nodesagency,项目名称:Translations,代码行数:7,代码来源:TranslationTest.php

示例2: testCreateNotDefaultLanguage

 /**
  * testCreateNotDefaultLanguage
  *
  * If a record is created in a not-default language, it should still store
  * in the original field the translated value. While this isn't particularly
  * correct - it's better than the original translated field being blank in the
  * default language - and therefore in all other langauges.
  *
  * @return void
  */
 public function testCreateNotDefaultLanguage()
 {
     Configure::write('Config.defaultLanguage', 'en');
     Configure::write('Config.language', 'es');
     $this->Tag->create();
     $this->Tag->save(array('tag' => 'nuevo'));
     $expected = array(1 => 'tag1', 'tag2', 'tag3', 'nuevo');
     $this->Tag->Behaviors->disable('Translate');
     $result = $this->Tag->find('list');
     $this->assertSame($expected, $result);
     $this->Tag->Behaviors->enable('Translate');
     $result = $this->Tag->find('list');
     $this->assertSame($expected, $result);
     $expected = array('Tag.1.tag' => 'tag1', 'Tag.2.tag' => 'tag2', 'Tag.3.tag' => 'tag3', 'Tag.4.tag' => 'nuevo');
     $translations = Translation::forLocale('en', array('domain' => 'data', 'section' => 'Tag', 'nested' => false));
     ksort($translations);
     $this->assertSame($expected, $translations);
 }
开发者ID:nodesagency,项目名称:Translations,代码行数:28,代码来源:TranslateBehaviorTest.php


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