public function testLoadTranslationData() { $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/XmlTm_test_en.xml', 'en'); $this->assertEquals('Message 1', $adapter->translate('Message 1')); $this->assertEquals('Message 5', $adapter->translate('Message 5')); $this->assertEquals('Message 2', $adapter->translate('Message 2', 'ru' )); $this->assertEquals('Message 1', $adapter->translate('Message 1', 'xx' )); $this->assertEquals('Message 1', $adapter->translate('Message 1', 'en_US')); try { $adapter->addTranslation(dirname(__FILE__) . '/_files/XmlTm_test_en.xml', 'xx'); $this->fail("exception expected"); } catch (Zend_Translate_Exception $e) { // success } $adapter->addTranslation(dirname(__FILE__) . '/_files/XmlTm_test_de.xml', 'de', array('clear' => true)); $this->assertEquals('Message 1', $adapter->translate('Message 1')); $this->assertEquals('Message 8', $adapter->translate('Message 8')); }
public function testWithoutEncoding() { $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/translation_withoutencoding.xmltm', 'en'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Küchen Möbel (en)', $adapter->translate('Cooking furniture')); $this->assertEquals('Cooking furniture (en)', $adapter->translate('Küchen Möbel')); }
public function testIsoEncoding() { $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/XmlTm_test_en2.xml', 'en'); $this->assertEquals('Message 1 (en)', $adapter->translate('Mess1')); $this->assertEquals('Message 1 (en)', $adapter->_('Mess1')); $this->assertEquals(iconv('UTF-8', 'ISO-8859-1', 'Küchen Möbel (en)'), $adapter->translate('Cooking Furniture')); $this->assertEquals('Cooking Furniture (en)', $adapter->translate(iconv('UTF-8', 'ISO-8859-1', 'Küchen Möbel'))); }