diff --git a/components/locale-provider/LocaleReceiver.jsx b/components/locale-provider/LocaleReceiver.jsx index b65196ae7..65b815dd6 100644 --- a/components/locale-provider/LocaleReceiver.jsx +++ b/components/locale-provider/LocaleReceiver.jsx @@ -1,9 +1,10 @@ import PropTypes from '../_util/vue-types' +import defaultLocaleData from './default' export default { props: { - componentName: PropTypes.string, + componentName: PropTypes.string.def('global'), defaultLocale: PropTypes.oneOfType([ PropTypes.object, PropTypes.func, @@ -16,10 +17,12 @@ export default { methods: { getLocale () { const { componentName, defaultLocale } = this + const locale = defaultLocale || defaultLocaleData[componentName || 'global'] const { antLocale } = this.localeData - const localeFromContext = antLocale && antLocale[componentName] + + const localeFromContext = componentName && antLocale ? antLocale[componentName] : {} return { - ...(typeof defaultLocale === 'function' ? defaultLocale() : defaultLocale), + ...(typeof locale === 'function' ? locale() : locale), ...(localeFromContext || {}), } }, @@ -29,7 +32,7 @@ export default { const localeCode = antLocale && antLocale.locale // Had use LocaleProvide but didn't set locale if (antLocale && antLocale.exist && !localeCode) { - return 'en-us' + return defaultLocaleData.locale } return localeCode }, diff --git a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap index e3e4beed9..986aa1089 100644 --- a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap +++ b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap @@ -896,7 +896,39 @@ exports[`Locale Provider should display the text as ar 1`] = ` -
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
ma | +ti | +on | +to | +fr | +lø | +sø | +
---|---|---|---|---|---|---|
+
+
+ 28
+
+ |
+
+
+
+ 29
+
+ |
+
+
+
+ 30
+
+ |
+
+
+
+ 31
+
+ |
+
+
+
+ 01
+
+ |
+
+
+
+ 02
+
+ |
+
+
+
+ 03
+
+ |
+
+
+
+ 04
+
+ |
+
+
+
+ 05
+
+ |
+
+
+
+ 06
+
+ |
+
+
+
+ 07
+
+ |
+
+
+
+ 08
+
+ |
+
+
+
+ 09
+
+ |
+
+
+
+ 10
+
+ |
+
+
+
+ 11
+
+ |
+
+
+
+ 12
+
+ |
+
+
+
+ 13
+
+ |
+
+
+
+ 14
+
+ |
+
+
+
+ 15
+
+ |
+
+
+
+ 16
+
+ |
+
+
+
+ 17
+
+ |
+
+
+
+ 18
+
+ |
+
+
+
+ 19
+
+ |
+
+
+
+ 20
+
+ |
+
+
+
+ 21
+
+ |
+
+
+
+ 22
+
+ |
+
+
+
+ 23
+
+ |
+
+
+
+ 24
+
+ |
+
+
+
+ 25
+
+ |
+
+
+
+ 26
+
+ |
+
+
+
+ 27
+
+ |
+
+
+
+ 28
+
+ |
+
+
+
+ 29
+
+ |
+
+
+
+ 30
+
+ |
+
+
+
+ 01
+
+ |
+
+
+
+ 02
+
+ |
+
+
+
+ 03
+
+ |
+
+
+
+ 04
+
+ |
+
+
+
+ 05
+
+ |
+
+
+
+ 06
+
+ |
+
+
+
+ 07
+
+ |
+
+
+
+ 08
+
+ |
+
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
א | +ב | +ג | +ד | +ה | +ו | +ש | +
---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24
+
+ |
+
+
+
+ 25
+
+ |
+
+
+
+ 26
+
+ |
+
+
+
+ 27
+
+ |
+
+
+
+ 28
+
+ |
+
+
+
+ 29
+
+ |
+
+
+
+ 30
+
+ |
+
+
+
+ 01
+
+ |
+
+
+
+ 02
+
+ |
+
+
+
+ 03
+
+ |
+
+
+
+ 04
+
+ |
+
+
+
+ 05
+
+ |
+
+
+
+ 06
+
+ |
+
+
+
+ 07
+
+ |
+
+
+
+ 08
+
+ |
+
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
आ. | +सो. | +मं. | +बु. | +बि. | +शु. | +श. | +
---|---|---|---|---|---|---|
+
+
+ 27
+
+ |
+
+
+
+ 28
+
+ |
+
+
+
+ 29
+
+ |
+
+
+
+ 30
+
+ |
+
+
+
+ 31
+
+ |
+
+
+
+ 01
+
+ |
+
+
+
+ 02
+
+ |
+
+
+
+ 03
+
+ |
+
+
+
+ 04
+
+ |
+
+
+
+ 05
+
+ |
+
+
+
+ 06
+
+ |
+
+
+
+ 07
+
+ |
+
+
+
+ 08
+
+ |
+
+
+
+ 09
+
+ |
+
+
+
+ 10
+
+ |
+
+
+
+ 11
+
+ |
+
+
+
+ 12
+
+ |
+
+
+
+ 13
+
+ |
+
+
+
+ 14
+
+ |
+
+
+
+ 15
+
+ |
+
+
+
+ 16
+
+ |
+
+
+
+ 17
+
+ |
+
+
+
+ 18
+
+ |
+
+
+
+ 19
+
+ |
+
+
+
+ 20
+
+ |
+
+
+
+ 21
+
+ |
+
+
+
+ 22
+
+ |
+
+
+
+ 23
+
+ |
+
+
+
+ 24
+
+ |
+
+
+
+ 25
+
+ |
+
+
+
+ 26
+
+ |
+
+
+
+ 27
+
+ |
+
+
+
+ 28
+
+ |
+
+
+
+ 29
+
+ |
+
+
+
+ 30
+
+ |
+
+
+
+ 01
+
+ |
+
+
+
+ 02
+
+ |
+
+
+
+ 03
+
+ |
+
+
+
+ 04
+
+ |
+
+
+
+ 05
+
+ |
+
+
+
+ 06
+
+ |
+
+
+
+ 07
+
+ |
+
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|
Name | Age |
---|
+ Name
+ |
+
+ Age
+ |
+
---|