コード例 #1
0
ファイル: CsvTest.php プロジェクト: jon9872/zend-framework
 public function testTranslate()
 {
     $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_en.csv', 'en');
     $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1'));
     $this->assertEquals('Message 1 (en)', $adapter->_('Message 1'));
     $this->assertEquals('Message 5 (en)', $adapter->translate('Message 5'));
     $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_en2.csv', 'en', array('separator' => ','));
     $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1'));
     $this->assertEquals('Message 4 (en)', $adapter->translate('Message 4,'));
     $this->assertEquals('Message 5, (en)', $adapter->translate('Message 5'));
     $this->assertEquals('Message 6,addon (en)', $adapter->translate('Message 6,addon,'));
 }
コード例 #2
0
ファイル: CsvTest.php プロジェクト: netvlies/zf
 public function testSpecialChars()
 {
     $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_specialchars.csv', 'en');
     $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1'));
     $this->assertEquals('Message 1 (en)', $adapter->_('Message 1'));
     $this->assertEquals('Message 6;" (en)', $adapter->translate('Message 6'));
     $this->assertEquals('Message 7 (en)', $adapter->translate('Message ;" 7'));
 }