You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/07/27 08:58:16 UTC
[incubator-apisix-dashboard] branch master updated: feat(i18n):
route module (#327)
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 062e4e9 feat(i18n): route module (#327)
062e4e9 is described below
commit 062e4e95ff746570748eb26c8e2f6ade595858f7
Author: TikWind <65...@users.noreply.github.com>
AuthorDate: Mon Jul 27 16:56:06 2020 +0800
feat(i18n): route module (#327)
* i18n route
* combine import
---
src/pages/Route/Create.tsx | 5 +-
src/pages/Route/List.tsx | 32 ++---
.../Route/components/CreateStep4/CreateStep4.tsx | 10 +-
.../Route/components/ResultView/ResultView.tsx | 20 +--
.../Route/components/Step1/MatchingRulesView.tsx | 77 ++++++------
src/pages/Route/components/Step1/MetaView.tsx | 18 +--
.../Route/components/Step1/RequestConfigView.tsx | 53 ++++----
.../components/Step2/HttpHeaderRewriteView.tsx | 42 ++++---
.../Route/components/Step2/RequestRewriteView.tsx | 58 ++++-----
src/pages/Route/locales/en-US.ts | 136 +++++++++++++++++++++
src/pages/Route/locales/zh-CN.ts | 136 +++++++++++++++++++++
11 files changed, 442 insertions(+), 145 deletions(-)
diff --git a/src/pages/Route/Create.tsx b/src/pages/Route/Create.tsx
index ee612ca..b3456e1 100644
--- a/src/pages/Route/Create.tsx
+++ b/src/pages/Route/Create.tsx
@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react';
import { Card, Steps, Form } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
+import { useIntl } from 'umi';
import ActionBar from '@/components/ActionBar';
import PluginPage from '@/components/PluginPage';
@@ -64,6 +65,8 @@ const Page: React.FC<Props> = (props) => {
setStep3Data(data.step3Data);
});
+ const { formatMessage } = useIntl();
+
useEffect(() => {
if (props.route.path.indexOf('edit') !== -1) {
setupRoute(props.match.params.rid);
@@ -208,7 +211,7 @@ const Page: React.FC<Props> = (props) => {
return (
<>
- <PageHeaderWrapper title="路由管理">
+ <PageHeaderWrapper title={formatMessage({ id: 'route.create.management' })}>
<Card bordered={false}>
<Steps current={step - 1} className={styles.steps}>
{stepHeader.map((item) => (
diff --git a/src/pages/Route/List.tsx b/src/pages/Route/List.tsx
index b91cdfe..ed19a40 100644
--- a/src/pages/Route/List.tsx
+++ b/src/pages/Route/List.tsx
@@ -5,20 +5,22 @@ import { Button, Popconfirm, notification, Tag, Input } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import moment from 'moment';
import { history } from 'umi';
+import { useIntl } from 'umi';
import { fetchList, remove } from './service';
const Page: React.FC = () => {
const ref = useRef<ActionType>();
const [search, setSearch] = useState('');
+ const { formatMessage } = useIntl();
const columns: ProColumns<RouteModule.BaseData>[] = [
{
- title: '名称',
+ title: formatMessage({ id: 'route.list.name' }),
dataIndex: 'name',
},
{
- title: '域名',
+ title: formatMessage({ id: 'route.list.domain.name' }),
dataIndex: 'hosts',
render: (_, record) =>
record.hosts.map((host) => (
@@ -28,7 +30,7 @@ const Page: React.FC = () => {
)),
},
{
- title: '路径',
+ title: formatMessage({ id: 'route.list.path' }),
dataIndex: 'uri',
render: (_, record) =>
record.uris.map((uri) => (
@@ -42,16 +44,16 @@ const Page: React.FC = () => {
// dataIndex: 'priority',
// },
{
- title: '描述',
+ title: formatMessage({ id: 'route.list.description' }),
dataIndex: 'description',
},
{
- title: '更新时间',
+ title: formatMessage({ id: 'route.list.edit.time' }),
dataIndex: 'update_time',
render: (text) => `${moment.unix(Number(text)).format('YYYY-MM-DD HH:mm:ss')}`,
},
{
- title: '操作',
+ title: formatMessage({ id: 'route.list.operation' }),
valueType: 'option',
render: (_, record) => (
<>
@@ -60,22 +62,22 @@ const Page: React.FC = () => {
onClick={() => history.push(`/routes/${record.id}/edit`)}
style={{ marginRight: 10 }}
>
- 编辑
+ {formatMessage({ id: 'route.list.edit' })}
</Button>
<Popconfirm
- title="确定删除该路由吗?"
+ title={formatMessage({ id: 'route.list.delete.confrim' })}
onConfirm={() => {
remove(record.id!).then(() => {
- notification.success({ message: '删除记录成功' });
+ notification.success({ message: formatMessage({ id: 'route.list.delete.success' }) });
/* eslint-disable no-unused-expressions */
ref.current?.reload();
});
}}
- okText="确定"
- cancelText="取消"
+ okText={formatMessage({ id: 'route.list.confirm' })}
+ cancelText={formatMessage({ id: 'route.list.cancel' })}
>
<Button type="primary" danger>
- 删除
+ {formatMessage({ id: 'route.list.delete' })}
</Button>
</Popconfirm>
</>
@@ -84,7 +86,7 @@ const Page: React.FC = () => {
];
return (
- <PageHeaderWrapper title="路由列表">
+ <PageHeaderWrapper title={formatMessage({ id: 'route.list' })}>
<ProTable<RouteModule.BaseData>
actionRef={ref}
rowKey="name"
@@ -93,7 +95,7 @@ const Page: React.FC = () => {
request={(params) => fetchList(params, search)}
toolBarRender={(action) => [
<Input.Search
- placeholder="请输入"
+ placeholder={formatMessage({ id: 'route.list.input' })}
onSearch={(value) => {
setSearch(value);
action.setPageInfo({ page: 1 });
@@ -102,7 +104,7 @@ const Page: React.FC = () => {
/>,
<Button type="primary" onClick={() => history.push('/routes/create')}>
<PlusOutlined />
- 创建
+ {formatMessage({ id: 'route.list.create' })}
</Button>,
]}
/>
diff --git a/src/pages/Route/components/CreateStep4/CreateStep4.tsx b/src/pages/Route/components/CreateStep4/CreateStep4.tsx
index 522995a..dc3131a 100644
--- a/src/pages/Route/components/CreateStep4/CreateStep4.tsx
+++ b/src/pages/Route/components/CreateStep4/CreateStep4.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import { FormInstance } from 'antd/lib/form';
+import { useIntl } from 'umi';
import PluginPage from '@/components/PluginPage';
@@ -17,15 +18,18 @@ const style = {
};
const CreateStep4: React.FC<Props> = ({ form1, form2, redirect, ...rest }) => {
+
+ const { formatMessage } = useIntl();
+
return (
<>
- <h2>定义 API 请求</h2>
+ <h2>{formatMessage({ id: 'route.create.define.api.request' })}</h2>
<Step1 {...rest} form={form1} disabled />
{!redirect && (
<>
- <h2 style={style}>定义 API 后端服务</h2>
+ <h2 style={style}>{formatMessage({ id: 'route.create.define.api.backend.server' })}</h2>
<Step2 {...rest} form={form2} disabled />
- <h2 style={style}>插件配置</h2>
+ <h2 style={style}>{formatMessage({ id: 'route.create.plugin.configuration' })}</h2>
<PluginPage data={rest.data.step3Data.plugins} disabled />
</>
)}
diff --git a/src/pages/Route/components/ResultView/ResultView.tsx b/src/pages/Route/components/ResultView/ResultView.tsx
index 1283799..784ab0c 100644
--- a/src/pages/Route/components/ResultView/ResultView.tsx
+++ b/src/pages/Route/components/ResultView/ResultView.tsx
@@ -1,24 +1,30 @@
import React from 'react';
import { Result, Button } from 'antd';
-import { history } from 'umi';
+import { history, useIntl } from 'umi';
type Props = {
onReset?(): void;
};
-const ResultView: React.FC<Props> = () => (
- <Result
+const ResultView: React.FC<Props> = () => {
+
+ const { formatMessage } = useIntl();
+
+ return(
+ <Result
status="success"
- title="提交成功"
+ title={formatMessage({ id: 'route.result.submit.success' })}
extra={[
<Button type="primary" key="goto-list" onClick={() => history.replace('/routes/list')}>
- 返回路由列表
+ {formatMessage({ id: 'route.result.return.list' })}
</Button>,
<Button key="create-new" onClick={() => history.replace('/routes/create')}>
- 创建新路由
+ {formatMessage({ id: 'route.result.create' })}
</Button>,
]}
/>
-);
+ );
+
+};
export default ResultView;
diff --git a/src/pages/Route/components/Step1/MatchingRulesView.tsx b/src/pages/Route/components/Step1/MatchingRulesView.tsx
index 7b85d2c..6c6694e 100644
--- a/src/pages/Route/components/Step1/MatchingRulesView.tsx
+++ b/src/pages/Route/components/Step1/MatchingRulesView.tsx
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import { Button, Table, Modal, Form, Select, Input, Space } from 'antd';
+import { useIntl } from 'umi';
import PanelSection from '@/components/PanelSection';
@@ -15,6 +16,8 @@ const MatchingRulesView: React.FC<Props> = ({ data, disabled, onChange }) => {
const { Option } = Select;
+ const { formatMessage } = useIntl();
+
const onOk = () => {
modalForm.validateFields().then((value) => {
if (mode === 'EDIT') {
@@ -55,16 +58,16 @@ const MatchingRulesView: React.FC<Props> = ({ data, disabled, onChange }) => {
const columns = [
{
- title: '参数位置',
+ title: formatMessage({ id: 'route.match.parameter.position' }),
key: 'position',
render: (text: RouteModule.MatchingRule) => {
let renderText;
switch (text.position) {
case 'http':
- renderText = 'HTTP 请求头';
+ renderText = formatMessage({ id: 'route.match.http.request.header' });
break;
case 'arg':
- renderText = '请求参数';
+ renderText = formatMessage({ id: 'route.match.request.parameter' });
break;
case 'cookie':
renderText = 'Cookie';
@@ -76,30 +79,30 @@ const MatchingRulesView: React.FC<Props> = ({ data, disabled, onChange }) => {
},
},
{
- title: '参数名称',
+ title: formatMessage({ id: 'route.match.parameter.name' }),
dataIndex: 'name',
key: 'name',
},
{
- title: '运算符',
+ title: formatMessage({ id: 'route.match.operational.character' }),
key: 'operator',
render: (text: RouteModule.MatchingRule) => {
let renderText;
switch (text.operator) {
case '==':
- renderText = '等于';
+ renderText = formatMessage({ id: 'route.match.equal' });
break;
case '~=':
- renderText = '不等于';
+ renderText = formatMessage({ id: 'route.match.unequal' });
break;
case '>':
- renderText = '大于';
+ renderText = formatMessage({ id: 'route.match.greater.than' });
break;
case '<':
- renderText = '小于';
+ renderText = formatMessage({ id: 'route.match.less.than' });
break;
case '~~':
- renderText = '正则匹配';
+ renderText = formatMessage({ id: 'route.match.regex.match' });
break;
default:
renderText = '';
@@ -108,19 +111,19 @@ const MatchingRulesView: React.FC<Props> = ({ data, disabled, onChange }) => {
},
},
{
- title: '参数值',
+ title: formatMessage({ id: 'route.match.parameter.value' }),
dataIndex: 'value',
key: 'value',
},
disabled
? {}
: {
- title: '操作',
+ title: formatMessage({ id: 'route.match.operation' }),
key: 'action',
render: (_: any, record: RouteModule.MatchingRule) => (
<Space size="middle">
- <a onClick={() => handleEdit(record)}>编辑</a>
- <a onClick={() => handleRemove(record.key)}>删除</a>
+ <a onClick={() => handleEdit(record)}>{formatMessage({ id: 'route.match.edit' })}</a>
+ <a onClick={() => handleRemove(record.key)}>{formatMessage({ id: 'route.match.delete' })}</a>
</Space>
),
},
@@ -128,7 +131,7 @@ const MatchingRulesView: React.FC<Props> = ({ data, disabled, onChange }) => {
const renderModal = () => (
<Modal
- title={mode === 'EDIT' ? '编辑规则' : '新建规则'}
+ title={mode === 'EDIT' ? formatMessage({ id: 'route.match.edit.rule' }) : formatMessage({ id: 'route.match.create.rule' })}
centered
visible
onOk={onOk}
@@ -136,58 +139,58 @@ const MatchingRulesView: React.FC<Props> = ({ data, disabled, onChange }) => {
setVisible(false);
modalForm.resetFields();
}}
- okText="确定"
- cancelText="取消"
+ okText={formatMessage({ id: 'route.match.confirm' })}
+ cancelText={formatMessage({ id: 'route.match.cancel' })}
destroyOnClose
>
<Form form={modalForm} labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
<Form.Item
- label="参数位置"
+ label={formatMessage({ id: 'route.match.parameter.position' })}
name="position"
- rules={[{ required: true, message: '请选择参数位置' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.match.select.parameter.position' }) }]}
>
<Select
onChange={(value) => {
if (value === 'http') {
- setNamePlaceholder('请求头键名:例如 HOST');
+ setNamePlaceholder(formatMessage({ id: 'route.match.request.header.example' }));
} else {
- setNamePlaceholder('参数名称:例如 id');
+ setNamePlaceholder(formatMessage({ id: 'route.match.parameter.name.example' }));
}
}}
>
- <Option value="http">HTTP 请求头</Option>
- <Option value="arg">请求参数</Option>
+ <Option value="http">{formatMessage({ id: 'route.match.http.request.header' })}</Option>
+ <Option value="arg">{formatMessage({ id: 'route.match.request.parameter' })}</Option>
<Option value="cookie">Cookie</Option>
</Select>
</Form.Item>
<Form.Item
- label="参数名称"
+ label={formatMessage({ id: 'route.match.parameter.name' })}
name="name"
rules={[
- { required: true, message: '请输入参数名称' },
+ { required: true, message: formatMessage({ id: 'route.match.input.parameter.name' }) },
{
pattern: new RegExp(/^([a-zA-Z][a-zA-Z0-9_-]*$)/, 'g'),
- message: '参数只支持字母、数字、-、_,并且以字母开头',
+ message: formatMessage({ id: 'route.match.parameter.name.rule' }),
},
]}
- extra="只支持字母和数字,并且以字母开头"
+ extra={formatMessage({ id: 'route.match.rule' })}
>
<Input placeholder={namePlaceholder} />
</Form.Item>
<Form.Item
- label="运算符"
+ label={formatMessage({ id: 'route.match.operational.character' })}
name="operator"
- rules={[{ required: true, message: '请选择运算符' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.match.choose.operational.character' }) }]}
>
<Select>
- <Option value="==">等于</Option>
- <Option value="~=">不等于</Option>
- <Option value=">">大于</Option>
- <Option value="<">小于</Option>
- <Option value="~~">正则匹配</Option>
+ <Option value="==">{formatMessage({ id: 'route.match.equal' })}</Option>
+ <Option value="~=">{formatMessage({ id: 'route.match.unequal' })}</Option>
+ <Option value=">">{formatMessage({ id: 'route.match.greater.than' })}</Option>
+ <Option value="<">{formatMessage({ id: 'route.match.less.than' })}</Option>
+ <Option value="~~">{formatMessage({ id: 'route.match.regex.match' })}</Option>
</Select>
</Form.Item>
- <Form.Item label="值" name="value" rules={[{ required: true, message: '请输入参数值' }]}>
+ <Form.Item label={formatMessage({ id: 'route.match.value' })} name="value" rules={[{ required: true, message: formatMessage({ id: 'route.match.input.parameter.value' }) }]}>
<Input />
</Form.Item>
</Form>
@@ -195,7 +198,7 @@ const MatchingRulesView: React.FC<Props> = ({ data, disabled, onChange }) => {
);
return (
- <PanelSection title="高级路由匹配条件">
+ <PanelSection title={formatMessage({ id: 'route.match.advanced.match.rule' })}>
{!disabled && (
<Button
onClick={() => {
@@ -207,7 +210,7 @@ const MatchingRulesView: React.FC<Props> = ({ data, disabled, onChange }) => {
marginBottom: 16,
}}
>
- 新建
+ {formatMessage({ id: 'route.match.create' })}
</Button>
)}
<Table key="table" bordered dataSource={advancedMatchingRules} columns={columns} />
diff --git a/src/pages/Route/components/Step1/MetaView.tsx b/src/pages/Route/components/Step1/MetaView.tsx
index d49ea26..5e5e109 100644
--- a/src/pages/Route/components/Step1/MetaView.tsx
+++ b/src/pages/Route/components/Step1/MetaView.tsx
@@ -1,30 +1,32 @@
import React from 'react';
import Form from 'antd/es/form';
import { Input } from 'antd';
+import { useIntl } from 'umi';
import PanelSection from '@/components/PanelSection';
interface Props extends RouteModule.Data {}
const MetaView: React.FC<Props> = ({ disabled }) => {
+ const { formatMessage } = useIntl();
return (
- <PanelSection title="名称及其描述">
+ <PanelSection title={formatMessage({ id: 'route.meta.name.description' })}>
<Form.Item
- label="API 名称"
+ label={formatMessage({ id: 'route.meta.api.name' })}
name="name"
rules={[
- { required: true, message: '请输入 API 名称' },
+ { required: true, message: formatMessage({ id: 'route.meta.input.api.name' }) },
{
pattern: new RegExp(/^[a-zA-Z][a-zA-Z0-9_-]{0,100}$/, 'g'),
- message: '最大长度100,仅支持英文,数字,下划线和减号,且只能以英文开头',
+ message: formatMessage({ id: 'route.meta.api.name.rule' }),
},
]}
- extra="支持英文,数字,下划线和减号,且只能以英文开头"
+ extra={formatMessage({ id: 'rotue.meta.api.rule' })}
>
- <Input placeholder="请输入 API 名称" disabled={disabled} />
+ <Input placeholder={formatMessage({ id: 'route.meta.input.api.name' })} disabled={disabled} />
</Form.Item>
- <Form.Item label="描述" name="desc">
- <Input.TextArea placeholder="不超过 200 个字符" disabled={disabled} />
+ <Form.Item label={formatMessage({ id: 'route.meta.description' })} name="desc">
+ <Input.TextArea placeholder={formatMessage({ id: 'route.meta.description.rule' })} disabled={disabled} />
</Form.Item>
</PanelSection>
);
diff --git a/src/pages/Route/components/Step1/RequestConfigView.tsx b/src/pages/Route/components/Step1/RequestConfigView.tsx
index 25b076a..f5b8156 100644
--- a/src/pages/Route/components/Step1/RequestConfigView.tsx
+++ b/src/pages/Route/components/Step1/RequestConfigView.tsx
@@ -3,6 +3,7 @@ import Form from 'antd/es/form';
import { Checkbox, Button, Input, Switch, Select, Row, Col } from 'antd';
import { PlusOutlined, MinusCircleOutlined } from '@ant-design/icons';
import { CheckboxValueType } from 'antd/lib/checkbox/Group';
+import { useIntl } from 'umi';
import {
HTTP_METHOD_OPTION_LIST,
@@ -21,6 +22,7 @@ const RequestConfigView: React.FC<Props> = ({ data, disabled, onChange }) => {
if (!e.includes('http') && !e.includes('https')) return;
onChange({ ...data.step1Data, protocols: e });
};
+ const { formatMessage } = useIntl();
const renderHosts = () => (
<Form.List name="hosts">
{(fields, { add, remove }) => {
@@ -29,10 +31,10 @@ const RequestConfigView: React.FC<Props> = ({ data, disabled, onChange }) => {
{fields.map((field, index) => (
<Form.Item
{...(index === 0 ? FORM_ITEM_LAYOUT : FORM_ITEM_WITHOUT_LABEL)}
- label={index === 0 ? '域名' : ''}
+ label={index === 0 ? formatMessage({ id: 'route.request.config.domain.name' }) : ''}
required
key={field.key}
- extra={index === 0 ? '域名或 IP:支持泛域名,如 "*.test.com"' : ''}
+ extra={index === 0 ? formatMessage({ id: 'route.request.config.domain.or.ip' }) : ''}
>
<Form.Item
{...field}
@@ -41,16 +43,16 @@ const RequestConfigView: React.FC<Props> = ({ data, disabled, onChange }) => {
{
required: true,
whitespace: true,
- message: '请输入域名',
+ message: formatMessage({ id: 'route.request.config.input.domain.name' }),
},
{
pattern: new RegExp(/(^\*?[a-zA-Z0-9._-]+$|^\*$)/, 'g'),
- message: '仅支持英文、数字、* (*只能是在开头位置),支持单个 *',
+ message: formatMessage({ id: 'route.request.config.domain.name.rule' }),
},
]}
noStyle
>
- <Input placeholder="请输入域名" style={{ width: '60%' }} disabled={disabled} />
+ <Input placeholder={formatMessage({ id: 'route.request.config.input.domain.name' })} style={{ width: '60%' }} disabled={disabled} />
</Form.Item>
{!disabled && fields.length > 1 ? (
<MinusCircleOutlined
@@ -71,7 +73,7 @@ const RequestConfigView: React.FC<Props> = ({ data, disabled, onChange }) => {
add();
}}
>
- <PlusOutlined /> 新建
+ <PlusOutlined /> {formatMessage({ id: 'route.request.config.create' })}
</Button>
</Form.Item>
)}
@@ -89,16 +91,15 @@ const RequestConfigView: React.FC<Props> = ({ data, disabled, onChange }) => {
{fields.map((field, index) => (
<Form.Item
{...(index === 0 ? FORM_ITEM_LAYOUT : FORM_ITEM_WITHOUT_LABEL)}
- label={index === 0 ? '路径' : ''}
+ label={index === 0 ? formatMessage({ id: 'route.request.config.path' }) : ''}
required
key={field.key}
extra={
index === 0 ? (
<div>
- 1. 请求路径,如 "/foo/index.html",支持请求路径前缀
- "/foo/*";
+ {formatMessage({ id: 'route.request.config.path.description1' })}
<br />
- 2. "/*" 代表所有路径
+ {formatMessage({ id: 'route.request.config.path.description2' })}
</div>
) : null
}
@@ -110,17 +111,17 @@ const RequestConfigView: React.FC<Props> = ({ data, disabled, onChange }) => {
{
required: true,
whitespace: true,
- message: '请输入请求路径',
+ message: formatMessage({ id: 'route.request.config.input.path' }),
},
{
pattern: new RegExp(/^\/[a-zA-Z0-9\-._~%!$&'()+,;=:@/]*\*?$/, 'g'),
- message: '以/开头,*只能在最后',
+ message: formatMessage({ id: 'route.request.config.path.rule' }),
},
]}
noStyle
>
<Input
- placeholder="请输入请求路径"
+ placeholder={formatMessage({ id: 'route.request.config.input.path' })}
style={{ width: '60%' }}
disabled={disabled}
/>
@@ -144,7 +145,7 @@ const RequestConfigView: React.FC<Props> = ({ data, disabled, onChange }) => {
add();
}}
>
- <PlusOutlined /> 新建
+ <PlusOutlined /> {formatMessage({ id: 'route.request.config.create' })}
</Button>
</Form.Item>
)}
@@ -155,8 +156,8 @@ const RequestConfigView: React.FC<Props> = ({ data, disabled, onChange }) => {
);
return (
- <PanelSection title="请求基础定义">
- <Form.Item label="协议" name="protocols" rules={[{ required: true, message: '请选择协议' }]}>
+ <PanelSection title={formatMessage({ id: 'route.request.config.basic.define' })}>
+ <Form.Item label={formatMessage({ id: 'route.request.config.protocol' })} name="protocols" rules={[{ required: true, message: formatMessage({ id: 'route.request.config.choose.protocol' }) }]}>
<Checkbox.Group
disabled={disabled}
options={['http', 'https']}
@@ -178,32 +179,32 @@ const RequestConfigView: React.FC<Props> = ({ data, disabled, onChange }) => {
{renderHosts()}
{renderPaths()}
<Form.Item
- label="HTTP 方法"
+ label={formatMessage({ id: 'route.request.config.http.method' })}
name="methods"
- rules={[{ required: true, message: '请选择 HTTP 方法' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.request.config.choose.http.method' }) }]}
>
<Checkbox.Group options={HTTP_METHOD_OPTION_LIST} disabled={disabled} />
</Form.Item>
- <Form.Item label="重定向" name="redirectOption">
+ <Form.Item label={formatMessage({ id: 'route.request.config.redirect' })} name="redirectOption">
<Select disabled={disabled}>
- <Select.Option value="forceHttps">启用 HTTPS</Select.Option>
- <Select.Option value="customRedirect">自定义</Select.Option>
- <Select.Option value="disabled">禁用</Select.Option>
+ <Select.Option value="forceHttps">{formatMessage({ id: 'route.request.config.enable.https' })}</Select.Option>
+ <Select.Option value="customRedirect">{formatMessage({ id: 'route.request.config.custom' })}</Select.Option>
+ <Select.Option value="disabled">{formatMessage({ id: 'route.request.config.forbidden' })}</Select.Option>
</Select>
</Form.Item>
{step1Data.redirectOption === 'customRedirect' && (
- <Form.Item label="自定义重定向" required>
+ <Form.Item label={formatMessage({ id: 'route.request.config.redirect.custom' })} required>
<Row gutter={10}>
<Col>
<Form.Item name="redirectURI" rules={[{required: true}]}>
- <Input placeholder="例如:/foo/index.html" disabled={disabled} />
+ <Input placeholder={formatMessage({ id: 'route.request.config.redirect.custom.example' })} disabled={disabled} />
</Form.Item>
</Col>
<Col span={10}>
<Form.Item name="redirectCode" rules={[{required: true}]}>
<Select disabled={disabled}>
- <Select.Option value={301}>301(永久重定向)</Select.Option>
- <Select.Option value={302}>302(临时重定向)</Select.Option>
+ <Select.Option value={301}>{formatMessage({ id: 'route.request.config.redirect.301' })}</Select.Option>
+ <Select.Option value={302}>{formatMessage({ id: 'route.request.config.redirect.302' })}</Select.Option>
</Select>
</Form.Item>
</Col>
diff --git a/src/pages/Route/components/Step2/HttpHeaderRewriteView.tsx b/src/pages/Route/components/Step2/HttpHeaderRewriteView.tsx
index 2863bd3..dc34a74 100644
--- a/src/pages/Route/components/Step2/HttpHeaderRewriteView.tsx
+++ b/src/pages/Route/components/Step2/HttpHeaderRewriteView.tsx
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import Form from 'antd/es/form';
import { Button, Table, Space, Modal, Input, Select } from 'antd';
+import { useIntl } from 'umi';
import PanelSection from '@/components/PanelSection';
@@ -12,6 +13,7 @@ const HttpHeaderRewriteView: React.FC<Props> = ({ data, disabled, onChange }) =>
const [modalForm] = Form.useForm();
const [mode, setMode] = useState<RouteModule.ModalType>('CREATE');
const [showModalValue, setShowModalValue] = useState(true);
+ const { formatMessage } = useIntl();
const handleEdit = (record: RouteModule.UpstreamHeader) => {
setMode('EDIT');
@@ -24,27 +26,27 @@ const HttpHeaderRewriteView: React.FC<Props> = ({ data, disabled, onChange }) =>
const columns = [
{
- title: '请求头',
+ title: formatMessage({ id: 'route.http.request.header.name' }),
dataIndex: 'header_name',
key: 'header_name',
},
{
- title: '行为',
+ title: formatMessage({ id: 'route.http.action' }),
dataIndex: 'header_action',
key: 'header_action',
render: (action: 'override' | 'remove') => {
- return action === 'override' ? '重写/添加' : '删除';
+ return action === 'override' ? formatMessage({ id: 'route.http.override.or.create' }) : formatMessage({ id: 'route.http.delete' });
},
},
{
- title: '值',
+ title: formatMessage({ id: 'route.http.value' }),
dataIndex: 'header_value',
key: 'header_value',
},
disabled
? {}
: {
- title: '操作',
+ title: formatMessage({ id: 'route.http.operation' }),
key: 'action',
render: (_: any, record: RouteModule.UpstreamHeader) => (
<Space size="middle">
@@ -53,14 +55,14 @@ const HttpHeaderRewriteView: React.FC<Props> = ({ data, disabled, onChange }) =>
handleEdit(record);
}}
>
- 编辑
+ {formatMessage({ id: 'route.http.edit' })}
</a>
<a
onClick={() => {
handleRemove(record.key);
}}
>
- 删除
+ {formatMessage({ id: 'route.http.delete' })}
</a>
</Space>
),
@@ -96,7 +98,7 @@ const HttpHeaderRewriteView: React.FC<Props> = ({ data, disabled, onChange }) =>
return (
<Modal
- title={mode === 'EDIT' ? '编辑请求头' : '操作请求头'}
+ title={mode === 'EDIT' ? formatMessage({ id: 'route.http.edit.request.header' }) : formatMessage({ id: 'route.http.operate.request.header' })}
centered
visible
onOk={handleOk}
@@ -104,33 +106,33 @@ const HttpHeaderRewriteView: React.FC<Props> = ({ data, disabled, onChange }) =>
setVisible(false);
modalForm.resetFields();
}}
- okText="确定"
- cancelText="取消"
+ okText={formatMessage({ id: 'route.http.confirm' })}
+ cancelText={formatMessage({ id: 'route.http.cancel' })}
destroyOnClose
>
<Form form={modalForm} labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
<Form.Item
- label="请求头"
+ label={formatMessage({ id: 'route.http.request.header.name' })}
name="header_name"
- rules={[{ required: true, message: '请输入请求头' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.http.input.request.header.name' }) }]}
>
<Input />
</Form.Item>
<Form.Item
- label="行为"
+ label={formatMessage({ id: 'route.http.action' })}
name="header_action"
- rules={[{ required: true, message: '请输入请求头' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.http.select.actions' }) }]}
>
<Select onChange={(e) => setShowModalValue(e === 'override')}>
- <Select.Option value="override">重写/添加</Select.Option>
- <Select.Option value="remove">删除</Select.Option>
+ <Select.Option value="override">{formatMessage({ id: 'route.http.override.or.create' })}</Select.Option>
+ <Select.Option value="remove">{formatMessage({ id: 'route.http.delete' })}</Select.Option>
</Select>
</Form.Item>
{showModalValue && (
<Form.Item
- label="值"
+ label={formatMessage({ id: 'route.http.value' })}
name="header_value"
- rules={[{ required: true, message: '请输入值' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.http.input.value' }) }]}
>
<Input />
</Form.Item>
@@ -141,7 +143,7 @@ const HttpHeaderRewriteView: React.FC<Props> = ({ data, disabled, onChange }) =>
};
return (
- <PanelSection title="HTTP 头改写">
+ <PanelSection title={formatMessage({ id: 'route.http.override.request.header' })}>
{!disabled && (
<Button
onClick={() => {
@@ -154,7 +156,7 @@ const HttpHeaderRewriteView: React.FC<Props> = ({ data, disabled, onChange }) =>
marginBottom: 16,
}}
>
- 操作
+ {formatMessage({ id: 'route.http.operation' })}
</Button>
)}
<Table key="table" bordered dataSource={upstreamHeaderList} columns={columns} />
diff --git a/src/pages/Route/components/Step2/RequestRewriteView.tsx b/src/pages/Route/components/Step2/RequestRewriteView.tsx
index 01c90df..5a2d106 100644
--- a/src/pages/Route/components/Step2/RequestRewriteView.tsx
+++ b/src/pages/Route/components/Step2/RequestRewriteView.tsx
@@ -3,6 +3,7 @@ import Form, { FormInstance } from 'antd/es/form';
import Radio from 'antd/lib/radio';
import { Input, Row, Col, InputNumber, Button, Select } from 'antd';
import { PlusOutlined, MinusCircleOutlined } from '@ant-design/icons';
+import { useIntl } from 'umi';
import { FORM_ITEM_LAYOUT, FORM_ITEM_WITHOUT_LABEL } from '@/pages/Route/constants';
import PanelSection from '@/components/PanelSection';
@@ -16,11 +17,12 @@ const RequestRewriteView: React.FC<Props> = ({ data, form, disabled, onChange })
const { step2Data } = data;
const [upstearms, setUpstreams] = useState<{ id: string; name: string }[]>();
const upstreamDisabled = disabled || !!step2Data.upstream_id;
+ const { formatMessage } = useIntl();
useEffect(() => {
// eslint-disable-next-line no-shadow
fetchUpstreamList().then(({ data }) => {
- setUpstreams([{ name: '手动填写', id: null }, ...data]);
+ setUpstreams([{ name: formatMessage({ id: 'route.request.override.input' }), id: null }, ...data]);
if (step2Data.upstream_id) {
onChange({ upstream_id: step2Data.upstream_id });
}
@@ -35,8 +37,8 @@ const RequestRewriteView: React.FC<Props> = ({ data, form, disabled, onChange })
required
key={field.key}
{...(index === 0 ? FORM_ITEM_LAYOUT : FORM_ITEM_WITHOUT_LABEL)}
- label={index === 0 ? '后端服务域名/IP' : ''}
- extra={index === 0 ? '使用域名时,默认解析本地 /etc/resolv.conf' : ''}
+ label={index === 0 ? formatMessage({ id: 'route.request.override.domain.name.or.ip' }) : ''}
+ extra={index === 0 ? formatMessage({ id: 'route.request.override.use.domain.name.default.analysis' }) : ''}
>
<Row style={{ marginBottom: '10px' }} gutter={16}>
<Col span={9}>
@@ -44,27 +46,27 @@ const RequestRewriteView: React.FC<Props> = ({ data, form, disabled, onChange })
style={{ marginBottom: 0 }}
name={[field.name, 'host']}
rules={[
- { required: true, message: '请输入域名/IP' },
+ { required: true, message: formatMessage({ id: 'route.request.override.input.domain.or.ip' }) },
{
pattern: new RegExp(
/(^([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])(\.(25[0-5]|1\d{2}|2[0-4]\d|[1-9]?\d)){3}$|^(?![0-9.]+$)([a-zA-Z0-9_-]+)(\.[a-zA-Z0-9_-]+){0,}$)/,
'g',
),
- message: '仅支持数字或者字符 或者 . (.不是必须)',
+ message: formatMessage({ id: 'route.request.override.domain.or.ip.rules' }),
},
]}
>
- <Input placeholder="域名/IP" disabled={upstreamDisabled} />
+ <Input placeholder={formatMessage({ id: 'route.request.override.domain.name.or.ip' })} disabled={upstreamDisabled} />
</Form.Item>
</Col>
<Col span={4}>
<Form.Item
style={{ marginBottom: 0 }}
name={[field.name, 'port']}
- rules={[{ required: true, message: '请输入端口' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.request.override.input.port.number' }) }]}
>
<InputNumber
- placeholder="端口号"
+ placeholder={formatMessage({ id: 'route.request.override.port.number' })}
disabled={upstreamDisabled}
min={1}
max={65535}
@@ -75,10 +77,10 @@ const RequestRewriteView: React.FC<Props> = ({ data, form, disabled, onChange })
<Form.Item
style={{ marginBottom: 0 }}
name={[field.name, 'weight']}
- rules={[{ required: true, message: '请输入权重' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.request.override.input.weight' }) }]}
>
<InputNumber
- placeholder="权重"
+ placeholder={formatMessage({ id: 'route.request.override.weight' })}
disabled={upstreamDisabled}
min={0}
max={1000}
@@ -107,7 +109,7 @@ const RequestRewriteView: React.FC<Props> = ({ data, form, disabled, onChange })
add();
}}
>
- <PlusOutlined /> 新建
+ <PlusOutlined /> {formatMessage({ id: 'route.request.override.create' })}
</Button>
</Form.Item>
)}
@@ -119,7 +121,7 @@ const RequestRewriteView: React.FC<Props> = ({ data, form, disabled, onChange })
const renderTimeUnit = () => <span style={{ margin: '0 8px' }}>ms</span>;
return (
- <PanelSection title="请求改写">
+ <PanelSection title={formatMessage({ id: 'route.request.override' })}>
<Form
{...FORM_ITEM_LAYOUT}
form={form}
@@ -128,9 +130,9 @@ const RequestRewriteView: React.FC<Props> = ({ data, form, disabled, onChange })
initialValues={step2Data}
>
<Form.Item
- label="协议"
+ label={formatMessage({ id: 'route.request.override.protocol' })}
name="upstream_protocol"
- rules={[{ required: true, message: '请勾选协议' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.request.override.select.protocol' }) }]}
>
<Radio.Group
onChange={(e) => {
@@ -139,12 +141,12 @@ const RequestRewriteView: React.FC<Props> = ({ data, form, disabled, onChange })
name="upstream_protocol"
disabled={disabled}
>
- <Radio value="keep">保持原样</Radio>
+ <Radio value="keep">{formatMessage({ id: 'route.request.override.stay.same' })}</Radio>
<Radio value="http">HTTP</Radio>
<Radio value="https">HTTPS</Radio>
</Radio.Group>
</Form.Item>
- <Form.Item label="请求路径">
+ <Form.Item label={formatMessage({ id: 'route.request.override.path' })}>
<Radio.Group
defaultValue={step2Data.upstreamPath === undefined ? 'keep' : 'modify'}
onChange={(e) => {
@@ -152,20 +154,20 @@ const RequestRewriteView: React.FC<Props> = ({ data, form, disabled, onChange })
}}
disabled={disabled}
>
- <Radio value="keep">保持原样</Radio>
- <Radio value="modify">修改</Radio>
+ <Radio value="keep">{formatMessage({ id: 'route.request.override.stay.same' })}</Radio>
+ <Radio value="modify">{formatMessage({ id: 'route.request.override.edit' })}</Radio>
</Radio.Group>
</Form.Item>
{step2Data.upstreamPath !== undefined && (
<Form.Item
- label="新路径"
+ label={formatMessage({ id: 'route.request.override.new.path' })}
name="upstreamPath"
- rules={[{ required: true, message: '请输入请求路径' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.request.override.input.path' }) }]}
>
- <Input disabled={disabled} placeholder="例如:/foo/bar/index.html" />
+ <Input disabled={disabled} placeholder={formatMessage({ id: 'route.request.override.path.example' })} />
</Form.Item>
)}
- <Form.Item label="上游" name="upstream_id">
+ <Form.Item label={formatMessage({ id: 'route.request.override.upstream' })} name="upstream_id">
<Select
onChange={(value) => {
onChange({ upstream_id: value });
@@ -182,31 +184,31 @@ const RequestRewriteView: React.FC<Props> = ({ data, form, disabled, onChange })
</Select>
</Form.Item>
{renderUpstreamMeta()}
- <Form.Item label="连接超时" required>
+ <Form.Item label={formatMessage({ id: 'route.request.override.connection.timeout' })} required>
<Form.Item
name={['timeout', 'connect']}
noStyle
- rules={[{ required: true, message: '请输入连接超时时间' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.request.override.input.connection.timeout' }) }]}
>
<InputNumber disabled={upstreamDisabled} />
</Form.Item>
{renderTimeUnit()}
</Form.Item>
- <Form.Item label="发送超时" required>
+ <Form.Item label={formatMessage({ id: 'route.request.override.send.timeout' })} required>
<Form.Item
name={['timeout', 'send']}
noStyle
- rules={[{ required: true, message: '请输入发送超时时间' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.request.override.inout.send.timeout' }) }]}
>
<InputNumber disabled={upstreamDisabled} />
</Form.Item>
{renderTimeUnit()}
</Form.Item>
- <Form.Item label="接收超时" required>
+ <Form.Item label={formatMessage({ id: 'route.request.override.receive.timeout' })} required>
<Form.Item
name={['timeout', 'read']}
noStyle
- rules={[{ required: true, message: '请输入接收超时时间' }]}
+ rules={[{ required: true, message: formatMessage({ id: 'route.request.override.inout.receive.timeout' }) }]}
>
<InputNumber disabled={upstreamDisabled} />
</Form.Item>
diff --git a/src/pages/Route/locales/en-US.ts b/src/pages/Route/locales/en-US.ts
index 56b2571..e7fc86b 100644
--- a/src/pages/Route/locales/en-US.ts
+++ b/src/pages/Route/locales/en-US.ts
@@ -3,4 +3,140 @@ export default {
'menu.routes.list': 'Route List',
'menu.routes.create': 'Create a Route',
'menu.routes.edit': 'Edit the Route',
+
+ 'route.create.define.api.request': 'Define API requests',
+ 'route.create.define.api.backend.server': 'Define API Backend Server',
+ 'route.create.plugin.configuration': 'Plugin Configuration',
+
+ 'route.result.submit.success': 'Submit Success',
+ 'route.result.return.list': 'Return Route List',
+ 'route.result.create': 'Create Route',
+
+ 'route.match.parameter.position': 'Parameter Position',
+ 'route.match.http.request.header': 'HTTP Request Header',
+ 'route.match.request.parameter': 'Request Parameter',
+ 'route.match.parameter.name': 'Parameter Name',
+ 'route.match.operational.character': 'Operational Character',
+ 'route.match.equal': 'Equal',
+ 'route.match.unequal': 'Unequal',
+ 'route.match.greater.than': 'Greater Than',
+ 'route.match.less.than': 'Less Than',
+ 'route.match.regex.match': 'Regex Match',
+ 'route.match.parameter.value': 'Parameter Value',
+ 'route.match.operation': 'Operation',
+ 'route.match.edit': 'Edit',
+ 'route.match.delete': 'Delete',
+ 'route.match.edit.rule': 'Edit Rule',
+ 'route.match.create.rule': 'Create Rule',
+ 'route.match.confirm': 'Confirm',
+ 'route.match.cancel': 'Cancel',
+ 'route.match.select.parameter.position': 'Please choose parameter position',
+ 'route.match.request.header.example': 'Request header name, for example: HOST',
+ 'route.match.parameter.name.example': 'Parameter name, for example: id',
+ 'route.match.input.parameter.name': 'Please input parameter name',
+ 'route.match.parameter.name.rule': 'Only letters, numbers, - and _ are supported, and can only begin with letters',
+ 'route.match.rule': 'Only letters and Numbers are supported, and can only begin with letters',
+ 'route.match.choose.operational.character': 'Please choose operational character',
+ 'route.match.value': 'Value',
+ 'route.match.input.parameter.value': 'Please input parameter value',
+ 'route.match.advanced.match.rule': 'Advanced Routing Matching Conditions',
+ 'route.match.create': 'Create',
+
+ 'route.meta.name.description':'Name And Description',
+ 'route.meta.api.name':'API Name',
+ 'route.meta.input.api.name':'Please input API name',
+ 'route.meta.api.name.rule':'Maximum length 100, only letters, Numbers, _, and - are supported, and can only begin with letters',
+ 'rotue.meta.api.rule':'Only letters, numbers, _ and - are supported, and can only begin with letters',
+ 'route.meta.description':'Description',
+ 'route.meta.description.rule':'Can not more than 200 characters',
+
+ 'route.request.config.domain.name':'Domain Name',
+ 'route.request.config.domain.or.ip':'Domain Name or IP, support for generic Domain Name, for example: *.test.com',
+ 'route.request.config.input.domain.name':'Please input Domain Name',
+ 'route.request.config.domain.name.rule':'Only letters, numbers and * are supported. * can only be at the beginning, and only single * is supported',
+ 'route.request.config.create':'Create',
+ 'route.request.config.path':'Path',
+ 'route.request.config.path.description1':'1. Request path, for example: /foo/index.html, supports request path prefix /foo/* ;',
+ 'route.request.config.path.description2':'2. /* represents all paths',
+ 'route.request.config.input.path':'Please input request path',
+ 'route.request.config.path.rule':'Begin with / , and * can only at the end',
+ 'route.request.config.basic.define':'Request Basic Define',
+ 'route.request.config.protocol':'Protocol',
+ 'route.request.config.choose.protocol':'Please choose protocols',
+ 'route.request.config.http.method':'HTTP Method',
+ 'route.request.config.choose.http.method':'Please choose HTTP methods',
+ 'route.request.config.redirect':'Redirect',
+ 'route.request.config.enable.https':'Enable HTTPS',
+ 'route.request.config.custom':'Custom',
+ 'route.request.config.forbidden':'Forbidden',
+ 'route.request.config.redirect.custom':'Custom Redirect',
+ 'route.request.config.redirect.custom.example':'For examle: /foo/index.html',
+ 'route.request.config.redirect.301':'301(Permanent Redirect)',
+ 'route.request.config.redirect.302':'302(Temporary Redirect)',
+
+ 'route.http.request.header.name':'HTTP Request Header Name',
+ 'route.http.action':'Action',
+ 'route.http.override.or.create':'Override/Create',
+ 'route.http.delete':'Delete',
+ 'route.http.value':'Value',
+ 'route.http.operation':'Operation',
+ 'route.http.edit':'Edit',
+ 'route.http.edit.request.header':'Edit HTTP request header',
+ 'route.http.operate.request.header':'Operate request header',
+ 'route.http.confirm':'Confirm',
+ 'route.http.cancel':'Cancel',
+ 'route.http.input.request.header.name':'Please input HTTP request header name',
+ 'route.http.select.actions':'Please select actions',
+ 'route.http.input.value':'Please input value',
+ 'route.http.override.request.header':'Override HTTP request header',
+
+ 'route.request.override.input':'Input',
+ 'route.request.override.domain.name.or.ip':'Domain Name/IP',
+ 'route.request.override.use.domain.name.default.analysis':'When using Domain Name, it will analysis the local: /etc/resolv.conf by default',
+ 'route.request.override.input.domain.or.ip':'Please input Domain Name/IP',
+ 'route.request.override.domain.or.ip.rules':'Only letters, numbers and . are supported',
+ 'route.request.override.input.port.number':'Please input port number',
+ 'route.request.override.port.number':'Port Number',
+ 'route.request.override.input.weight':'Please input weight',
+ 'route.request.override.weight':'Weight',
+ 'route.request.override.create':'Create',
+ 'route.request.override':'Requests Override',
+ 'route.request.override.protocol':'Protocol',
+ 'route.request.override.select.protocol':'Please select protocol',
+ 'route.request.override.stay.same':'Stay The Same',
+ 'route.request.override.path':'Request Path',
+ 'route.request.override.edit':'Edit',
+ 'route.request.override.new.path':'New Path',
+ 'route.request.override.input.path':'Please input request path',
+ 'route.request.override.path.example':'For example: /foo/bar/index.html',
+ 'route.request.override.upstream':'Upstream',
+ 'route.request.override.connection.timeout':'Connection Timeout',
+ 'route.request.override.input.connection.timeout':'Please inout connection timeout',
+ 'route.request.override.send.timeout':'Send Timeout',
+ 'route.request.override.inout.send.timeout':'Please input send timeout',
+ 'route.request.override.receive.timeout':'Receive Timeout',
+ 'route.request.override.inout.receive.timeout':'Please input receive timeout',
+
+ 'route.constants.define.api.request':'Define API Request',
+ 'route.constants.preview':'Preview',
+ 'route.constants.define.api.backend.serve':'Define API Backend Server',
+ 'route.constants.plugin.configuration':'Plugin Configuration',
+
+ 'route.create.management':'Route Management',
+
+ 'route.list.name':'Name',
+ 'route.list.domain.name':'Domain Name',
+ 'route.list.path':'Path',
+ 'route.list.description':'Description',
+ 'route.list.edit.time':'Edit Time',
+ 'route.list.operation':'Operation',
+ 'route.list.edit':'Edit',
+ 'route.list.delete.confrim':'Are you sure to delete this route?',
+ 'route.list.delete.success':'Delete Success!',
+ 'route.list.confirm':'Confirm',
+ 'route.list.cancel':'Cancel',
+ 'route.list.delete':'Delete',
+ 'route.list':'Route List',
+ 'route.list.input':'Please input',
+ 'route.list.create':'Create',
};
diff --git a/src/pages/Route/locales/zh-CN.ts b/src/pages/Route/locales/zh-CN.ts
index a5ee0dd..e8789dc 100644
--- a/src/pages/Route/locales/zh-CN.ts
+++ b/src/pages/Route/locales/zh-CN.ts
@@ -3,4 +3,140 @@ export default {
'menu.routes.list': '列表',
'menu.routes.create': '创建',
'menu.routes.edit': '编辑',
+
+ 'route.create.define.api.request': '定义 API 请求',
+ 'route.create.define.api.backend.server': '定义 API 后端服务',
+ 'route.create.plugin.configuration': '插件配置',
+
+ 'route.result.submit.success': '提交成功',
+ 'route.result.return.list': '返回路由列表',
+ 'route.result.create': '创建路由',
+
+ 'route.match.parameter.position': '参数位置',
+ 'route.match.http.request.header': 'HTTP 请求头',
+ 'route.match.request.parameter': '请求参数',
+ 'route.match.parameter.name': '参数名称',
+ 'route.match.operational.character': '运算符',
+ 'route.match.equal': '等于',
+ 'route.match.unequal': '不等于',
+ 'route.match.greater.than': '大于',
+ 'route.match.less.than': '小于',
+ 'route.match.regex.match': '正则匹配',
+ 'route.match.parameter.value': '参数值',
+ 'route.match.operation': '操作',
+ 'route.match.edit': '编辑',
+ 'route.match.delete': '删除',
+ 'route.match.edit.rule': '编辑规则',
+ 'route.match.create.rule': '创建规则',
+ 'route.match.confirm': '确定',
+ 'route.match.cancel': '取消',
+ 'route.match.select.parameter.position': '请选择参数位置',
+ 'route.match.request.header.example': '请求头键名,例如:HOST',
+ 'route.match.parameter.name.example': '参数名称,例如:id',
+ 'route.match.input.parameter.name': '请输入参数名称',
+ 'route.match.parameter.name.rule': '仅支持字母、数字、- 和 _ ,且只能以字母开头',
+ 'route.match.rule': '仅支持字母和数字,且只能以字母开头',
+ 'route.match.choose.operational.character': '请选择运算符',
+ 'route.match.value': '值',
+ 'route.match.input.parameter.value': '请输入参数值',
+ 'route.match.advanced.match.rule': '高级路由匹配条件',
+ 'route.match.create': '创建',
+
+ 'route.meta.name.description':'名称及其描述',
+ 'route.meta.api.name':'API 名称',
+ 'route.meta.input.api.name':'请输入 API 名称',
+ 'route.meta.api.name.rule':'最大长度100,仅支持字母、数字、- 和 _,且只能以字母开头',
+ 'rotue.meta.api.rule':'仅支持字母、数字、- 和 _,且只能以字母开头',
+ 'route.meta.description':'描述',
+ 'route.meta.description.rule':'不超过 200 个字符',
+
+ 'route.request.config.domain.name':'域名',
+ 'route.request.config.domain.or.ip':'域名或IP,支持泛域名,如:*.test.com',
+ 'route.request.config.input.domain.name':'请输入域名',
+ 'route.request.config.domain.name.rule':'仅支持字母、数字和 * ,且 * 只能是在开头,支持单个 * ',
+ 'route.request.config.create':'创建',
+ 'route.request.config.path':'路径',
+ 'route.request.config.path.description1':'1. 请求路径,如 /foo/index.html,支持请求路径前缀 /foo/* ;',
+ 'route.request.config.path.description2':'2. /* 代表所有路径',
+ 'route.request.config.input.path':'请输入请求路径',
+ 'route.request.config.path.rule':'以 / 开头,且 * 只能在最后',
+ 'route.request.config.basic.define':'请求基础定义',
+ 'route.request.config.protocol':'协议',
+ 'route.request.config.choose.protocol':'请选择协议',
+ 'route.request.config.http.method':'HTTP 方法',
+ 'route.request.config.choose.http.method':'请选择 HTTP 方法',
+ 'route.request.config.redirect':'重定向',
+ 'route.request.config.enable.https':'启用 HTTPS',
+ 'route.request.config.custom':'自定义',
+ 'route.request.config.forbidden':'禁用',
+ 'route.request.config.redirect.custom':'自定义重定向',
+ 'route.request.config.redirect.custom.example':'例如:/foo/index.html',
+ 'route.request.config.redirect.301':'301(永久重定向)',
+ 'route.request.config.redirect.302':'302(临时重定向)',
+
+ 'route.http.request.header.name':'HTTP 请求头名称',
+ 'route.http.action':'行为',
+ 'route.http.override.or.create':'重写/创建',
+ 'route.http.delete':'删除',
+ 'route.http.value':'值',
+ 'route.http.operation':'操作',
+ 'route.http.edit':'编辑',
+ 'route.http.edit.request.header':'编辑请求头',
+ 'route.http.operate.request.header':'操作请求头',
+ 'route.http.confirm':'确定',
+ 'route.http.cancel':'取消',
+ 'route.http.input.request.header.name':'请输入 HTTP 请求头名称',
+ 'route.http.select.actions':'请选择行为',
+ 'route.http.input.value':'请输入值',
+ 'route.http.override.request.header':'HTTP 请求头改写',
+
+ 'route.request.override.input':'手动填写',
+ 'route.request.override.domain.name.or.ip':'域名/IP',
+ 'route.request.override.use.domain.name.default.analysis':'使用域名时,默认解析本地:/etc/resolv.conf',
+ 'route.request.override.input.domain.or.ip':'请输入域名/IP',
+ 'route.request.override.domain.or.ip.rules':'仅支持字母、数字和 . ',
+ 'route.request.override.input.port.number':'请输入端口号',
+ 'route.request.override.port.number':'端口号',
+ 'route.request.override.input.weight':'请输入权重',
+ 'route.request.override.weight':'权重',
+ 'route.request.override.create':'创建',
+ 'route.request.override':'请求改写',
+ 'route.request.override.protocol':'协议',
+ 'route.request.override.select.protocol':'请选择协议',
+ 'route.request.override.stay.same':'保持原样',
+ 'route.request.override.path':'请求路径',
+ 'route.request.override.edit':'编辑',
+ 'route.request.override.new.path':'新路径',
+ 'route.request.override.input.path':'请输入请求路径',
+ 'route.request.override.path.example':'例如:/foo/bar/index.html',
+ 'route.request.override.upstream':'上游',
+ 'route.request.override.connection.timeout':'连接超时',
+ 'route.request.override.input.connection.timeout':'请输入连接超时时间',
+ 'route.request.override.send.timeout':'发送超时',
+ 'route.request.override.inout.send.timeout':'请输入发送超时时间',
+ 'route.request.override.receive.timeout':'接收超时',
+ 'route.request.override.inout.receive.timeout':'请输入接收超时时间',
+
+ 'route.constants.define.api.request':'定义 API 请求',
+ 'route.constants.preview':'预览',
+ 'route.constants.define.api.backend.serve':'定义 API 后端服务',
+ 'route.constants.plugin.configuration':'插件配置',
+
+ 'route.create.management':'路由管理',
+
+ 'route.list.name':'名称',
+ 'route.list.domain.name':'域名',
+ 'route.list.path':'路径',
+ 'route.list.description':'描述',
+ 'route.list.edit.time':'编辑时间',
+ 'route.list.operation':'操作',
+ 'route.list.edit':'编辑',
+ 'route.list.delete.confrim':'确定删除该路由吗?',
+ 'route.list.delete.success':'删除成功!',
+ 'route.list.confirm':'确认',
+ 'route.list.cancel':'取消',
+ 'route.list.delete':'删除',
+ 'route.list':'路由列表',
+ 'route.list.input':'请输入',
+ 'route.list.create':'创建',
};