From a313df17e459ed87e0ad49255b935d48aa5d87fd Mon Sep 17 00:00:00 2001 From: rlgo Date: Mon, 19 Jun 2023 00:40:03 +0800 Subject: [PATCH 1/2] adding simplified and traditional chinese translations --- docusaurus/docs/intro.md | 2 +- example/src/App.tsx | 8 ++++++++ src/index.tsx | 2 ++ src/translations/zh.ts | 20 ++++++++++++++++++++ src/translations/zhTW.ts | 21 +++++++++++++++++++++ 5 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/translations/zh.ts create mode 100644 src/translations/zhTW.ts diff --git a/docusaurus/docs/intro.md b/docusaurus/docs/intro.md index f7adfc2f..f0f73430 100644 --- a/docusaurus/docs/intro.md +++ b/docusaurus/docs/intro.md @@ -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` 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' diff --git a/example/src/App.tsx b/example/src/App.tsx index e4047c1e..ac10033f 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -37,6 +37,8 @@ import { pt, registerTranslation, tr, + zh, + zhTW, } from '../../src' function App() { @@ -89,6 +91,8 @@ function App() { 'hi', 'tr', 'en-GB', + 'zh', + 'zh-TW', ] let timeDate = new Date() time.hours !== undefined && timeDate.setHours(time.hours) @@ -166,6 +170,10 @@ function App() { return pt case 'tr': return tr + case 'zh': + return zh + case 'zh-TW': + return zhTW default: return enGB } diff --git a/src/index.tsx b/src/index.tsx index 94b81c94..1e2d762d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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' diff --git a/src/translations/zh.ts b/src/translations/zh.ts new file mode 100644 index 00000000..da806f28 --- /dev/null +++ b/src/translations/zh.ts @@ -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 diff --git a/src/translations/zhTW.ts b/src/translations/zhTW.ts new file mode 100644 index 00000000..e9280bb0 --- /dev/null +++ b/src/translations/zhTW.ts @@ -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 From 86d20753751df6f92dc6a7b2ece437a2647658e6 Mon Sep 17 00:00:00 2001 From: rlgo Date: Tue, 20 Jun 2023 10:37:38 +0800 Subject: [PATCH 2/2] add zh-TW to intro.md --- docusaurus/docs/intro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus/docs/intro.md b/docusaurus/docs/intro.md index f0f73430..e7f2f8f2 100644 --- a/docusaurus/docs/intro.md +++ b/docusaurus/docs/intro.md @@ -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/zh` 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'