fix(client): add locale for sequence field (#995)

* fix(core): add locale for sequence field

* fix(client): add locale for sequence field
This commit is contained in:
Junyi 2022-10-31 20:52:47 +08:00 committed by GitHub
parent 3aada8fe07
commit 5cb6a9646d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View File

@ -146,13 +146,14 @@ const RuleTypes = {
title: '{{t("Reset cycle")}}', title: '{{t("Reset cycle")}}',
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
['x-component']({ value, onChange }) { ['x-component']({ value, onChange }) {
const { t } = useTranslation();
const shortValues = [ const shortValues = [
{ label: '不重置', value: 0 }, { label: 'No reset', value: 0 },
{ label: '每天', value: 1, cron: '0 0 * * *' }, { label: 'Daily', value: 1, cron: '0 0 * * *' },
{ label: '每周一', value: 2, cron: '0 0 * * 1' }, { label: 'Every Monday', value: 2, cron: '0 0 * * 1' },
{ label: '每月', value: 3, cron: '0 0 1 * *' }, { label: 'Monthly', value: 3, cron: '0 0 1 * *' },
{ label: '每年', value: 4, cron: '0 0 1 1 *' }, { label: 'Yearly', value: 4, cron: '0 0 1 1 *' },
{ label: '自定义', value: 5, cron: '* * * * *' } { label: 'Customize', value: 5, cron: '* * * * *' }
]; ];
const option = typeof value === 'undefined' const option = typeof value === 'undefined'
? shortValues[0] ? shortValues[0]
@ -163,7 +164,7 @@ const RuleTypes = {
<fieldset> <fieldset>
<Select value={option.value} onChange={(v) => onChange(shortValues[v].cron)}> <Select value={option.value} onChange={(v) => onChange(shortValues[v].cron)}>
{shortValues.map(item => ( {shortValues.map(item => (
<Select.Option key={item.value} value={item.value}>{item.label}</Select.Option> <Select.Option key={item.value} value={item.value}>{t(item.label)}</Select.Option>
))} ))}
</Select> </Select>
{option.value === 5 {option.value === 5

View File

@ -143,6 +143,11 @@ export default {
"Start from": "起始于", "Start from": "起始于",
"Starts from {{value}}": "从 {{value}} 开始", "Starts from {{value}}": "从 {{value}} 开始",
"Reset cycle": "重置周期", "Reset cycle": "重置周期",
"No reset": "不重置",
"Daily": "每天",
"Every Monday": "每周一",
"Monthly": "每月",
"Yearly": "每年",
"Operations": "操作", "Operations": "操作",
"Choices": "选择类型", "Choices": "选择类型",
"Checkbox": "勾选", "Checkbox": "勾选",