Components/MultilangRequest.php
protected function getCurrentLang(){
        if(!Yii::$app->user->isGuest && !empty(Yii::$app->user->identity->lang)) {
            $lang = Yii::$app->user->identity->lang;
        } else if(Yii::$app->session->get('lang')) {
            $lang = Yii::$app->session->get('lang');
        } else {
            $lang = Yii::$app->getRequest()->getPreferredLanguage();
        }
        
        return $lang;
    }
protected function getCurrentLang(){
        if(!Yii::$app->user->isGuest && !empty(Yii::$app->user->identity->lang)) {
            $lang = Yii::$app->user->identity->lang;
        } else if(Yii::$app->session->get('lang')) {
            $lang = Yii::$app->session->get('lang');
        } else {
            $lang = Yii::$app->getRequest()->getPreferredLanguage();
        }
        
        return $lang;
    }
protected function getCurrentLang ( ) { if ( ! Yii :: $ app -> user -> isGuest && ! empty ( Yii :: $ app -> user -> identity -> lang ) ) { $ lang = Yii :: $ app -> user -> identity -> lang ; } else if ( Yii :: $ app -> session -> get ( 'lang' ) ) { $ lang = Yii :: $ app -> session -> get ( 'lang' ) ; } else { $ lang = Yii :: $ app -> getRequest ( ) -> getPreferredLanguage ( ) ; } return $ lang ; }
Get current language
If user is logged in gets its language
Otherwise from session
Otherwise from request
@return string
Get current language If user is logged in gets its language Otherwise from session Otherwise from request