Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(i18n): add enGB locale #2338

Merged
merged 2 commits into from
Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## NEXT_VERSION

### i18n

- Add enGB locale.

## 2.25.0

### Breaking Changes
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## NEXT_VERSION

### i18n

- 新增 enGB locale

## 2.25.0

### Breaking Changes
Expand Down
1 change: 1 addition & 0 deletions demo/pages/docs/i18n/enUS/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | NEXT_VERSION |

## Customize the existing locale

Expand Down
144 changes: 144 additions & 0 deletions src/locales/__snapshots__/index.spec.tsx.snap

Large diffs are not rendered by default.

111 changes: 111 additions & 0 deletions src/locales/common/enGB.ts
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions src/locales/date/enGB.ts
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions src/locales/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
frFR,
esAR,
itIT,
enGB,
dateEnUS,
dateZhCN,
dateZhTW,
Expand All @@ -25,6 +26,7 @@ import {
dateFrFR,
dateEsAR,
dateItIT,
dateEnGB,
NConfigProvider,
NDateLocale,
NLocale,
Expand Down Expand Up @@ -203,5 +205,13 @@ describe('locale', () => {
}
}).html()
).toMatchSnapshot()
expect(
mount(Wrapper, {
props: {
dateLocale: dateEnGB,
locale: enGB
}
}).html()
).toMatchSnapshot()
})
})
2 changes: 2 additions & 0 deletions src/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down