예제 #1
0
 public function testCanSetLocale()
 {
     $trans = new Zend_Translate('array', array('one' => 'eins', 'two %1\\$s' => 'zwei %1\\$s'), 'de');
     $trans->addTranslation(array('one' => 'uno', 'two %1\\$s' => 'duo %2\\$s'), 'it');
     $this->helper->setTranslator($trans);
     $this->assertEquals('eins', $this->helper->translate('one'));
     $new = $this->helper->setLocale('it');
     $this->assertTrue($new instanceof Zend_View_Helper_Translate);
     $this->assertEquals('it', $new->getLocale());
     $this->assertEquals('uno', $this->helper->translate('one'));
 }
예제 #2
0
    public function testCanSetLocale()
    {
        $trans = new Translator\Translator('arrayAdapter', array('one' => 'eins', 'two %1\$s' => 'zwei %1\$s'), 'de');
        $trans->addTranslation(array('one' => 'uno', 'two %1\$s' => 'duo %2\$s'), 'it');
        $trans->setLocale('de');

        $this->helper->setTranslator($trans);
        $this->assertEquals('eins', $this->helper->direct('one'));
        $new = $this->helper->setLocale('it');
        $this->assertTrue($new instanceof Helper\Translate);
        $this->assertEquals('it', $new->getLocale());
        $this->assertEquals('uno', $this->helper->direct('one'));
    }