Skip to content

Commit 873a8d8

Browse files
authored
feat(i18n): modify some i18n according to the proposal#331 (#366)
1 parent 217cb00 commit 873a8d8

File tree

8 files changed

+46
-29
lines changed

8 files changed

+46
-29
lines changed

src/components/ActionBar/ActionBar.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ const style: CSSProperties = {
3737
};
3838

3939
const ActionBar: React.FC<Props> = ({ step, lastStep, onChange, withResultView }) => {
40-
4140
const { formatMessage } = useIntl();
4241

4342
if (step > lastStep && !withResultView) {
@@ -50,12 +49,14 @@ const ActionBar: React.FC<Props> = ({ step, lastStep, onChange, withResultView }
5049
<Row gutter={10} justify="end">
5150
<Col>
5251
<Button type="primary" onClick={() => onChange(step - 1)} disabled={step === 1}>
53-
{formatMessage({ id: 'actionbar.last.step' })}
52+
{formatMessage({ id: 'component.actionbar.button.preStep' })}
5453
</Button>
5554
</Col>
5655
<Col>
5756
<Button type="primary" onClick={() => onChange(step + 1)}>
58-
{step < lastStep ? formatMessage({ id: 'actionbar.next.step' }) : formatMessage({ id: 'actionbar.submit' })}
57+
{step < lastStep
58+
? formatMessage({ id: 'component.actionbar.button.nextStep' })
59+
: formatMessage({ id: 'component.global.button.submit' })}
5960
</Button>
6061
</Col>
6162
</Row>

src/components/ActionBar/locales/en-US.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* limitations under the License.
1616
*/
1717
export default {
18-
'actionbar.last.step': 'Last Step',
19-
'actionbar.next.step': 'Next Step',
20-
'actionbar.submit': 'Submit',
18+
'component.actionbar.button.preStep': 'Previous',
19+
'component.actionbar.button.nextStep': 'Next',
2120
};

src/components/ActionBar/locales/zh-CN.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* limitations under the License.
1616
*/
1717
export default {
18-
'actionbar.last.step': '上一步',
19-
'actionbar.next.step': '下一步',
20-
'actionbar.submit': '提交',
18+
'component.actionbar.button.preStep': '上一步',
19+
'component.actionbar.button.nextStep': '下一步',
2120
};

src/locales/en-US/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default {
2020
'component.tagSelect.all': 'All',
2121
'component.global.remove': 'Remove',
2222
'component.global.cancel': 'Cancel',
23-
'component.global.submit': 'Submit',
23+
'component.global.button.submit': 'Submit',
2424
'component.global.create': 'Create',
2525
'component.global.add': 'Add',
2626
'component.global.save': 'Save',

src/locales/zh-CN/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default {
2020
'component.tagSelect.all': '全部',
2121
'component.global.remove': '删除',
2222
'component.global.cancel': '取消',
23-
'component.global.submit': '提交',
23+
'component.global.button.submit': '提交',
2424
'component.global.create': '创建',
2525
'component.global.add': '新建',
2626
'component.global.save': '保存',

src/pages/Setting/Setting.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ const Setting: React.FC = () => {
6565
resolve();
6666
}),
6767
]).then(() => {
68-
notification.success({ message: formatMessage({ id: 'setting.update.configuration.successfully' }) });
68+
notification.success({
69+
message: formatMessage({
70+
id: 'page.setting.notification.update.configuration.successfully',
71+
}),
72+
});
6973
setTimeout(() => {
7074
window.location.reload();
7175
}, 500);
@@ -74,22 +78,34 @@ const Setting: React.FC = () => {
7478

7579
return (
7680
<>
77-
<PageContainer title={formatMessage({ id: 'set' })}>
81+
<PageContainer title={formatMessage({ id: 'page.setting.pageContainer.title' })}>
7882
<Card>
7983
<Row>
8084
<Col span={10}>
8185
<Form form={form} labelCol={{ span: 7 }}>
8286
{!isWorkspace && (
83-
<Form.Item label={formatMessage({ id: 'setting.api.address' })} name="baseURL">
87+
<Form.Item
88+
label={formatMessage({ id: 'page.setting.form.item.baseURL' })}
89+
name="baseURL"
90+
>
8491
<Input />
8592
</Form.Item>
8693
)}
8794
{canFetchGrafana && (
8895
<Form.Item
89-
label={formatMessage({ id: 'setting.grafana.address' })}
96+
label={formatMessage({ id: 'page.setting.form.item.grafanaURL' })}
9097
name="grafanaURL"
91-
extra={formatMessage({ id: 'setting.grafana.address.rule' })}
92-
rules={[{ pattern: new RegExp(/^https?:\/\//), message: formatMessage({ id: 'setting.grafana.address.illegality' }) }]}
98+
extra={formatMessage({
99+
id: 'page.setting.form.item.grafanaURL.inputHelpMessage',
100+
})}
101+
rules={[
102+
{
103+
pattern: new RegExp(/^https?:\/\//),
104+
message: formatMessage({
105+
id: 'page.setting.form.item.grafanaURL.inputErrorMessage',
106+
}),
107+
},
108+
]}
93109
>
94110
<Input />
95111
</Form.Item>

src/pages/Setting/locales/en-US.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
* limitations under the License.
1616
*/
1717
export default {
18-
'setting.update.configuration.successfully': 'Update Configuration Successfully',
19-
'setting':'Setting',
20-
'setting.api.address':'API Address',
21-
'setting.grafana.address':'Grafana Address',
22-
'setting.grafana.address.rule':'Grafana address should begin with HTTP or HTTPS',
23-
'setting.grafana.address.illegality':'Address is illegality',
18+
'page.setting.notification.update.configuration.successfully':
19+
'Update Configuration Successfully',
20+
'page.setting.pageContainer.title': 'Setting',
21+
'page.setting.form.item.baseURL': 'API Address',
22+
'page.setting.form.item.grafanaURL': 'Grafana Address',
23+
'page.setting.form.item.grafanaURL.inputHelpMessage':
24+
'Grafana address should begin with HTTP or HTTPS',
25+
'page.setting.form.item.grafanaURL.inputErrorMessage': 'Address is illegality',
2426
};

src/pages/Setting/locales/zh-CN.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
* limitations under the License.
1616
*/
1717
export default {
18-
'setting.update.configuration.successfully': '更新配置成功',
19-
'setting':'设置',
20-
'setting.api.address':'API 地址',
21-
'setting.grafana.address':'Grafana 地址',
22-
'setting.grafana.address.rule':'Grafana 地址需以 HTTP 或 HTTPS 开头',
23-
'setting.grafana.address.illegality':'非法的地址',
18+
'page.setting.notification.update.configuration.successfully': '更新配置成功',
19+
'page.setting.pageContainer.title': '设置',
20+
'page.setting.form.item.baseURL': 'API 基础地址',
21+
'page.setting.form.item.grafanaURL': 'Grafana 地址',
22+
'page.setting.form.item.grafanaURL.inputHelpMessage': 'Grafana 地址需以 HTTP 或 HTTPS 开头',
23+
'page.setting.form.item.grafanaURL.inputErrorMessage': '非法的地址',
2424
};

0 commit comments

Comments
 (0)