Skip to content

Commit 6728894

Browse files
Merge pull request #295 from rlgo/master
Adding simplified and traditional chinese translations
2 parents df50c8b + 86d2075 commit 6728894

File tree

5 files changed

+52
-1
lines changed

5 files changed

+52
-1
lines changed

docusaurus/docs/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ npm install react-native-paper-dates --save
3636

3737
### Supported
3838

39-
React-Native-Paper-Dates currently supports `en/nl/de/pl/pt/ar/ko/fr/he/hi/tr/enGB` translations. Ideally you would do this somewhere before react-native-paper-dates is used. For example, you might add the follow to your `index.js` or `app.js`.
39+
React-Native-Paper-Dates currently supports `en/nl/de/pl/pt/ar/ko/fr/he/hi/tr/enGB/zh/zh-TW` translations. Ideally you would do this somewhere before react-native-paper-dates is used. For example, you might add the follow to your `index.js` or `app.js`.
4040

4141
```javascript
4242
import { enGB, registerTranslation } from 'react-native-paper-dates'

example/src/App.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import {
3737
pt,
3838
registerTranslation,
3939
tr,
40+
zh,
41+
zhTW,
4042
} from '../../src'
4143

4244
function App() {
@@ -89,6 +91,8 @@ function App() {
8991
'hi',
9092
'tr',
9193
'en-GB',
94+
'zh',
95+
'zh-TW',
9296
]
9397
let timeDate = new Date()
9498
time.hours !== undefined && timeDate.setHours(time.hours)
@@ -166,6 +170,10 @@ function App() {
166170
return pt
167171
case 'tr':
168172
return tr
173+
case 'zh':
174+
return zh
175+
case 'zh-TW':
176+
return zhTW
169177
default:
170178
return enGB
171179
}

src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ export { default as nl } from './translations/nl'
2222
export { default as pl } from './translations/pl'
2323
export { default as pt } from './translations/pt'
2424
export { default as tr } from './translations/tr'
25+
export { default as zh } from './translations/zh'
26+
export { default as zhTW } from './translations/zhTW'

src/translations/zh.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { TranslationsType } from './utils'
2+
3+
const zh: TranslationsType = {
4+
save: '保存',
5+
selectSingle: '选择日期',
6+
selectMultiple: '选择多个日期',
7+
selectRange: '选择期间',
8+
notAccordingToDateFormat: (inputFormat) => `日期格式必须是 ${inputFormat}`,
9+
mustBeHigherThan: (date) => `必须晚于 ${date}`,
10+
mustBeLowerThan: (date) => `必须早于 ${date}`,
11+
mustBeBetween: (startDate, endDate) =>
12+
`必须在 ${startDate} - ${endDate} 之间`,
13+
dateIsDisabled: '日期不可选',
14+
previous: '上一个',
15+
next: '下一个',
16+
typeInDate: '输入日期',
17+
pickDateFromCalendar: '从日历中选择日期',
18+
close: '关闭',
19+
}
20+
export default zh

src/translations/zhTW.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { TranslationsType } from './utils'
2+
3+
const zhTW: TranslationsType = {
4+
save: '保存',
5+
selectSingle: '選擇日期',
6+
selectMultiple: '選擇多個日期',
7+
selectRange: '選擇期間',
8+
notAccordingToDateFormat: (inputFormat) => `日期格式必須是 ${inputFormat}`,
9+
mustBeHigherThan: (date) => `必須晚於 ${date}`,
10+
mustBeLowerThan: (date) => `必須早於 ${date}`,
11+
mustBeBetween: (startDate, endDate) =>
12+
`必須在 ${startDate} - ${endDate} 之間`,
13+
dateIsDisabled: '日期不可選',
14+
previous: '上一個',
15+
next: '下一個',
16+
typeInDate: '輸入日期',
17+
pickDateFromCalendar: '從日曆中選擇日期',
18+
close: '關閉',
19+
}
20+
21+
export default zhTW

0 commit comments

Comments
 (0)