react-native-paper-dates 0.22.41 → 0.22.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,8 +10,8 @@ const en = {
10
10
  selectMultiple: 'Select dates',
11
11
  selectRange: 'Select period',
12
12
  notAccordingToDateFormat: inputFormat => `Date format must be ${inputFormat}`,
13
- mustBeHigherThan: date => `Must be later then ${date}`,
14
- mustBeLowerThan: date => `Must be earlier then ${date}`,
13
+ mustBeHigherThan: date => `Must be later than ${date}`,
14
+ mustBeLowerThan: date => `Must be earlier than ${date}`,
15
15
  mustBeBetween: (startDate, endDate) => `Must be between ${startDate} - ${endDate}`,
16
16
  dateIsDisabled: 'Day is not allowed',
17
17
  previous: 'Previous',
@@ -10,8 +10,8 @@ const enGB = {
10
10
  selectMultiple: 'Select dates',
11
11
  selectRange: 'Select period',
12
12
  notAccordingToDateFormat: inputFormat => `Date format must be ${inputFormat}`,
13
- mustBeHigherThan: date => `Must be later then ${date}`,
14
- mustBeLowerThan: date => `Must be earlier then ${date}`,
13
+ mustBeHigherThan: date => `Must be later than ${date}`,
14
+ mustBeLowerThan: date => `Must be earlier than ${date}`,
15
15
  mustBeBetween: (startDate, endDate) => `Must be between ${startDate} - ${endDate}`,
16
16
  dateIsDisabled: 'Day is not allowed',
17
17
  previous: 'Previous',
@@ -13,7 +13,7 @@ function getTranslation(locale, key, fallback) {
13
13
  console.warn(`[react-native-paper-dates] The locale ${locale} is not registered, see README!, key: ${key}`);
14
14
  return fallback || key;
15
15
  }
16
- const translation = translationsPerLocale[l][key];
16
+ const translation = typeof translationForLocale === 'function' ? translationForLocale(locale)[key] : translationForLocale[key];
17
17
  if (!translation) {
18
18
  console.warn(`[react-native-paper-dates] The locale ${locale} is registered, but ${key} is missing`);
19
19
  }
@@ -1 +1 @@
1
- {"version":3,"names":["translationsPerLocale","getTranslation","locale","key","fallback","l","translationForLocale","console","warn","translation","registerTranslation","translations"],"sourceRoot":"../../../src","sources":["translations/utils.ts"],"mappings":";;;;;;;AAmBA,IAAIA,qBAAuD,GAAG,CAAC,CAAC;AAEzD,SAASC,cAAcA,CAC5BC,MAA0B,EAC1BC,GAAM,EACNC,QAAc,EACd;EACA,MAAMC,CAAC,GAAGH,MAAM,IAAI,IAAI;EACxB,MAAMI,oBAAoB,GAAGN,qBAAqB,CAACK,CAAC,CAAC;EACrD,IAAI,CAACC,oBAAoB,EAAE;IACzBC,OAAO,CAACC,IAAI,CACV,yCAAyCN,MAAM,yCAAyCC,GAAG,EAC7F,CAAC;IACD,OAAOC,QAAQ,IAAID,GAAG;EACxB;EACA,MAAMM,WAAW,GAAGT,qBAAqB,CAACK,CAAC,CAAC,CAACF,GAAG,CAAC;EACjD,IAAI,CAACM,WAAW,EAAE;IAChBF,OAAO,CAACC,IAAI,CACV,yCAAyCN,MAAM,uBAAuBC,GAAG,aAC3E,CAAC;EACH;EACA,OAAOM,WAAW,IAAIL,QAAQ,IAAID,GAAG;AACvC;AAEO,SAASO,mBAAmBA,CACjCR,MAAc,EACdS,YAA8B,EAC9B;EACAX,qBAAqB,CAACE,MAAM,CAAC,GAAGS,YAAY;AAC9C","ignoreList":[]}
1
+ {"version":3,"names":["translationsPerLocale","getTranslation","locale","key","fallback","l","translationForLocale","console","warn","translation","registerTranslation","translations"],"sourceRoot":"../../../src","sources":["translations/utils.ts"],"mappings":";;;;;;;AAuBA,IAAIA,qBAGH,GAAG,CAAC,CAAC;AAEC,SAASC,cAAcA,CAC5BC,MAA0B,EAC1BC,GAAM,EACNC,QAAc,EACd;EACA,MAAMC,CAAC,GAAGH,MAAM,IAAI,IAAI;EACxB,MAAMI,oBAAoB,GAAGN,qBAAqB,CAACK,CAAC,CAAC;EACrD,IAAI,CAACC,oBAAoB,EAAE;IACzBC,OAAO,CAACC,IAAI,CACV,yCAAyCN,MAAM,yCAAyCC,GAAG,EAC7F,CAAC;IACD,OAAOC,QAAQ,IAAID,GAAG;EACxB;EACA,MAAMM,WAAgC,GACpC,OAAOH,oBAAoB,KAAK,UAAU,GACtCA,oBAAoB,CAACJ,MAAM,CAAC,CAACC,GAAG,CAAC,GACjCG,oBAAoB,CAACH,GAAG,CAAC;EAC/B,IAAI,CAACM,WAAW,EAAE;IAChBF,OAAO,CAACC,IAAI,CACV,yCAAyCN,MAAM,uBAAuBC,GAAG,aAC3E,CAAC;EACH;EACA,OAAOM,WAAW,IAAIL,QAAQ,IAAID,GAAG;AACvC;AAEO,SAASO,mBAAmBA,CACjCR,MAAc,EACdS,YAAoD,EACpD;EACAX,qBAAqB,CAACE,MAAM,CAAC,GAAGS,YAAY;AAC9C","ignoreList":[]}
@@ -6,8 +6,8 @@ const en = {
6
6
  selectMultiple: 'Select dates',
7
7
  selectRange: 'Select period',
8
8
  notAccordingToDateFormat: inputFormat => `Date format must be ${inputFormat}`,
9
- mustBeHigherThan: date => `Must be later then ${date}`,
10
- mustBeLowerThan: date => `Must be earlier then ${date}`,
9
+ mustBeHigherThan: date => `Must be later than ${date}`,
10
+ mustBeLowerThan: date => `Must be earlier than ${date}`,
11
11
  mustBeBetween: (startDate, endDate) => `Must be between ${startDate} - ${endDate}`,
12
12
  dateIsDisabled: 'Day is not allowed',
13
13
  previous: 'Previous',
@@ -6,8 +6,8 @@ const enGB = {
6
6
  selectMultiple: 'Select dates',
7
7
  selectRange: 'Select period',
8
8
  notAccordingToDateFormat: inputFormat => `Date format must be ${inputFormat}`,
9
- mustBeHigherThan: date => `Must be later then ${date}`,
10
- mustBeLowerThan: date => `Must be earlier then ${date}`,
9
+ mustBeHigherThan: date => `Must be later than ${date}`,
10
+ mustBeLowerThan: date => `Must be earlier than ${date}`,
11
11
  mustBeBetween: (startDate, endDate) => `Must be between ${startDate} - ${endDate}`,
12
12
  dateIsDisabled: 'Day is not allowed',
13
13
  previous: 'Previous',
@@ -8,7 +8,7 @@ export function getTranslation(locale, key, fallback) {
8
8
  console.warn(`[react-native-paper-dates] The locale ${locale} is not registered, see README!, key: ${key}`);
9
9
  return fallback || key;
10
10
  }
11
- const translation = translationsPerLocale[l][key];
11
+ const translation = typeof translationForLocale === 'function' ? translationForLocale(locale)[key] : translationForLocale[key];
12
12
  if (!translation) {
13
13
  console.warn(`[react-native-paper-dates] The locale ${locale} is registered, but ${key} is missing`);
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"names":["translationsPerLocale","getTranslation","locale","key","fallback","l","translationForLocale","console","warn","translation","registerTranslation","translations"],"sourceRoot":"../../../src","sources":["translations/utils.ts"],"mappings":";;AAmBA,IAAIA,qBAAuD,GAAG,CAAC,CAAC;AAEhE,OAAO,SAASC,cAAcA,CAC5BC,MAA0B,EAC1BC,GAAM,EACNC,QAAc,EACd;EACA,MAAMC,CAAC,GAAGH,MAAM,IAAI,IAAI;EACxB,MAAMI,oBAAoB,GAAGN,qBAAqB,CAACK,CAAC,CAAC;EACrD,IAAI,CAACC,oBAAoB,EAAE;IACzBC,OAAO,CAACC,IAAI,CACV,yCAAyCN,MAAM,yCAAyCC,GAAG,EAC7F,CAAC;IACD,OAAOC,QAAQ,IAAID,GAAG;EACxB;EACA,MAAMM,WAAW,GAAGT,qBAAqB,CAACK,CAAC,CAAC,CAACF,GAAG,CAAC;EACjD,IAAI,CAACM,WAAW,EAAE;IAChBF,OAAO,CAACC,IAAI,CACV,yCAAyCN,MAAM,uBAAuBC,GAAG,aAC3E,CAAC;EACH;EACA,OAAOM,WAAW,IAAIL,QAAQ,IAAID,GAAG;AACvC;AAEA,OAAO,SAASO,mBAAmBA,CACjCR,MAAc,EACdS,YAA8B,EAC9B;EACAX,qBAAqB,CAACE,MAAM,CAAC,GAAGS,YAAY;AAC9C","ignoreList":[]}
1
+ {"version":3,"names":["translationsPerLocale","getTranslation","locale","key","fallback","l","translationForLocale","console","warn","translation","registerTranslation","translations"],"sourceRoot":"../../../src","sources":["translations/utils.ts"],"mappings":";;AAuBA,IAAIA,qBAGH,GAAG,CAAC,CAAC;AAEN,OAAO,SAASC,cAAcA,CAC5BC,MAA0B,EAC1BC,GAAM,EACNC,QAAc,EACd;EACA,MAAMC,CAAC,GAAGH,MAAM,IAAI,IAAI;EACxB,MAAMI,oBAAoB,GAAGN,qBAAqB,CAACK,CAAC,CAAC;EACrD,IAAI,CAACC,oBAAoB,EAAE;IACzBC,OAAO,CAACC,IAAI,CACV,yCAAyCN,MAAM,yCAAyCC,GAAG,EAC7F,CAAC;IACD,OAAOC,QAAQ,IAAID,GAAG;EACxB;EACA,MAAMM,WAAgC,GACpC,OAAOH,oBAAoB,KAAK,UAAU,GACtCA,oBAAoB,CAACJ,MAAM,CAAC,CAACC,GAAG,CAAC,GACjCG,oBAAoB,CAACH,GAAG,CAAC;EAC/B,IAAI,CAACM,WAAW,EAAE;IAChBF,OAAO,CAACC,IAAI,CACV,yCAAyCN,MAAM,uBAAuBC,GAAG,aAC3E,CAAC;EACH;EACA,OAAOM,WAAW,IAAIL,QAAQ,IAAID,GAAG;AACvC;AAEA,OAAO,SAASO,mBAAmBA,CACjCR,MAAc,EACdS,YAAoD,EACpD;EACAX,qBAAqB,CAACE,MAAM,CAAC,GAAGS,YAAY;AAC9C","ignoreList":[]}
@@ -16,6 +16,7 @@ export type TranslationsType = {
16
16
  hour: string;
17
17
  minute: string;
18
18
  };
19
+ export type TranslationResolver = (locale: string | undefined) => TranslationsType;
19
20
  export declare function getTranslation<K extends keyof TranslationsType>(locale: string | undefined, key: K, fallback?: any): any;
20
- export declare function registerTranslation(locale: string, translations: TranslationsType): void;
21
+ export declare function registerTranslation(locale: string, translations: TranslationsType | TranslationResolver): void;
21
22
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/translations/utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,wBAAw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,MAAM,CAAA;IAC7D,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,MAAM,EAAE,MAAM,GAAG,SAAS,KACvB,gBAAgB,CAAA;AAOrB,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAC7D,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,GAAG,EAAE,CAAC,EACN,QAAQ,CAAC,EAAE,GAAG,OAoBf;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,gBAAgB,GAAG,mBAAmB,QAGrD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-paper-dates",
3
- "version": "0.22.41",
3
+ "version": "0.22.43",
4
4
  "description": "Performant Date Picker for React Native Paper",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -32,7 +32,7 @@
32
32
  "pods": "cd example && pod-install --quiet",
33
33
  "bootstrap": "yarn example && yarn && yarn pods",
34
34
  "prepack": "bob build",
35
- "build-example": "cd example && npx expo export --platform web"
35
+ "build-example": "cd example && npx expo export:web"
36
36
  },
37
37
  "keywords": [
38
38
  "react-native",
@@ -7,8 +7,8 @@ const en: TranslationsType = {
7
7
  selectRange: 'Select period',
8
8
  notAccordingToDateFormat: (inputFormat) =>
9
9
  `Date format must be ${inputFormat}`,
10
- mustBeHigherThan: (date) => `Must be later then ${date}`,
11
- mustBeLowerThan: (date) => `Must be earlier then ${date}`,
10
+ mustBeHigherThan: (date) => `Must be later than ${date}`,
11
+ mustBeLowerThan: (date) => `Must be earlier than ${date}`,
12
12
  mustBeBetween: (startDate, endDate) =>
13
13
  `Must be between ${startDate} - ${endDate}`,
14
14
  dateIsDisabled: 'Day is not allowed',
@@ -7,8 +7,8 @@ const enGB: TranslationsType = {
7
7
  selectRange: 'Select period',
8
8
  notAccordingToDateFormat: (inputFormat) =>
9
9
  `Date format must be ${inputFormat}`,
10
- mustBeHigherThan: (date) => `Must be later then ${date}`,
11
- mustBeLowerThan: (date) => `Must be earlier then ${date}`,
10
+ mustBeHigherThan: (date) => `Must be later than ${date}`,
11
+ mustBeLowerThan: (date) => `Must be earlier than ${date}`,
12
12
  mustBeBetween: (startDate, endDate) =>
13
13
  `Must be between ${startDate} - ${endDate}`,
14
14
  dateIsDisabled: 'Day is not allowed',
@@ -17,7 +17,14 @@ export type TranslationsType = {
17
17
  minute: string
18
18
  }
19
19
 
20
- let translationsPerLocale: Record<string, TranslationsType> = {}
20
+ export type TranslationResolver = (
21
+ locale: string | undefined
22
+ ) => TranslationsType
23
+
24
+ let translationsPerLocale: Record<
25
+ string,
26
+ TranslationsType | TranslationResolver
27
+ > = {}
21
28
 
22
29
  export function getTranslation<K extends keyof TranslationsType>(
23
30
  locale: string | undefined,
@@ -32,7 +39,10 @@ export function getTranslation<K extends keyof TranslationsType>(
32
39
  )
33
40
  return fallback || key
34
41
  }
35
- const translation = translationsPerLocale[l][key]
42
+ const translation: TranslationsType[K] =
43
+ typeof translationForLocale === 'function'
44
+ ? translationForLocale(locale)[key]
45
+ : translationForLocale[key]
36
46
  if (!translation) {
37
47
  console.warn(
38
48
  `[react-native-paper-dates] The locale ${locale} is registered, but ${key} is missing`
@@ -43,7 +53,7 @@ export function getTranslation<K extends keyof TranslationsType>(
43
53
 
44
54
  export function registerTranslation(
45
55
  locale: string,
46
- translations: TranslationsType
56
+ translations: TranslationsType | TranslationResolver
47
57
  ) {
48
58
  translationsPerLocale[locale] = translations
49
59
  }