public function init() { parent::init(); $mobile_detect = new MobileDetect(); $this->is_mobile = $mobile_detect->isMobile(); $this->is_tablet = $mobile_detect->isTablet(); // Yii::$app->language = 'vi-VN'; $language = Language::getLanguage(); $language_data = $language->getLanguageData(); $currency_params = $language->getDefaultCurrencyParams(); I18n::setLanguageData($language_data); I18n::setCurrencyParams($currency_params); Yii::$app->session->set('language_id', $language->id); $this->meta_index = 'index'; $this->meta_follow = 'follow'; $this->page_title = I18n::t('{page title}'); $this->meta_title = I18n::t('{meta title}'); $this->meta_description = I18n::t('{meta description}'); $this->meta_keywords = I18n::t('{meta keywords}'); $this->meta_image = Yii::$app->params['default_image']; Yii::$app->session->has('cart') or Yii::$app->session->set('cart', new Cart()); }