From 9ce96d75f9abe0fa646edec686c27f048ea01620 Mon Sep 17 00:00:00 2001 From: yaojn Date: Fri, 15 Aug 2025 14:14:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?-=20[=E5=8A=9F=E8=83=BD]=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=8C=89=E6=A8=A1=E5=9D=97=E6=8A=BD=E7=A6=BB?= =?UTF-8?q?=20=20=20=20-=20[=E5=85=B3=E8=81=94]#[1487772764831744]?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E6=96=87=E4=BB=B6=E6=8C=89=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=8A=BD=E7=A6=BB=20http://192.168.0.96:8090/demo/rdm.html#/st?= =?UTF-8?q?ory-detail/939050947543040/939050947543042/1487772764831744?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/assets/languages/en.js | 68 ++++++++++++++++-- src/resources/assets/languages/router/en.json | 6 -- src/resources/assets/languages/router/zh.json | 6 -- src/resources/assets/languages/term/en.json | 44 ++---------- src/resources/assets/languages/term/zh.json | 44 ++---------- src/resources/assets/languages/zh.js | 69 +++++++++++++++++-- 6 files changed, 137 insertions(+), 100 deletions(-) diff --git a/src/resources/assets/languages/en.js b/src/resources/assets/languages/en.js index b243e027..265f4fde 100644 --- a/src/resources/assets/languages/en.js +++ b/src/resources/assets/languages/en.js @@ -5,11 +5,65 @@ import message from '@/resources/assets/languages/message/en.json'; import router from '@/resources/assets/languages/router/en.json'; import term from '@/resources/assets/languages/term/en.json'; +let languagesCategoryConfig = { + page: page, + form: form, + dialog: dialog, + message: message, + router: router, + term: term +}; +try { + // 导入定制模块多语言 + let languagesConfig = require.context('@/community-module', true, /en.json$/); + languagesConfig.keys().forEach(languagePath => { + if (languagePath) { + handleLanguageConfig(languagesConfig, languagePath); + } + }); + languagesConfig = require.context('@/commercial-module', true, /en.json$/); + languagesConfig.keys().forEach(languagePath => { + if (languagePath) { + handleLanguageConfig(languagesConfig, languagePath); + } + }); + function getCategoryName(path) { + const langIndex = path.indexOf('languages/'); + if (langIndex === -1) return null; + const jsonIndex = path.indexOf('/en.json', langIndex); + if (jsonIndex === -1) return null; + return path.substring(langIndex + 10, jsonIndex); + } + function handleLanguageConfig(languagesConfig, languagePath) { + const pathParts = languagePath.split('/'); + const moduleName = pathParts[1]?.split('-')?.pop() ?? pathParts[1]; + const category = getCategoryName(languagePath); + const languageJson = languagesConfig(languagePath) ?? {}; + + // 确保类别存在 + if (!languagesCategoryConfig[category]) { + languagesCategoryConfig[category] = {}; + } + + let targetCategory = languagesCategoryConfig[category]; + const childCategoryList = Object.keys(targetCategory) || []; + if (targetCategory[moduleName]) { + // 合并现有配置和新配置 + targetCategory[moduleName] = { ...targetCategory[moduleName], ...languageJson }; + } else { + // 创建新模块配置 + if (childCategoryList && childCategoryList.length > 0) { + // 如果存在子类别,将新模块配置添加到子类别中 + targetCategory[moduleName] = languageJson; + } else { + // 如果不存在子类别,将新模块配置添加到根类别中 + languagesCategoryConfig[category] = languageJson; + } + } + } +} catch (error) { + console.error('zh.json抛出异常', error); +} export default { - page, - form, - dialog, - message, - router, - term -} \ No newline at end of file + ...languagesCategoryConfig +}; diff --git a/src/resources/assets/languages/router/en.json b/src/resources/assets/languages/router/en.json index 9e4a22ac..006eb5cb 100644 --- a/src/resources/assets/languages/router/en.json +++ b/src/resources/assets/languages/router/en.json @@ -297,12 +297,6 @@ "documentsearch": "Document Search", "directorymanage": "Document directory management" }, - "dr": { - "dr": "Disaster cutting", - "basicsetting": "Basic Settings", - "servicemanage": "service list", - "servicedetail": "Service List Details" - }, "diagram": { "diagrammanage": "System Management", "catalogmanage": "Catalog Management", diff --git a/src/resources/assets/languages/router/zh.json b/src/resources/assets/languages/router/zh.json index c3b0f5a2..7ec4d0ef 100644 --- a/src/resources/assets/languages/router/zh.json +++ b/src/resources/assets/languages/router/zh.json @@ -297,12 +297,6 @@ "documentsearch": "文档搜索", "directorymanage": "文档目录管理" }, - "dr": { - "dr": "灾切", - "basicsetting": "基础设置", - "servicemanage": "服务清单", - "servicedetail": "服务清单详情" - }, "diagram": { "diagrammanage": "系统管理", "catalogmanage": "目录管理", diff --git a/src/resources/assets/languages/term/en.json b/src/resources/assets/languages/term/en.json index 69187154..c44ad5c1 100644 --- a/src/resources/assets/languages/term/en.json +++ b/src/resources/assets/languages/term/en.json @@ -2734,41 +2734,6 @@ "representmenupage": "Represent menu page", "representsubpages": "Represent Subpages" }, - "dr": { - "assetconfig": "Asset allocation", - "scenarioconfig": "Scenario configuration", - "centername": "Center Name", - "basicservices": "Basic services", - "associationmodel": "Association model", - "network": "network", - "migrationdirection": "Migration direction", - "datareferencetip": "The current data is referenced by the scene and cannot be deleted", - "organizationalstructure": "organizational structure", - "affiliatedorganization": "Affiliated organization", - "currentoranghaschildnodelete": "The current organizational structure has child levels that cannot be deleted", - "currentorangbindusernodelete": "The current organizational structure is bound to a user and cannot be deleted", - "selectatleastmodel": "Select at least one model", - "applicationtypename": "Application Type", - "org": "Recovery institutions", - "fileconfigpath": "Configuration file path", - "datacenterrel": "Associate Data Centers", - "selectdatacenter": "Select at least two data centers", - "publicapplication": "public service", - "combopname": "Automated orchestration", - "dependency": "rely on", - "dependencyservice": "dependent service", - "scencedependency": "Scenario Dependency", - "servicedependency": "Service Dependency", - "scenarioplan": "Scenario Plan", - "relyonmyservices": "Rely on my services", - "servicerelyon": "The service I rely on", - "dependentapp": "Dependent applications", - "preparation": "reserve plan", - "exerciseplan": "Exercise plan", - "dependencyscene": "Dependent scenarios", - "sourcedatacenter": "Source Data Center", - "targetdatacenter": "Target Data Center" - }, "diagram": { "widgetlist": "Element List", "widget": "Element", @@ -2848,7 +2813,9 @@ "fromrel": "Upstream relationship", "rel": "Related relationships", "reltypeconfig": "Connection type configuration", - "edgetype": "line segment" + "edgetype": "line segment", + "associationmodel": "Association model", + "preparation": "reserve plan" }, "license": { "isbanmodule": "Disable module upon expiration", @@ -2884,5 +2851,8 @@ }, "runnergroup": { "ruletips": "The request for login authentication needs to carry a header as a rule expression (note that the header parameter in the expression is all lowercase). If the value of the expression after execution is true, the executor group will take effect, and false and syntax exceptions will not take effect. For example: ${env}==\\ bit \\&&(${test}==\\ 1 \\ | | ${test2}==\\ aaa \\)" + }, + "common": { + "preparation": "reserve plan" } -} \ No newline at end of file +} diff --git a/src/resources/assets/languages/term/zh.json b/src/resources/assets/languages/term/zh.json index d04b9b89..344527b1 100644 --- a/src/resources/assets/languages/term/zh.json +++ b/src/resources/assets/languages/term/zh.json @@ -2733,41 +2733,6 @@ "representmenupage": "表示菜单页面", "representsubpages": "表示子页面" }, - "dr": { - "assetconfig": "资产配置", - "scenarioconfig": "场景配置", - "centername": "中心名称", - "basicservices": "基础服务", - "associationmodel": "关联模型", - "network": "网络", - "migrationdirection": "迁移方向", - "datareferencetip": "当前数据被场景引用,无法删除", - "organizationalstructure": "组织架构", - "affiliatedorganization": "所属组织", - "currentoranghaschildnodelete": "当前组织架构已有子级不可删除", - "currentorangbindusernodelete": "当前组织架构已绑定用户不可删除", - "selectatleastmodel": "至少选择一个模型", - "applicationtypename": "应用类型", - "org": "恢复机构", - "fileconfigpath": "配置文件路径", - "datacenterrel": "关联数据中心", - "selectdatacenter": "至少选择两个数据中心", - "publicapplication": "公共服务", - "combopname": "自动化编排", - "dependency": "依赖", - "dependencyservice": "依赖服务", - "scencedependency": "场景依赖", - "servicedependency": "服务依赖", - "scenarioplan": "场景预案", - "relyonmyservices": "依赖我的服务", - "servicerelyon": "我依赖的服务", - "dependentapp": "依赖应用", - "preparation": "预案", - "exerciseplan": "演练计划", - "dependencyscene": "依赖场景", - "sourcedatacenter": "来源数据中心", - "targetdatacenter": "目标数据中心" - }, "diagram": { "widgetlist": "图元列表", "widget": "图元", @@ -2848,7 +2813,9 @@ "fromrel": "上游关系", "rel": "关联关系", "reltypeconfig": "连线类型配置", - "edgetype": "线段" + "edgetype": "线段", + "associationmodel": "关联模型", + "preparation": "预案" }, "license": { "isbanmodule": "到期禁用模块", @@ -2881,5 +2848,8 @@ "joinalert": "归并到告警", "uniquekey": "唯一键", "alertsign": "告警特征" + }, + "common": { + "preparation": "预案" } -} \ No newline at end of file +} diff --git a/src/resources/assets/languages/zh.js b/src/resources/assets/languages/zh.js index b07e9643..b0d78dc2 100644 --- a/src/resources/assets/languages/zh.js +++ b/src/resources/assets/languages/zh.js @@ -4,11 +4,66 @@ import dialog from '@/resources/assets/languages/dialog/zh.json'; import message from '@/resources/assets/languages/message/zh.json'; import router from '@/resources/assets/languages/router/zh.json'; import term from '@/resources/assets/languages/term/zh.json'; +let languagesCategoryConfig = { + page: page, + form: form, + dialog: dialog, + message: message, + router: router, + term: term +}; +try { + // 导入定制模块多语言 + let languagesConfig = require.context('@/community-module', true, /zh.json$/); + languagesConfig.keys().forEach(languagePath => { + if (languagePath) { + handleLanguageConfig(languagesConfig, languagePath); + } + }); + languagesConfig = require.context('@/commercial-module', true, /zh.json$/); + languagesConfig.keys().forEach(languagePath => { + if (languagePath) { + handleLanguageConfig(languagesConfig, languagePath); + } + }); + function getCategoryName(path) { + const langIndex = path.indexOf('languages/'); + if (langIndex === -1) return null; + const jsonIndex = path.indexOf('/zh.json', langIndex); + if (jsonIndex === -1) return null; + return path.substring(langIndex + 10, jsonIndex); + } + function handleLanguageConfig(languagesConfig, languagePath) { + const pathParts = languagePath.split('/'); + const moduleName = pathParts[1]?.split('-')?.pop() ?? pathParts[1]; + const category = getCategoryName(languagePath); + const exportValue = languagesConfig(languagePath) ?? {}; + + // 确保类别存在 + if (!languagesCategoryConfig[category]) { + languagesCategoryConfig[category] = {}; + } + + let targetCategory = languagesCategoryConfig[category]; + const childCategoryList = Object.keys(targetCategory) || []; + if (targetCategory[moduleName]) { + // 合并现有配置和新配置 + targetCategory[moduleName] = { ...targetCategory[moduleName], ...exportValue }; + } else { + // 创建新模块配置 + if (childCategoryList && childCategoryList.length > 0) { + // 如果存在子类别,将新模块配置添加到子类别中 + targetCategory[moduleName] = exportValue; + } else { + // 如果不存在子类别,将新模块配置添加到根类别中 + languagesCategoryConfig[category] = exportValue; + } + } + } + console.log('zh.json加载完成', languagesCategoryConfig); +} catch (error) { + console.error('zh.json抛出异常', error); +} export default { - page, - form, - dialog, - message, - router, - term -} \ No newline at end of file + ...languagesCategoryConfig +}; -- Gitee From ccb503a23f3e18e6ba988ceaf55cf5b59f60b240 Mon Sep 17 00:00:00 2001 From: yaojn Date: Fri, 15 Aug 2025 16:09:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?-=20[=E5=8A=9F=E8=83=BD]=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=8C=89=E6=A8=A1=E5=9D=97=E6=8A=BD=E7=A6=BB?= =?UTF-8?q?=20=20=20-=20[=E5=85=B3=E8=81=94]#[1487772764831744]=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E6=96=87=E4=BB=B6=E6=8C=89=E6=A8=A1=E5=9D=97=E6=8A=BD?= =?UTF-8?q?=E7=A6=BB=20http://192.168.0.96:8090/demo/rdm.html#/story-detai?= =?UTF-8?q?l/939050947543040/939050947543042/1487772764831744?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/assets/languages/router/en.json | 6 +++ src/resources/assets/languages/router/zh.json | 6 +++ src/resources/assets/languages/term/en.json | 44 ++++++++++++++++--- src/resources/assets/languages/term/zh.json | 44 ++++++++++++++++--- 4 files changed, 86 insertions(+), 14 deletions(-) diff --git a/src/resources/assets/languages/router/en.json b/src/resources/assets/languages/router/en.json index 006eb5cb..9e4a22ac 100644 --- a/src/resources/assets/languages/router/en.json +++ b/src/resources/assets/languages/router/en.json @@ -297,6 +297,12 @@ "documentsearch": "Document Search", "directorymanage": "Document directory management" }, + "dr": { + "dr": "Disaster cutting", + "basicsetting": "Basic Settings", + "servicemanage": "service list", + "servicedetail": "Service List Details" + }, "diagram": { "diagrammanage": "System Management", "catalogmanage": "Catalog Management", diff --git a/src/resources/assets/languages/router/zh.json b/src/resources/assets/languages/router/zh.json index 7ec4d0ef..c3b0f5a2 100644 --- a/src/resources/assets/languages/router/zh.json +++ b/src/resources/assets/languages/router/zh.json @@ -297,6 +297,12 @@ "documentsearch": "文档搜索", "directorymanage": "文档目录管理" }, + "dr": { + "dr": "灾切", + "basicsetting": "基础设置", + "servicemanage": "服务清单", + "servicedetail": "服务清单详情" + }, "diagram": { "diagrammanage": "系统管理", "catalogmanage": "目录管理", diff --git a/src/resources/assets/languages/term/en.json b/src/resources/assets/languages/term/en.json index c44ad5c1..69187154 100644 --- a/src/resources/assets/languages/term/en.json +++ b/src/resources/assets/languages/term/en.json @@ -2734,6 +2734,41 @@ "representmenupage": "Represent menu page", "representsubpages": "Represent Subpages" }, + "dr": { + "assetconfig": "Asset allocation", + "scenarioconfig": "Scenario configuration", + "centername": "Center Name", + "basicservices": "Basic services", + "associationmodel": "Association model", + "network": "network", + "migrationdirection": "Migration direction", + "datareferencetip": "The current data is referenced by the scene and cannot be deleted", + "organizationalstructure": "organizational structure", + "affiliatedorganization": "Affiliated organization", + "currentoranghaschildnodelete": "The current organizational structure has child levels that cannot be deleted", + "currentorangbindusernodelete": "The current organizational structure is bound to a user and cannot be deleted", + "selectatleastmodel": "Select at least one model", + "applicationtypename": "Application Type", + "org": "Recovery institutions", + "fileconfigpath": "Configuration file path", + "datacenterrel": "Associate Data Centers", + "selectdatacenter": "Select at least two data centers", + "publicapplication": "public service", + "combopname": "Automated orchestration", + "dependency": "rely on", + "dependencyservice": "dependent service", + "scencedependency": "Scenario Dependency", + "servicedependency": "Service Dependency", + "scenarioplan": "Scenario Plan", + "relyonmyservices": "Rely on my services", + "servicerelyon": "The service I rely on", + "dependentapp": "Dependent applications", + "preparation": "reserve plan", + "exerciseplan": "Exercise plan", + "dependencyscene": "Dependent scenarios", + "sourcedatacenter": "Source Data Center", + "targetdatacenter": "Target Data Center" + }, "diagram": { "widgetlist": "Element List", "widget": "Element", @@ -2813,9 +2848,7 @@ "fromrel": "Upstream relationship", "rel": "Related relationships", "reltypeconfig": "Connection type configuration", - "edgetype": "line segment", - "associationmodel": "Association model", - "preparation": "reserve plan" + "edgetype": "line segment" }, "license": { "isbanmodule": "Disable module upon expiration", @@ -2851,8 +2884,5 @@ }, "runnergroup": { "ruletips": "The request for login authentication needs to carry a header as a rule expression (note that the header parameter in the expression is all lowercase). If the value of the expression after execution is true, the executor group will take effect, and false and syntax exceptions will not take effect. For example: ${env}==\\ bit \\&&(${test}==\\ 1 \\ | | ${test2}==\\ aaa \\)" - }, - "common": { - "preparation": "reserve plan" } -} +} \ No newline at end of file diff --git a/src/resources/assets/languages/term/zh.json b/src/resources/assets/languages/term/zh.json index 344527b1..d04b9b89 100644 --- a/src/resources/assets/languages/term/zh.json +++ b/src/resources/assets/languages/term/zh.json @@ -2733,6 +2733,41 @@ "representmenupage": "表示菜单页面", "representsubpages": "表示子页面" }, + "dr": { + "assetconfig": "资产配置", + "scenarioconfig": "场景配置", + "centername": "中心名称", + "basicservices": "基础服务", + "associationmodel": "关联模型", + "network": "网络", + "migrationdirection": "迁移方向", + "datareferencetip": "当前数据被场景引用,无法删除", + "organizationalstructure": "组织架构", + "affiliatedorganization": "所属组织", + "currentoranghaschildnodelete": "当前组织架构已有子级不可删除", + "currentorangbindusernodelete": "当前组织架构已绑定用户不可删除", + "selectatleastmodel": "至少选择一个模型", + "applicationtypename": "应用类型", + "org": "恢复机构", + "fileconfigpath": "配置文件路径", + "datacenterrel": "关联数据中心", + "selectdatacenter": "至少选择两个数据中心", + "publicapplication": "公共服务", + "combopname": "自动化编排", + "dependency": "依赖", + "dependencyservice": "依赖服务", + "scencedependency": "场景依赖", + "servicedependency": "服务依赖", + "scenarioplan": "场景预案", + "relyonmyservices": "依赖我的服务", + "servicerelyon": "我依赖的服务", + "dependentapp": "依赖应用", + "preparation": "预案", + "exerciseplan": "演练计划", + "dependencyscene": "依赖场景", + "sourcedatacenter": "来源数据中心", + "targetdatacenter": "目标数据中心" + }, "diagram": { "widgetlist": "图元列表", "widget": "图元", @@ -2813,9 +2848,7 @@ "fromrel": "上游关系", "rel": "关联关系", "reltypeconfig": "连线类型配置", - "edgetype": "线段", - "associationmodel": "关联模型", - "preparation": "预案" + "edgetype": "线段" }, "license": { "isbanmodule": "到期禁用模块", @@ -2848,8 +2881,5 @@ "joinalert": "归并到告警", "uniquekey": "唯一键", "alertsign": "告警特征" - }, - "common": { - "preparation": "预案" } -} +} \ No newline at end of file -- Gitee