From 1bee4c32c261da2833a44d9058cea3e17a3f17e7 Mon Sep 17 00:00:00 2001 From: dengliming Date: Sat, 26 Dec 2020 22:14:52 +0800 Subject: [PATCH] Optimize internationalization related comments --- src/common/menu.js | 2 +- src/components/SiderMenu/SiderMenu.js | 16 ++- src/layouts/BasicLayout.js | 15 ++- src/layouts/UserLayout.js | 2 +- src/locales/en-US.json | 6 +- src/locales/zh-CN.json | 5 + src/models/auth.js | 11 +- src/models/common.js | 13 +-- src/models/divide.js | 13 +-- src/models/global.js | 3 +- src/models/hystrix.js | 13 +-- src/models/login.js | 2 +- src/models/manage.js | 9 +- src/models/metadata.js | 21 ++-- src/models/plugin.js | 13 +-- src/models/pluginHandle.js | 7 +- src/models/rewrite.js | 13 +-- src/models/soulDict.js | 9 +- src/models/spring.js | 13 +-- src/router.js | 6 +- src/routes/Plugin/Common/Rule.js | 8 +- src/routes/Plugin/Common/Selector.js | 8 +- src/routes/Plugin/Common/index.js | 8 +- src/routes/Plugin/Divide/Rule.js | 12 +-- src/routes/Plugin/Divide/index.js | 3 +- src/routes/Plugin/Hystrix/Rule.js | 10 +- src/routes/Plugin/Hystrix/Selector.js | 8 +- src/routes/Plugin/Hystrix/index.js | 3 +- src/routes/System/AppAuth/AddModal.js | 2 +- src/routes/System/AppAuth/TableTransfer.js | 7 +- src/routes/System/AppAuth/index.js | 4 +- src/routes/System/Dict/AddModal.js | 2 +- src/routes/System/Dict/index.js | 4 +- src/routes/System/Metadata/AddModal.js | 5 +- src/routes/System/Metadata/index.js | 4 +- src/routes/System/Plugin/index.js | 4 +- src/routes/System/PluginHandle/index.js | 2 +- src/routes/System/User/index.js | 2 +- src/services/api.js | 117 ++++++++++----------- src/utils/IntlUtils.js | 8 +- 40 files changed, 211 insertions(+), 202 deletions(-) diff --git a/src/common/menu.js b/src/common/menu.js index 713ec95f4..6cf1e5d72 100644 --- a/src/common/menu.js +++ b/src/common/menu.js @@ -1,6 +1,6 @@ import { isUrl } from '../utils/utils'; import { getIntlContent } from '../utils/IntlUtils' -/** 菜单 移到 统一地方 处理 */ + export const menuData = [ { name: getIntlContent('SOUL.MENU.PLUGIN.LIST'), diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 79e9e2d0c..d9e15234c 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -102,9 +102,9 @@ export default class SiderMenu extends PureComponent { } /** - * 判断是否是http链接.返回 Link 或 a * Judge whether it is http link.return a or Link - * @memberof SiderMenu + * + * member of SiderMenu */ getMenuItemPath = item => { const itemPath = this.conversionPath(item.path); @@ -145,7 +145,7 @@ export default class SiderMenu extends PureComponent { getSubMenuOrItem = item => { if (item.children && item.children.some(child => child.name)) { const childrenItems = this.getNavMenuItems(item.children); - // 当无子菜单时就不展示菜单 + // The menu is not displayed when there are no submenus if (childrenItems && childrenItems.length > 0) { return ( { if (!menusData) { @@ -200,7 +199,6 @@ export default class SiderMenu extends PureComponent { }; // conversion Path - // 转化路径 conversionPath = path => { if (path && path.indexOf('http') === 0) { return path; @@ -232,7 +230,7 @@ export default class SiderMenu extends PureComponent { }); }; - /** 根据当前语言 修改 菜单 */ + /** Modify the menu based on the current language */ updateMenuData() { if (this.props.menuData.length === 0) { return; @@ -241,14 +239,14 @@ export default class SiderMenu extends PureComponent { // eslint-disable-next-line no-plusplus for ( let i = 0 ; i < this.props.menuData.length; i++) { if (this.props.menuData[i].locale) { - this.props.menuData[i].name = getIntlContent(this.props.menuData[i].locale); + this.props.menuData[i].name = getIntlContent(this.props.menuData[i].locale, this.props.menuData[i].name); } if (this.props.menuData[i].children.length > 0) { // eslint-disable-next-line no-plusplus for (let j = 0; j < this.props.menuData[i].children.length; j++) { if (this.props.menuData[i].children[j].locale) { - this.props.menuData[i].children[j].name = getIntlContent(this.props.menuData[i].children[j].locale); + this.props.menuData[i].children[j].name = getIntlContent(this.props.menuData[i].children[j].locale, this.props.menuData[i].children[j].name); } } } diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 18c7bbe77..32f82ac5b 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -25,7 +25,7 @@ const { Content, Header } = Layout; const { AuthorizedRoute, check } = Authorized; /** - * 根据菜单取得重定向地址. + * Get the redirect address from the menu. */ const redirectData = []; const getRedirect = item => { @@ -44,9 +44,10 @@ const getRedirect = item => { getMenuData().forEach(getRedirect); /** - * 获取面包屑映射 - * @param {Object} menuData 菜单配置 - * @param {Object} routerData 路由配置 + * Gets the breadcrumb map + * + * @param {Object} menuData + * @param {Object} routerData */ const getBreadcrumbNameMap = (menuData, routerData) => { const result = {}; @@ -110,7 +111,7 @@ class BasicLayout extends React.PureComponent { getPageTitle() { const { routerData, location } = this.props; const { pathname } = location; - let title = "网关管理"; + let title = "Gateway Management"; let currRouterData = null; // match params path Object.keys(routerData).forEach(key => { @@ -119,14 +120,13 @@ class BasicLayout extends React.PureComponent { } }); if (currRouterData && currRouterData.name) { - title = `soul - 网关管理`; + title = `Soul - Gateway Management`; } return title; } getBaseRedirect = () => { // According to the url parameter to redirect - // 这里是重定向的,重定向到 url 的 redirect 参数所示地址 const urlParams = new URL(window.location.href); const redirect = urlParams.searchParams.get("redirect"); @@ -166,7 +166,6 @@ class BasicLayout extends React.PureComponent { { item.key = item.id; return item; @@ -47,7 +48,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(addUser, payload); if (json.code === 200) { - message.success("添加成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.ADD.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -59,7 +60,7 @@ export default { const { list } = payload; const json = yield call(deleteUser, { list }); if (json.code === 200) { - message.success("删除成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.DELETE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -70,7 +71,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(updateUser, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { diff --git a/src/models/metadata.js b/src/models/metadata.js index 6a34eb80c..6be2bf470 100644 --- a/src/models/metadata.js +++ b/src/models/metadata.js @@ -8,6 +8,7 @@ import { updateEnabled, syncData } from "../services/api"; +import {getIntlContent} from "../utils/IntlUtils"; export default { namespace: "metadata", @@ -23,7 +24,7 @@ export default { const json = yield call(getAllMetadata, payload); if (json.code === 200) { let { page, dataList } = json.data; - + dataList = dataList.map(item => { item.key = item.id; return item; @@ -39,7 +40,7 @@ export default { }, *fetchItem(params, { call }) { const { payload, callback } = params; - + const json = yield call(findMetadata, payload); if (json.code === 200) { const user = json.data; @@ -48,10 +49,10 @@ export default { }, *add(params, { call, put }) { const { payload, callback, fetchValue } = params; - + const json = yield call(addMetadata, payload); if (json.code === 200) { - message.success("添加成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.ADD.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -63,7 +64,7 @@ export default { const { list } = payload; const json = yield call(deleteMetadata, { list }); if (json.code === 200) { - message.success("删除成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.DELETE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -74,7 +75,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(updateMetadata, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -83,10 +84,10 @@ export default { }, *updateEn(params, {call, put}) { const { payload, fetchValue, callback } = params; - + const json = yield call(updateEnabled, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -96,7 +97,7 @@ export default { *syncDa( params, {call}) { const { payload } = params; yield call(syncData,payload); - + }, *reload(params, { put }) { const { fetchValue } = params; @@ -105,7 +106,7 @@ export default { yield put({ type: "fetch", payload }); }, - + }, reducers: { diff --git a/src/models/plugin.js b/src/models/plugin.js index eb9c4abf8..718b13ede 100644 --- a/src/models/plugin.js +++ b/src/models/plugin.js @@ -8,6 +8,7 @@ import { asyncPlugin, updatepluginEnabled } from "../services/api"; +import {getIntlContent} from "../utils/IntlUtils"; export default { namespace: "plugin", @@ -48,7 +49,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(addPlugin, payload); if (json.code === 200) { - message.success("添加成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.ADD.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -58,7 +59,7 @@ export default { *changeStatus({ payload }, { call, put }) { const json = yield call(updatePlugin, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); yield put({ type: "updatePlugins", payload, @@ -72,7 +73,7 @@ export default { const { list } = payload; const json = yield call(deletePlugin, { list }); if (json.code === 200) { - message.success("删除成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.DELETE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -83,7 +84,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(updatePlugin, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -94,7 +95,7 @@ export default { const {payload,fetchValue,callback} = params; const json = yield call (updatepluginEnabled,payload); if(json.code===200){ - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({type: "reload", fetchValue}); } else { @@ -110,7 +111,7 @@ export default { *asyncAll(_, { call }) { const json = yield call(asyncPlugin); if (json.code === 200) { - message.success("同步成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.SYNC.SUCCESS')); } else { message.warn(json.message); } diff --git a/src/models/pluginHandle.js b/src/models/pluginHandle.js index e134cef2d..60cbd5113 100644 --- a/src/models/pluginHandle.js +++ b/src/models/pluginHandle.js @@ -8,6 +8,7 @@ import { fetchPluginHandleByPluginId, getPluginDropDownList, } from "../services/api"; +import {getIntlContent} from "../utils/IntlUtils"; export default { namespace: "pluginHandle", @@ -41,7 +42,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(addPluginHandle, payload); if (json.code === 200) { - message.success("添加成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.ADD.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -60,7 +61,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(updatePluginHandle, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -72,7 +73,7 @@ export default { const { list } = payload; const json = yield call(batchDeletePluginHandle, { list }); if (json.code === 200) { - message.success("删除成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.DELETE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { diff --git a/src/models/rewrite.js b/src/models/rewrite.js index 77effb023..1733ba643 100644 --- a/src/models/rewrite.js +++ b/src/models/rewrite.js @@ -12,6 +12,7 @@ import { findRule, updateRule, } from "../services/api"; +import {getIntlContent} from "../utils/IntlUtils"; export default { namespace: "rewrite", @@ -81,7 +82,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(addSelector, payload); if (json.code === 200) { - message.success("添加成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.ADD.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -93,7 +94,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(addRule, payload); if (json.code === 200) { - message.success("添加成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.ADD.SUCCESS')); callback(); yield put({ type: "reloadRule", fetchValue }); } else { @@ -114,7 +115,7 @@ export default { const { list } = payload; const json = yield call(deleteSelector, { list }); if (json.code === 200) { - message.success("删除成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.DELETE.SUCCESS')); yield put({ type: "saveRule", payload: { @@ -131,7 +132,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(updateSelector, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -143,7 +144,7 @@ export default { const { list } = payload; const json = yield call(deleteRule, { list }); if (json.code === 200) { - message.success("删除成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.DELETE.SUCCESS')); yield put({ type: "reloadRule", fetchValue }); } else { message.warn(json.message); @@ -161,7 +162,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(updateRule, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({ type: "reloadRule", fetchValue }); } else { diff --git a/src/models/soulDict.js b/src/models/soulDict.js index bd136b775..76bd438bb 100644 --- a/src/models/soulDict.js +++ b/src/models/soulDict.js @@ -8,6 +8,7 @@ import { fetchSoulDictByType, updateSoulDictEnabled, } from "../services/api"; +import {getIntlContent} from "../utils/IntlUtils"; export default { @@ -41,7 +42,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(addSoulDict, payload); if (json.code === 200) { - message.success("添加成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.ADD.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -60,7 +61,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(updateSoulDict, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -72,7 +73,7 @@ export default { const { list } = payload; const json = yield call(batchDeleteSoulDict, { list }); if (json.code === 200) { - message.success("删除成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.DELETE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -83,7 +84,7 @@ export default { const {payload,fetchValue,callback} = params; const json = yield call (updateSoulDictEnabled,payload); if(json.code===200){ - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({type: "reload", fetchValue}); } else { diff --git a/src/models/spring.js b/src/models/spring.js index d0398305a..f09290b86 100644 --- a/src/models/spring.js +++ b/src/models/spring.js @@ -11,6 +11,7 @@ import { findRule, updateRule, } from "../services/api"; +import {getIntlContent} from "../utils/IntlUtils"; export default { namespace: "spring", @@ -81,7 +82,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(addSelector, payload); if (json.code === 200) { - message.success("添加成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.ADD.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -93,7 +94,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(addRule, payload); if (json.code === 200) { - message.success("添加成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.ADD.SUCCESS')); callback(); yield put({ type: "reloadRule", fetchValue }); } else { @@ -114,7 +115,7 @@ export default { const { list } = payload; const json = yield call(deleteSelector, { list }); if (json.code === 200) { - message.success("删除成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.DELETE.SUCCESS')); yield put({ type: "saveRule", payload: { @@ -131,7 +132,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(updateSelector, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({ type: "reload", fetchValue }); } else { @@ -143,7 +144,7 @@ export default { const { list } = payload; const json = yield call(deleteRule, { list }); if (json.code === 200) { - message.success("删除成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.DELETE.SUCCESS')); yield put({ type: "reloadRule", fetchValue }); } else { message.warn(json.message); @@ -161,7 +162,7 @@ export default { const { payload, callback, fetchValue } = params; const json = yield call(updateRule, payload); if (json.code === 200) { - message.success("修改成功"); + message.success(getIntlContent('SOUL.COMMON.RESPONSE.UPDATE.SUCCESS')); callback(); yield put({ type: "reloadRule", fetchValue }); } else { diff --git a/src/router.js b/src/router.js index 4784fd6fd..641d9f853 100644 --- a/src/router.js +++ b/src/router.js @@ -1,6 +1,6 @@ import React from 'react'; import { routerRedux, Route, Switch } from 'dva/router'; -import { LocaleProvider } from 'antd'; +import { ConfigProvider } from 'antd'; import enUS from 'antd/lib/locale-provider/en_US'; import { getRouterData } from './common/router'; import Authorized from './utils/Authorized'; @@ -16,7 +16,7 @@ function RouterConfig({ history, app }) { const BasicLayout = routerData['/'].component; return ( - + @@ -30,7 +30,7 @@ function RouterConfig({ history, app }) { /> - + ); } diff --git a/src/routes/Plugin/Common/Rule.js b/src/routes/Plugin/Common/Rule.js index e259dc4a4..ec4ef8e4f 100644 --- a/src/routes/Plugin/Common/Rule.js +++ b/src/routes/Plugin/Common/Rule.js @@ -69,7 +69,7 @@ class AddModal extends Component { const { paramType, operator, paramName, paramValue } = item; if (!paramType || !operator || !paramValue) { message.destroy(); - message.error(`第${index + 1}行条件不完整`); + message.error(`Line ${index + 1} condition is incomplete`); result = false; } if (paramType === "uri" || paramType === "host" || paramType === "ip") { @@ -78,14 +78,14 @@ class AddModal extends Component { // eslint-disable-next-line no-lonely-if if (!paramName) { message.destroy(); - message.error(`第${index + 1}行条件不完整`); + message.error(`Line ${index + 1} condition is incomplete`); result = false; } } }); } else { message.destroy(); - message.error(`条件不完整`); + message.error(`Incomplete condition`); result = false; } @@ -143,7 +143,7 @@ class AddModal extends Component { ruleConditions.splice(index, 1); } else { message.destroy(); - message.error("至少有一个条件"); + message.error("At least one condition"); } this.setState({ ruleConditions }); }; diff --git a/src/routes/Plugin/Common/Selector.js b/src/routes/Plugin/Common/Selector.js index 17979603d..6c3a4d7f9 100644 --- a/src/routes/Plugin/Common/Selector.js +++ b/src/routes/Plugin/Common/Selector.js @@ -72,7 +72,7 @@ class AddModal extends Component { const { paramType, operator, paramName, paramValue } = item; if (!paramType || !operator || !paramValue) { message.destroy(); - message.error(`第${index + 1}行条件不完整`); + message.error(`Line ${index + 1} condition is incomplete`); result = false; } if (paramType === "uri" || paramType === "host" || paramType === "ip") { @@ -81,14 +81,14 @@ class AddModal extends Component { // eslint-disable-next-line no-lonely-if if (!paramName) { message.destroy(); - message.error(`第${index + 1}行条件不完整`); + message.error(`Line ${index + 1} condition is incomplete`); result = false; } } }); } else { message.destroy(); - message.error(`条件不完整`); + message.error(`Incomplete condition`); result = false; } return result; @@ -142,7 +142,7 @@ class AddModal extends Component { selectorConditions.splice(index, 1); } else { message.destroy(); - message.error("至少有一个条件"); + message.error("At least one condition"); } this.setState({ selectorConditions }); }; diff --git a/src/routes/Plugin/Common/index.js b/src/routes/Plugin/Common/index.js index 094577e46..ea3694d00 100644 --- a/src/routes/Plugin/Common/index.js +++ b/src/routes/Plugin/Common/index.js @@ -164,7 +164,7 @@ export default class Common extends Component { }); } else { message.destroy(); - message.warn("请先添加选择器"); + message.warn(getIntlContent('SOUL.COMMON.WARN.INPUT_SELECTOR')); } }; @@ -239,7 +239,7 @@ export default class Common extends Component { this.getAllRules(page); }; - // 点击选择器 + // select rowClick = record => { const { id } = record; const { dispatch } = this.props; @@ -425,9 +425,9 @@ export default class Common extends Component { key: "enabled", render: text => { if (text) { - return
开启
; + return
{getIntlContent("SOUL.COMMON.OPEN")}
; } else { - return
关闭
; + return
{getIntlContent("SOUL.COMMON.CLOSE")}
; } } }, diff --git a/src/routes/Plugin/Divide/Rule.js b/src/routes/Plugin/Divide/Rule.js index 81dd5c0fc..205cbcb91 100644 --- a/src/routes/Plugin/Divide/Rule.js +++ b/src/routes/Plugin/Divide/Rule.js @@ -81,7 +81,7 @@ class AddModal extends Component { const { paramType, operator, paramName, paramValue } = item; if (!paramType || !operator || !paramValue) { message.destroy(); - message.error(`第${index + 1}行条件不完整`); + message.error(`Line ${index + 1} condition is incomplete`); result = false; } if (paramType === "uri" || paramType === "host" || paramType === "ip") { @@ -90,26 +90,26 @@ class AddModal extends Component { // eslint-disable-next-line no-lonely-if if (!paramName) { message.destroy(); - message.error(`第${index + 1}行条件不完整`); + message.error(`Line ${index + 1} condition is incomplete`); result = false; } } }); } else { message.destroy(); - message.error(`条件不完整`); + message.error(`Incomplete condition`); result = false; } if (!loadBalance) { message.destroy(); - message.error(`负载策略不能为空`); + message.error(`The loadBalance cannot be null`); result = false; } if (!timeout) { message.destroy(); - message.error(`超时时间不能为空`); + message.error(`The timeout cannot be null`); result = false; } @@ -196,7 +196,7 @@ class AddModal extends Component { ruleConditions.splice(index, 1); } else { message.destroy(); - message.error("至少有一个条件"); + message.error("At least one condition"); } this.setState({ ruleConditions }); }; diff --git a/src/routes/Plugin/Divide/index.js b/src/routes/Plugin/Divide/index.js index 53b938ae1..925311134 100644 --- a/src/routes/Plugin/Divide/index.js +++ b/src/routes/Plugin/Divide/index.js @@ -128,7 +128,7 @@ export default class Divide extends Component { }); } else { message.destroy(); - message.warn("请先添加选择器"); + message.warn(getIntlContent('SOUL.COMMON.WARN.INPUT_SELECTOR')); } }; @@ -203,7 +203,6 @@ export default class Divide extends Component { this.getAllRules(page); }; - // 点击选择器 rowClick = record => { const { id } = record; const { dispatch } = this.props; diff --git a/src/routes/Plugin/Hystrix/Rule.js b/src/routes/Plugin/Hystrix/Rule.js index dcb97a1eb..0ac99b73f 100644 --- a/src/routes/Plugin/Hystrix/Rule.js +++ b/src/routes/Plugin/Hystrix/Rule.js @@ -87,7 +87,7 @@ class AddModal extends Component { const { paramType, operator, paramName, paramValue } = item; if (!paramType || !operator || !paramValue) { message.destroy(); - message.error(`第${index + 1}行条件不完整`); + message.error(`Line ${index + 1} condition is incomplete`); result = false; } if (paramType === "uri" || paramType === "host" || paramType === "ip") { @@ -96,20 +96,20 @@ class AddModal extends Component { // eslint-disable-next-line no-lonely-if if (!paramName) { message.destroy(); - message.error(`第${index + 1}行条件不完整`); + message.error(`Line ${index + 1} condition is incomplete`); result = false; } } }); } else { message.destroy(); - message.error(`条件不完整`); + message.error(`Incomplete condition`); result = false; } if (permission === "reject" && !statusCode) { message.destroy(); - message.error(`请填写状态码`); + message.error(`Please input the status code`); result = false; } @@ -210,7 +210,7 @@ class AddModal extends Component { ruleConditions.splice(index, 1); } else { message.destroy(); - message.error("至少有一个条件"); + message.error("At least one condition"); } this.setState({ ruleConditions }); }; diff --git a/src/routes/Plugin/Hystrix/Selector.js b/src/routes/Plugin/Hystrix/Selector.js index 40bcff7a8..c89fae144 100644 --- a/src/routes/Plugin/Hystrix/Selector.js +++ b/src/routes/Plugin/Hystrix/Selector.js @@ -49,7 +49,7 @@ class AddModal extends Component { const { paramType, operator, paramName, paramValue } = item; if (!paramType || !operator || !paramValue) { message.destroy(); - message.error(`第${index + 1}行条件不完整`); + message.error(`Line ${index + 1} condition is incomplete`); result = false; } if (paramType === "uri" || paramType === "host" || paramType === "ip") { @@ -58,14 +58,14 @@ class AddModal extends Component { // eslint-disable-next-line no-lonely-if if (!paramName) { message.destroy(); - message.error(`第${index + 1}行条件不完整`); + message.error(`Line ${index + 1} condition is incomplete`); result = false; } } }); } else { message.destroy(); - message.error(`条件不完整`); + message.error(`Incomplete condition`); result = false; } return result; @@ -113,7 +113,7 @@ class AddModal extends Component { selectorConditions.splice(index, 1); } else { message.destroy(); - message.error("至少有一个条件"); + message.error("At least one condition"); } this.setState({ selectorConditions }); }; diff --git a/src/routes/Plugin/Hystrix/index.js b/src/routes/Plugin/Hystrix/index.js index 02090da7c..720f04373 100644 --- a/src/routes/Plugin/Hystrix/index.js +++ b/src/routes/Plugin/Hystrix/index.js @@ -129,7 +129,7 @@ export default class Hystrix extends Component { }); } else { message.destroy(); - message.warn("请先添加选择器"); + message.warn(getIntlContent('SOUL.COMMON.WARN.INPUT_SELECTOR')); } }; @@ -202,7 +202,6 @@ export default class Hystrix extends Component { this.getAllRules(page); }; - // 点击选择器 rowClick = record => { const { id } = record; const { dispatch } = this.props; diff --git a/src/routes/System/AppAuth/AddModal.js b/src/routes/System/AppAuth/AddModal.js index 7d5fcf6eb..ca180e901 100644 --- a/src/routes/System/AppAuth/AddModal.js +++ b/src/routes/System/AppAuth/AddModal.js @@ -40,7 +40,7 @@ class AddModal extends Component { selectorConditions.splice(index, 1); } else { message.destroy(); - message.error("至少有一个条件"); + message.error("At least one condition"); } this.setState({ selectorConditions }); }; diff --git a/src/routes/System/AppAuth/TableTransfer.js b/src/routes/System/AppAuth/TableTransfer.js index da23fc5ec..9d66e182e 100644 --- a/src/routes/System/AppAuth/TableTransfer.js +++ b/src/routes/System/AppAuth/TableTransfer.js @@ -4,13 +4,14 @@ import 'antd/dist/antd.css'; import { Transfer, Table } from 'antd'; import difference from 'lodash/difference'; +import {getIntlContent} from "../../../utils/IntlUtils"; // import uniqBy from 'lodash/uniqBy'; // import reqwest from 'reqwest'; const columns = [ { dataIndex: 'path', - title: '资源路径', + title: getIntlContent('SOUL.AUTH.RESOUCE.PATH'), width: 200, textWrap: 'word-break', align: 'center', @@ -18,7 +19,7 @@ const columns = [ }, { dataIndex: 'appName', - title: '应用名称', + title: getIntlContent('SOUL.AUTH.APPNAME'), width: 100, textWrap: 'word-break', align: 'center', @@ -45,7 +46,7 @@ class TableTransfer extends React.Component { const { authName } = this.props; const { dataSource, pagination } = this.state; return ( - record.path}> + record.path}> {({ direction, // 渲染列表的方向 filteredItems, diff --git a/src/routes/System/AppAuth/index.js b/src/routes/System/AppAuth/index.js index 1c0d818e1..3094afe76 100644 --- a/src/routes/System/AppAuth/index.js +++ b/src/routes/System/AppAuth/index.js @@ -224,7 +224,7 @@ export default class Auth extends Component { }); } else { message.destroy(); - message.warn("请选择数据"); + message.warn("Please select data"); } }; @@ -296,7 +296,7 @@ export default class Auth extends Component { }) } else { message.destroy(); - message.warn("请选择数据"); + message.warn("Please select data"); } } diff --git a/src/routes/System/Dict/AddModal.js b/src/routes/System/Dict/AddModal.js index 408050a89..2ec440f0f 100644 --- a/src/routes/System/Dict/AddModal.js +++ b/src/routes/System/Dict/AddModal.js @@ -117,7 +117,7 @@ class AddModal extends Component { )} - {/* 状态 */} + {/* status */} {this.props.isShow? ( - // )} )} - {/* 下拉 */} + {/* select */} )} - {/* 状态 */} + {/* status */} {this.props.isShow? ( {} }) } -export function getIntlContent(key) { - return intl.get(key); +export function getIntlContent(key, defaultValue) { + return intl.get(key).defaultMessage(defaultValue); } export function getCurrentLocale(locale) {