This is an automated email from the ASF dual-hosted git repository.

dengliming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 291c0eea fix(i18n): replace hardcoded Chinese strings with translation 
keys, add missing keys (#702)
291c0eea is described below

commit 291c0eeaac1a264e3a61971a3935741827f64c33
Author: Hussnain Ahmad <[email protected]>
AuthorDate: Mon Oct 12 23:38:49 2026 -0400

    fix(i18n): replace hardcoded Chinese strings with translation keys, add 
missing keys (#702)
    
    * fix(i18n): replace hardcoded Chinese strings with translation keys, add 
missing keys
    
    Replaces hardcoded Chinese user-facing strings in request/download
    helpers, MCP config dialog and generated defaults, MCP tool validation
    messages, exception pages, resource warning and instance chart with
    getIntlContent() keys, and adds the five missing keys referenced by the
    app (SHENYU.SYSTEM.ALERT.LABELS.NAME/VALUE, SHENYU.COMMON.SAVE,
    SHENYU.SYSTEM.DESCRIBE, SHENYU.COMMON.BACK) to both locale files.
    
    Closes #701
    
    * test(i18n): update download test for localized 401 notification message 
(#701)
    
    * fix(i18n): fix comma splice in MCP param-incomplete message (#701)
---
 src/components/Exception/index.js             |  8 +++--
 src/components/Exception/typeConfig.js        | 14 ++++----
 src/locales/en-US.json                        | 50 ++++++++++++++++++++++++++-
 src/locales/zh-CN.json                        | 50 ++++++++++++++++++++++++++-
 src/routes/Plugin/McpServer/McpConfigModal.js | 50 ++++++++++++++++++---------
 src/routes/Plugin/McpServer/ToolsModal.js     | 12 ++++---
 src/routes/System/Instance/index.js           |  2 +-
 src/routes/System/Resource/index.js           |  2 +-
 src/utils/download.js                         |  7 ++--
 src/utils/download.test.js                    |  3 +-
 src/utils/request.js                          | 39 +++++++++++----------
 11 files changed, 184 insertions(+), 53 deletions(-)

diff --git a/src/components/Exception/index.js 
b/src/components/Exception/index.js
index ade3a819..57efb124 100644
--- a/src/components/Exception/index.js
+++ b/src/components/Exception/index.js
@@ -18,7 +18,8 @@
 import React, { createElement } from "react";
 import classNames from "classnames";
 import { Button } from "antd";
-import config from "./typeConfig";
+import getTypeConfig from "./typeConfig";
+import { getIntlContent } from "../../utils/IntlUtils";
 import styles from "./index.less";
 
 const Exception = ({
@@ -31,6 +32,7 @@ const Exception = ({
   actions,
   ...rest
 }) => {
+  const config = getTypeConfig();
   const pageType = type in config ? type : "404";
   const clsString = classNames(styles.exception, className);
   return (
@@ -52,7 +54,9 @@ const Exception = ({
                 to: "/",
                 href: "/",
               },
-              <Button type="primary">返回首页</Button>,
+              <Button type="primary">
+                {getIntlContent("SHENYU.EXCEPTION.BACK.HOME")}
+              </Button>,
             )}
         </div>
       </div>
diff --git a/src/components/Exception/typeConfig.js 
b/src/components/Exception/typeConfig.js
index 89b3aa9c..5ed0c489 100644
--- a/src/components/Exception/typeConfig.js
+++ b/src/components/Exception/typeConfig.js
@@ -15,22 +15,24 @@
  * limitations under the License.
  */
 
-const config = {
+import { getIntlContent } from "../../utils/IntlUtils";
+
+const getTypeConfig = () => ({
   403: {
     img: "https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg";,
     title: "403",
-    desc: "抱歉,你无权访问该页面",
+    desc: getIntlContent("SHENYU.EXCEPTION.403.DESC"),
   },
   404: {
     img: "https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg";,
     title: "404",
-    desc: "抱歉,你访问的页面不存在",
+    desc: getIntlContent("SHENYU.EXCEPTION.404.DESC"),
   },
   500: {
     img: "https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg";,
     title: "500",
-    desc: "抱歉,服务器出错了",
+    desc: getIntlContent("SHENYU.EXCEPTION.500.DESC"),
   },
-};
+});
 
-export default config;
+export default getTypeConfig;
diff --git a/src/locales/en-US.json b/src/locales/en-US.json
index 46794c20..2b7234b4 100644
--- a/src/locales/en-US.json
+++ b/src/locales/en-US.json
@@ -672,5 +672,53 @@
   "APIPROXY.APIKEY.USAGE.LINE1": "Proxy API Key works at selector granularity. 
Add header X-API-KEY: <proxyApiKey>; this check has the highest priority.",
   "APIPROXY.APIKEY.USAGE.LINE2": "The realApiKey is strongly bound to the 
selector configuration. To change the mapping between proxyApiKey and 
realApiKey, edit the selector configuration.",
   "APIPROXY.APIKEY.USAGE.HINT": "How to use: Add this API Key to the X-API-KEY 
field in your request header.",
-  "APIPROXY.APIKEY.PROXY_ENABLED_REQUIRED": "Please set proxyEnabled to 
\"true\" in this selector's configuration before entering Proxy API Key 
Management."
+  "APIPROXY.APIKEY.PROXY_ENABLED_REQUIRED": "Please set proxyEnabled to 
\"true\" in this selector's configuration before entering Proxy API Key 
Management.",
+  "SHENYU.SYSTEM.ALERT.LABELS.NAME": "Name",
+  "SHENYU.SYSTEM.ALERT.LABELS.VALUE": "Value",
+  "SHENYU.COMMON.SAVE": "Save",
+  "SHENYU.SYSTEM.DESCRIBE": "Description",
+  "SHENYU.COMMON.BACK": "Back",
+  "SHENYU.REQUEST.ERROR": "Request error",
+  "SHENYU.REQUEST.STATUS.200": "The server successfully returned the requested 
data.",
+  "SHENYU.REQUEST.STATUS.201": "New or modified data succeeded.",
+  "SHENYU.REQUEST.STATUS.202": "A request has entered the background queue 
(async task).",
+  "SHENYU.REQUEST.STATUS.204": "Data deleted successfully.",
+  "SHENYU.REQUEST.STATUS.400": "The request has an error, and the server did 
not create or modify data.",
+  "SHENYU.REQUEST.STATUS.401": "The user does not have permission (token, 
username, or password error).",
+  "SHENYU.REQUEST.STATUS.403": "The user is authorized, but access is 
forbidden.",
+  "SHENYU.REQUEST.STATUS.404": "The request targets a record that does not 
exist, and the server performed no operation.",
+  "SHENYU.REQUEST.STATUS.406": "The requested format is not available.",
+  "SHENYU.REQUEST.STATUS.410": "The requested resource has been permanently 
deleted and will not be available again.",
+  "SHENYU.REQUEST.STATUS.422": "A validation error occurred when creating an 
object.",
+  "SHENYU.REQUEST.STATUS.500": "A server error occurred, please check the 
server.",
+  "SHENYU.REQUEST.STATUS.502": "Gateway error.",
+  "SHENYU.REQUEST.STATUS.503": "Service unavailable, the server is temporarily 
overloaded or under maintenance.",
+  "SHENYU.REQUEST.STATUS.504": "Gateway timeout.",
+  "SHENYU.DOWNLOAD.FILE.FAILED": "Failed to download file",
+  "SHENYU.MCP.CONFIG.GATEWAY.TITLE": "Gateway Address Configuration:",
+  "SHENYU.MCP.CONFIG.GATEWAY.PLACEHOLDER": "Enter a custom gateway address, 
e.g.: http://localhost:9195 (leave empty to use the default)",
+  "SHENYU.MCP.CONFIG.GATEWAY.CURRENT": "Currently using:",
+  "SHENYU.MCP.CONFIG.SELECTOR.ENABLED": " (Enabled)",
+  "SHENYU.MCP.CONFIG.SELECTOR.DISABLED": " (Disabled)",
+  "SHENYU.MCP.CONFIG.BASE.PATH": "Base Path:",
+  "SHENYU.MCP.CONFIG.URL.EXPLAIN": "Final URL = Gateway Address + Base Path + 
Protocol Suffix (/sse or /streamablehttp)",
+  "SHENYU.MCP.CONFIG.NAME.SERVICE.SSE": " Service SSE",
+  "SHENYU.MCP.CONFIG.NAME.SERVICE": " Service",
+  "SHENYU.MCP.CONFIG.DESC.SERVICE.SSE": " Service SSE Test",
+  "SHENYU.MCP.CONFIG.DESC.SERVICE": " Service Test",
+  "SHENYU.MCP.CONFIG.DEFAULT.SERVICE.NAME": "Default MCP Service",
+  "SHENYU.MCP.TOOLS.PARAM.DEPTH.EXCEEDED": "Parameter nesting depth exceeds 
the limit",
+  "SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.PREFIX": " (max ",
+  "SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.SUFFIX": " levels)",
+  "SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.REACHED": "Maximum nesting depth limit 
reached",
+  "SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.CANNOT.ADD": ", cannot add more 
sub-parameters",
+  "SHENYU.MCP.TOOLS.PARAM.ROW.PREFIX": "Row ",
+  "SHENYU.MCP.TOOLS.PARAM.ROW.SUFFIX": "",
+  "SHENYU.MCP.TOOLS.PARAM.INCOMPLETE": "parameters are incomplete; please fill 
in the name and type",
+  "SHENYU.EXCEPTION.403.DESC": "Sorry, you don't have access to this page",
+  "SHENYU.EXCEPTION.404.DESC": "Sorry, the page you visited does not exist",
+  "SHENYU.EXCEPTION.500.DESC": "Sorry, something went wrong with the server",
+  "SHENYU.EXCEPTION.BACK.HOME": "Back to Home",
+  "SHENYU.SYSTEM.RESOURCE.SELECT.MENU.WARN": "Please select a menu on the left 
first",
+  "SHENYU.SYSTEM.INSTANCE.CHART.COUNT": "Count"
 }
diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json
index e93199a6..764daf79 100644
--- a/src/locales/zh-CN.json
+++ b/src/locales/zh-CN.json
@@ -678,5 +678,53 @@
   "APIPROXY.APIKEY.USAGE.LINE1": "代理 API Key 以选择器(Selector)为粒度生效,请在请求头添加 
X-API-KEY: <proxyApiKey>,其校验优先级最高。",
   "APIPROXY.APIKEY.USAGE.LINE2": "真实 API Key 
与选择器配置强绑定,如需变更代理与真实的映射,请修改该选择器的配置。",
   "APIPROXY.APIKEY.USAGE.HINT": "使用提示:请将此 API Key 添加到请求头的 X-API-KEY 字段。",
-  "APIPROXY.APIKEY.PROXY_ENABLED_REQUIRED": "请先在该选择器的配置中将 proxyEnabled 设置为 
\"true\",再进入代理 API Key 管理。"
+  "APIPROXY.APIKEY.PROXY_ENABLED_REQUIRED": "请先在该选择器的配置中将 proxyEnabled 设置为 
\"true\",再进入代理 API Key 管理。",
+  "SHENYU.SYSTEM.ALERT.LABELS.NAME": "名称",
+  "SHENYU.SYSTEM.ALERT.LABELS.VALUE": "值",
+  "SHENYU.COMMON.SAVE": "保存",
+  "SHENYU.SYSTEM.DESCRIBE": "描述",
+  "SHENYU.COMMON.BACK": "返回",
+  "SHENYU.REQUEST.ERROR": "请求错误",
+  "SHENYU.REQUEST.STATUS.200": "服务器成功返回请求的数据。",
+  "SHENYU.REQUEST.STATUS.201": "新建或修改数据成功。",
+  "SHENYU.REQUEST.STATUS.202": "一个请求已经进入后台排队(异步任务)。",
+  "SHENYU.REQUEST.STATUS.204": "删除数据成功。",
+  "SHENYU.REQUEST.STATUS.400": "发出的请求有错误,服务器没有进行新建或修改数据的操作。",
+  "SHENYU.REQUEST.STATUS.401": "用户没有权限(令牌、用户名、密码错误)。",
+  "SHENYU.REQUEST.STATUS.403": "用户得到授权,但是访问是被禁止的。",
+  "SHENYU.REQUEST.STATUS.404": "发出的请求针对的是不存在的记录,服务器没有进行操作。",
+  "SHENYU.REQUEST.STATUS.406": "请求的格式不可得。",
+  "SHENYU.REQUEST.STATUS.410": "请求的资源被永久删除,且不会再得到的。",
+  "SHENYU.REQUEST.STATUS.422": "当创建一个对象时,发生一个验证错误。",
+  "SHENYU.REQUEST.STATUS.500": "服务器发生错误,请检查服务器。",
+  "SHENYU.REQUEST.STATUS.502": "网关错误。",
+  "SHENYU.REQUEST.STATUS.503": "服务不可用,服务器暂时过载或维护。",
+  "SHENYU.REQUEST.STATUS.504": "网关超时。",
+  "SHENYU.DOWNLOAD.FILE.FAILED": "下载文件失败",
+  "SHENYU.MCP.CONFIG.GATEWAY.TITLE": "网关地址配置:",
+  "SHENYU.MCP.CONFIG.GATEWAY.PLACEHOLDER": "输入自定义网关地址,如: http://localhost:9195 
(留空使用默认)",
+  "SHENYU.MCP.CONFIG.GATEWAY.CURRENT": "当前使用:",
+  "SHENYU.MCP.CONFIG.SELECTOR.ENABLED": " (启用)",
+  "SHENYU.MCP.CONFIG.SELECTOR.DISABLED": " (禁用)",
+  "SHENYU.MCP.CONFIG.BASE.PATH": "基础路径:",
+  "SHENYU.MCP.CONFIG.URL.EXPLAIN": "最终URL = 网关地址 + 基础路径 + 协议后缀(/sse 或 
/streamablehttp)",
+  "SHENYU.MCP.CONFIG.NAME.SERVICE.SSE": "服务sse",
+  "SHENYU.MCP.CONFIG.NAME.SERVICE": "服务",
+  "SHENYU.MCP.CONFIG.DESC.SERVICE.SSE": "服务测试sse",
+  "SHENYU.MCP.CONFIG.DESC.SERVICE": "服务测试",
+  "SHENYU.MCP.CONFIG.DEFAULT.SERVICE.NAME": "默认MCP服务",
+  "SHENYU.MCP.TOOLS.PARAM.DEPTH.EXCEEDED": "参数嵌套深度超过限制",
+  "SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.PREFIX": "(最大",
+  "SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.SUFFIX": "层)",
+  "SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.REACHED": "已达到最大嵌套深度限制",
+  "SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.CANNOT.ADD": ",无法继续添加子参数",
+  "SHENYU.MCP.TOOLS.PARAM.ROW.PREFIX": "第",
+  "SHENYU.MCP.TOOLS.PARAM.ROW.SUFFIX": "行",
+  "SHENYU.MCP.TOOLS.PARAM.INCOMPLETE": "参数不完整,请填写名称、类型",
+  "SHENYU.EXCEPTION.403.DESC": "抱歉,你无权访问该页面",
+  "SHENYU.EXCEPTION.404.DESC": "抱歉,你访问的页面不存在",
+  "SHENYU.EXCEPTION.500.DESC": "抱歉,服务器出错了",
+  "SHENYU.EXCEPTION.BACK.HOME": "返回首页",
+  "SHENYU.SYSTEM.RESOURCE.SELECT.MENU.WARN": "请先选择左侧菜单",
+  "SHENYU.SYSTEM.INSTANCE.CHART.COUNT": "数量"
 }
diff --git a/src/routes/Plugin/McpServer/McpConfigModal.js 
b/src/routes/Plugin/McpServer/McpConfigModal.js
index a4b2abb3..52792756 100644
--- a/src/routes/Plugin/McpServer/McpConfigModal.js
+++ b/src/routes/Plugin/McpServer/McpConfigModal.js
@@ -72,8 +72,8 @@ class McpConfigModal extends Component {
       const sseKey = `shenyu-mcp-sse-${selectorName}`;
       mcpServers[sseKey] = {
         url: `${selectorUrl}/sse`,
-        name: `${selectorName}服务sse`,
-        description: `${selectorName}服务测试sse - ${selectorDescription}`,
+        name: 
`${selectorName}${getIntlContent("SHENYU.MCP.CONFIG.NAME.SERVICE.SSE")}`,
+        description: 
`${selectorName}${getIntlContent("SHENYU.MCP.CONFIG.DESC.SERVICE.SSE")} - 
${selectorDescription}`,
         headers: defaultHeaders,
         transport: "sse",
       };
@@ -82,8 +82,8 @@ class McpConfigModal extends Component {
       const streamableKey = `shenyu-mcp-${selectorName}`;
       mcpServers[streamableKey] = {
         url: `${selectorUrl}/streamablehttp`,
-        name: `${selectorName}服务`,
-        description: `${selectorName}服务测试 - ${selectorDescription}`,
+        name: 
`${selectorName}${getIntlContent("SHENYU.MCP.CONFIG.NAME.SERVICE")}`,
+        description: 
`${selectorName}${getIntlContent("SHENYU.MCP.CONFIG.DESC.SERVICE")} - 
${selectorDescription}`,
         headers: defaultHeaders,
         transport: "streamableHttp",
       };
@@ -135,13 +135,17 @@ class McpConfigModal extends Component {
 
   // 从selector的handle字段获取描述信息
   getHandleDescription = (handle) => {
-    if (!handle) return "默认MCP服务";
+    if (!handle)
+      return getIntlContent("SHENYU.MCP.CONFIG.DEFAULT.SERVICE.NAME");
 
     try {
       const handleObj = JSON.parse(handle);
-      return handleObj.description || "默认MCP服务";
+      return (
+        handleObj.description ||
+        getIntlContent("SHENYU.MCP.CONFIG.DEFAULT.SERVICE.NAME")
+      );
     } catch (e) {
-      return "默认MCP服务";
+      return getIntlContent("SHENYU.MCP.CONFIG.DEFAULT.SERVICE.NAME");
     }
   };
 
@@ -166,8 +170,14 @@ class McpConfigModal extends Component {
     const basePath = "/http"; // MCP插件的默认基础路径
     const urlPath =
       transport === "sse" ? `${basePath}/sse` : `${basePath}/streamablehttp`;
-    const nameSuffix = transport === "sse" ? "服务sse" : "服务";
-    const descSuffix = transport === "sse" ? "服务测试sse" : "服务测试";
+    const nameSuffix =
+      transport === "sse"
+        ? getIntlContent("SHENYU.MCP.CONFIG.NAME.SERVICE.SSE")
+        : getIntlContent("SHENYU.MCP.CONFIG.NAME.SERVICE");
+    const descSuffix =
+      transport === "sse"
+        ? getIntlContent("SHENYU.MCP.CONFIG.DESC.SERVICE.SSE")
+        : getIntlContent("SHENYU.MCP.CONFIG.DESC.SERVICE");
 
     return {
       mcpServers: {
@@ -323,10 +333,14 @@ class McpConfigModal extends Component {
 
         <div style={{ marginBottom: "16px" }}>
           <div style={{ marginBottom: "8px" }}>
-            <Text strong>网关地址配置:</Text>
+            <Text strong>
+              {getIntlContent("SHENYU.MCP.CONFIG.GATEWAY.TITLE")}
+            </Text>
           </div>
           <Input
-            placeholder="输入自定义网关地址,如: http://localhost:9195 (留空使用默认)"
+            placeholder={getIntlContent(
+              "SHENYU.MCP.CONFIG.GATEWAY.PLACEHOLDER",
+            )}
             value={this.state.customGatewayHost}
             onChange={(e) => {
               this.setState({ customGatewayHost: e.target.value }, () => {
@@ -337,7 +351,8 @@ class McpConfigModal extends Component {
             style={{ marginBottom: "8px" }}
           />
           <div style={{ fontSize: "12px", color: "#666" }}>
-            当前使用: <strong>{this.getGatewayHost()}</strong>
+            {getIntlContent("SHENYU.MCP.CONFIG.GATEWAY.CURRENT")}{" "}
+            <strong>{this.getGatewayHost()}</strong>
           </div>
         </div>
 
@@ -346,14 +361,17 @@ class McpConfigModal extends Component {
             <Text type="secondary">
               <>
                 <strong>Selector:</strong> {currentSelector.name}
-                {currentSelector.enabled ? " (启用)" : " (禁用)"}
+                {currentSelector.enabled
+                  ? getIntlContent("SHENYU.MCP.CONFIG.SELECTOR.ENABLED")
+                  : getIntlContent("SHENYU.MCP.CONFIG.SELECTOR.DISABLED")}
                 <br />
-                <strong>基础路径:</strong>{" "}
+                <strong>
+                  {getIntlContent("SHENYU.MCP.CONFIG.BASE.PATH")}
+                </strong>{" "}
                 {this.getSelectorPathInfo(currentSelector)}
                 <br />
                 <small style={{ color: "#888" }}>
-                  最终URL = 网关地址 + 基础路径 + 协议后缀(/sse 或
-                  /streamablehttp)
+                  {getIntlContent("SHENYU.MCP.CONFIG.URL.EXPLAIN")}
                 </small>
               </>
             </Text>
diff --git a/src/routes/Plugin/McpServer/ToolsModal.js 
b/src/routes/Plugin/McpServer/ToolsModal.js
index 421c9b2e..ac5541a7 100644
--- a/src/routes/Plugin/McpServer/ToolsModal.js
+++ b/src/routes/Plugin/McpServer/ToolsModal.js
@@ -413,7 +413,7 @@ class AddModal extends Component {
       if (depth > MAX_NESTING_DEPTH) {
         message.destroy();
         message.error(
-          `参数嵌套深度超过限制(最大${MAX_NESTING_DEPTH}层): ${path}`,
+          
`${getIntlContent("SHENYU.MCP.TOOLS.PARAM.DEPTH.EXCEEDED")}${getIntlContent("SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.PREFIX")}${MAX_NESTING_DEPTH}${getIntlContent("SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.SUFFIX")}:
 ${path}`,
         );
         return false;
       }
@@ -421,11 +421,15 @@ class AddModal extends Component {
       for (let i = 0; i < params.length; i += 1) {
         const item = params[i];
         const { type, name } = item;
-        const currentPath = path ? `${path}[${i}]` : `第${i + 1}行`;
+        const currentPath = path
+          ? `${path}[${i}]`
+          : `${getIntlContent("SHENYU.MCP.TOOLS.PARAM.ROW.PREFIX")}${i + 
1}${getIntlContent("SHENYU.MCP.TOOLS.PARAM.ROW.SUFFIX")}`;
 
         if (!type || !name) {
           message.destroy();
-          message.error(`${currentPath} 参数不完整,请填写名称、类型`);
+          message.error(
+            `${currentPath} 
${getIntlContent("SHENYU.MCP.TOOLS.PARAM.INCOMPLETE")}`,
+          );
           return false;
         }
 
@@ -614,7 +618,7 @@ class AddModal extends Component {
     if (path.length >= MAX_NESTING_DEPTH) {
       message.destroy();
       message.warning(
-        `已达到最大嵌套深度限制(${MAX_NESTING_DEPTH}层),无法继续添加子参数`,
+        
`${getIntlContent("SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.REACHED")}${getIntlContent("SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.PREFIX")}${MAX_NESTING_DEPTH}${getIntlContent("SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.SUFFIX")}${getIntlContent("SHENYU.MCP.TOOLS.PARAM.DEPTH.MAX.CANNOT.ADD")}`,
       );
       return;
     }
diff --git a/src/routes/System/Instance/index.js 
b/src/routes/System/Instance/index.js
index acef7185..0bdcb12e 100644
--- a/src/routes/System/Instance/index.js
+++ b/src/routes/System/Instance/index.js
@@ -257,7 +257,7 @@ export default class Instance extends Component {
         max: 4,
         minInterval: 1,
         interval: 1,
-        name: "数量",
+        name: getIntlContent("SHENYU.SYSTEM.INSTANCE.CHART.COUNT"),
         nameTextStyle: {
           color: "#333",
           fontSize: 12,
diff --git a/src/routes/System/Resource/index.js 
b/src/routes/System/Resource/index.js
index 280d10cf..525c2031 100755
--- a/src/routes/System/Resource/index.js
+++ b/src/routes/System/Resource/index.js
@@ -174,7 +174,7 @@ export default class Resource extends Component {
     } = this.props;
     const { currentMenu } = this.state;
     if (resourceType === 2 && !currentMenu) {
-      message.warn("请先选择左侧菜单");
+      message.warn(getIntlContent("SHENYU.SYSTEM.RESOURCE.SELECT.MENU.WARN"));
       return;
     }
 
diff --git a/src/utils/download.js b/src/utils/download.js
index fa7c3cdc..bf84cf4b 100644
--- a/src/utils/download.js
+++ b/src/utils/download.js
@@ -18,6 +18,7 @@
 import fetch from "dva/fetch";
 import { notification } from "antd";
 import { handleUnauthorized } from "./request";
+import { getIntlContent } from "./IntlUtils";
 
 async function checkStatus(response) {
   if (response.ok) {
@@ -34,7 +35,7 @@ async function checkStatus(response) {
   const errorText =
     (errorResponse && errorResponse.message) || response.statusText;
   notification.error({
-    message: `请求错误 ${response.status}: ${response.url}`,
+    message: `${getIntlContent("SHENYU.REQUEST.ERROR")} ${response.status}: 
${response.url}`,
     description: errorText,
   });
   if (response.status === 401) {
@@ -116,6 +117,8 @@ export default async function download(url, options) {
     a.click();
     document.body.removeChild(a);
   } catch (error) {
-    throw new Error(`下载文件失败:${error.message || error}`);
+    throw new Error(
+      `${getIntlContent("SHENYU.DOWNLOAD.FILE.FAILED")}: ${error.message || 
error}`,
+    );
   }
 }
diff --git a/src/utils/download.test.js b/src/utils/download.test.js
index cdc7f3b2..d50c2d3f 100644
--- a/src/utils/download.test.js
+++ b/src/utils/download.test.js
@@ -23,6 +23,7 @@ import download from "./download";
 jest.mock("dva/fetch", () => jest.fn());
 jest.mock("antd", () => ({ notification: { error: jest.fn() } }));
 jest.mock("./request", () => ({ handleUnauthorized: jest.fn() }));
+jest.mock("./IntlUtils", () => ({ getIntlContent: (key) => key }));
 
 const createHeaders = (headers = {}) => ({
   get: jest.fn((name) => headers[name.toLowerCase()] || null),
@@ -113,7 +114,7 @@ describe("download", () => {
 
     expect(handleUnauthorized).toHaveBeenCalledTimes(1);
     expect(notification.error).toHaveBeenCalledWith({
-      message: "请求错误 401: undefined",
+      message: "SHENYU.REQUEST.ERROR 401: undefined",
       description: "Authentication failed",
     });
   });
diff --git a/src/utils/request.js b/src/utils/request.js
index 8f84c35e..4d66a6e1 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -20,31 +20,34 @@ import { notification } from "antd";
 import store from "../index";
 import { getIntlContent } from "./IntlUtils";
 
-const codeMessage = {
-  200: "服务器成功返回请求的数据。",
-  201: "新建或修改数据成功。",
-  202: "一个请求已经进入后台排队(异步任务)。",
-  204: "删除数据成功。",
-  400: "发出的请求有错误,服务器没有进行新建或修改数据的操作。",
-  401: "用户没有权限(令牌、用户名、密码错误)。",
-  403: "用户得到授权,但是访问是被禁止的。",
-  404: "发出的请求针对的是不存在的记录,服务器没有进行操作。",
-  406: "请求的格式不可得。",
-  410: "请求的资源被永久删除,且不会再得到的。",
-  422: "当创建一个对象时,发生一个验证错误。",
-  500: "服务器发生错误,请检查服务器。",
-  502: "网关错误。",
-  503: "服务不可用,服务器暂时过载或维护。",
-  504: "网关超时。",
+const getCodeMessage = (status) => {
+  const codeMessage = {
+    200: getIntlContent("SHENYU.REQUEST.STATUS.200"),
+    201: getIntlContent("SHENYU.REQUEST.STATUS.201"),
+    202: getIntlContent("SHENYU.REQUEST.STATUS.202"),
+    204: getIntlContent("SHENYU.REQUEST.STATUS.204"),
+    400: getIntlContent("SHENYU.REQUEST.STATUS.400"),
+    401: getIntlContent("SHENYU.REQUEST.STATUS.401"),
+    403: getIntlContent("SHENYU.REQUEST.STATUS.403"),
+    404: getIntlContent("SHENYU.REQUEST.STATUS.404"),
+    406: getIntlContent("SHENYU.REQUEST.STATUS.406"),
+    410: getIntlContent("SHENYU.REQUEST.STATUS.410"),
+    422: getIntlContent("SHENYU.REQUEST.STATUS.422"),
+    500: getIntlContent("SHENYU.REQUEST.STATUS.500"),
+    502: getIntlContent("SHENYU.REQUEST.STATUS.502"),
+    503: getIntlContent("SHENYU.REQUEST.STATUS.503"),
+    504: getIntlContent("SHENYU.REQUEST.STATUS.504"),
+  };
+  return codeMessage[status];
 };
 
 function checkStatus(response) {
   if (response.status >= 200 && response.status < 300) {
     return response;
   }
-  const errortext = codeMessage[response.status] || response.statusText;
+  const errortext = getCodeMessage(response.status) || response.statusText;
   notification.error({
-    message: `请求错误 ${response.status}: ${response.url}`,
+    message: `${getIntlContent("SHENYU.REQUEST.ERROR")} ${response.status}: 
${response.url}`,
     description: errortext,
   });
   const error = new Error(errortext);

Reply via email to