Feature: multi language (VI, EN, JA)

CR: sonh (fake)
This commit is contained in:
2021-08-23 15:19:49 +07:00
parent 7057e5b35c
commit eb88996797
37 changed files with 788 additions and 327 deletions

View File

@@ -14,9 +14,9 @@ class ConfigController extends Controller {
public function init() {
parent::init();
if (Yii::$app->user->isGuest) {
Yii::$app->language = Yii::$app->session->get("language") ? Yii::$app->session->get("language")["name"] : "vi-VI";
if (Yii::$app->user->isGuest)
return $this->redirect(['/site/login']);
}
}
/**
@@ -157,12 +157,8 @@ class ConfigController extends Controller {
]
];
/**
* Lists all Script models.
* @return mixed
*/
public function actionIndex() {
$this->view->title = "Cấu hình máy chủ";
$this->view->title = Yii::t("app", "CAU_HINH_MAY_CHU");
$options = [
'http' => [
'header' => "Content-Type: application/json",
@@ -262,7 +258,7 @@ class ConfigController extends Controller {
]));
return true;
} else {
$this->view->title = "Cấu hình nhận diện";
$this->view->title = Yii::t("app", "CAU_HINH_NHAN_DIEN");
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
'http' => [
'header' => "Content-Type: application/json",
@@ -368,7 +364,7 @@ class ConfigController extends Controller {
} else {
Yii::$app->response->format = "json";
return [
"title" => "Reset thiết bị",
"title" => Yii::t("app", "RESET_THIET_BI"),
"form" => $this->renderPartial("reset")
];
}
@@ -387,7 +383,7 @@ class ConfigController extends Controller {
return ['status' => false, 'text' => 'error'];
if ($tempConfig['data'] === "")
return ['status' => false, 'text' => 'Cấu hình ip chưa đúng!'];
return ['status' => false, 'text' => Yii::t("app", "CAU_HINH_IP_CHUA_DUNG")];
$engineConfig = json_decode($tempConfig['data'], true);
if (count($engineConfig['data']['engines']) == 0)
@@ -412,7 +408,7 @@ class ConfigController extends Controller {
}
public function actionCauHinhThietBi() {
$this->view->title = "Cấu hình thiết bị";
$this->view->title = Yii::t("app", "CAU_HINH_THIET_BI");
return $this->render('device', [
"server_api" => \app\models\SyncUrl::findOne(['key_config' => 'server_api']),
"device_id" => \app\models\SyncUrl::findOne(['key_config' => 'device_id'])