Skip to content
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
2 changes: 1 addition & 1 deletion docusaurus/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npm install react-native-paper-dates --save

### Supported

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`.
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`.

```javascript
import { enGB, registerTranslation } from 'react-native-paper-dates'
Expand Down
8 changes: 8 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import {
pt,
registerTranslation,
tr,
zh,
zhTW,
} from '../../src'

function App() {
Expand Down Expand Up @@ -89,6 +91,8 @@ function App() {
'hi',
'tr',
'en-GB',
'zh',
'zh-TW',
]
let timeDate = new Date()
time.hours !== undefined && timeDate.setHours(time.hours)
Expand Down Expand Up @@ -166,6 +170,10 @@ function App() {
return pt
case 'tr':
return tr
case 'zh':
return zh
case 'zh-TW':
return zhTW
default:
return enGB
}
Expand Down
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ export { default as nl } from './translations/nl'
export { default as pl } from './translations/pl'
export { default as pt } from './translations/pt'
export { default as tr } from './translations/tr'
export { default as zh } from './translations/zh'
export { default as zhTW } from './translations/zhTW'
20 changes: 20 additions & 0 deletions src/translations/zh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { TranslationsType } from './utils'

const zh: TranslationsType = {
save: '保存',
selectSingle: '选择日期',
selectMultiple: '选择多个日期',
selectRange: '选择期间',
notAccordingToDateFormat: (inputFormat) => `日期格式必须是 ${inputFormat}`,
mustBeHigherThan: (date) => `必须晚于 ${date}`,
mustBeLowerThan: (date) => `必须早于 ${date}`,
mustBeBetween: (startDate, endDate) =>
`必须在 ${startDate} - ${endDate} 之间`,
dateIsDisabled: '日期不可选',
previous: '上一个',
next: '下一个',
typeInDate: '输入日期',
pickDateFromCalendar: '从日历中选择日期',
close: '关闭',
}
export default zh
21 changes: 21 additions & 0 deletions src/translations/zhTW.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { TranslationsType } from './utils'

const zhTW: TranslationsType = {
save: '保存',
selectSingle: '選擇日期',
selectMultiple: '選擇多個日期',
selectRange: '選擇期間',
notAccordingToDateFormat: (inputFormat) => `日期格式必須是 ${inputFormat}`,
mustBeHigherThan: (date) => `必須晚於 ${date}`,
mustBeLowerThan: (date) => `必須早於 ${date}`,
mustBeBetween: (startDate, endDate) =>
`必須在 ${startDate} - ${endDate} 之間`,
dateIsDisabled: '日期不可選',
previous: '上一個',
next: '下一個',
typeInDate: '輸入日期',
pickDateFromCalendar: '從日曆中選擇日期',
close: '關閉',
}

export default zhTW