From 3822a7bfb41a4792c414ecfb6eabd21b70eb9718 Mon Sep 17 00:00:00 2001 From: YuMao Date: Wed, 30 Oct 2024 14:34:57 +0800 Subject: [PATCH] chore: i18n code --- daemon/src/entity/commands/general/general_kill.ts | 2 +- daemon/src/entity/commands/pty/pty_start.ts | 2 +- daemon/src/entity/instance/instance.ts | 4 ++-- languages/en_US.json | 6 +++++- languages/zh_CN.json | 6 +++++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/daemon/src/entity/commands/general/general_kill.ts b/daemon/src/entity/commands/general/general_kill.ts index 29eadf93..bfe86e47 100755 --- a/daemon/src/entity/commands/general/general_kill.ts +++ b/daemon/src/entity/commands/general/general_kill.ts @@ -16,7 +16,7 @@ export default class GeneralKillCommand extends InstanceCommand { return instance.failure(new Error($t("TXT_CODE_general_stop.notRunning"))); } if (instance.startTimestamp + 6 * 1000 > Date.now()) { - return instance.failure(new Error($t("程序必须运行超过6秒才能被强制停止!"))); + return instance.failure(new Error($t("TXT_CODE_6259357c"))); } const task = instance?.asynchronousTask; diff --git a/daemon/src/entity/commands/pty/pty_start.ts b/daemon/src/entity/commands/pty/pty_start.ts index 71bd0ccf..546f2981 100755 --- a/daemon/src/entity/commands/pty/pty_start.ts +++ b/daemon/src/entity/commands/pty/pty_start.ts @@ -50,7 +50,7 @@ export class GoPtyProcessAdapter extends EventEmitter implements IInstanceProces private initNamedPipe() { if (!fs.existsSync(this.pipeName)) { throw new Error( - $t("程序启动失败,输入输出流不可读:{{pipeName}}", { + $t("TXT_CODE_9d1d244f", { pipeName: this.pipeName }) ); diff --git a/daemon/src/entity/instance/instance.ts b/daemon/src/entity/instance/instance.ts index 663d749b..5a1b4670 100755 --- a/daemon/src/entity/instance/instance.ts +++ b/daemon/src/entity/instance/instance.ts @@ -229,7 +229,7 @@ export default class Instance extends EventEmitter { setLock(bool: boolean) { if (this.lock === true && bool === true) { - throw new Error($t("实例有其他任务正在进行中,无法进行此操作!")); + throw new Error($t("TXT_CODE_ca030197")); } this.lock = bool; } @@ -306,7 +306,7 @@ export default class Instance extends EventEmitter { const currentTimestamp = new Date().getTime(); const startThreshold = 2 * 1000; if (currentTimestamp - this.startTimestamp < startThreshold) { - this.println("ERROR", $t("实例进程启动失败,请检查启动命令和运行环境等配置!")); + this.println("ERROR", $t("TXT_CODE_aae2918f")); } } diff --git a/languages/en_US.json b/languages/en_US.json index 240a480a..0dd98f51 100644 --- a/languages/en_US.json +++ b/languages/en_US.json @@ -1951,5 +1951,9 @@ "TXT_CODE_a6424dcc": "The working directory or startup command cannot be empty", "TXT_CODE_ffa884f9": "Warning: The working directory is not mounted to the container, and the container will not be able to access files in the instance's working directory", "TXT_CODE_6c232c9c": "Used to mount additional folders on the host into the container, supports two variable strings: {mcsm_workspace} (working directory) and {mcsm_instance_id} (instance ID).", - "TXT_CODE_fa487a47": "Provide the following variable strings: {mcsm_instance_id} = instance ID, {mcsm_workspace} = instance installation directory" + "TXT_CODE_fa487a47": "Provide the following variable strings: {mcsm_instance_id} = instance ID, {mcsm_workspace} = instance installation directory", + "TXT_CODE_6259357c": "The program must run for more than 6 seconds before it can be forced to stop!", + "TXT_CODE_9d1d244f": "Program startup failed, input and output streams are unreadable: {{pipeName}}", + "TXT_CODE_ca030197": "The instance has other tasks in progress, and this operation cannot be performed!", + "TXT_CODE_aae2918f": "The instance process failed to start, please check the startup command and operating environment configuration!" } diff --git a/languages/zh_CN.json b/languages/zh_CN.json index 8157c96d..edda61c2 100644 --- a/languages/zh_CN.json +++ b/languages/zh_CN.json @@ -1951,5 +1951,9 @@ "TXT_CODE_a6424dcc": "工作目录和启动命令不可为空", "TXT_CODE_ffa884f9": "警告:工作目录没有挂载到容器中,容器将无法访问到实例工作目录中的文件", "TXT_CODE_6c232c9c": "用于挂载主机上额外的文件夹到容器中,支持 {mcsm_workspace}(工作目录)和 {mcsm_instance_id}(实例ID)两个变量字符串。", - "TXT_CODE_fa487a47": "提供以下变量字符串:{mcsm_instance_id} = 实例ID,{mcsm_workspace} = 实例安装目录" + "TXT_CODE_fa487a47": "提供以下变量字符串:{mcsm_instance_id} = 实例ID,{mcsm_workspace} = 实例安装目录", + "TXT_CODE_6259357c": "程序必须运行超过6秒才能被强制停止!", + "TXT_CODE_9d1d244f": "程序启动失败,输入输出流不可读:{{pipeName}}", + "TXT_CODE_ca030197": "实例有其他任务正在进行中,无法进行此操作!", + "TXT_CODE_aae2918f": "实例进程启动失败,请检查启动命令和运行环境等配置!" }