fix: using the global cron locale

This commit is contained in:
chenos 2024-06-19 17:52:34 +08:00
parent 173dfbfe21
commit 8586992219

View File

@ -7,16 +7,11 @@
* 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 React, { useCallback } from 'react';
import { Cron } from 'react-js-cron';
import { useWorkflowTranslation } from '../../locale';
import CronZhCN from './locale/Cron.zh-CN';
const languages = {
'zh-CN': CronZhCN,
};
const RepeatOptions = [
{ value: 'none', text: 'No repeat' },
@ -65,7 +60,6 @@ function CommonRepeatField({ value, onChange }) {
export function RepeatField({ value = null, onChange }) {
const { t } = useWorkflowTranslation();
const api = useAPIClient();
const typeValue = getRepeatTypeValue(value);
const onTypeChange = useCallback(
(v) => {
@ -82,8 +76,6 @@ export function RepeatField({ value = null, onChange }) {
[onChange],
);
const locale = languages[localStorage.getItem(api.auth.locale) || 'en-US'];
return (
<fieldset
className={css`
@ -130,7 +122,7 @@ export function RepeatField({ value = null, onChange }) {
value={value.trim().split(/\s+/).slice(1).join(' ')}
setValue={(v) => onChange(`0 ${v}`)}
clearButton={false}
locale={locale}
locale={window['cronLocale']}
/>
) : null}
</fieldset>