public function init() { $controller = $this->getActionController(); if (!($requestedLocale = $controller->getRequest()->getParam('language', false))) { $local = new Zend_Locale(); $requestedLocale = $local->getLanguage(); } if (is_array($requestedLocale)) { $requestedLocale = current($requestedLocale); } $requestedLocale = strtolower($requestedLocale); try { Centurion_Db::getSingleton('translation/language')->get(array('locale' => $requestedLocale)); } catch (Centurion_Db_Table_Row_Exception_DoesNotExist $e) { $requestedLocale = Translation_Traits_Common::getDefaultLanguage(); $requestedLocale = $requestedLocale->locale; } Zend_Registry::get('Zend_Translate')->setLocale($requestedLocale); Zend_Locale::setDefault($requestedLocale); Zend_Registry::set('Zend_Locale', $requestedLocale); $options = Centurion_Db_Table_Abstract::getDefaultFrontendOptions(); if (!isset($options['cache_id_prefix'])) { $options['cache_id_prefix'] = ''; } $options['cache_id_prefix'] = $requestedLocale . '_' . $options['cache_id_prefix']; Centurion_Db_Table_Abstract::setDefaultFrontendOptions($options); //TODO: fix this when in test unit environment if (!APPLICATION_ENV === 'testing') { $this->getActionController()->getFrontController()->getParam('bootstrap')->getResource('cachemanager')->addIdPrefix($requestedLocale . '_'); } if (Centurion_Config_Manager::get('translation.global_param')) { $this->getFrontController()->getRouter()->setGlobalParam('language', $requestedLocale); } }
protected function _initDb() { try { Zend_Db_Table_Abstract::setDefaultAdapter($this->getPluginResource('db')->getDbAdapter()); Zend_Db_Table_Abstract::setDefaultMetadataCache($this->_getCache('core')); Centurion_Db_Table_Abstract::setDefaultBackendOptions(Centurion_Config_Manager::get('resources.cachemanager.class.backend.options')); Centurion_Db_Table_Abstract::setDefaultFrontendOptions(Centurion_Config_Manager::get('resources.cachemanager.class.frontend.options')); } catch (Exception $e) { exit($e->getMessage()); } }