From d689c7b855908b29bb808d5a51e7905298bb32a4 Mon Sep 17 00:00:00 2001 From: Amumu Date: Fri, 9 Dec 2022 15:04:08 +0800 Subject: [PATCH] feat: Remove locale-provider (#39373) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: remove locale-provider * chore: fix lint * Empty-Commit * test: remove test * Revert "test: remove test" This reverts commit 4f6b59883f6bf078f21a10898ef913c9e2adb913. * chore: 阶段性兼容 * fix lint * fix: fix lint * fix: add index * docs: update docs * docs: update * docs: update * docs: update --- components/calendar/generateCalendar.tsx | 2 +- .../config-provider/__tests__/locale.test.tsx | 4 +- components/config-provider/context.tsx | 2 +- components/config-provider/index.tsx | 6 +- .../date-picker/__tests__/other.test.tsx | 6 +- .../generatePicker/generateRangePicker.tsx | 2 +- .../generatePicker/generateSinglePicker.tsx | 2 +- components/empty/index.tsx | 2 +- components/form/FormItemLabel.tsx | 2 +- components/locale-provider/LocaleReceiver.tsx | 64 +------- .../__tests__/cached-context.test.tsx | 4 +- .../locale-provider/__tests__/config.test.tsx | 2 +- .../locale-provider/__tests__/index.test.tsx | 140 +++++++++--------- components/locale-provider/ar_EG.tsx | 3 - components/locale-provider/az_AZ.tsx | 3 - components/locale-provider/bg_BG.tsx | 3 - components/locale-provider/bn_BD.tsx | 3 - components/locale-provider/by_BY.tsx | 3 - components/locale-provider/ca_ES.tsx | 3 - components/locale-provider/cs_CZ.tsx | 3 - components/locale-provider/da_DK.tsx | 3 - components/locale-provider/de_DE.tsx | 3 - components/locale-provider/el_GR.tsx | 3 - components/locale-provider/en_GB.tsx | 3 - components/locale-provider/en_US.tsx | 3 - components/locale-provider/es_ES.tsx | 3 - components/locale-provider/et_EE.tsx | 3 - components/locale-provider/eu_ES.tsx | 3 - components/locale-provider/fa_IR.tsx | 3 - components/locale-provider/fi_FI.tsx | 3 - components/locale-provider/fr_BE.tsx | 3 - components/locale-provider/fr_CA.tsx | 3 - components/locale-provider/fr_FR.tsx | 3 - components/locale-provider/ga_IE.tsx | 3 - components/locale-provider/gl_ES.tsx | 3 - components/locale-provider/he_IL.tsx | 3 - components/locale-provider/hi_IN.tsx | 3 - components/locale-provider/hr_HR.tsx | 3 - components/locale-provider/hu_HU.tsx | 3 - components/locale-provider/hy_AM.tsx | 3 - components/locale-provider/id_ID.tsx | 3 - components/locale-provider/index.ts | 6 + components/locale-provider/is_IS.tsx | 3 - components/locale-provider/it_IT.tsx | 3 - components/locale-provider/ja_JP.tsx | 3 - components/locale-provider/ka_GE.tsx | 3 - components/locale-provider/kk_KZ.tsx | 3 - components/locale-provider/km_KH.tsx | 3 - components/locale-provider/kmr_IQ.tsx | 3 - components/locale-provider/kn_IN.tsx | 3 - components/locale-provider/ko_KR.tsx | 3 - components/locale-provider/ku_IQ.tsx | 3 - components/locale-provider/lt_LT.tsx | 3 - components/locale-provider/lv_LV.tsx | 3 - components/locale-provider/mk_MK.tsx | 3 - components/locale-provider/ml_IN.tsx | 3 - components/locale-provider/mn_MN.tsx | 3 - components/locale-provider/ms_MY.tsx | 3 - components/locale-provider/nb_NO.tsx | 3 - components/locale-provider/ne_NP.tsx | 3 - components/locale-provider/nl_BE.tsx | 3 - components/locale-provider/nl_NL.tsx | 3 - components/locale-provider/pl_PL.tsx | 3 - components/locale-provider/pt_BR.tsx | 3 - components/locale-provider/pt_PT.tsx | 3 - components/locale-provider/ro_RO.tsx | 3 - components/locale-provider/ru_RU.tsx | 3 - components/locale-provider/si_LK.tsx | 3 - components/locale-provider/sk_SK.tsx | 3 - components/locale-provider/sl_SI.tsx | 3 - components/locale-provider/sr_RS.tsx | 3 - components/locale-provider/sv_SE.tsx | 3 - components/locale-provider/ta_IN.tsx | 3 - components/locale-provider/th_TH.tsx | 3 - components/locale-provider/tk_TK.tsx | 3 - components/locale-provider/tr_TR.tsx | 3 - components/locale-provider/uk_UA.tsx | 3 - components/locale-provider/ur_PK.tsx | 3 - components/locale-provider/vi_VN.tsx | 3 - components/locale-provider/zh_CN.tsx | 3 - components/locale-provider/zh_HK.tsx | 3 - components/locale-provider/zh_TW.tsx | 3 - components/locale/LocaleReceiver.tsx | 64 ++++++++ components/locale/ar_EG.tsx | 2 +- components/locale/az_AZ.tsx | 2 +- components/locale/bg_BG.tsx | 2 +- components/locale/bn_BD.tsx | 2 +- components/locale/by_BY.tsx | 2 +- components/locale/ca_ES.tsx | 2 +- .../{locale-provider => locale}/context.ts | 0 components/locale/cs_CZ.tsx | 2 +- components/locale/da_DK.tsx | 2 +- components/locale/de_DE.tsx | 2 +- components/locale/el_GR.tsx | 2 +- components/locale/en_GB.tsx | 2 +- components/locale/en_US.tsx | 2 +- components/locale/es_ES.tsx | 2 +- components/locale/et_EE.tsx | 2 +- components/locale/eu_ES.tsx | 2 +- components/locale/fa_IR.tsx | 2 +- components/locale/fi_FI.tsx | 2 +- components/locale/fr_BE.tsx | 2 +- components/locale/fr_CA.tsx | 2 +- components/locale/fr_FR.tsx | 2 +- components/locale/ga_IE.tsx | 2 +- components/locale/gl_ES.tsx | 2 +- components/locale/he_IL.tsx | 2 +- components/locale/hi_IN.tsx | 2 +- components/locale/hr_HR.tsx | 2 +- components/locale/hu_HU.tsx | 2 +- components/locale/hy_AM.tsx | 2 +- components/locale/id_ID.tsx | 2 +- .../{locale-provider => locale}/index.tsx | 0 components/locale/is_IS.tsx | 2 +- components/locale/it_IT.tsx | 2 +- components/locale/ja_JP.tsx | 2 +- components/locale/ka_GE.tsx | 2 +- components/locale/kk_KZ.tsx | 2 +- components/locale/km_KH.tsx | 2 +- components/locale/kmr_IQ.tsx | 2 +- components/locale/kn_IN.tsx | 2 +- components/locale/ko_KR.tsx | 2 +- components/locale/ku_IQ.tsx | 2 +- components/locale/lt_LT.tsx | 2 +- components/locale/lv_LV.tsx | 2 +- components/locale/mk_MK.tsx | 2 +- components/locale/ml_IN.tsx | 2 +- components/locale/mn_MN.tsx | 2 +- components/locale/ms_MY.tsx | 2 +- components/locale/nb_NO.tsx | 2 +- components/locale/ne_NP.tsx | 2 +- components/locale/nl_BE.tsx | 2 +- components/locale/nl_NL.tsx | 2 +- components/locale/pl_PL.tsx | 2 +- components/locale/pt_BR.tsx | 2 +- components/locale/pt_PT.tsx | 2 +- components/locale/ro_RO.tsx | 2 +- components/locale/ru_RU.tsx | 2 +- components/locale/si_LK.tsx | 2 +- components/locale/sk_SK.tsx | 2 +- components/locale/sl_SI.tsx | 2 +- components/locale/sr_RS.tsx | 2 +- components/locale/sv_SE.tsx | 2 +- components/locale/ta_IN.tsx | 2 +- components/locale/th_TH.tsx | 2 +- components/locale/tk_TK.tsx | 2 +- components/locale/tr_TR.tsx | 2 +- components/locale/uk_UA.tsx | 2 +- components/locale/ur_PK.tsx | 2 +- components/locale/vi_VN.tsx | 2 +- components/locale/zh_CN.tsx | 2 +- components/locale/zh_HK.tsx | 2 +- components/locale/zh_TW.tsx | 2 +- components/modal/ConfirmDialog.tsx | 2 +- components/modal/PurePanel.tsx | 2 +- components/modal/useModal/HookModal.tsx | 2 +- components/pagination/Pagination.tsx | 2 +- components/popconfirm/PurePanel.tsx | 2 +- components/qrcode/index.tsx | 2 +- components/tour/panelRender.tsx | 2 +- components/transfer/ListItem.tsx | 2 +- components/transfer/index.tsx | 2 +- components/typography/Base/index.tsx | 2 +- components/upload/Upload.tsx | 2 +- docs/react/i18n.en-US.md | 4 +- docs/react/i18n.zh-CN.md | 6 +- docs/react/migration-v5.en-US.md | 2 +- docs/react/migration-v5.zh-CN.md | 2 +- scripts/generateLegacyLocale.js | 23 --- tests/dekko/lib.test.js | 38 ----- 170 files changed, 246 insertions(+), 499 deletions(-) delete mode 100644 components/locale-provider/ar_EG.tsx delete mode 100644 components/locale-provider/az_AZ.tsx delete mode 100644 components/locale-provider/bg_BG.tsx delete mode 100644 components/locale-provider/bn_BD.tsx delete mode 100644 components/locale-provider/by_BY.tsx delete mode 100644 components/locale-provider/ca_ES.tsx delete mode 100644 components/locale-provider/cs_CZ.tsx delete mode 100644 components/locale-provider/da_DK.tsx delete mode 100644 components/locale-provider/de_DE.tsx delete mode 100644 components/locale-provider/el_GR.tsx delete mode 100644 components/locale-provider/en_GB.tsx delete mode 100644 components/locale-provider/en_US.tsx delete mode 100644 components/locale-provider/es_ES.tsx delete mode 100644 components/locale-provider/et_EE.tsx delete mode 100644 components/locale-provider/eu_ES.tsx delete mode 100644 components/locale-provider/fa_IR.tsx delete mode 100644 components/locale-provider/fi_FI.tsx delete mode 100644 components/locale-provider/fr_BE.tsx delete mode 100644 components/locale-provider/fr_CA.tsx delete mode 100644 components/locale-provider/fr_FR.tsx delete mode 100644 components/locale-provider/ga_IE.tsx delete mode 100644 components/locale-provider/gl_ES.tsx delete mode 100644 components/locale-provider/he_IL.tsx delete mode 100644 components/locale-provider/hi_IN.tsx delete mode 100644 components/locale-provider/hr_HR.tsx delete mode 100644 components/locale-provider/hu_HU.tsx delete mode 100644 components/locale-provider/hy_AM.tsx delete mode 100644 components/locale-provider/id_ID.tsx create mode 100644 components/locale-provider/index.ts delete mode 100644 components/locale-provider/is_IS.tsx delete mode 100644 components/locale-provider/it_IT.tsx delete mode 100644 components/locale-provider/ja_JP.tsx delete mode 100644 components/locale-provider/ka_GE.tsx delete mode 100644 components/locale-provider/kk_KZ.tsx delete mode 100644 components/locale-provider/km_KH.tsx delete mode 100644 components/locale-provider/kmr_IQ.tsx delete mode 100644 components/locale-provider/kn_IN.tsx delete mode 100644 components/locale-provider/ko_KR.tsx delete mode 100644 components/locale-provider/ku_IQ.tsx delete mode 100644 components/locale-provider/lt_LT.tsx delete mode 100644 components/locale-provider/lv_LV.tsx delete mode 100644 components/locale-provider/mk_MK.tsx delete mode 100644 components/locale-provider/ml_IN.tsx delete mode 100644 components/locale-provider/mn_MN.tsx delete mode 100644 components/locale-provider/ms_MY.tsx delete mode 100644 components/locale-provider/nb_NO.tsx delete mode 100644 components/locale-provider/ne_NP.tsx delete mode 100644 components/locale-provider/nl_BE.tsx delete mode 100644 components/locale-provider/nl_NL.tsx delete mode 100644 components/locale-provider/pl_PL.tsx delete mode 100644 components/locale-provider/pt_BR.tsx delete mode 100644 components/locale-provider/pt_PT.tsx delete mode 100644 components/locale-provider/ro_RO.tsx delete mode 100644 components/locale-provider/ru_RU.tsx delete mode 100644 components/locale-provider/si_LK.tsx delete mode 100644 components/locale-provider/sk_SK.tsx delete mode 100644 components/locale-provider/sl_SI.tsx delete mode 100644 components/locale-provider/sr_RS.tsx delete mode 100644 components/locale-provider/sv_SE.tsx delete mode 100644 components/locale-provider/ta_IN.tsx delete mode 100644 components/locale-provider/th_TH.tsx delete mode 100644 components/locale-provider/tk_TK.tsx delete mode 100644 components/locale-provider/tr_TR.tsx delete mode 100644 components/locale-provider/uk_UA.tsx delete mode 100644 components/locale-provider/ur_PK.tsx delete mode 100644 components/locale-provider/vi_VN.tsx delete mode 100644 components/locale-provider/zh_CN.tsx delete mode 100644 components/locale-provider/zh_HK.tsx delete mode 100644 components/locale-provider/zh_TW.tsx create mode 100644 components/locale/LocaleReceiver.tsx rename components/{locale-provider => locale}/context.ts (100%) rename components/{locale-provider => locale}/index.tsx (100%) delete mode 100644 scripts/generateLegacyLocale.js diff --git a/components/calendar/generateCalendar.tsx b/components/calendar/generateCalendar.tsx index 63f8a9533a..ffc51fa20a 100644 --- a/components/calendar/generateCalendar.tsx +++ b/components/calendar/generateCalendar.tsx @@ -10,7 +10,7 @@ import type { import useMergedState from 'rc-util/lib/hooks/useMergedState'; import * as React from 'react'; import { ConfigContext } from '../config-provider'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import CalendarHeader from './Header'; import enUS from './locale/en_US'; diff --git a/components/config-provider/__tests__/locale.test.tsx b/components/config-provider/__tests__/locale.test.tsx index 2842648117..677fc3ec56 100644 --- a/components/config-provider/__tests__/locale.test.tsx +++ b/components/config-provider/__tests__/locale.test.tsx @@ -2,8 +2,8 @@ import React from 'react'; import { closePicker, openPicker, selectCell } from '../../date-picker/__tests__/utils'; import ConfigProvider from '..'; import DatePicker from '../../date-picker'; -import type { Locale } from '../../locale-provider'; -import LocaleProvider from '../../locale-provider'; +import type { Locale } from '../../locale'; +import LocaleProvider from '../../locale'; import enUS from '../../locale/en_US'; import zhCN from '../../locale/zh_CN'; import Modal from '../../modal'; diff --git a/components/config-provider/context.tsx b/components/config-provider/context.tsx index ea90512c5d..4f17595dc9 100644 --- a/components/config-provider/context.tsx +++ b/components/config-provider/context.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import type { DerivativeFunc } from '@ant-design/cssinjs'; import type { RequiredMark } from '../form/Form'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import type { AliasToken, MapToken, OverrideToken, SeedToken } from '../theme/interface'; import type { RenderEmptyHandler } from './defaultRenderEmpty'; import type { SizeType } from './SizeContext'; diff --git a/components/config-provider/index.tsx b/components/config-provider/index.tsx index a0cb824d8f..fefc898b08 100644 --- a/components/config-provider/index.tsx +++ b/components/config-provider/index.tsx @@ -6,9 +6,9 @@ import useMemo from 'rc-util/lib/hooks/useMemo'; import * as React from 'react'; import type { ReactElement } from 'react'; import type { RequiredMark } from '../form/Form'; -import type { Locale } from '../locale-provider'; -import LocaleProvider, { ANT_MARK } from '../locale-provider'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import type { Locale } from '../locale'; +import LocaleProvider, { ANT_MARK } from '../locale'; +import LocaleReceiver from '../locale/LocaleReceiver'; import defaultLocale from '../locale/en_US'; import { DesignTokenContext } from '../theme/internal'; import defaultSeedToken from '../theme/themes/seed'; diff --git a/components/date-picker/__tests__/other.test.tsx b/components/date-picker/__tests__/other.test.tsx index 7b160ab305..7af93c50a3 100644 --- a/components/date-picker/__tests__/other.test.tsx +++ b/components/date-picker/__tests__/other.test.tsx @@ -4,9 +4,9 @@ import customParseFormat from 'dayjs/plugin/customParseFormat'; import React from 'react'; import DatePicker from '..'; import ConfigProvider from '../../config-provider'; -import type { Locale } from '../../locale-provider'; -import LocaleProvider from '../../locale-provider'; -import locale from '../../locale-provider/zh_CN'; +import type { Locale } from '../../locale'; +import LocaleProvider from '../../locale'; +import locale from '../../locale/zh_CN'; import jaJP from '../../locale/ja_JP'; import zhTW from '../locale/zh_TW'; import { render } from '../../../tests/utils'; diff --git a/components/date-picker/generatePicker/generateRangePicker.tsx b/components/date-picker/generatePicker/generateRangePicker.tsx index 0774a456a7..9dc48bb908 100644 --- a/components/date-picker/generatePicker/generateRangePicker.tsx +++ b/components/date-picker/generatePicker/generateRangePicker.tsx @@ -14,7 +14,7 @@ import DisabledContext from '../../config-provider/DisabledContext'; import SizeContext from '../../config-provider/SizeContext'; import { FormItemInputContext } from '../../form/context'; import { useCompactItemContext } from '../../space/Compact'; -import LocaleReceiver from '../../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../../locale/LocaleReceiver'; import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils'; import enUS from '../locale/en_US'; import { getRangePlaceholder, transPlacement2DropdownAlign } from '../util'; diff --git a/components/date-picker/generatePicker/generateSinglePicker.tsx b/components/date-picker/generatePicker/generateSinglePicker.tsx index d37b7b59b9..6a70810eba 100644 --- a/components/date-picker/generatePicker/generateSinglePicker.tsx +++ b/components/date-picker/generatePicker/generateSinglePicker.tsx @@ -14,7 +14,7 @@ import { ConfigContext } from '../../config-provider'; import DisabledContext from '../../config-provider/DisabledContext'; import SizeContext from '../../config-provider/SizeContext'; import { FormItemInputContext } from '../../form/context'; -import LocaleReceiver from '../../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../../locale/LocaleReceiver'; import type { InputStatus } from '../../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils'; import warning from '../../_util/warning'; diff --git a/components/empty/index.tsx b/components/empty/index.tsx index 407d9d6cee..d45a69e738 100644 --- a/components/empty/index.tsx +++ b/components/empty/index.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import * as React from 'react'; import { ConfigContext } from '../config-provider'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import DefaultEmptyImg from './empty'; import SimpleEmptyImg from './simple'; diff --git a/components/form/FormItemLabel.tsx b/components/form/FormItemLabel.tsx index cb8d2d5195..961a03fd54 100644 --- a/components/form/FormItemLabel.tsx +++ b/components/form/FormItemLabel.tsx @@ -3,7 +3,7 @@ import classNames from 'classnames'; import * as React from 'react'; import type { ColProps } from '../grid/col'; import Col from '../grid/col'; -import { useLocaleReceiver } from '../locale-provider/LocaleReceiver'; +import { useLocaleReceiver } from '../locale/LocaleReceiver'; import defaultLocale from '../locale/en_US'; import type { TooltipProps } from '../tooltip'; import Tooltip from '../tooltip'; diff --git a/components/locale-provider/LocaleReceiver.tsx b/components/locale-provider/LocaleReceiver.tsx index 94685af859..50d1d6201e 100644 --- a/components/locale-provider/LocaleReceiver.tsx +++ b/components/locale-provider/LocaleReceiver.tsx @@ -1,64 +1,6 @@ -import * as React from 'react'; -import type { Locale } from '.'; -import type { LocaleContextProps } from './context'; -import LocaleContext from './context'; -import defaultLocaleData from '../locale/en_US'; +// locale-provider 文件夹的移除需要修改 @ant-design/tools 和 antd-img-crop +import LocaleReceiver from '../locale/LocaleReceiver'; -export type LocaleComponentName = Exclude; - -export interface LocaleReceiverProps { - componentName?: C; - defaultLocale?: Locale[C] | (() => Locale[C]); - children: ( - locale: NonNullable, - localeCode: string, - fullLocale: Locale, - ) => React.ReactElement; -} - -const LocaleReceiver = ( - props: LocaleReceiverProps, -) => { - const { componentName = 'global' as C, defaultLocale, children } = props; - const antLocale = React.useContext(LocaleContext); - - const getLocale = React.useMemo>(() => { - const locale = defaultLocale || defaultLocaleData[componentName]; - const localeFromContext = antLocale?.[componentName] ?? {}; - return { - ...(locale instanceof Function ? locale() : locale), - ...(localeFromContext || {}), - }; - }, [componentName, defaultLocale, antLocale]); - - const getLocaleCode = React.useMemo(() => { - const localeCode = antLocale && antLocale.locale; - // Had use LocaleProvide but didn't set locale - if (antLocale && antLocale.exist && !localeCode) { - return defaultLocaleData.locale; - } - return localeCode!; - }, [antLocale]); - - return children(getLocale, getLocaleCode, antLocale!); -}; +export * from '../locale/LocaleReceiver'; export default LocaleReceiver; - -export const useLocaleReceiver = ( - componentName: C, - defaultLocale?: Locale[C] | (() => Locale[C]), -): [Locale[C]] => { - const antLocale = React.useContext(LocaleContext); - - const getLocale = React.useMemo>(() => { - const locale = defaultLocale || defaultLocaleData[componentName]; - const localeFromContext = antLocale?.[componentName] ?? {}; - return { - ...(typeof locale === 'function' ? locale() : locale), - ...(localeFromContext || {}), - }; - }, [componentName, defaultLocale, antLocale]); - - return [getLocale]; -}; diff --git a/components/locale-provider/__tests__/cached-context.test.tsx b/components/locale-provider/__tests__/cached-context.test.tsx index c9a9406e66..b690de29bb 100644 --- a/components/locale-provider/__tests__/cached-context.test.tsx +++ b/components/locale-provider/__tests__/cached-context.test.tsx @@ -1,7 +1,7 @@ import React, { memo, useContext } from 'react'; import { fireEvent, pureRender } from '../../../tests/utils'; -import LocaleProvider from '..'; -import LocaleContext from '../context'; +import LocaleProvider from '../../locale'; +import LocaleContext from '../../locale/context'; let innerCount = 0; let outerCount = 0; diff --git a/components/locale-provider/__tests__/config.test.tsx b/components/locale-provider/__tests__/config.test.tsx index 886db210d8..70c5b8ad1e 100644 --- a/components/locale-provider/__tests__/config.test.tsx +++ b/components/locale-provider/__tests__/config.test.tsx @@ -2,7 +2,7 @@ import React, { useEffect } from 'react'; import { Modal } from '../..'; import { waitFakeTimer, render, fireEvent } from '../../../tests/utils'; import ConfigProvider from '../../config-provider'; -import zhCN from '../zh_CN'; +import zhCN from '../../locale/zh_CN'; const Demo: React.FC<{ type: string }> = ({ type }) => { useEffect(() => { diff --git a/components/locale-provider/__tests__/index.test.tsx b/components/locale-provider/__tests__/index.test.tsx index 05d8f6a3fe..330e902aba 100644 --- a/components/locale-provider/__tests__/index.test.tsx +++ b/components/locale-provider/__tests__/index.test.tsx @@ -68,8 +68,8 @@ import preParsePostFormat from 'dayjs/plugin/preParsePostFormat'; import MockDate from 'mockdate'; import React from 'react'; import { render } from '../../../tests/utils'; -import type { Locale } from '..'; -import LocaleProvider from '..'; +import type { Locale } from '../../locale'; +import LocaleProvider from '../../locale'; import { Calendar, DatePicker, @@ -82,74 +82,74 @@ import { Transfer, } from '../..'; import mountTest from '../../../tests/shared/mountTest'; -import arEG from '../ar_EG'; -import azAZ from '../az_AZ'; -import bgBG from '../bg_BG'; -import bnBD from '../bn_BD'; -import byBY from '../by_BY'; -import caES from '../ca_ES'; -import csCZ from '../cs_CZ'; -import daDK from '../da_DK'; -import deDE from '../de_DE'; -import elGR from '../el_GR'; -import enGB from '../en_GB'; -import enUS from '../en_US'; -import esES from '../es_ES'; -import etEE from '../et_EE'; -import euES from '../eu_ES'; -import faIR from '../fa_IR'; -import fiFI from '../fi_FI'; -import frBE from '../fr_BE'; -import frCA from '../fr_CA'; -import frFR from '../fr_FR'; -import gaIE from '../ga_IE'; -import glES from '../gl_ES'; -import heIL from '../he_IL'; -import hiIN from '../hi_IN'; -import hrHR from '../hr_HR'; -import huHU from '../hu_HU'; -import hyAM from '../hy_AM'; -import idID from '../id_ID'; -import isIS from '../is_IS'; -import itIT from '../it_IT'; -import jaJP from '../ja_JP'; -import kaGE from '../ka_GE'; -import kkKZ from '../kk_KZ'; -import kmrIQ from '../kmr_IQ'; -import kmKH from '../km_KH'; -import knIN from '../kn_IN'; -import koKR from '../ko_KR'; -import kuIQ from '../ku_IQ'; -import ltLT from '../lt_LT'; -import lvLV from '../lv_LV'; -import mkMK from '../mk_MK'; -import mlIN from '../ml_IN'; -import mnMN from '../mn_MN'; -import msMY from '../ms_MY'; -import nbNO from '../nb_NO'; -import neNP from '../ne_NP'; -import nlBE from '../nl_BE'; -import nlNL from '../nl_NL'; -import plPL from '../pl_PL'; -import ptBR from '../pt_BR'; -import ptPT from '../pt_PT'; -import roRO from '../ro_RO'; -import ruRU from '../ru_RU'; -import siLK from '../si_LK'; -import skSK from '../sk_SK'; -import slSI from '../sl_SI'; -import srRS from '../sr_RS'; -import svSE from '../sv_SE'; -import taIN from '../ta_IN'; -import thTH from '../th_TH'; -import tkTK from '../tk_TK'; -import trTR from '../tr_TR'; -import ukUA from '../uk_UA'; -import urPK from '../ur_PK'; -import viVN from '../vi_VN'; -import zhCN from '../zh_CN'; -import zhHK from '../zh_HK'; -import zhTW from '../zh_TW'; +import arEG from '../../locale/ar_EG'; +import azAZ from '../../locale/az_AZ'; +import bgBG from '../../locale/bg_BG'; +import bnBD from '../../locale/bn_BD'; +import byBY from '../../locale/by_BY'; +import caES from '../../locale/ca_ES'; +import csCZ from '../../locale/cs_CZ'; +import daDK from '../../locale/da_DK'; +import deDE from '../../locale/de_DE'; +import elGR from '../../locale/el_GR'; +import enGB from '../../locale/en_GB'; +import enUS from '../../locale/en_US'; +import esES from '../../locale/es_ES'; +import etEE from '../../locale/et_EE'; +import euES from '../../locale/eu_ES'; +import faIR from '../../locale/fa_IR'; +import fiFI from '../../locale/fi_FI'; +import frBE from '../../locale/fr_BE'; +import frCA from '../../locale/fr_CA'; +import frFR from '../../locale/fr_FR'; +import gaIE from '../../locale/ga_IE'; +import glES from '../../locale/gl_ES'; +import heIL from '../../locale/he_IL'; +import hiIN from '../../locale/hi_IN'; +import hrHR from '../../locale/hr_HR'; +import huHU from '../../locale/hu_HU'; +import hyAM from '../../locale/hy_AM'; +import idID from '../../locale/id_ID'; +import isIS from '../../locale/is_IS'; +import itIT from '../../locale/it_IT'; +import jaJP from '../../locale/ja_JP'; +import kaGE from '../../locale/ka_GE'; +import kkKZ from '../../locale/kk_KZ'; +import kmrIQ from '../../locale/kmr_IQ'; +import kmKH from '../../locale/km_KH'; +import knIN from '../../locale/kn_IN'; +import koKR from '../../locale/ko_KR'; +import kuIQ from '../../locale/ku_IQ'; +import ltLT from '../../locale/lt_LT'; +import lvLV from '../../locale/lv_LV'; +import mkMK from '../../locale/mk_MK'; +import mlIN from '../../locale/ml_IN'; +import mnMN from '../../locale/mn_MN'; +import msMY from '../../locale/ms_MY'; +import nbNO from '../../locale/nb_NO'; +import neNP from '../../locale/ne_NP'; +import nlBE from '../../locale/nl_BE'; +import nlNL from '../../locale/nl_NL'; +import plPL from '../../locale/pl_PL'; +import ptBR from '../../locale/pt_BR'; +import ptPT from '../../locale/pt_PT'; +import roRO from '../../locale/ro_RO'; +import ruRU from '../../locale/ru_RU'; +import siLK from '../../locale/si_LK'; +import skSK from '../../locale/sk_SK'; +import slSI from '../../locale/sl_SI'; +import srRS from '../../locale/sr_RS'; +import svSE from '../../locale/sv_SE'; +import taIN from '../../locale/ta_IN'; +import thTH from '../../locale/th_TH'; +import tkTK from '../../locale/tk_TK'; +import trTR from '../../locale/tr_TR'; +import ukUA from '../../locale/uk_UA'; +import urPK from '../../locale/ur_PK'; +import viVN from '../../locale/vi_VN'; +import zhCN from '../../locale/zh_CN'; +import zhHK from '../../locale/zh_HK'; +import zhTW from '../../locale/zh_TW'; dayjs.extend(preParsePostFormat); diff --git a/components/locale-provider/ar_EG.tsx b/components/locale-provider/ar_EG.tsx deleted file mode 100644 index 55b7906d95..0000000000 --- a/components/locale-provider/ar_EG.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ar_EG'; - -export default locale; diff --git a/components/locale-provider/az_AZ.tsx b/components/locale-provider/az_AZ.tsx deleted file mode 100644 index b2f4b3f1ee..0000000000 --- a/components/locale-provider/az_AZ.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/az_AZ'; - -export default locale; diff --git a/components/locale-provider/bg_BG.tsx b/components/locale-provider/bg_BG.tsx deleted file mode 100644 index 2cf89f06a4..0000000000 --- a/components/locale-provider/bg_BG.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/bg_BG'; - -export default locale; diff --git a/components/locale-provider/bn_BD.tsx b/components/locale-provider/bn_BD.tsx deleted file mode 100644 index a5e02075e9..0000000000 --- a/components/locale-provider/bn_BD.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/bn_BD'; - -export default locale; diff --git a/components/locale-provider/by_BY.tsx b/components/locale-provider/by_BY.tsx deleted file mode 100644 index 61e41a6f34..0000000000 --- a/components/locale-provider/by_BY.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/by_BY'; - -export default locale; diff --git a/components/locale-provider/ca_ES.tsx b/components/locale-provider/ca_ES.tsx deleted file mode 100644 index bfca168429..0000000000 --- a/components/locale-provider/ca_ES.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ca_ES'; - -export default locale; diff --git a/components/locale-provider/cs_CZ.tsx b/components/locale-provider/cs_CZ.tsx deleted file mode 100644 index a14aefebda..0000000000 --- a/components/locale-provider/cs_CZ.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/cs_CZ'; - -export default locale; diff --git a/components/locale-provider/da_DK.tsx b/components/locale-provider/da_DK.tsx deleted file mode 100644 index 92a83f169b..0000000000 --- a/components/locale-provider/da_DK.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/da_DK'; - -export default locale; diff --git a/components/locale-provider/de_DE.tsx b/components/locale-provider/de_DE.tsx deleted file mode 100644 index f804a836e5..0000000000 --- a/components/locale-provider/de_DE.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/de_DE'; - -export default locale; diff --git a/components/locale-provider/el_GR.tsx b/components/locale-provider/el_GR.tsx deleted file mode 100644 index 0934a503f3..0000000000 --- a/components/locale-provider/el_GR.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/el_GR'; - -export default locale; diff --git a/components/locale-provider/en_GB.tsx b/components/locale-provider/en_GB.tsx deleted file mode 100644 index 73926d57b6..0000000000 --- a/components/locale-provider/en_GB.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/en_GB'; - -export default locale; diff --git a/components/locale-provider/en_US.tsx b/components/locale-provider/en_US.tsx deleted file mode 100644 index c1a1995e17..0000000000 --- a/components/locale-provider/en_US.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/en_US'; - -export default locale; diff --git a/components/locale-provider/es_ES.tsx b/components/locale-provider/es_ES.tsx deleted file mode 100644 index 2ad9715e12..0000000000 --- a/components/locale-provider/es_ES.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/es_ES'; - -export default locale; diff --git a/components/locale-provider/et_EE.tsx b/components/locale-provider/et_EE.tsx deleted file mode 100644 index 0b6a19b02f..0000000000 --- a/components/locale-provider/et_EE.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/et_EE'; - -export default locale; diff --git a/components/locale-provider/eu_ES.tsx b/components/locale-provider/eu_ES.tsx deleted file mode 100644 index 400ef77553..0000000000 --- a/components/locale-provider/eu_ES.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/eu_ES'; - -export default locale; \ No newline at end of file diff --git a/components/locale-provider/fa_IR.tsx b/components/locale-provider/fa_IR.tsx deleted file mode 100644 index a1d65051fd..0000000000 --- a/components/locale-provider/fa_IR.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/fa_IR'; - -export default locale; diff --git a/components/locale-provider/fi_FI.tsx b/components/locale-provider/fi_FI.tsx deleted file mode 100644 index 59c506f6bc..0000000000 --- a/components/locale-provider/fi_FI.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/fi_FI'; - -export default locale; diff --git a/components/locale-provider/fr_BE.tsx b/components/locale-provider/fr_BE.tsx deleted file mode 100644 index b93758edce..0000000000 --- a/components/locale-provider/fr_BE.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/fr_BE'; - -export default locale; diff --git a/components/locale-provider/fr_CA.tsx b/components/locale-provider/fr_CA.tsx deleted file mode 100644 index cfca41c6c5..0000000000 --- a/components/locale-provider/fr_CA.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/fr_CA'; - -export default locale; diff --git a/components/locale-provider/fr_FR.tsx b/components/locale-provider/fr_FR.tsx deleted file mode 100644 index 97184887b2..0000000000 --- a/components/locale-provider/fr_FR.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/fr_FR'; - -export default locale; diff --git a/components/locale-provider/ga_IE.tsx b/components/locale-provider/ga_IE.tsx deleted file mode 100644 index 75358cd9ce..0000000000 --- a/components/locale-provider/ga_IE.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ga_IE'; - -export default locale; diff --git a/components/locale-provider/gl_ES.tsx b/components/locale-provider/gl_ES.tsx deleted file mode 100644 index 49cf38ea52..0000000000 --- a/components/locale-provider/gl_ES.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/gl_ES'; - -export default locale; diff --git a/components/locale-provider/he_IL.tsx b/components/locale-provider/he_IL.tsx deleted file mode 100644 index 225fc31cb3..0000000000 --- a/components/locale-provider/he_IL.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/he_IL'; - -export default locale; diff --git a/components/locale-provider/hi_IN.tsx b/components/locale-provider/hi_IN.tsx deleted file mode 100644 index fb1b0bda4f..0000000000 --- a/components/locale-provider/hi_IN.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/hi_IN'; - -export default locale; diff --git a/components/locale-provider/hr_HR.tsx b/components/locale-provider/hr_HR.tsx deleted file mode 100644 index d021e11019..0000000000 --- a/components/locale-provider/hr_HR.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/hr_HR'; - -export default locale; diff --git a/components/locale-provider/hu_HU.tsx b/components/locale-provider/hu_HU.tsx deleted file mode 100644 index 6087d3fd30..0000000000 --- a/components/locale-provider/hu_HU.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/hu_HU'; - -export default locale; diff --git a/components/locale-provider/hy_AM.tsx b/components/locale-provider/hy_AM.tsx deleted file mode 100644 index 70cfbb12bd..0000000000 --- a/components/locale-provider/hy_AM.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/hy_AM'; - -export default locale; diff --git a/components/locale-provider/id_ID.tsx b/components/locale-provider/id_ID.tsx deleted file mode 100644 index 59b6761330..0000000000 --- a/components/locale-provider/id_ID.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/id_ID'; - -export default locale; diff --git a/components/locale-provider/index.ts b/components/locale-provider/index.ts new file mode 100644 index 0000000000..391dae433c --- /dev/null +++ b/components/locale-provider/index.ts @@ -0,0 +1,6 @@ +// locale-provider 文件夹的移除需要修改 @ant-design/tools 和 antd-img-crop +import locale from '../locale'; + +export * from '../locale'; + +export default locale; diff --git a/components/locale-provider/is_IS.tsx b/components/locale-provider/is_IS.tsx deleted file mode 100644 index cf8b9a9f6c..0000000000 --- a/components/locale-provider/is_IS.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/is_IS'; - -export default locale; diff --git a/components/locale-provider/it_IT.tsx b/components/locale-provider/it_IT.tsx deleted file mode 100644 index c3f68f401e..0000000000 --- a/components/locale-provider/it_IT.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/it_IT'; - -export default locale; diff --git a/components/locale-provider/ja_JP.tsx b/components/locale-provider/ja_JP.tsx deleted file mode 100644 index 9f1f2f7942..0000000000 --- a/components/locale-provider/ja_JP.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ja_JP'; - -export default locale; diff --git a/components/locale-provider/ka_GE.tsx b/components/locale-provider/ka_GE.tsx deleted file mode 100644 index 4c97bc0492..0000000000 --- a/components/locale-provider/ka_GE.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ka_GE'; - -export default locale; diff --git a/components/locale-provider/kk_KZ.tsx b/components/locale-provider/kk_KZ.tsx deleted file mode 100644 index d800bdfc07..0000000000 --- a/components/locale-provider/kk_KZ.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/kk_KZ'; - -export default locale; diff --git a/components/locale-provider/km_KH.tsx b/components/locale-provider/km_KH.tsx deleted file mode 100644 index f8a210be17..0000000000 --- a/components/locale-provider/km_KH.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/km_KH'; - -export default locale; diff --git a/components/locale-provider/kmr_IQ.tsx b/components/locale-provider/kmr_IQ.tsx deleted file mode 100644 index d5814ddedc..0000000000 --- a/components/locale-provider/kmr_IQ.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/kmr_IQ'; - -export default locale; diff --git a/components/locale-provider/kn_IN.tsx b/components/locale-provider/kn_IN.tsx deleted file mode 100644 index ed0ac385b9..0000000000 --- a/components/locale-provider/kn_IN.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/kn_IN'; - -export default locale; diff --git a/components/locale-provider/ko_KR.tsx b/components/locale-provider/ko_KR.tsx deleted file mode 100644 index 75e5750d56..0000000000 --- a/components/locale-provider/ko_KR.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ko_KR'; - -export default locale; diff --git a/components/locale-provider/ku_IQ.tsx b/components/locale-provider/ku_IQ.tsx deleted file mode 100644 index daf734fb1e..0000000000 --- a/components/locale-provider/ku_IQ.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ku_IQ'; - -export default locale; diff --git a/components/locale-provider/lt_LT.tsx b/components/locale-provider/lt_LT.tsx deleted file mode 100644 index e2f2ba2f9b..0000000000 --- a/components/locale-provider/lt_LT.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/lt_LT'; - -export default locale; diff --git a/components/locale-provider/lv_LV.tsx b/components/locale-provider/lv_LV.tsx deleted file mode 100644 index 57ace71955..0000000000 --- a/components/locale-provider/lv_LV.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/lv_LV'; - -export default locale; diff --git a/components/locale-provider/mk_MK.tsx b/components/locale-provider/mk_MK.tsx deleted file mode 100644 index c4e03653b9..0000000000 --- a/components/locale-provider/mk_MK.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/mk_MK'; - -export default locale; diff --git a/components/locale-provider/ml_IN.tsx b/components/locale-provider/ml_IN.tsx deleted file mode 100644 index 639f1f1b51..0000000000 --- a/components/locale-provider/ml_IN.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ml_IN'; - -export default locale; diff --git a/components/locale-provider/mn_MN.tsx b/components/locale-provider/mn_MN.tsx deleted file mode 100644 index bbfb83f739..0000000000 --- a/components/locale-provider/mn_MN.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/mn_MN'; - -export default locale; diff --git a/components/locale-provider/ms_MY.tsx b/components/locale-provider/ms_MY.tsx deleted file mode 100644 index 80799ae693..0000000000 --- a/components/locale-provider/ms_MY.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ms_MY'; - -export default locale; diff --git a/components/locale-provider/nb_NO.tsx b/components/locale-provider/nb_NO.tsx deleted file mode 100644 index 6f0c0d4e7a..0000000000 --- a/components/locale-provider/nb_NO.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/nb_NO'; - -export default locale; diff --git a/components/locale-provider/ne_NP.tsx b/components/locale-provider/ne_NP.tsx deleted file mode 100644 index 234388b4dc..0000000000 --- a/components/locale-provider/ne_NP.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ne_NP'; - -export default locale; diff --git a/components/locale-provider/nl_BE.tsx b/components/locale-provider/nl_BE.tsx deleted file mode 100644 index a52233bebc..0000000000 --- a/components/locale-provider/nl_BE.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/nl_BE'; - -export default locale; diff --git a/components/locale-provider/nl_NL.tsx b/components/locale-provider/nl_NL.tsx deleted file mode 100644 index ee14c0d4b7..0000000000 --- a/components/locale-provider/nl_NL.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/nl_NL'; - -export default locale; diff --git a/components/locale-provider/pl_PL.tsx b/components/locale-provider/pl_PL.tsx deleted file mode 100644 index 6ec40c21a5..0000000000 --- a/components/locale-provider/pl_PL.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/pl_PL'; - -export default locale; diff --git a/components/locale-provider/pt_BR.tsx b/components/locale-provider/pt_BR.tsx deleted file mode 100644 index bca2fbc179..0000000000 --- a/components/locale-provider/pt_BR.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/pt_BR'; - -export default locale; diff --git a/components/locale-provider/pt_PT.tsx b/components/locale-provider/pt_PT.tsx deleted file mode 100644 index 325077d951..0000000000 --- a/components/locale-provider/pt_PT.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/pt_PT'; - -export default locale; diff --git a/components/locale-provider/ro_RO.tsx b/components/locale-provider/ro_RO.tsx deleted file mode 100644 index c95794f777..0000000000 --- a/components/locale-provider/ro_RO.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ro_RO'; - -export default locale; diff --git a/components/locale-provider/ru_RU.tsx b/components/locale-provider/ru_RU.tsx deleted file mode 100644 index 130e0f4592..0000000000 --- a/components/locale-provider/ru_RU.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ru_RU'; - -export default locale; diff --git a/components/locale-provider/si_LK.tsx b/components/locale-provider/si_LK.tsx deleted file mode 100644 index aa719688da..0000000000 --- a/components/locale-provider/si_LK.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/si_LK'; - -export default locale; diff --git a/components/locale-provider/sk_SK.tsx b/components/locale-provider/sk_SK.tsx deleted file mode 100644 index 1a7836054b..0000000000 --- a/components/locale-provider/sk_SK.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/sk_SK'; - -export default locale; diff --git a/components/locale-provider/sl_SI.tsx b/components/locale-provider/sl_SI.tsx deleted file mode 100644 index 183230ce66..0000000000 --- a/components/locale-provider/sl_SI.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/sl_SI'; - -export default locale; diff --git a/components/locale-provider/sr_RS.tsx b/components/locale-provider/sr_RS.tsx deleted file mode 100644 index 3af113eb15..0000000000 --- a/components/locale-provider/sr_RS.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/sr_RS'; - -export default locale; diff --git a/components/locale-provider/sv_SE.tsx b/components/locale-provider/sv_SE.tsx deleted file mode 100644 index 8bdc8e9ff6..0000000000 --- a/components/locale-provider/sv_SE.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/sv_SE'; - -export default locale; diff --git a/components/locale-provider/ta_IN.tsx b/components/locale-provider/ta_IN.tsx deleted file mode 100644 index c0117822d8..0000000000 --- a/components/locale-provider/ta_IN.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ta_IN'; - -export default locale; diff --git a/components/locale-provider/th_TH.tsx b/components/locale-provider/th_TH.tsx deleted file mode 100644 index 085c556686..0000000000 --- a/components/locale-provider/th_TH.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/th_TH'; - -export default locale; diff --git a/components/locale-provider/tk_TK.tsx b/components/locale-provider/tk_TK.tsx deleted file mode 100644 index 68cdbd43a6..0000000000 --- a/components/locale-provider/tk_TK.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/tk_TK'; - -export default locale; diff --git a/components/locale-provider/tr_TR.tsx b/components/locale-provider/tr_TR.tsx deleted file mode 100644 index 83005e59d1..0000000000 --- a/components/locale-provider/tr_TR.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/tr_TR'; - -export default locale; diff --git a/components/locale-provider/uk_UA.tsx b/components/locale-provider/uk_UA.tsx deleted file mode 100644 index 819c5b655c..0000000000 --- a/components/locale-provider/uk_UA.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/uk_UA'; - -export default locale; diff --git a/components/locale-provider/ur_PK.tsx b/components/locale-provider/ur_PK.tsx deleted file mode 100644 index 64722eb28b..0000000000 --- a/components/locale-provider/ur_PK.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/ur_PK'; - -export default locale; diff --git a/components/locale-provider/vi_VN.tsx b/components/locale-provider/vi_VN.tsx deleted file mode 100644 index 77ab9897ed..0000000000 --- a/components/locale-provider/vi_VN.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/vi_VN'; - -export default locale; diff --git a/components/locale-provider/zh_CN.tsx b/components/locale-provider/zh_CN.tsx deleted file mode 100644 index eda5720f9e..0000000000 --- a/components/locale-provider/zh_CN.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/zh_CN'; - -export default locale; diff --git a/components/locale-provider/zh_HK.tsx b/components/locale-provider/zh_HK.tsx deleted file mode 100644 index 94386ad5aa..0000000000 --- a/components/locale-provider/zh_HK.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/zh_HK'; - -export default locale; diff --git a/components/locale-provider/zh_TW.tsx b/components/locale-provider/zh_TW.tsx deleted file mode 100644 index 7e4917fa1a..0000000000 --- a/components/locale-provider/zh_TW.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import locale from '../locale/zh_TW'; - -export default locale; diff --git a/components/locale/LocaleReceiver.tsx b/components/locale/LocaleReceiver.tsx new file mode 100644 index 0000000000..94685af859 --- /dev/null +++ b/components/locale/LocaleReceiver.tsx @@ -0,0 +1,64 @@ +import * as React from 'react'; +import type { Locale } from '.'; +import type { LocaleContextProps } from './context'; +import LocaleContext from './context'; +import defaultLocaleData from '../locale/en_US'; + +export type LocaleComponentName = Exclude; + +export interface LocaleReceiverProps { + componentName?: C; + defaultLocale?: Locale[C] | (() => Locale[C]); + children: ( + locale: NonNullable, + localeCode: string, + fullLocale: Locale, + ) => React.ReactElement; +} + +const LocaleReceiver = ( + props: LocaleReceiverProps, +) => { + const { componentName = 'global' as C, defaultLocale, children } = props; + const antLocale = React.useContext(LocaleContext); + + const getLocale = React.useMemo>(() => { + const locale = defaultLocale || defaultLocaleData[componentName]; + const localeFromContext = antLocale?.[componentName] ?? {}; + return { + ...(locale instanceof Function ? locale() : locale), + ...(localeFromContext || {}), + }; + }, [componentName, defaultLocale, antLocale]); + + const getLocaleCode = React.useMemo(() => { + const localeCode = antLocale && antLocale.locale; + // Had use LocaleProvide but didn't set locale + if (antLocale && antLocale.exist && !localeCode) { + return defaultLocaleData.locale; + } + return localeCode!; + }, [antLocale]); + + return children(getLocale, getLocaleCode, antLocale!); +}; + +export default LocaleReceiver; + +export const useLocaleReceiver = ( + componentName: C, + defaultLocale?: Locale[C] | (() => Locale[C]), +): [Locale[C]] => { + const antLocale = React.useContext(LocaleContext); + + const getLocale = React.useMemo>(() => { + const locale = defaultLocale || defaultLocaleData[componentName]; + const localeFromContext = antLocale?.[componentName] ?? {}; + return { + ...(typeof locale === 'function' ? locale() : locale), + ...(localeFromContext || {}), + }; + }, [componentName, defaultLocale, antLocale]); + + return [getLocale]; +}; diff --git a/components/locale/ar_EG.tsx b/components/locale/ar_EG.tsx index 9be2083032..15bf74aac3 100644 --- a/components/locale/ar_EG.tsx +++ b/components/locale/ar_EG.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/ar_EG'; import Calendar from '../calendar/locale/ar_EG'; import DatePicker from '../date-picker/locale/ar_EG'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ar_EG'; const typeTemplate = 'ليس ${label} من نوع ${type} صالحًا'; diff --git a/components/locale/az_AZ.tsx b/components/locale/az_AZ.tsx index 5ce65949bc..ffcbad7957 100644 --- a/components/locale/az_AZ.tsx +++ b/components/locale/az_AZ.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/az_AZ'; import Calendar from '../calendar/locale/az_AZ'; import DatePicker from '../date-picker/locale/az_AZ'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/az_AZ'; const typeTemplate = '${label}Hökmlü deyil${type}'; diff --git a/components/locale/bg_BG.tsx b/components/locale/bg_BG.tsx index a745b202f3..0657ad598d 100644 --- a/components/locale/bg_BG.tsx +++ b/components/locale/bg_BG.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/bg_BG'; import Calendar from '../calendar/locale/bg_BG'; import DatePicker from '../date-picker/locale/bg_BG'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/bg_BG'; const localeValues: Locale = { diff --git a/components/locale/bn_BD.tsx b/components/locale/bn_BD.tsx index 1cf7bcc9d2..6052cc7491 100644 --- a/components/locale/bn_BD.tsx +++ b/components/locale/bn_BD.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/bn_BD'; import Calendar from '../calendar/locale/bn_BD'; import DatePicker from '../date-picker/locale/bn_BD'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/bn_BD'; const typeTemplate = '${label} টি সঠিক ${type} নয়।'; diff --git a/components/locale/by_BY.tsx b/components/locale/by_BY.tsx index c40f10e9db..a152f5872f 100644 --- a/components/locale/by_BY.tsx +++ b/components/locale/by_BY.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/by_BY'; import Calendar from '../calendar/locale/by_BY'; import DatePicker from '../date-picker/locale/by_BY'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/by_BY'; const typeTemplate: string = "${label} не з'яўляецца тыпам ${type}"; diff --git a/components/locale/ca_ES.tsx b/components/locale/ca_ES.tsx index ba042632b8..fda4d6f8bc 100644 --- a/components/locale/ca_ES.tsx +++ b/components/locale/ca_ES.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/ca_ES'; import Calendar from '../calendar/locale/ca_ES'; import DatePicker from '../date-picker/locale/ca_ES'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ca_ES'; const typeTemplate = '${label} no és un ${type} vàlid'; diff --git a/components/locale-provider/context.ts b/components/locale/context.ts similarity index 100% rename from components/locale-provider/context.ts rename to components/locale/context.ts diff --git a/components/locale/cs_CZ.tsx b/components/locale/cs_CZ.tsx index 65f3fd2a5c..4347e00bf7 100644 --- a/components/locale/cs_CZ.tsx +++ b/components/locale/cs_CZ.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/cs_CZ'; import Calendar from '../calendar/locale/cs_CZ'; import DatePicker from '../date-picker/locale/cs_CZ'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/cs_CZ'; const typeTemplate = '${label} není platný ${type}'; diff --git a/components/locale/da_DK.tsx b/components/locale/da_DK.tsx index 56f03be6f0..1a0212c108 100644 --- a/components/locale/da_DK.tsx +++ b/components/locale/da_DK.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/da_DK'; import Calendar from '../calendar/locale/da_DK'; import DatePicker from '../date-picker/locale/da_DK'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/da_DK'; const localeValues: Locale = { diff --git a/components/locale/de_DE.tsx b/components/locale/de_DE.tsx index 3022eb71a6..5f98885b88 100644 --- a/components/locale/de_DE.tsx +++ b/components/locale/de_DE.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/de_DE'; import Calendar from '../calendar/locale/de_DE'; import DatePicker from '../date-picker/locale/de_DE'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/de_DE'; const typeTemplate = '${label} ist nicht gültig. ${type} erwartet'; diff --git a/components/locale/el_GR.tsx b/components/locale/el_GR.tsx index ba5e26b3da..b42084c692 100644 --- a/components/locale/el_GR.tsx +++ b/components/locale/el_GR.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/el_GR'; import Calendar from '../calendar/locale/el_GR'; import DatePicker from '../date-picker/locale/el_GR'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/el_GR'; const localeValues: Locale = { diff --git a/components/locale/en_GB.tsx b/components/locale/en_GB.tsx index d07eeba66c..9fb99c031e 100644 --- a/components/locale/en_GB.tsx +++ b/components/locale/en_GB.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/en_GB'; import Calendar from '../calendar/locale/en_GB'; import DatePicker from '../date-picker/locale/en_GB'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/en_GB'; const typeTemplate = '${label} is not a valid ${type}'; diff --git a/components/locale/en_US.tsx b/components/locale/en_US.tsx index 080e2ebcd9..a8cc5bc7bd 100644 --- a/components/locale/en_US.tsx +++ b/components/locale/en_US.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/en_US'; import Calendar from '../calendar/locale/en_US'; import DatePicker from '../date-picker/locale/en_US'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/en_US'; const typeTemplate = '${label} is not a valid ${type}'; diff --git a/components/locale/es_ES.tsx b/components/locale/es_ES.tsx index 4151756f7e..380c01f31a 100644 --- a/components/locale/es_ES.tsx +++ b/components/locale/es_ES.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/es_ES'; import Calendar from '../calendar/locale/es_ES'; import DatePicker from '../date-picker/locale/es_ES'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/es_ES'; const typeTemplate = '${label} no es un ${type} válido'; diff --git a/components/locale/et_EE.tsx b/components/locale/et_EE.tsx index d42683631f..a37314658c 100644 --- a/components/locale/et_EE.tsx +++ b/components/locale/et_EE.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/et_EE'; import Calendar from '../calendar/locale/et_EE'; import DatePicker from '../date-picker/locale/et_EE'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/et_EE'; const typeTemplate = '${label} ei ole kehtiv ${type}'; diff --git a/components/locale/eu_ES.tsx b/components/locale/eu_ES.tsx index 494411b798..4231e7a692 100644 --- a/components/locale/eu_ES.tsx +++ b/components/locale/eu_ES.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/eu_ES'; import Calendar from '../calendar/locale/eu_ES'; import DatePicker from '../date-picker/locale/eu_ES'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/eu_ES'; const typeTemplate = '${label} ez da ${type} balioduna'; diff --git a/components/locale/fa_IR.tsx b/components/locale/fa_IR.tsx index 681105b50b..dcfbab5c70 100644 --- a/components/locale/fa_IR.tsx +++ b/components/locale/fa_IR.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/fa_IR'; import Calendar from '../calendar/locale/fa_IR'; import DatePicker from '../date-picker/locale/fa_IR'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/fa_IR'; const typeTemplate = '${label} از نوع ${type} معتبر نیست'; diff --git a/components/locale/fi_FI.tsx b/components/locale/fi_FI.tsx index 6b0cb7cbec..0d5b81cc81 100644 --- a/components/locale/fi_FI.tsx +++ b/components/locale/fi_FI.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/fi_FI'; import Calendar from '../calendar/locale/fi_FI'; import DatePicker from '../date-picker/locale/fi_FI'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/fi_FI'; const localeValues: Locale = { diff --git a/components/locale/fr_BE.tsx b/components/locale/fr_BE.tsx index dd520c9f1b..c72871f976 100644 --- a/components/locale/fr_BE.tsx +++ b/components/locale/fr_BE.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/fr_BE'; import Calendar from '../calendar/locale/fr_BE'; import DatePicker from '../date-picker/locale/fr_BE'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/fr_BE'; const localeValues: Locale = { diff --git a/components/locale/fr_CA.tsx b/components/locale/fr_CA.tsx index 08789cb953..cc33da33e2 100644 --- a/components/locale/fr_CA.tsx +++ b/components/locale/fr_CA.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/fr_CA'; import Calendar from '../calendar/locale/fr_CA'; import DatePicker from '../date-picker/locale/fr_CA'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/fr_CA'; const typeTemplate = "La valeur du champ ${label} n'est pas valide pour le type ${type}"; diff --git a/components/locale/fr_FR.tsx b/components/locale/fr_FR.tsx index 81664d2e9c..5720a6d6bc 100644 --- a/components/locale/fr_FR.tsx +++ b/components/locale/fr_FR.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/fr_FR'; import Calendar from '../calendar/locale/fr_FR'; import DatePicker from '../date-picker/locale/fr_FR'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/fr_FR'; const typeTemplate = "La valeur du champ ${label} n'est pas valide pour le type ${type}"; diff --git a/components/locale/ga_IE.tsx b/components/locale/ga_IE.tsx index 9aad32cdcc..5288deb3f2 100644 --- a/components/locale/ga_IE.tsx +++ b/components/locale/ga_IE.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/ga_IE'; import Calendar from '../calendar/locale/ga_IE'; import DatePicker from '../date-picker/locale/ga_IE'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ga_IE'; const typeTemplate = '${label} is not a valid ${type}'; diff --git a/components/locale/gl_ES.tsx b/components/locale/gl_ES.tsx index 8e1d135901..14bbe03828 100644 --- a/components/locale/gl_ES.tsx +++ b/components/locale/gl_ES.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/gl_ES'; import Calendar from '../calendar/locale/gl_ES'; import DatePicker from '../date-picker/locale/gl_ES'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/gl_ES'; const typeTemplate = '${label} non é un ${type} válido'; diff --git a/components/locale/he_IL.tsx b/components/locale/he_IL.tsx index 739dbb716a..e803a08cf6 100644 --- a/components/locale/he_IL.tsx +++ b/components/locale/he_IL.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/he_IL'; import Calendar from '../calendar/locale/he_IL'; import DatePicker from '../date-picker/locale/he_IL'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/he_IL'; const typeTemplate = '${label} הוא לא ${type} תקין'; diff --git a/components/locale/hi_IN.tsx b/components/locale/hi_IN.tsx index 738e674966..3672a2066c 100644 --- a/components/locale/hi_IN.tsx +++ b/components/locale/hi_IN.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/hi_IN'; import Calendar from '../calendar/locale/hi_IN'; import DatePicker from '../date-picker/locale/hi_IN'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/hi_IN'; const typeTemplate = '${label} मान्य ${type} नहीं है'; diff --git a/components/locale/hr_HR.tsx b/components/locale/hr_HR.tsx index db188f4d6c..1d6f31b9b2 100644 --- a/components/locale/hr_HR.tsx +++ b/components/locale/hr_HR.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/hr_HR'; import Calendar from '../calendar/locale/hr_HR'; import DatePicker from '../date-picker/locale/hr_HR'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/hr_HR'; const typeTemplate = '${label} nije valjan ${type}'; diff --git a/components/locale/hu_HU.tsx b/components/locale/hu_HU.tsx index d3385bf094..e670cb6ae2 100644 --- a/components/locale/hu_HU.tsx +++ b/components/locale/hu_HU.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/hu_HU'; import Calendar from '../calendar/locale/hu_HU'; import DatePicker from '../date-picker/locale/hu_HU'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/hu_HU'; const localeValues: Locale = { diff --git a/components/locale/hy_AM.tsx b/components/locale/hy_AM.tsx index 7480c851cb..ef998efafe 100644 --- a/components/locale/hy_AM.tsx +++ b/components/locale/hy_AM.tsx @@ -1,5 +1,5 @@ import type { PickerLocale } from '../date-picker/generatePicker'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; const datePickerLocale: PickerLocale = { lang: { diff --git a/components/locale/id_ID.tsx b/components/locale/id_ID.tsx index dee3e95905..c8016dcccb 100644 --- a/components/locale/id_ID.tsx +++ b/components/locale/id_ID.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/id_ID'; import Calendar from '../calendar/locale/id_ID'; import DatePicker from '../date-picker/locale/id_ID'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/id_ID'; const localeValues: Locale = { diff --git a/components/locale-provider/index.tsx b/components/locale/index.tsx similarity index 100% rename from components/locale-provider/index.tsx rename to components/locale/index.tsx diff --git a/components/locale/is_IS.tsx b/components/locale/is_IS.tsx index 0ecec8f953..7563a6ddeb 100644 --- a/components/locale/is_IS.tsx +++ b/components/locale/is_IS.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/is_IS'; import Calendar from '../calendar/locale/is_IS'; import DatePicker from '../date-picker/locale/is_IS'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/is_IS'; const localeValues: Locale = { diff --git a/components/locale/it_IT.tsx b/components/locale/it_IT.tsx index f5ccc038af..04265542a7 100644 --- a/components/locale/it_IT.tsx +++ b/components/locale/it_IT.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/it_IT'; import Calendar from '../calendar/locale/it_IT'; import DatePicker from '../date-picker/locale/it_IT'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/it_IT'; const typeTemplate = ' ${label} non è un ${type} valido'; diff --git a/components/locale/ja_JP.tsx b/components/locale/ja_JP.tsx index 2ee099d323..6bb07893c8 100644 --- a/components/locale/ja_JP.tsx +++ b/components/locale/ja_JP.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/ja_JP'; import Calendar from '../calendar/locale/ja_JP'; import DatePicker from '../date-picker/locale/ja_JP'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ja_JP'; const typeTemplate = '${label}は有効な${type}ではありません'; diff --git a/components/locale/ka_GE.tsx b/components/locale/ka_GE.tsx index c7330a61fc..5f21c382df 100644 --- a/components/locale/ka_GE.tsx +++ b/components/locale/ka_GE.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/ka_GE'; import Calendar from '../calendar/locale/ka_GE'; import DatePicker from '../date-picker/locale/ka_GE'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ka_GE'; const typeTemplate = '${label} არ არის სწორი ${type}'; diff --git a/components/locale/kk_KZ.tsx b/components/locale/kk_KZ.tsx index 6665122acb..4b7421e967 100644 --- a/components/locale/kk_KZ.tsx +++ b/components/locale/kk_KZ.tsx @@ -3,7 +3,7 @@ import Pagination from 'rc-pagination/lib/locale/kk_KZ'; import Calendar from '../calendar/locale/kk_KZ'; import DatePicker from '../date-picker/locale/kk_KZ'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/kk_KZ'; const typeTemplate: string = '${label} ${type} типі емес'; diff --git a/components/locale/km_KH.tsx b/components/locale/km_KH.tsx index 79663471a7..efde3600f7 100644 --- a/components/locale/km_KH.tsx +++ b/components/locale/km_KH.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/km_KH'; import Calendar from '../calendar/locale/km_KH'; import DatePicker from '../date-picker/locale/km_KH'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/km_KH'; const typeTemplate = '${label} is not a valid ${type}'; diff --git a/components/locale/kmr_IQ.tsx b/components/locale/kmr_IQ.tsx index 147b15fbe6..a13ac71660 100644 --- a/components/locale/kmr_IQ.tsx +++ b/components/locale/kmr_IQ.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/kmr_IQ'; import Calendar from '../calendar/locale/kmr_IQ'; import DatePicker from '../date-picker/locale/kmr_IQ'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/kmr_IQ'; const localeValues: Locale = { diff --git a/components/locale/kn_IN.tsx b/components/locale/kn_IN.tsx index 155b352b32..c58533ce93 100644 --- a/components/locale/kn_IN.tsx +++ b/components/locale/kn_IN.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/kn_IN'; import Calendar from '../calendar/locale/kn_IN'; import DatePicker from '../date-picker/locale/kn_IN'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/kn_IN'; const localeValues: Locale = { diff --git a/components/locale/ko_KR.tsx b/components/locale/ko_KR.tsx index f02da311ef..1009cd74fb 100644 --- a/components/locale/ko_KR.tsx +++ b/components/locale/ko_KR.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/ko_KR'; import Calendar from '../calendar/locale/ko_KR'; import DatePicker from '../date-picker/locale/ko_KR'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ko_KR'; const typeTemplate = '${label} 유효하지 않은 ${type}'; diff --git a/components/locale/ku_IQ.tsx b/components/locale/ku_IQ.tsx index 55ba9b3a71..126d27d97a 100755 --- a/components/locale/ku_IQ.tsx +++ b/components/locale/ku_IQ.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/kmr_IQ'; import Calendar from '../calendar/locale/kmr_IQ'; import DatePicker from '../date-picker/locale/kmr_IQ'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/kmr_IQ'; // please use antd/locale/kmr_IQ instead diff --git a/components/locale/lt_LT.tsx b/components/locale/lt_LT.tsx index f3c3ecd4f3..2ac9c50336 100644 --- a/components/locale/lt_LT.tsx +++ b/components/locale/lt_LT.tsx @@ -3,7 +3,7 @@ import Pagination from 'rc-pagination/lib/locale/lt_LT'; import Calendar from '../calendar/locale/lt_LT'; import DatePicker from '../date-picker/locale/lt_LT'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/lt_LT'; const typeTemplate: string = '${label} neatitinka tipo ${type}'; diff --git a/components/locale/lv_LV.tsx b/components/locale/lv_LV.tsx index 26ad88713a..500a3848e2 100644 --- a/components/locale/lv_LV.tsx +++ b/components/locale/lv_LV.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/lv_LV'; import Calendar from '../calendar/locale/lv_LV'; import DatePicker from '../date-picker/locale/lv_LV'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/lv_LV'; const localeValues: Locale = { diff --git a/components/locale/mk_MK.tsx b/components/locale/mk_MK.tsx index c523b35c27..260e468449 100644 --- a/components/locale/mk_MK.tsx +++ b/components/locale/mk_MK.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/mk_MK'; import Calendar from '../calendar/locale/mk_MK'; import DatePicker from '../date-picker/locale/mk_MK'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/mk_MK'; const localeValues: Locale = { diff --git a/components/locale/ml_IN.tsx b/components/locale/ml_IN.tsx index e4d12ffec0..6c31108856 100644 --- a/components/locale/ml_IN.tsx +++ b/components/locale/ml_IN.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/ml_IN'; import Calendar from '../calendar/locale/ml_IN'; import DatePicker from '../date-picker/locale/ml_IN'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ml_IN'; const typeTemplate = '${label} അസാധുവായ ${type} ആണ്'; diff --git a/components/locale/mn_MN.tsx b/components/locale/mn_MN.tsx index 94c5fe4d2d..308300eb22 100644 --- a/components/locale/mn_MN.tsx +++ b/components/locale/mn_MN.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/mn_MN'; import Calendar from '../calendar/locale/mn_MN'; import DatePicker from '../date-picker/locale/mn_MN'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/mn_MN'; const localeValues: Locale = { diff --git a/components/locale/ms_MY.tsx b/components/locale/ms_MY.tsx index 993c4b9fc2..6e31753203 100644 --- a/components/locale/ms_MY.tsx +++ b/components/locale/ms_MY.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/ms_MY'; import Calendar from '../calendar/locale/ms_MY'; import DatePicker from '../date-picker/locale/ms_MY'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ms_MY'; const localeValues: Locale = { diff --git a/components/locale/nb_NO.tsx b/components/locale/nb_NO.tsx index 5f2374f08f..4d91225c50 100644 --- a/components/locale/nb_NO.tsx +++ b/components/locale/nb_NO.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/nb_NO'; import Calendar from '../calendar/locale/nb_NO'; import DatePicker from '../date-picker/locale/nb_NO'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/nb_NO'; const typeTemplate = '${label} er ikke et gyldig ${type}'; diff --git a/components/locale/ne_NP.tsx b/components/locale/ne_NP.tsx index c066720652..04020cb355 100644 --- a/components/locale/ne_NP.tsx +++ b/components/locale/ne_NP.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/en_US'; import Calendar from '../calendar/locale/en_US'; import DatePicker from '../date-picker/locale/en_US'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/en_US'; const localeValues: Locale = { diff --git a/components/locale/nl_BE.tsx b/components/locale/nl_BE.tsx index 4bfe994ac4..1fcccf660e 100644 --- a/components/locale/nl_BE.tsx +++ b/components/locale/nl_BE.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/nl_BE'; import Calendar from '../calendar/locale/nl_BE'; import DatePicker from '../date-picker/locale/nl_BE'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/nl_BE'; const typeTemplate = '${label} is geen geldige ${type}'; diff --git a/components/locale/nl_NL.tsx b/components/locale/nl_NL.tsx index be4efa8502..dd2a857897 100644 --- a/components/locale/nl_NL.tsx +++ b/components/locale/nl_NL.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/nl_NL'; import Calendar from '../calendar/locale/nl_NL'; import DatePicker from '../date-picker/locale/nl_NL'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/nl_NL'; const typeTemplate = '${label} is geen geldige ${type}'; diff --git a/components/locale/pl_PL.tsx b/components/locale/pl_PL.tsx index 533c6c2427..1c09472df3 100644 --- a/components/locale/pl_PL.tsx +++ b/components/locale/pl_PL.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/pl_PL'; import Calendar from '../calendar/locale/pl_PL'; import DatePicker from '../date-picker/locale/pl_PL'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/pl_PL'; const typeTemplate = '${label} nie posiada poprawnej wartości dla typu ${type}'; diff --git a/components/locale/pt_BR.tsx b/components/locale/pt_BR.tsx index b45492ae49..4622829b63 100644 --- a/components/locale/pt_BR.tsx +++ b/components/locale/pt_BR.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/pt_BR'; import Calendar from '../calendar/locale/pt_BR'; import DatePicker from '../date-picker/locale/pt_BR'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/pt_BR'; const typeTemplate = '${label} não é um ${type} válido'; diff --git a/components/locale/pt_PT.tsx b/components/locale/pt_PT.tsx index 52bbe7a79a..82f6c204e6 100644 --- a/components/locale/pt_PT.tsx +++ b/components/locale/pt_PT.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/pt_PT'; import Calendar from '../calendar/locale/pt_PT'; import DatePicker from '../date-picker/locale/pt_PT'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/pt_PT'; const typeTemplate = '${label} não é um ${type} válido'; diff --git a/components/locale/ro_RO.tsx b/components/locale/ro_RO.tsx index dcaea95a88..8342ca8f27 100644 --- a/components/locale/ro_RO.tsx +++ b/components/locale/ro_RO.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/ro_RO'; import Calendar from '../calendar/locale/ro_RO'; import DatePicker from '../date-picker/locale/ro_RO'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ro_RO'; const typeTemplate = '${label} nu conține tipul corect (${type})'; diff --git a/components/locale/ru_RU.tsx b/components/locale/ru_RU.tsx index 8cad33a900..2ba2752d1f 100644 --- a/components/locale/ru_RU.tsx +++ b/components/locale/ru_RU.tsx @@ -3,7 +3,7 @@ import Pagination from 'rc-pagination/lib/locale/ru_RU'; import Calendar from '../calendar/locale/ru_RU'; import DatePicker from '../date-picker/locale/ru_RU'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ru_RU'; const typeTemplate: string = '${label} не является типом ${type}'; diff --git a/components/locale/si_LK.tsx b/components/locale/si_LK.tsx index e051b409c7..36e9590d95 100644 --- a/components/locale/si_LK.tsx +++ b/components/locale/si_LK.tsx @@ -3,7 +3,7 @@ import Pagination from 'rc-pagination/lib/locale/si_LK'; import DatePicker from '../date-picker/locale/si_LK'; import TimePicker from '../time-picker/locale/si_LK'; import Calendar from '../calendar/locale/si_LK'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; const typeTemplate = '${label} වලංගු ${type} ක් නොවේ'; diff --git a/components/locale/sk_SK.tsx b/components/locale/sk_SK.tsx index 59c02defa3..113e0f869b 100644 --- a/components/locale/sk_SK.tsx +++ b/components/locale/sk_SK.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/sk_SK'; import Calendar from '../calendar/locale/sk_SK'; import DatePicker from '../date-picker/locale/sk_SK'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/sk_SK'; const typeTemplate = '${label} nie je platný ${type}'; diff --git a/components/locale/sl_SI.tsx b/components/locale/sl_SI.tsx index ea02ff43c4..a1328a71ae 100644 --- a/components/locale/sl_SI.tsx +++ b/components/locale/sl_SI.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/sl_SI'; import Calendar from '../calendar/locale/sl_SI'; import DatePicker from '../date-picker/locale/sl_SI'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/sl_SI'; const localeValues: Locale = { diff --git a/components/locale/sr_RS.tsx b/components/locale/sr_RS.tsx index b2c8ab8aeb..f0f635eab7 100644 --- a/components/locale/sr_RS.tsx +++ b/components/locale/sr_RS.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/sr_RS'; import Calendar from '../calendar/locale/sr_RS'; import DatePicker from '../date-picker/locale/sr_RS'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/sr_RS'; const typeTemplate = '${label} nije važeći ${type}'; diff --git a/components/locale/sv_SE.tsx b/components/locale/sv_SE.tsx index af34f836da..64437c0db5 100644 --- a/components/locale/sv_SE.tsx +++ b/components/locale/sv_SE.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/sv_SE'; import Calendar from '../calendar/locale/sv_SE'; import DatePicker from '../date-picker/locale/sv_SE'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/sv_SE'; const typeTemplate = '${label} är inte en giltig ${type}'; diff --git a/components/locale/ta_IN.tsx b/components/locale/ta_IN.tsx index d3be76755a..80fa8adfd3 100644 --- a/components/locale/ta_IN.tsx +++ b/components/locale/ta_IN.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/ta_IN'; import Calendar from '../calendar/locale/ta_IN'; import DatePicker from '../date-picker/locale/ta_IN'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ta_IN'; const localeValues: Locale = { diff --git a/components/locale/th_TH.tsx b/components/locale/th_TH.tsx index ff4623098f..d89af49d62 100644 --- a/components/locale/th_TH.tsx +++ b/components/locale/th_TH.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/th_TH'; import Calendar from '../calendar/locale/th_TH'; import DatePicker from '../date-picker/locale/th_TH'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/th_TH'; const typeTemplate = '${label} ไม่ใช่ ${type} ที่ถูกต้อง'; diff --git a/components/locale/tk_TK.tsx b/components/locale/tk_TK.tsx index c1b2b1dae6..f9a836d16f 100644 --- a/components/locale/tk_TK.tsx +++ b/components/locale/tk_TK.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/tk_TK'; import Calendar from '../calendar/locale/tk_TK'; import DatePicker from '../date-picker/locale/tk_TK'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/tk_TK'; const typeTemplate: string = '${label} ${type} görnüşinde däl'; diff --git a/components/locale/tr_TR.tsx b/components/locale/tr_TR.tsx index 71dfd923f5..20614567c3 100644 --- a/components/locale/tr_TR.tsx +++ b/components/locale/tr_TR.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/tr_TR'; import Calendar from '../calendar/locale/tr_TR'; import DatePicker from '../date-picker/locale/tr_TR'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/tr_TR'; const typeTemplate = '${label} geçerli bir ${type} değil'; diff --git a/components/locale/uk_UA.tsx b/components/locale/uk_UA.tsx index bbbed5ba45..3fe96fc9c9 100644 --- a/components/locale/uk_UA.tsx +++ b/components/locale/uk_UA.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/uk_UA'; import Calendar from '../calendar/locale/uk_UA'; import DatePicker from '../date-picker/locale/uk_UA'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/uk_UA'; const typeTemplate = '${label} не є типом ${type}'; diff --git a/components/locale/ur_PK.tsx b/components/locale/ur_PK.tsx index ff5a07bb18..97dfa5ecd5 100644 --- a/components/locale/ur_PK.tsx +++ b/components/locale/ur_PK.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/ur_PK'; import Calendar from '../calendar/locale/ur_PK'; import DatePicker from '../date-picker/locale/ur_PK'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/ur_PK'; const typeTemplate = '${label} درست نہیں ہے ${type}'; diff --git a/components/locale/vi_VN.tsx b/components/locale/vi_VN.tsx index c7669b4447..1bbca71e5a 100644 --- a/components/locale/vi_VN.tsx +++ b/components/locale/vi_VN.tsx @@ -1,7 +1,7 @@ import Pagination from 'rc-pagination/lib/locale/vi_VN'; import Calendar from '../calendar/locale/vi_VN'; import DatePicker from '../date-picker/locale/vi_VN'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/vi_VN'; const localeValues: Locale = { diff --git a/components/locale/zh_CN.tsx b/components/locale/zh_CN.tsx index ea97e256bf..30eec8848b 100644 --- a/components/locale/zh_CN.tsx +++ b/components/locale/zh_CN.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/zh_CN'; import Calendar from '../calendar/locale/zh_CN'; import DatePicker from '../date-picker/locale/zh_CN'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/zh_CN'; const typeTemplate = '${label}不是一个有效的${type}'; diff --git a/components/locale/zh_HK.tsx b/components/locale/zh_HK.tsx index ce06aa9440..6820c7922d 100644 --- a/components/locale/zh_HK.tsx +++ b/components/locale/zh_HK.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/zh_TW'; import Calendar from '../calendar/locale/zh_TW'; import DatePicker from '../date-picker/locale/zh_TW'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/zh_TW'; const typeTemplate = '${label}不是一個有效的${type}'; diff --git a/components/locale/zh_TW.tsx b/components/locale/zh_TW.tsx index d6cf310308..7a817c96a5 100644 --- a/components/locale/zh_TW.tsx +++ b/components/locale/zh_TW.tsx @@ -2,7 +2,7 @@ import Pagination from 'rc-pagination/lib/locale/zh_TW'; import Calendar from '../calendar/locale/zh_TW'; import DatePicker from '../date-picker/locale/zh_TW'; -import type { Locale } from '../locale-provider'; +import type { Locale } from '../locale'; import TimePicker from '../time-picker/locale/zh_TW'; const typeTemplate = '${label}不是一個有效的${type}'; diff --git a/components/modal/ConfirmDialog.tsx b/components/modal/ConfirmDialog.tsx index 5e4302d751..6e5a8b47ca 100644 --- a/components/modal/ConfirmDialog.tsx +++ b/components/modal/ConfirmDialog.tsx @@ -5,7 +5,7 @@ import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled'; import classNames from 'classnames'; import * as React from 'react'; import ConfigProvider from '../config-provider'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import ActionButton from '../_util/ActionButton'; import { getTransitionName } from '../_util/motion'; import warning from '../_util/warning'; diff --git a/components/modal/PurePanel.tsx b/components/modal/PurePanel.tsx index ed44c36a66..b38f9167fc 100644 --- a/components/modal/PurePanel.tsx +++ b/components/modal/PurePanel.tsx @@ -6,7 +6,7 @@ import * as React from 'react'; import Button from '../button'; import { convertLegacyProps } from '../button/button'; import { ConfigContext } from '../config-provider'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import { ConfirmContent } from './ConfirmDialog'; import { getConfirmLocale } from './locale'; import type { ModalProps, ModalFuncProps } from './Modal'; diff --git a/components/modal/useModal/HookModal.tsx b/components/modal/useModal/HookModal.tsx index 03df9d8c46..ecbeee322d 100644 --- a/components/modal/useModal/HookModal.tsx +++ b/components/modal/useModal/HookModal.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { ConfigContext } from '../../config-provider'; -import LocaleReceiver from '../../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../../locale/LocaleReceiver'; import defaultLocale from '../../locale/en_US'; import ConfirmDialog from '../ConfirmDialog'; import type { ModalFuncProps } from '../Modal'; diff --git a/components/pagination/Pagination.tsx b/components/pagination/Pagination.tsx index 3372e1eff9..05673f6da6 100644 --- a/components/pagination/Pagination.tsx +++ b/components/pagination/Pagination.tsx @@ -9,7 +9,7 @@ import enUS from 'rc-pagination/lib/locale/en_US'; import * as React from 'react'; import { ConfigContext } from '../config-provider'; import useBreakpoint from '../grid/hooks/useBreakpoint'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import { MiddleSelect, MiniSelect } from './Select'; import useStyle from './style'; diff --git a/components/popconfirm/PurePanel.tsx b/components/popconfirm/PurePanel.tsx index 9fb6bedee3..4e9d74525b 100644 --- a/components/popconfirm/PurePanel.tsx +++ b/components/popconfirm/PurePanel.tsx @@ -5,7 +5,7 @@ import type { PopconfirmProps } from '.'; import Button from '../button'; import { convertLegacyProps } from '../button/button'; import ActionButton from '../_util/ActionButton'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import defaultLocale from '../locale/en_US'; import { getRenderPropValue } from '../_util/getRenderPropValue'; import { ConfigContext } from '../config-provider'; diff --git a/components/qrcode/index.tsx b/components/qrcode/index.tsx index b47d7da928..f905ed7841 100644 --- a/components/qrcode/index.tsx +++ b/components/qrcode/index.tsx @@ -3,7 +3,7 @@ import { QRCodeCanvas } from 'qrcode.react'; import classNames from 'classnames'; import { ReloadOutlined } from '@ant-design/icons'; import { ConfigContext } from '../config-provider'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import type { ConfigConsumerProps } from '../config-provider'; import type { QRCodeProps, QRPropsCanvas } from './interface'; import warning from '../_util/warning'; diff --git a/components/tour/panelRender.tsx b/components/tour/panelRender.tsx index cb9d777fdf..e399d8f033 100644 --- a/components/tour/panelRender.tsx +++ b/components/tour/panelRender.tsx @@ -3,7 +3,7 @@ import type { ReactNode } from 'react'; import classNames from 'classnames'; import CloseOutlined from '@ant-design/icons/CloseOutlined'; import type { TourStepProps } from './interface'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import Button from '../button'; import type { ButtonProps } from '../button'; import defaultLocale from '../locale/en_US'; diff --git a/components/transfer/ListItem.tsx b/components/transfer/ListItem.tsx index 90bff58908..59137c449f 100644 --- a/components/transfer/ListItem.tsx +++ b/components/transfer/ListItem.tsx @@ -3,7 +3,7 @@ import classNames from 'classnames'; import * as React from 'react'; import type { KeyWiseTransferItem } from '.'; import Checkbox from '../checkbox'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import defaultLocale from '../locale/en_US'; import TransButton from '../_util/transButton'; diff --git a/components/transfer/index.tsx b/components/transfer/index.tsx index 9ec0a8a91d..57ab588747 100644 --- a/components/transfer/index.tsx +++ b/components/transfer/index.tsx @@ -4,7 +4,7 @@ import type { ConfigConsumerProps, RenderEmptyHandler } from '../config-provider import { ConfigConsumer } from '../config-provider'; import defaultRenderEmpty from '../config-provider/defaultRenderEmpty'; import { FormItemInputContext } from '../form/context'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import defaultLocale from '../locale/en_US'; import type { InputStatus } from '../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils'; diff --git a/components/typography/Base/index.tsx b/components/typography/Base/index.tsx index 7ef36168b5..2652860d80 100644 --- a/components/typography/Base/index.tsx +++ b/components/typography/Base/index.tsx @@ -12,7 +12,7 @@ import omit from 'rc-util/lib/omit'; import { composeRef } from 'rc-util/lib/ref'; import * as React from 'react'; import { ConfigContext } from '../../config-provider'; -import { useLocaleReceiver } from '../../locale-provider/LocaleReceiver'; +import { useLocaleReceiver } from '../../locale/LocaleReceiver'; import TransButton from '../../_util/transButton'; import { isStyleSupport } from '../../_util/styleChecker'; import type { TooltipProps } from '../../tooltip'; diff --git a/components/upload/Upload.tsx b/components/upload/Upload.tsx index db14eeb0cd..c71d49b657 100644 --- a/components/upload/Upload.tsx +++ b/components/upload/Upload.tsx @@ -6,7 +6,7 @@ import * as React from 'react'; import { flushSync } from 'react-dom'; import { ConfigContext } from '../config-provider'; import DisabledContext from '../config-provider/DisabledContext'; -import LocaleReceiver from '../locale-provider/LocaleReceiver'; +import LocaleReceiver from '../locale/LocaleReceiver'; import defaultLocale from '../locale/en_US'; import warning from '../_util/warning'; import type { RcFile, ShowUploadListInterface, UploadChangeParam, UploadFile } from './interface'; diff --git a/docs/react/i18n.en-US.md b/docs/react/i18n.en-US.md index e75458c10d..578fa1deeb 100644 --- a/docs/react/i18n.en-US.md +++ b/docs/react/i18n.en-US.md @@ -119,11 +119,11 @@ Do it step by step: 3. Add the language support for [rc-pagination](https://github.com/react-component/pagination), for example [this](https://github.com/react-component/pagination/blob/master/src/locale/en_US.js). 4. Wait for `rc-picker` and `rc-pagination` to release the new version containing the above. 5. Update the `rc-picker` and `rc-pagination` versions in `antd` and add the remaining other necessary content for the language. for example [Azerbaijani PR](https://github.com/ant-design/ant-design/pull/21387). -6. Add a test case for the language in [index.test.js](https://github.com/ant-design/ant-design/blob/master/components/locale-provider/__tests__/index.test.js). +6. Add a test case for the language in [index.test.tsx](https://github.com/ant-design/ant-design/blob/master/components/locale-provider/__tests__/index.test.tsx). 7. update snapshots, you may also need to delete `node_modules`, lock files (`yarn.lock` or `package-lock.json`) and reinstall at first. ```bash - npm run test -- components/locale-provider -u + npm run test -- components/locale -u ``` 8. Add the language to i18n list [docs/react/i18n.en-US.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.en-US.md) and [docs/react/i18n.zh-CN.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.zh-CN.md). diff --git a/docs/react/i18n.zh-CN.md b/docs/react/i18n.zh-CN.md index 0324d968c5..d3e8b5e046 100644 --- a/docs/react/i18n.zh-CN.md +++ b/docs/react/i18n.zh-CN.md @@ -40,7 +40,7 @@ return ( | 英语 | en_GB | | 英语(美式) | en_US | | 西班牙语 | es_ES | -| 巴斯克语 | eu_ES | +| 巴斯克语 | eu_ES | | 爱沙尼亚语 | et_EE | | 波斯语 | fa_IR | | 芬兰语 | fi_FI | @@ -116,11 +116,11 @@ return ( 3. 为 [rc-pagination](https://github.com/react-component/pagination) 添加对应语言,参考 [这个](https://github.com/react-component/pagination/blob/master/src/locale/en_US.js)。 4. 等待 `rc-picker` 和 `rc-pagination` 发布含上述内容的最低版本。 5. 参考 [阿塞拜疆语的 PR](https://github.com/ant-design/ant-design/pull/21387) 向 `antd` 发起 PR,完善对应语言的其他内容和更新 `rc-picker` 和 `rc-pagination` 版本。 -6. 在 [index.test.js](https://github.com/ant-design/ant-design/blob/master/components/locale-provider/__tests__/index.test.js) 添加该语言的测试用例。 +6. 在 [index.test.tsx](https://github.com/ant-design/ant-design/blob/master/components/locale-provider/__tests__/index.test.tsx) 添加该语言的测试用例。 7. 更新 snapshot,在这之前或许你还需要先删除 `node_modules` 和 lock 文件 (`yarn.lock` or `package-lock.json`) 并全新安装。 ```bash - npm run test -- components/locale-provider -u + npm run test -- components/locale -u ``` 8. 更新 [docs/react/i18n.zh-CN.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.zh-CN.md) 和 [docs/react/i18n.zh-CN.md](https://github.com/ant-design/ant-design/blob/master/docs/react/i18n.zh-CN.md),将对应语言添加到文档列表。 diff --git a/docs/react/migration-v5.en-US.md b/docs/react/migration-v5.en-US.md index 7ba8c47be2..1c9746ff04 100644 --- a/docs/react/migration-v5.en-US.md +++ b/docs/react/migration-v5.en-US.md @@ -24,7 +24,7 @@ This document will help you upgrade from antd `4.x` version to antd `5.x` versio - All less files are removed, and less variables are no longer exported. - Css files are no longer included in package. Since CSS-in-JS supports importing on demand, the original `antd/dist/antd.css` has also been abandoned. If you need to reset some basic styles, please import `antd/dist/reset.css`. - Remove css variables and dynamic theme built on top of them. -- Remove `antd/es/locale`, you can find the packages in `antd/locale`. +- LocaleProvider has been deprecated in 4.x (use `` instead), we removed the related folder `antd/es/locale-provider` and `antd/lib/locale-provider` in 5.x. - Replace built-in Moment.js with Dayjs. For more: [Use custom date library](/docs/react/use-custom-date-library/). - `babel-plugin-import` is no longer supported. CSS-in-JS itself has the ability to import on demand, and plugin support is no longer required. Umi users can remove related configurations. diff --git a/docs/react/migration-v5.zh-CN.md b/docs/react/migration-v5.zh-CN.md index c7be2d7318..6816923738 100644 --- a/docs/react/migration-v5.zh-CN.md +++ b/docs/react/migration-v5.zh-CN.md @@ -25,7 +25,7 @@ title: 从 v4 到 v5 - 所有 less 文件全部移除,less 变量不再支持透出。 - 产物中不再包含 css 文件。由于 CSS-in-JS 支持按需引入,原本的 `antd/dist/antd.css` 也已经移除,如果需要重置一些基本样式请引入 `antd/dist/reset.css`。 - 移除 css variables 以及在此之上构筑的动态主题方案。 -- 移除 `antd/es/locale` 目录,语言包可到 `antd/locale` 目录下寻找。 +- LocaleProvider 在 4.x 中已经废弃(使用 `` 替代),我们在 5.x 里彻底移除了相关目录 `antd/es/locale-provider`、`antd/lib/locale-provider`。 - 内置的时间库使用 Dayjs 替代 Moment.js,具体请查看 [使用自定义日期库](/docs/react/use-custom-date-library-cn/)。 - 不再支持 `babel-plugin-import`,CSS-in-JS 本身具有按需加载的能力,不再需要插件支持。 diff --git a/scripts/generateLegacyLocale.js b/scripts/generateLegacyLocale.js deleted file mode 100644 index 8a7b11d303..0000000000 --- a/scripts/generateLegacyLocale.js +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-disable no-console */ -/** Generate legacy locale file as shadow of `/locale` to `/locale-provider`. */ - -const glob = require('glob'); -const fs = require('fs'); -const chalk = require('chalk'); - -glob('components/locale/@(*_*|default).tsx', (er, files) => { - files.forEach((filePath) => { - const modulePath = filePath.replace(/^components/, '..').replace('.tsx', ''); - const legacyModulePath = filePath.replace('locale', 'locale-provider'); - - const template = `import locale from '${modulePath}'; - -export default locale; -`.trim(); - - console.log(modulePath, '=>', legacyModulePath); - fs.writeFileSync(legacyModulePath, template, 'utf8'); - }); - - console.log(chalk.green('✨ Locale generate success!')); -}); diff --git a/tests/dekko/lib.test.js b/tests/dekko/lib.test.js index 73c626f124..888a55137e 100644 --- a/tests/dekko/lib.test.js +++ b/tests/dekko/lib.test.js @@ -1,10 +1,5 @@ const $ = require('dekko'); const chalk = require('chalk'); -const path = require('path'); - -function getFileName(filePath) { - return filePath.slice(filePath.lastIndexOf(path.sep) + 1); -} $('lib').isDirectory().hasFile('index.js').hasFile('index.d.ts'); @@ -23,38 +18,5 @@ $('lib/*') .hasFile('index.js') .hasFile('index.d.ts'); -// locale - -const filterLocaleFile = (filePath) => { - const fileName = getFileName(filePath); - return ( - !fileName.endsWith('index.js') && - !fileName.endsWith('.d.ts') && - !fileName.endsWith('.map') && - !fileName.endsWith('style') && - !fileName.includes('-') && - !fileName.endsWith('LocaleReceiver.js') && - !fileName.endsWith('context.js') - ); -}; -const localeFiles = $('lib/locale/*').filter(filterLocaleFile); -const localeProviderFiles = $('lib/locale-provider/*').filter(filterLocaleFile); - -function compare(originFiles, targetFiles, targetPath) { - originFiles.assert( - `not exist in '${targetPath}'. Please use 'scripts/generateLegacyLocale.js' to refresh locale files.`, - (filePath) => { - const fileName = getFileName(filePath); - - return targetFiles.filenames.some( - (targetFilePath) => getFileName(targetFilePath) === fileName, - ); - }, - ); -} - -compare(localeFiles, localeProviderFiles, '/locale-provider'); -compare(localeProviderFiles, localeFiles, '/locale'); - // eslint-disable-next-line no-console console.log(chalk.green('✨ `lib` directory is valid.'));