protected function _bootstrapTranslations() { $translationFiles = array('en' => ENGINEBLOCK_FOLDER_ROOT . 'languages/en.php', 'nl' => ENGINEBLOCK_FOLDER_ROOT . 'languages/nl.php'); $translationCacheProxy = new EngineBlock_Translate_CacheProxy($translationFiles, $this->_application->getDiContainer()->getApplicationCache()); $translate = $translationCacheProxy->load(); // If the URL has &lang=nl in it or the lang var is posted, or a lang cookie was set, then use that locale $httpRequest = $this->_application->getHttpRequest(); $cookieLang = $httpRequest->getCookie('lang'); $getLang = $httpRequest->getQueryParameter('lang'); $postLang = $httpRequest->getPostParameter('lang'); $lang = null; if ($getLang) { $lang = strtolower($getLang); } else { if ($postLang) { $lang = strtolower($postLang); } else { $lang = strtolower($cookieLang); } } $langCookieConfig = $this->_application->getConfigurationValue('cookie')->lang; $cookieDomain = $langCookieConfig->domain; $cookieExpiry = null; if (isset($langCookieConfig->expiry) && $langCookieConfig->expiry > 0) { $cookieExpiry = time() + $langCookieConfig->expiry; } if ($lang && $translate->getAdapter()->isAvailable($lang)) { $translate->setLocale($lang); $this->_application->getHttpResponse()->setCookie('lang', $lang, $cookieExpiry, '/', $cookieDomain); } else { $translate->setLocale('en'); $this->_application->getHttpResponse()->setCookie('lang', 'en', $cookieExpiry, '/', $cookieDomain); } $this->_application->setTranslator($translate); }