Пример #1
0
 public function testCanTranslateWithOptions()
 {
     $trans = new Translator\Translator('arrayAdapter', array('one' => 'eins', "two %1\$s" => "zwei %1\$s", "three %1\$s %2\$s" => "drei %1\$s %2\$s"), 'de');
     $trans->addTranslation(array('one' => 'uno', "two %1\$s" => "duo %2\$s", "three %1\$s %2\$s" => "tre %1\$s %2\$s"), 'it');
     $trans->setLocale('de');
     $this->helper->setTranslator($trans);
     $this->assertEquals("drei 100 200", $this->helper->__invoke("three %1\$s %2\$s", "100", "200"));
     $this->assertEquals("tre 100 200", $this->helper->__invoke("three %1\$s %2\$s", "100", "200", 'it'));
     $this->assertEquals("drei 100 it", $this->helper->translate("three %1\$s %2\$s", "100", "it"));
     $this->assertEquals("drei 100 200", $this->helper->__invoke("three %1\$s %2\$s", array("100", "200")));
     $this->assertEquals("tre 100 200", $this->helper->__invoke("three %1\$s %2\$s", array("100", "200"), 'it'));
 }