value). Both the name and value will be URL-encoded. * If the name is '#', the corresponding value will be treated as an anchor * and will be appended at the end of the URL. * @param string $ampersand the token separating name-value pairs in the URL. Defaults to '&'. * @return string the constructed URL */ public function createUrl($route, $params = array(), $ampersand = '&') { return parent::createUrl( $route, array_merge(array($this->langKey => Yii::app()->language), $params), $ampersand); } public function parseUrl($request) { $res = parent::parseUrl($request); // $app = Yii::app(); // // if (isset($_GET['lang'])) { // set language from `lang` param // if (count(array_intersect(array($_GET['lang']), Yii::app()->params['languages'])) == 0) // $app->request->redirect('/'); // $app->language = $_GET['lang']; // } else { // $_GET['lang'] = Yii::app()->language; // // todo: set language by request headers // // $al = $_SERVER["HTTP_ACCEPT_LANGUAGE"]; // } return $res; } }