From 2f7f548344feb8ebee76368c053ec1c2c743b2db Mon Sep 17 00:00:00 2001 From: ilank Date: Tue, 31 Jan 2023 23:17:11 +0200 Subject: [PATCH 1/2] Adding hebrew translation --- .../__snapshots__/TimeInput.test.tsx.snap | 2 +- .../__snapshots__/TimeInputs.test.tsx.snap | 4 ++-- .../__snapshots__/TimePicker.test.tsx.snap | 4 ++-- src/index.tsx | 1 + src/translations/he.ts | 21 +++++++++++++++++++ 5 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 src/translations/he.ts diff --git a/src/__tests__/Time/__snapshots__/TimeInput.test.tsx.snap b/src/__tests__/Time/__snapshots__/TimeInput.test.tsx.snap index 4ec88cca..090d87b0 100644 --- a/src/__tests__/Time/__snapshots__/TimeInput.test.tsx.snap +++ b/src/__tests__/Time/__snapshots__/TimeInput.test.tsx.snap @@ -20,7 +20,6 @@ exports[`renders TimeInput 1`] = ` style={ [ { - "fontSize": 57, "textAlign": "center", "textAlignVertical": "center", "width": 96, @@ -31,6 +30,7 @@ exports[`renders TimeInput 1`] = ` "borderRadius": 8, "borderWidth": 2, "color": "rgba(33, 0, 93, 1)", + "fontSize": 57, "height": 80, }, ] diff --git a/src/__tests__/Time/__snapshots__/TimeInputs.test.tsx.snap b/src/__tests__/Time/__snapshots__/TimeInputs.test.tsx.snap index 17c42666..9c78818f 100644 --- a/src/__tests__/Time/__snapshots__/TimeInputs.test.tsx.snap +++ b/src/__tests__/Time/__snapshots__/TimeInputs.test.tsx.snap @@ -43,7 +43,6 @@ exports[`renders TimeInputs 1`] = ` style={ [ { - "fontSize": 57, "textAlign": "center", "textAlignVertical": "center", "width": 96, @@ -54,6 +53,7 @@ exports[`renders TimeInputs 1`] = ` "borderRadius": 8, "borderWidth": 0, "color": "rgba(28, 27, 31, 1)", + "fontSize": 57, "height": 72, }, ] @@ -178,7 +178,6 @@ exports[`renders TimeInputs 1`] = ` style={ [ { - "fontSize": 57, "textAlign": "center", "textAlignVertical": "center", "width": 96, @@ -189,6 +188,7 @@ exports[`renders TimeInputs 1`] = ` "borderRadius": 8, "borderWidth": 0, "color": "rgba(28, 27, 31, 1)", + "fontSize": 57, "height": 72, }, ] diff --git a/src/__tests__/Time/__snapshots__/TimePicker.test.tsx.snap b/src/__tests__/Time/__snapshots__/TimePicker.test.tsx.snap index c39bc492..7f036c1f 100644 --- a/src/__tests__/Time/__snapshots__/TimePicker.test.tsx.snap +++ b/src/__tests__/Time/__snapshots__/TimePicker.test.tsx.snap @@ -51,7 +51,6 @@ exports[`renders TimePicker 1`] = ` style={ [ { - "fontSize": 57, "textAlign": "center", "textAlignVertical": "center", "width": 96, @@ -62,6 +61,7 @@ exports[`renders TimePicker 1`] = ` "borderRadius": 8, "borderWidth": 0, "color": "rgba(28, 27, 31, 1)", + "fontSize": 57, "height": 72, }, ] @@ -186,7 +186,6 @@ exports[`renders TimePicker 1`] = ` style={ [ { - "fontSize": 57, "textAlign": "center", "textAlignVertical": "center", "width": 96, @@ -197,6 +196,7 @@ exports[`renders TimePicker 1`] = ` "borderRadius": 8, "borderWidth": 0, "color": "rgba(28, 27, 31, 1)", + "fontSize": 57, "height": 72, }, ] diff --git a/src/index.tsx b/src/index.tsx index dd7624ee..5016dcb1 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -14,6 +14,7 @@ export { default as en } from './translations/en' export { default as enGB } from './translations/enGB' export { default as es } from './translations/es' export { default as fr } from './translations/fr' +export { default as he } from './translations/he' export { default as it } from './translations/it' export { default as ko } from './translations/ko' export { default as nl } from './translations/nl' diff --git a/src/translations/he.ts b/src/translations/he.ts new file mode 100644 index 00000000..ff0fd3c8 --- /dev/null +++ b/src/translations/he.ts @@ -0,0 +1,21 @@ +import type { TranslationsType } from './utils' + +const he: 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 he From 1a024f36a697dc5c8f2094b3534ba0000acfe727 Mon Sep 17 00:00:00 2001 From: ilank Date: Thu, 2 Feb 2023 12:52:20 +0200 Subject: [PATCH 2/2] updated intro.md to include hebrew --- docusaurus/docs/intro.md | 61 ++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/docusaurus/docs/intro.md b/docusaurus/docs/intro.md index 41c1ca6c..37260ef9 100644 --- a/docusaurus/docs/intro.md +++ b/docusaurus/docs/intro.md @@ -36,13 +36,10 @@ npm install react-native-paper-dates --save ### Supported -React-Native-Paper-Dates currently supports `en/nl/de/pl/pt/ar/ko/fr/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/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`. ```javascript -import { - enGB, - registerTranslation, -} from 'react-native-paper-dates' +import { enGB, registerTranslation } from 'react-native-paper-dates' registerTranslation('en-GB', enGB) ``` @@ -51,10 +48,8 @@ registerTranslation('en-GB', enGB) React-Native-Paper-Dates also provides the ability to register your own translation. 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 { - registerTranslation, -} from 'react-native-paper-dates' -registerTranslation("pl", { +import { registerTranslation } from 'react-native-paper-dates' +registerTranslation('pl', { save: 'Save', selectSingle: 'Select date', selectMultiple: 'Select dates', @@ -119,41 +114,41 @@ Don't forget to import the languages you want to support, in the example only en ```javascript // on top of your index.android.js file -const isAndroid = require('react-native').Platform.OS === 'android'; // this line is only needed if you don't use an .android.js file -const isHermesEnabled = !!global.HermesInternal; // this line is only needed if you don't use an .android.js file +const isAndroid = require('react-native').Platform.OS === 'android' // this line is only needed if you don't use an .android.js file +const isHermesEnabled = !!global.HermesInternal // this line is only needed if you don't use an .android.js file // in your index.js file -if (isHermesEnabled || isAndroid) { // this line is only needed if you don't use an .android.js file +if (isHermesEnabled || isAndroid) { + // this line is only needed if you don't use an .android.js file - require('@formatjs/intl-getcanonicallocales/polyfill'); - require('@formatjs/intl-locale/polyfill'); + require('@formatjs/intl-getcanonicallocales/polyfill') + require('@formatjs/intl-locale/polyfill') - require('@formatjs/intl-pluralrules/polyfill'); - require('@formatjs/intl-pluralrules/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT + require('@formatjs/intl-pluralrules/polyfill') + require('@formatjs/intl-pluralrules/locale-data/en.js') // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT - require('@formatjs/intl-displaynames/polyfill'); - require('@formatjs/intl-displaynames/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT + require('@formatjs/intl-displaynames/polyfill') + require('@formatjs/intl-displaynames/locale-data/en.js') // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT - require('@formatjs/intl-listformat/polyfill'); - require('@formatjs/intl-listformat/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT + require('@formatjs/intl-listformat/polyfill') + require('@formatjs/intl-listformat/locale-data/en.js') // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT - require('@formatjs/intl-numberformat/polyfill'); - require('@formatjs/intl-numberformat/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT + require('@formatjs/intl-numberformat/polyfill') + require('@formatjs/intl-numberformat/locale-data/en.js') // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT - require('@formatjs/intl-relativetimeformat/polyfill'); - require('@formatjs/intl-relativetimeformat/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT + require('@formatjs/intl-relativetimeformat/polyfill') + require('@formatjs/intl-relativetimeformat/locale-data/en.js') // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT - require('@formatjs/intl-datetimeformat/polyfill'); - require('@formatjs/intl-datetimeformat/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT + require('@formatjs/intl-datetimeformat/polyfill') + require('@formatjs/intl-datetimeformat/locale-data/en.js') // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT - require('@formatjs/intl-datetimeformat/add-golden-tz.js'); + require('@formatjs/intl-datetimeformat/add-golden-tz.js') // https://formatjs.io/docs/polyfills/intl-datetimeformat/#default-timezone if ('__setDefaultTimeZone' in Intl.DateTimeFormat) { - // If you are using react-native-cli - let RNLocalize = require('react-native-localize'); - Intl.DateTimeFormat.__setDefaultTimeZone(RNLocalize.getTimeZone()); + let RNLocalize = require('react-native-localize') + Intl.DateTimeFormat.__setDefaultTimeZone(RNLocalize.getTimeZone()) // Are you using Expo, use this instead of previous 2 lines // Intl.DateTimeFormat.__setDefaultTimeZone( @@ -169,9 +164,9 @@ if (isHermesEnabled || isAndroid) { // this line is only needed if you don't us - Try to avoid putting the Picker Modals inside of a scrollView If that is not possible use the following props on the surrounding ScrollViews/Flatlists ```javascript - keyboardDismissMode="on-drag" - keyboardShouldPersistTaps="handled" - contentInsetAdjustmentBehavior="always" +keyboardDismissMode = 'on-drag' +keyboardShouldPersistTaps = 'handled' +contentInsetAdjustmentBehavior = 'always' ``` This is to prevent the need to press 2 times before save or close button in modal works (1 press for closing keyboard, 1 press for confirm/close) [React Native Issue: #10138](https://github.com/facebook/react-native/issues/10138)