Esempio n. 1
0
 protected function _initTranslate()
 {
     $config = new Zend_Config_Ini(APPLICATION_PATH . "/configs/gasestema.ini");
     $resource = new Zend_Application_Resource_Translate(array('adapter' => 'gettext', 'locale' => $config->locale, 'data' => APPLICATION_PATH . "/translations/{$config->locale}.mo", 'options' => array('disableNotices' => true)));
     $resource->setBootstrap($this);
     return $resource->init();
 }
Esempio n. 2
0
 /**
  * @group GH-103
  */
 public function testLogFactory()
 {
     $options = $this->_translationOptions;
     $options['log'][0] = new Zend_Log_Writer_Mock();
     $options['logUntranslated'] = true;
     $options['locale'] = 'en';
     $resource = new Zend_Application_Resource_Translate($options);
     $resource->setBootstrap($this->bootstrap);
     $resource->init()->translate('untranslated');
     $event = current($options['log'][0]->events);
     $this->assertTrue(is_array($event));
     $this->assertTrue(array_key_exists('message', $event));
     $this->assertEquals("Untranslated message within 'en': untranslated", $event['message']);
 }
Esempio n. 3
0
 /**
  * @group ZF-10034
  */
 public function testSetCacheFromCacheManager()
 {
     $configCache = array('translate' => array('frontend' => array('name' => 'Core', 'options' => array('lifetime' => 120, 'automatic_serialization' => true)), 'backend' => array('name' => 'Black Hole')));
     $this->bootstrap->registerPluginResource('cachemanager', $configCache);
     $options = $this->_translationOptions;
     $options['cache'] = 'translate';
     $resource = new Zend_Application_Resource_Translate($options);
     $resource->setBootstrap($this->bootstrap);
     $resource->init();
     $this->assertType('Zend_Cache_Core', Zend_Translate::getCache());
     Zend_Translate::removeCache();
 }
Esempio n. 4
0
 public function testOptionsPassedToResourceAreUsedToSetLocaleState()
 {
     $resource = new Zend_Application_Resource_Translate($this->_translationOptions);
     $resource->setBootstrap($this->bootstrap);
     $resource->init();
     $translate = $resource->getTranslate();
     $this->assertTrue(Zend_Registry::isRegistered('Zend_Translate'));
     $this->assertSame(Zend_Registry::get('Zend_Translate'), $translate);
 }