Esempio n. 1
0
 /**
  * Tests getting plurals from lowered locale
  */
 public function testGettingPluralsUsingOwnRule()
 {
     $lang = new Translator\Translator(Translator\Translator::AN_ARRAY, array('singular' => array('plural_0 (en)', 'plural_1 (en)', 'plural_2 (en)', 'plural_3 (en)'), 'plural' => ''), 'en');
     $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'en_US');
     $lang->setLocale('en_US');
     Translator\Plural::setPlural(array($this, 'customPlural'), 'en_US');
     $this->assertEquals('plural_1 (en)', $lang->translate(array('singular', 'plural', 1)));
     $this->assertEquals('plural_1 (en)', $lang->plural('singular', 'plural', 1));
     $this->assertEquals('plural_1 (en)', $lang->translate(array('singular', 'plural', 0)));
     $this->assertEquals('plural_1 (en)', $lang->plural('singular', 'plural', 0));
 }