mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 10:42:19 +08:00
fix: using the global cron locale
This commit is contained in:
parent
173dfbfe21
commit
8586992219
@ -7,16 +7,11 @@
|
|||||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { css, useAPIClient } from '@nocobase/client';
|
import { css } from '@nocobase/client';
|
||||||
import { InputNumber, Select } from 'antd';
|
import { InputNumber, Select } from 'antd';
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { Cron } from 'react-js-cron';
|
import { Cron } from 'react-js-cron';
|
||||||
import { useWorkflowTranslation } from '../../locale';
|
import { useWorkflowTranslation } from '../../locale';
|
||||||
import CronZhCN from './locale/Cron.zh-CN';
|
|
||||||
|
|
||||||
const languages = {
|
|
||||||
'zh-CN': CronZhCN,
|
|
||||||
};
|
|
||||||
|
|
||||||
const RepeatOptions = [
|
const RepeatOptions = [
|
||||||
{ value: 'none', text: 'No repeat' },
|
{ value: 'none', text: 'No repeat' },
|
||||||
@ -65,7 +60,6 @@ function CommonRepeatField({ value, onChange }) {
|
|||||||
|
|
||||||
export function RepeatField({ value = null, onChange }) {
|
export function RepeatField({ value = null, onChange }) {
|
||||||
const { t } = useWorkflowTranslation();
|
const { t } = useWorkflowTranslation();
|
||||||
const api = useAPIClient();
|
|
||||||
const typeValue = getRepeatTypeValue(value);
|
const typeValue = getRepeatTypeValue(value);
|
||||||
const onTypeChange = useCallback(
|
const onTypeChange = useCallback(
|
||||||
(v) => {
|
(v) => {
|
||||||
@ -82,8 +76,6 @@ export function RepeatField({ value = null, onChange }) {
|
|||||||
[onChange],
|
[onChange],
|
||||||
);
|
);
|
||||||
|
|
||||||
const locale = languages[localStorage.getItem(api.auth.locale) || 'en-US'];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<fieldset
|
<fieldset
|
||||||
className={css`
|
className={css`
|
||||||
@ -130,7 +122,7 @@ export function RepeatField({ value = null, onChange }) {
|
|||||||
value={value.trim().split(/\s+/).slice(1).join(' ')}
|
value={value.trim().split(/\s+/).slice(1).join(' ')}
|
||||||
setValue={(v) => onChange(`0 ${v}`)}
|
setValue={(v) => onChange(`0 ${v}`)}
|
||||||
clearButton={false}
|
clearButton={false}
|
||||||
locale={locale}
|
locale={window['cronLocale']}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user