From 3ea3a1049a2c87993bf47ce0a66c67940b3bd400 Mon Sep 17 00:00:00 2001 From: jiangfeng Date: Tue, 28 Jul 2020 13:32:40 +0800 Subject: [PATCH] i18n route --- src/pages/Route/Create.tsx | 11 +++++++---- src/pages/Route/constants.ts | 4 ---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/pages/Route/Create.tsx b/src/pages/Route/Create.tsx index b3456e10bd..70eade37fd 100644 --- a/src/pages/Route/Create.tsx +++ b/src/pages/Route/Create.tsx @@ -21,8 +21,6 @@ import { DEFAULT_STEP_1_DATA, DEFAULT_STEP_2_DATA, DEFAULT_STEP_3_DATA, - STEP_HEADER_2, - STEP_HEADER_4, } from './constants'; import ResultView from './components/ResultView'; import styles from './Create.less'; @@ -36,6 +34,13 @@ type Props = { }; const Page: React.FC = (props) => { + + const { formatMessage } = useIntl(); + + const STEP_HEADER_2 = [formatMessage({ id: 'route.constants.define.api.request' }), formatMessage({ id: 'route.constants.preview' })]; + + const STEP_HEADER_4 = [formatMessage({ id: 'route.constants.define.api.request' }), formatMessage({ id: 'route.constants.define.api.backend.serve' }), formatMessage({ id: 'route.constants.plugin.configuration' }), formatMessage({ id: 'route.constants.preview' })]; + const [step1Data, setStep1Data] = useState(DEFAULT_STEP_1_DATA); const [step2Data, setStep2Data] = useState(DEFAULT_STEP_2_DATA); const [step3Data, setStep3Data] = useState(DEFAULT_STEP_3_DATA); @@ -65,8 +70,6 @@ const Page: React.FC = (props) => { setStep3Data(data.step3Data); }); - const { formatMessage } = useIntl(); - useEffect(() => { if (props.route.path.indexOf('edit') !== -1) { setupRoute(props.match.params.rid); diff --git a/src/pages/Route/constants.ts b/src/pages/Route/constants.ts index 8f8a2fe898..e4d69a17b7 100644 --- a/src/pages/Route/constants.ts +++ b/src/pages/Route/constants.ts @@ -54,7 +54,3 @@ export const DEFAULT_STEP_2_DATA: RouteModule.Step2Data = { export const DEFAULT_STEP_3_DATA: RouteModule.Step3Data = { plugins: {}, }; - -export const STEP_HEADER_2 = ['定义 API 请求', '预览']; - -export const STEP_HEADER_4 = ['定义 API 请求', '定义 API 后端服务', '插件配置', '预览'];