From 1bc9e23ef9eefded37cf227204b6de80e51da589 Mon Sep 17 00:00:00 2001 From: a20070322 <1031839775@qq.com> Date: Fri, 14 Jun 2024 13:49:43 +0800 Subject: [PATCH] =?UTF-8?q?i18n:=20=E5=A2=9E=E5=8A=A0=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-vue/bin/i18n.cjs | 2 +- web-vue/package.json | 2 +- web-vue/src/api/config.ts | 10 +++++----- .../src/api/file-manager/release-task-log.ts | 2 +- web-vue/src/api/system/assets-docker.ts | 4 ++-- web-vue/src/api/system/assets-machine.ts | 10 +++++----- web-vue/src/api/system/assets-ssh.ts | 6 +++--- web-vue/src/i18n/index.ts | 3 +-- web-vue/src/i18n/locales/en_us.json | 18 ++++++++++++++++++ web-vue/src/i18n/locales/zh_cn.json | 19 ++++++++++++++++++- 10 files changed, 55 insertions(+), 21 deletions(-) diff --git a/web-vue/bin/i18n.cjs b/web-vue/bin/i18n.cjs index 3c6d25f9c..88cc07aa5 100644 --- a/web-vue/bin/i18n.cjs +++ b/web-vue/bin/i18n.cjs @@ -26,7 +26,7 @@ const main = async () => { const config = { projectPath: process.cwd(), globalPath: 'src', - includeDir: ['api'], + includeDir: ['api', 'components', 'pages', 'stores', 'utils'], exts: ['.vue', '.ts', '.js'], prettier: prettierrCconfig, lang: { diff --git a/web-vue/package.json b/web-vue/package.json index 5486bc0d7..ca2d71cc9 100644 --- a/web-vue/package.json +++ b/web-vue/package.json @@ -49,7 +49,7 @@ "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-vue": "^9.25.0", "https": "^1.0.0", - "jpom-i18n": "^1.0.8", + "jpom-i18n": "^1.0.9", "less": "^4.2.0", "prettier": "^3.2.5", "rollup-plugin-visualizer": "^5.12.0", diff --git a/web-vue/src/api/config.ts b/web-vue/src/api/config.ts index 9945d95e6..fc0724869 100644 --- a/web-vue/src/api/config.ts +++ b/web-vue/src/api/config.ts @@ -168,9 +168,9 @@ async function request(arg: string | AxiosRequestConfig, config?: Axios const options = typeof arg === 'string' ? { - url: arg, - ...config - } + url: arg, + ...config + } : arg const response = await instance.request>(options) const { data } = response @@ -296,7 +296,7 @@ function toLogin2(message: any, description: any) { }) setTimeout(() => { - ; (location.href as any) = pageUrl.href + ;(location.href as any) = pageUrl.href }, 2000) }) return false @@ -322,7 +322,7 @@ function toLoginOnly(message: any, description: any) { }) setTimeout(() => { - ; (location.href as any) = pageUrl.href + ;(location.href as any) = pageUrl.href }, 2000) }) return false diff --git a/web-vue/src/api/file-manager/release-task-log.ts b/web-vue/src/api/file-manager/release-task-log.ts index 053af2530..c99fd5ccd 100644 --- a/web-vue/src/api/file-manager/release-task-log.ts +++ b/web-vue/src/api/file-manager/release-task-log.ts @@ -86,5 +86,5 @@ export const statusMap = { export const taskTypeMap = { 0: 'SSH', - 1: '节点' + 1: t('api.file-manager.release-task-log.e076d90b') } diff --git a/web-vue/src/api/system/assets-docker.ts b/web-vue/src/api/system/assets-docker.ts index 5d1f7a6f8..2f8c2487c 100644 --- a/web-vue/src/api/system/assets-docker.ts +++ b/web-vue/src/api/system/assets-docker.ts @@ -146,6 +146,6 @@ export function dockerListWorkspace(params) { } export const statusMap = { - 0: { desc: '无法连接', color: 'red' }, - 1: { desc: '正常连接', color: 'green' } + 0: { desc: t('api.system.assets-docker.b26020d2'), color: 'red' }, + 1: { desc: t('api.system.assets-docker.591ff086'), color: 'green' } } diff --git a/web-vue/src/api/system/assets-machine.ts b/web-vue/src/api/system/assets-machine.ts index 619d9ead4..fce4dd853 100644 --- a/web-vue/src/api/system/assets-machine.ts +++ b/web-vue/src/api/system/assets-machine.ts @@ -56,11 +56,11 @@ export function machineDistribute(params) { } export const statusMap = { - 0: '无法连接', - 1: '正常', - 2: '授权信息错误', - 3: '状态码错误', - 4: '资源监控异常' + 0: t('api.system.assets-machine.b26020d2'), + 1: t('api.system.assets-machine.e039b9b5'), + 2: t('api.system.assets-machine.2eff6016'), + 3: t('api.system.assets-machine.8ae7a8a'), + 4: t('api.system.assets-machine.f1e810b2') } // 查看机器关联节点 diff --git a/web-vue/src/api/system/assets-ssh.ts b/web-vue/src/api/system/assets-ssh.ts index d2cbd358e..fb9465b45 100644 --- a/web-vue/src/api/system/assets-ssh.ts +++ b/web-vue/src/api/system/assets-ssh.ts @@ -124,7 +124,7 @@ export function importData(formData) { } export const statusMap = { - 0: { desc: '无法连接', color: 'red' }, - 1: { desc: '正常', color: 'green' }, - 2: { desc: '禁用监控', color: 'orange' } + 0: { desc: t('api.system.assets-ssh.b26020d2'), color: 'red' }, + 1: { desc: t('api.system.assets-ssh.e039b9b5'), color: 'green' }, + 2: { desc: t('api.system.assets-ssh.3eb8617a'), color: 'orange' } } diff --git a/web-vue/src/i18n/index.ts b/web-vue/src/i18n/index.ts index 5b084a2e6..3bc4d0365 100644 --- a/web-vue/src/i18n/index.ts +++ b/web-vue/src/i18n/index.ts @@ -56,7 +56,7 @@ export const lang: { [key: string]: any } = { } } -const i18n = createI18n({ +const i18n = createI18n({ legacy: false, locale: 'zh-cn', //'en-us', // 默认显示语言 messages: Object.keys(lang).reduce((pre: { [key: string]: any }, key: string) => { @@ -68,5 +68,4 @@ const i18n = createI18n({ export default i18n -// @ts-ignore 兼容i8n_tools插件 export const { t } = i18n.global diff --git a/web-vue/src/i18n/locales/en_us.json b/web-vue/src/i18n/locales/en_us.json index 1857da025..c6f24a083 100644 --- a/web-vue/src/i18n/locales/en_us.json +++ b/web-vue/src/i18n/locales/en_us.json @@ -4838,6 +4838,24 @@ "227abc8e": "Account disabled", "521c4ec2": "Login successful, MFA verification required" } + }, + "system": { + "assets-docker": { + "b26020d2": "cannot connect", + "591ff086": "Normal connection" + }, + "assets-machine": { + "b26020d2": "cannot connect", + "e039b9b5": "normal", + "2eff6016": "Authorization information error", + "8ae7a8a": "Status code error", + "f1e810b2": "Resource monitoring exception" + }, + "assets-ssh": { + "b26020d2": "cannot connect", + "e039b9b5": "normal", + "3eb8617a": "Disable monitoring" + } } } } diff --git a/web-vue/src/i18n/locales/zh_cn.json b/web-vue/src/i18n/locales/zh_cn.json index 08f65c5b3..f25793fa0 100644 --- a/web-vue/src/i18n/locales/zh_cn.json +++ b/web-vue/src/i18n/locales/zh_cn.json @@ -4829,7 +4829,24 @@ "44701ced": "触发器", "a1e86c58": "构建事件" }, - "system": {}, + "system": { + "assets-docker": { + "b26020d2": "无法连接", + "591ff086": "正常连接" + }, + "assets-machine": { + "b26020d2": "无法连接", + "e039b9b5": "正常", + "2eff6016": "授权信息错误", + "8ae7a8a": "状态码错误", + "f1e810b2": "资源监控异常" + }, + "assets-ssh": { + "b26020d2": "无法连接", + "e039b9b5": "正常", + "3eb8617a": "禁用监控" + } + }, "user": { "user-login-log": { "a1d02c3e": "正常登录",