typed-locales 1.0.13 → 1.0.15
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-utilities.d.ts","sourceRoot":"","sources":["../src/react-utilities.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAqB,MAAM,SAAS,CAAC;AAEtH,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;CACnC;AAGD,eAAO,MAAM,SAAS,GACrB,iBAAiB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,CAAC,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,EACxF,eAAe,OAAO,EACtB,iBAAiB,eAAe;
|
|
1
|
+
{"version":3,"file":"react-utilities.d.ts","sourceRoot":"","sources":["../src/react-utilities.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAqB,MAAM,SAAS,CAAC;AAEtH,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;CACnC;AAGD,eAAO,MAAM,SAAS,GACrB,iBAAiB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,CAAC,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,EACxF,eAAe,OAAO,EACtB,iBAAiB,eAAe;wCAIW;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;CA4DxE,CAAC"}
|
package/dist/react-utilities.js
CHANGED
|
@@ -4,9 +4,10 @@ import { getTranslate } from './index.js';
|
|
|
4
4
|
// Initial translation always should be loaded
|
|
5
5
|
export const initReact = (allTranslations, initialLocale, extraFormatters) => {
|
|
6
6
|
const TranslationContext = createContext(undefined);
|
|
7
|
+
const initialTranslate = getTranslate(allTranslations[initialLocale], initialLocale, extraFormatters);
|
|
7
8
|
const TranslationProvider = ({ children }) => {
|
|
8
9
|
const [locale, setLocale] = useState(initialLocale);
|
|
9
|
-
const [translate, setTranslate] = useState(
|
|
10
|
+
const [translate, setTranslate] = useState(initialTranslate);
|
|
10
11
|
const [isLoading, setIsLoading] = useState(true);
|
|
11
12
|
const loadTranslation = async (targetLocale) => {
|
|
12
13
|
try {
|
|
@@ -19,6 +20,8 @@ export const initReact = (allTranslations, initialLocale, extraFormatters) => {
|
|
|
19
20
|
else {
|
|
20
21
|
translationData = translationOrLoader;
|
|
21
22
|
}
|
|
23
|
+
console.log('setting translation to', translationData);
|
|
24
|
+
console.log('translate', getTranslate(translationData, targetLocale, extraFormatters));
|
|
22
25
|
setTranslate(getTranslate(translationData, targetLocale, extraFormatters));
|
|
23
26
|
}
|
|
24
27
|
catch (error) {
|