Example #1
0
 public function testLocale()
 {
     $adapter = new Zend_Translate_Adapter_Qt(dirname(__FILE__) . '/_files/translation_de.ts', 'de');
     $this->assertEquals($adapter->getLocale(), 'de');
     $locale = new Zend_Locale('de');
     $adapter->setLocale($locale);
     $this->assertEquals($adapter->getLocale(), 'de');
     try {
         $adapter->setLocale('nolocale');
         $this->fail();
     } catch (Zend_Translate_Exception $e) {
         // success
     }
     try {
         $adapter->setLocale('en');
         $this->fail();
     } catch (Zend_Translate_Exception $e) {
         // success
     }
 }
Example #2
0
 public function testLocale()
 {
     $adapter = new Zend_Translate_Adapter_Qt(dirname(__FILE__) . '/_files/translation_en.ts', 'en');
     $this->assertEquals('en', $adapter->getLocale());
     $locale = new Zend_Locale('en');
     $adapter->setLocale($locale);
     $this->assertEquals('en', $adapter->getLocale());
     try {
         $adapter->setLocale('nolocale');
         $this->fail("exception expected");
     } catch (Zend_Translate_Exception $e) {
         $this->assertContains('does not exist', $e->getMessage());
     }
     set_error_handler(array($this, 'errorHandlerIgnore'));
     $adapter->setLocale('it');
     restore_error_handler();
     $this->assertEquals('it', $adapter->getLocale());
 }