From 7e4e67a725d9d5773c063accf4798d3503a7e862 Mon Sep 17 00:00:00 2001
From: jfrs <4005764+jfrs@users.noreply.github.com>
Date: Sat, 5 Feb 2022 13:38:56 +0000
Subject: [PATCH 1/2] feat(i18n): add enGB locale
---
CHANGELOG.en-US.md | 6 +
CHANGELOG.zh-CN.md | 6 +
demo/pages/docs/i18n/enUS/index.md | 1 +
src/locales/__snapshots__/index.spec.tsx.snap | 144 ++++++++++++++++++
src/locales/common/enGB.ts | 111 ++++++++++++++
src/locales/date/enGB.ts | 9 ++
src/locales/index.spec.tsx | 10 ++
src/locales/index.ts | 2 +
8 files changed, 289 insertions(+)
create mode 100644 src/locales/common/enGB.ts
create mode 100644 src/locales/date/enGB.ts
diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md
index 17ed9820b10..b635cd1cec7 100644
--- a/CHANGELOG.en-US.md
+++ b/CHANGELOG.en-US.md
@@ -1,5 +1,11 @@
# CHANGELOG
+## NEXT_VERSION
+
+### i18n
+
+- Add enGB locale.
+
## 2.25.0
### Breaking Changes
diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md
index 8ced5c7f158..737fe27f16c 100644
--- a/CHANGELOG.zh-CN.md
+++ b/CHANGELOG.zh-CN.md
@@ -1,5 +1,11 @@
# CHANGELOG
+## NEXT_VERSION
+
+### i18n
+
+- 新增 enGB locale
+
## 2.25.0
### Breaking Changes
diff --git a/demo/pages/docs/i18n/enUS/index.md b/demo/pages/docs/i18n/enUS/index.md
index cc708a635f3..d3a5a13a56c 100644
--- a/demo/pages/docs/i18n/enUS/index.md
+++ b/demo/pages/docs/i18n/enUS/index.md
@@ -55,6 +55,7 @@ PRs are welcomed for locales that are not supported yet!
| French | frFR | dateFrFR | |
| Spanish (Argentina) | esAR | dateEsAR | 2.24.2 |
| Italiano | itIT | dateItIT | 2.24.2 |
+| English (British) | enGB | dateEnGB | 2.25.1 |
## Customize the existing locale
diff --git a/src/locales/__snapshots__/index.spec.tsx.snap b/src/locales/__snapshots__/index.spec.tsx.snap
index 9d62e4581c6..90987acf88a 100644
--- a/src/locales/__snapshots__/index.spec.tsx.snap
+++ b/src/locales/__snapshots__/index.spec.tsx.snap
@@ -1727,3 +1727,147 @@ exports[`locale works 12`] = `
"
`;
+
+exports[`locale works 13`] = `
+"
"
+`;
diff --git a/src/locales/common/enGB.ts b/src/locales/common/enGB.ts
new file mode 100644
index 00000000000..c87654485b2
--- /dev/null
+++ b/src/locales/common/enGB.ts
@@ -0,0 +1,111 @@
+const enGB = {
+ name: 'en-GB',
+ global: {
+ undo: 'Undo',
+ redo: 'Redo',
+ confirm: 'Confirm'
+ },
+ Popconfirm: {
+ positiveText: 'Confirm',
+ negativeText: 'Cancel'
+ },
+ Cascader: {
+ placeholder: 'Please Select',
+ loading: 'Loading',
+ loadingRequiredMessage: (label: string): string =>
+ `Please load all ${label}'s descendants before checking it.`
+ },
+ Time: {
+ dateFormat: 'yyyy/MM/dd',
+ dateTimeFormat: 'yyyy/MM/dd HH:mm:ss'
+ },
+ DatePicker: {
+ yearFormat: 'yyyy',
+ monthFormat: 'MMM',
+ dayFormat: 'eeeeee',
+ yearTypeFormat: 'yyyy',
+ monthTypeFormat: 'yyyy/MM',
+ dateFormat: 'yyyy/MM/dd',
+ dateTimeFormat: 'yyyy/MM/dd HH:mm:ss',
+ quarterFormat: 'yyyy-qqq',
+ clear: 'Clear',
+ now: 'Now',
+ confirm: 'Confirm',
+ selectTime: 'Select Time',
+ selectDate: 'Select Date',
+ datePlaceholder: 'Select Date',
+ datetimePlaceholder: 'Select Date and Time',
+ monthPlaceholder: 'Select Month',
+ yearPlaceholder: 'Select Year',
+ quarterPlaceholder: 'Select Quarter',
+ startDatePlaceholder: 'Start Date',
+ endDatePlaceholder: 'End Date',
+ startDatetimePlaceholder: 'Start Date and Time',
+ endDatetimePlaceholder: 'End Date and Time',
+ monthBeforeYear: true,
+ firstDayOfWeek: 0 as 0 | 1 | 2 | 3 | 4 | 5 | 6,
+ today: 'Today'
+ },
+ DataTable: {
+ checkTableAll: 'Select all in the table',
+ uncheckTableAll: 'Unselect all in the table',
+ confirm: 'Confirm',
+ clear: 'Clear'
+ },
+ Transfer: {
+ sourceTitle: 'Source',
+ targetTitle: 'Target'
+ },
+ Empty: {
+ description: 'No Data'
+ },
+ Select: {
+ placeholder: 'Please Select'
+ },
+ TimePicker: {
+ placeholder: 'Select Time',
+ positiveText: 'OK',
+ negativeText: 'Cancel',
+ now: 'Now'
+ },
+ Pagination: {
+ goto: 'Goto',
+ selectionSuffix: 'page'
+ },
+ DynamicTags: {
+ add: 'Add'
+ },
+ Log: {
+ loading: 'Loading'
+ },
+ Input: {
+ placeholder: 'Please Input'
+ },
+ InputNumber: {
+ placeholder: 'Please Input'
+ },
+ DynamicInput: {
+ create: 'Create'
+ },
+ ThemeEditor: {
+ title: 'Theme Editor',
+ clearAllVars: 'Clear All Variables',
+ clearSearch: 'Clear Search',
+ filterCompName: 'Filter Component Name',
+ filterVarName: 'Filter Variable Name',
+ import: 'Import',
+ export: 'Export',
+ restore: 'Reset to Default'
+ },
+ Image: {
+ tipPrevious: 'Previous picture (←)',
+ tipNext: 'Next picture (→)',
+ tipCounterclockwise: 'Counterclockwise',
+ tipClockwise: 'Clockwise',
+ tipZoomOut: 'Zoom out',
+ tipZoomIn: 'Zoom in',
+ tipClose: 'Close (Esc)'
+ }
+}
+
+export default enGB
diff --git a/src/locales/date/enGB.ts b/src/locales/date/enGB.ts
new file mode 100644
index 00000000000..77a4bae58ac
--- /dev/null
+++ b/src/locales/date/enGB.ts
@@ -0,0 +1,9 @@
+import enGB from 'date-fns/locale/en-GB'
+import { NDateLocale } from './enUS'
+
+const dateEnGB: NDateLocale = {
+ name: 'en-GB',
+ locale: enGB
+}
+
+export default dateEnGB
diff --git a/src/locales/index.spec.tsx b/src/locales/index.spec.tsx
index 0fa700b5d6d..a36879786d9 100644
--- a/src/locales/index.spec.tsx
+++ b/src/locales/index.spec.tsx
@@ -13,6 +13,7 @@ import {
frFR,
esAR,
itIT,
+ enGB,
dateEnUS,
dateZhCN,
dateZhTW,
@@ -25,6 +26,7 @@ import {
dateFrFR,
dateEsAR,
dateItIT,
+ dateEnGB,
NConfigProvider,
NDateLocale,
NLocale,
@@ -203,5 +205,13 @@ describe('locale', () => {
}
}).html()
).toMatchSnapshot()
+ expect(
+ mount(Wrapper, {
+ props: {
+ dateLocale: dateEnGB,
+ locale: enGB
+ }
+ }).html()
+ ).toMatchSnapshot()
})
})
diff --git a/src/locales/index.ts b/src/locales/index.ts
index 7fbad155bd5..b353e3070e0 100644
--- a/src/locales/index.ts
+++ b/src/locales/index.ts
@@ -10,6 +10,7 @@ export { default as nbNO } from './common/nbNO'
export { default as frFR } from './common/frFR'
export { default as esAR } from './common/esAR'
export { default as itIT } from './common/itIT'
+export { default as enGB } from './common/enGB'
export { default as dateZhCN } from './date/zhCN'
export { default as dateZhTW } from './date/zhTW'
export { default as dateEnUS } from './date/enUS'
@@ -22,6 +23,7 @@ export { default as dateNbNO } from './date/nbNO'
export { default as dateFrFR } from './date/frFR'
export { default as dateEsAR } from './date/esAR'
export { default as dateItIT } from './date/itIT'
+export { default as dateEnGB } from './date/enGB'
export type { NLocale } from './common/enUS'
export type { NDateLocale } from './date/enUS'
export type { NPartialLocale } from './utils/index'
From 4d20e1180c19632807f305a047415d56c8b774b1 Mon Sep 17 00:00:00 2001
From: 07akioni <07akioni2@gmail.com>
Date: Sat, 5 Feb 2022 22:08:27 +0800
Subject: [PATCH 2/2] Apply suggestions from code review
---
demo/pages/docs/i18n/enUS/index.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/demo/pages/docs/i18n/enUS/index.md b/demo/pages/docs/i18n/enUS/index.md
index d3a5a13a56c..1014db36414 100644
--- a/demo/pages/docs/i18n/enUS/index.md
+++ b/demo/pages/docs/i18n/enUS/index.md
@@ -55,7 +55,7 @@ PRs are welcomed for locales that are not supported yet!
| French | frFR | dateFrFR | |
| Spanish (Argentina) | esAR | dateEsAR | 2.24.2 |
| Italiano | itIT | dateItIT | 2.24.2 |
-| English (British) | enGB | dateEnGB | 2.25.1 |
+| English (British) | enGB | dateEnGB | NEXT_VERSION |
## Customize the existing locale