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/28 09:31:55 UTC
[incubator-apisix-dashboard] branch master updated: i18n actionbar
(#343)
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 ff711ea i18n actionbar (#343)
ff711ea is described below
commit ff711ea23893e4645d54611520976c14ef9ec512
Author: TikWind <65...@users.noreply.github.com>
AuthorDate: Tue Jul 28 17:31:45 2020 +0800
i18n actionbar (#343)
---
src/components/ActionBar/ActionBar.tsx | 9 ++++++---
src/components/ActionBar/index.ts | 2 ++
src/components/ActionBar/locales/en-US.ts | 5 +++++
src/components/ActionBar/locales/zh-CN.ts | 5 +++++
src/locales/en-US.ts | 2 ++
src/locales/zh-CN.ts | 2 ++
6 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/components/ActionBar/ActionBar.tsx b/src/components/ActionBar/ActionBar.tsx
index 6ce7b53..9087d7a 100644
--- a/src/components/ActionBar/ActionBar.tsx
+++ b/src/components/ActionBar/ActionBar.tsx
@@ -1,6 +1,6 @@
import React, { CSSProperties } from 'react';
-
import { Row, Col, Button } from 'antd';
+import { useIntl } from 'umi';
interface Props {
step: number;
@@ -21,6 +21,9 @@ const style: CSSProperties = {
};
const ActionBar: React.FC<Props> = ({ step, lastStep, onChange, withResultView }) => {
+
+ const { formatMessage } = useIntl();
+
if (step > lastStep && !withResultView) {
onChange(lastStep);
return null;
@@ -31,12 +34,12 @@ const ActionBar: React.FC<Props> = ({ step, lastStep, onChange, withResultView }
<Row gutter={10} justify="end">
<Col>
<Button type="primary" onClick={() => onChange(step - 1)} disabled={step === 1}>
- 上一步
+ {formatMessage({ id: 'actionbar.last.step' })}
</Button>
</Col>
<Col>
<Button type="primary" onClick={() => onChange(step + 1)}>
- {step < lastStep ? '下一步' : '提交'}
+ {step < lastStep ? formatMessage({ id: 'actionbar.next.step' }) : formatMessage({ id: 'actionbar.submit' })}
</Button>
</Col>
</Row>
diff --git a/src/components/ActionBar/index.ts b/src/components/ActionBar/index.ts
index d08aed0..69ad8f6 100644
--- a/src/components/ActionBar/index.ts
+++ b/src/components/ActionBar/index.ts
@@ -1 +1,3 @@
export { default } from './ActionBar';
+export { default as ActionBarZhCN } from './locales/zh-CN';
+export { default as ActionBarEnUS } from './locales/en-US';
diff --git a/src/components/ActionBar/locales/en-US.ts b/src/components/ActionBar/locales/en-US.ts
new file mode 100644
index 0000000..0b810e3
--- /dev/null
+++ b/src/components/ActionBar/locales/en-US.ts
@@ -0,0 +1,5 @@
+export default {
+ 'actionbar.last.step': 'Last Step',
+ 'actionbar.next.step': 'Next Step',
+ 'actionbar.submit': 'Submit',
+};
diff --git a/src/components/ActionBar/locales/zh-CN.ts b/src/components/ActionBar/locales/zh-CN.ts
new file mode 100644
index 0000000..3e4e233
--- /dev/null
+++ b/src/components/ActionBar/locales/zh-CN.ts
@@ -0,0 +1,5 @@
+export default {
+ 'actionbar.last.step': '上一步',
+ 'actionbar.next.step': '下一步',
+ 'actionbar.submit': '提交',
+};
diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts
index 3ff90f6..9fcf594 100644
--- a/src/locales/en-US.ts
+++ b/src/locales/en-US.ts
@@ -1,4 +1,5 @@
import { PluginFormEnUS } from '@/components/PluginForm';
+import { ActionBarEnUS } from '@/components/ActionBar';
import { ConsumerEnUS } from '@/pages/Consumer';
import { RouteEnUS } from '@/pages/Route';
@@ -25,4 +26,5 @@ export default {
...PluginFormEnUS,
...ConsumerEnUS,
...RouteEnUS,
+ ...ActionBarEnUS,
};
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index c862e1b..1dc1263 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -1,4 +1,5 @@
import { PluginFormZhCN } from '@/components/PluginForm';
+import { ActionBarZhCN } from '@/components/ActionBar';
import { ConsumerZhCN } from '@/pages/Consumer';
import { RouteZhCN } from '@/pages/Route';
@@ -25,4 +26,5 @@ export default {
...PluginFormZhCN,
...ConsumerZhCN,
...RouteZhCN,
+ ...ActionBarZhCN,
};