public function testLoadTranslationData()
 {
     $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/testmsg_en.mo', 'en');
     $this->assertEquals($adapter->translate('Message 1'), 'Message 1 (en)');
     $this->assertEquals($adapter->translate('Message 5'), 'Message 5');
     $this->assertEquals($adapter->translate('Message 2', 'ru'), 'Message 2');
     $adapter->addTranslation('ru', dirname(__FILE__) . '/_files/testmsg_ru(koi8-r).mo');
     $this->assertEquals($adapter->translate('Message 2', 'ru'), 'Сообщение 2 (ru)');
     $this->assertEquals($adapter->translate('Message 5'), 'Message 5');
     $this->assertEquals($adapter->translate('Message 5', 'ru'), 'Message 5');
 }
 public function testLoadTranslationData()
 {
     $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/testmsg_en.mo', 'en');
     $this->assertEquals($adapter->translate('Message 1'), 'Message 1 (en)');
     $this->assertEquals($adapter->translate('Message 5'), 'Message 5');
     $this->assertEquals($adapter->translate('Message 2', 'ru'), 'Message 2');
     $adapter->addTranslation(dirname(__FILE__) . '/_files/testmsg_ru(koi8-r).mo', 'ru');
     // unknown format KOI8-R, string has to be converted to UTF8 as this file is UTF8 and not KOI8-R
     //        $this->assertEquals($adapter->translate('Message 2', 'ru'), 'óÏÏÂÝÅÎÉÅ 2 (ru)');
     $this->assertEquals($adapter->translate('Message 5'), 'Message 5');
     $this->assertEquals($adapter->translate('Message 5', 'ru'), 'Message 5');
 }
 /**
  * @group ZF-9489
  */
 public function testAddingAdapterToSourceUsingOwnRule()
 {
     $translate = new Zend_Translate(Zend_Translate::AN_ARRAY, array('singular' => array('plural_0 (en)', 'plural_1 (en)', 'plural_2 (en)', 'plural_3 (en)'), 'plural' => ''), 'en');
     $this->assertFalse($translate->isTranslated('Message 1'));
     $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/Translate/Adapter/_files/translation_en.mo', 'en');
     $translate->addTranslation($adapter);
     $this->assertTrue($adapter->isTranslated('Message 1'));
     $adapter2 = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/Translate/Adapter/_files/testmo/de_AT/LC_TEST/translation-de_DE.mo', 'de_AT');
     $adapter2->addTranslation(dirname(__FILE__) . '/Translate/Adapter/_files/translation_en2.mo', 'fr');
     $translate->addTranslation($adapter2, 'fr');
     $languages = $translate->getList();
     $this->assertFalse(array_key_exists('de_AT', $languages));
     $this->assertTrue(array_key_exists('fr', $languages));
 }
 public function testBigEndian()
 {
     $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/translate_bigendian.mo', 'sr');
     $this->assertEquals($adapter->translate('Informacje'), 'Informacje');
 }
Beispiel #5
0
 /**
  * @group GH-66
  */
 public function testPluralToSingular()
 {
     $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/translation_plural_tr.mo', 'tr');
     $this->assertEquals('%d mesaj var', $adapter->plural('There is %d message', 'There are %d messages', 0));
     $this->assertEquals('%d mesaj var', $adapter->plural('There is %d message', 'There are %d messages', 1));
     $this->assertEquals('%d mesaj var', $adapter->plural('There is %d message', 'There are %d messages', 2));
 }
Beispiel #6
0
 public function testMissingAdapterInfo()
 {
     $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/failed3.mo', 'en');
     $this->assertContains('No adapter information available', current($adapter->getAdapterInfo()));
 }