react-native-paper-dates 0.22.42 → 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.
- package/lib/commonjs/translations/utils.js +1 -1
- package/lib/commonjs/translations/utils.js.map +1 -1
- package/lib/module/translations/utils.js +1 -1
- package/lib/module/translations/utils.js.map +1 -1
- package/lib/typescript/translations/utils.d.ts +2 -1
- package/lib/typescript/translations/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/translations/utils.ts +13 -3
|
@@ -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 =
|
|
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":";;;;;;;
|
|
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":[]}
|
|
@@ -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 =
|
|
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":";;
|
|
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,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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.
|
|
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
|
|
35
|
+
"build-example": "cd example && npx expo export:web"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
38
38
|
"react-native",
|
|
@@ -17,7 +17,14 @@ export type TranslationsType = {
|
|
|
17
17
|
minute: string
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
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
|
|
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
|
}
|