/**
  * Strategy pattern: Initialize the configuration.
  *
  * Change the title web page according the configuration pararmeters
  *
  * See {@link \Zend_View}
  * See {@link \Zend_View_Helper_HeadTitle}
  *
  * @param \Zend_Controller_Request_Abstract $request
  */
 public function init(\Zend_Controller_Request_Abstract $request)
 {
     $this->_headTitle = $this->_getView()->headTitle($this->_options['title'], $this->_type);
     $this->_headTitle->setSeparator($this->_separator);
     if ($this->_translate) {
         $this->_headTitle->enableTranslation();
     } else {
         $this->_headTitle->disableTranslation();
     }
 }
 public function getHeadTitle()
 {
     if ($this->_headTitle === null) {
         parent::init();
         $options = $this->getOptions();
         $this->_headTitle = $this->_getView()->headTitle($options['title'], $this->_type);
         $this->_headTitle->setSeparator($this->_separator);
         if ($this->_translate) {
             $this->_headTitle->enableTranslation();
         } else {
             $this->_headTitle->disableTranslation();
         }
     }
     return $this->_headTitle;
 }
예제 #3
0
 public function testCanTranslateTitle()
 {
     $adapter = new \Zend\Translator\Adapter\Ini(dirname(__FILE__) . '/../../Translator/Adapter/_files/translation_en.ini', 'en');
     \Zend\Registry::set('Zend_Translate', $adapter);
     $this->helper->enableTranslation();
     $this->helper->direct('Message_1');
     $this->assertEquals('<title>Message 1 (en)</title>', $this->helper->toString());
 }
예제 #4
0
 public function testCanTranslateTitle()
 {
     require_once 'Zend/Translate/Adapter/Ini.php';
     require_once 'Zend/Registry.php';
     $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/../../Translate/Adapter/_files/translation_en.ini', 'en');
     Zend_Registry::set('Zend_Translate', $adapter);
     $this->helper->enableTranslation();
     $this->helper->headTitle('Message_1');
     $this->assertEquals('<title>Message 1 (en)</title>', $this->helper->toString());
 }
예제 #5
0
 public function testCanTranslateTitle()
 {
     $loader = new TestAsset\ArrayTranslator();
     $loader->translations = array('Message_1' => 'Message 1 (en)');
     $translator = new Translator();
     $translator->getPluginManager()->setService('default', $loader);
     $translator->addTranslationFile('default', null);
     $this->helper->enableTranslation();
     $this->helper->setTranslator($translator);
     $this->helper->__invoke('Message_1');
     $this->assertEquals('<title>Message 1 (en)</title>', $this->helper->toString());
 }