/** Extract language code from uri @param $uri object @private **/ private static function _parseLanguageOption(&$uri) { $elems = explode('/', $uri->_url); if ($elems) { // get language packs $lang_codes = I18N::getList(); if (in_array($elems[0], array_keys($lang_codes))) { Request::setVar('language', $elems[0]); // add to session Request::setVar('language', $elems[0], 'SESSION'); // omit lang code from url $uri->_raw = str_replace("/{$elems[0]}", '', $uri->_raw); $uri->_url = str_replace("{$elems[0]}/", '', $uri->_url); } } }