public function parseRequest($request)
    {
        if (count($this->availableLanguages) > 0) {
            if (preg_match('/\/(' . implode('|', $this->availableLanguages) . ')(.*)/si', $request->url, $matches)) {
                Yii::$app->language = $matches[1];
            }
        }

        $res = parent::parseRequest($request);
        if (is_array($res)) {
            if (isset($res[1]['language']) && in_array($res[1]['language'], $this->availableLanguages)) {
                Yii::$app->language = $res[1]['language'];
            }
        }
        return $res;
    }
public function parseRequest($request)
    {
        if (count($this->availableLanguages) > 0) {
            if (preg_match('/\/(' . implode('|', $this->availableLanguages) . ')(.*)/si', $request->url, $matches)) {
                Yii::$app->language = $matches[1];
            }
        }

        $res = parent::parseRequest($request);
        if (is_array($res)) {
            if (isset($res[1]['language']) && in_array($res[1]['language'], $this->availableLanguages)) {
                Yii::$app->language = $res[1]['language'];
            }
        }
        return $res;
    }
public function parseRequest ( $ request ) { if ( count ( $ this -> availableLanguages ) > 0 ) { if ( preg_match ( '/\/(' . implode ( '|' , $ this -> availableLanguages ) . ')(.*)/si' , $ request -> url , $ matches ) ) { Yii :: $ app -> language = $ matches [ 1 ] ; } } $ res = parent :: parseRequest ( $ request ) ; if ( is_array ( $ res ) ) { if ( isset ( $ res [ 1 ] [ 'language' ] ) && in_array ( $ res [ 1 ] [ 'language' ] , $ this -> availableLanguages ) ) { Yii :: $ app -> language = $ res [ 1 ] [ 'language' ] ; } } return $ res ; }
Parse request and set application language
@param \yii\web\Request $request
@return array|bool
Parse request and set application language