code: protected function initLanguages()
      {
          if (!Yii::$app->user->isGuest) {
              Yii::$app->language = Yii::$app->user->identity->lang;
          }
  
          if (!isset(Yii::$app->wavecms))
              throw new InvalidConfigException(Yii::t('wavecms/main', 'Component "wavecms" not defined in config.php'));
  
          if (!count(Yii::$app->wavecms->languages))
              throw new InvalidConfigException(Yii::t('wavecms/main', 'Property "languages" is not defined in config file for component "wavecms"'));
  
          if (!Yii::$app->session->get('editedLanguage')) {
              Yii::$app->session->set('editedLanguage', Yii::$app->wavecms->languages[0]);
          }
  
          Yii::$app->wavecms->editedLanguage = Yii::$app->session->get('editedLanguage');
      }
docs: Init wavecms languages
  @param $module
  @throws \yii\base\InvalidConfigException