/** * setActionController() * * @param Zend_Controller_Action $oActionController * @return Zend_Controller_ActionHelper_Abstract */ public function setActionController(Zend_Controller_Action $oActionController = null) { parent::setActionController($oActionController); $oActionController->view = $this; return $this; }
/** * setActionController() * * @param Zend_Controller_Action $oActionController * @return Zend_Controller_ActionHelper_Abstract */ public function setActionController(Zend_Controller_Action $oActionController = null) { static $bSmartyInitialized; foreach ($this->_aTranslationsPaths as $sName => $sPath) { $this->_aTranslationsPaths[$sName] = Volcano_Tools::fixPath($sPath); } $aProposedLocales = array(); if ($this->_sRequestParamName && ($sParam = $oActionController->getRequest()->getParam($this->_sRequestParamName))) { $aProposedLocales[] = $sParam; } $sCookieLocale = false; if ($this->_sCookieName && ($sCookieLocale = $oActionController->getRequest()->getCookie($this->_sCookieName))) { $aProposedLocales[] = $sCookieLocale; } $oLocalizer = new Volcano_Localizer($aProposedLocales, $this->_sTranslationAdapterName, $this->_aTranslationsPaths, $this->_bParseRequestHeaders); if ($sCookieLocale != $oLocalizer->getLocale()->getLanguage()) { setcookie($this->_sCookieName, $oLocalizer->getLocale()->getLanguage(), time() + 60 * 60 * 24 * 30, "/"); } parent::setActionController($oActionController); $oActionController->localizer = $oLocalizer; //add localizer to smarty if (Zend_Controller_Action_HelperBroker::hasHelper('Smarty') && !$bSmartyInitialized) { $oSmartyHelper = Zend_Controller_Action_HelperBroker::getExistingHelper('Smarty'); $oSmartyHelper->addCustomFunction('modifier', array($oLocalizer, 'translate'), 'translate'); $oSmartyHelper->locale = array('language' => $oLocalizer->getLocale()->getLanguage(), 'region' => $oLocalizer->getLocale()->getRegion()); $bSmartyInitialized = TRUE; } return $this; }