typed-locales 1.0.35 → 1.0.36

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/dist/react.d.ts CHANGED
@@ -3,7 +3,7 @@ import { getTranslate, type ExtraFormatters, type Locales, type TranslationType
3
3
  export interface TranslationContextType {
4
4
  isLoading: boolean;
5
5
  locale: Locales;
6
- setLocale: (locale: Locales) => void;
6
+ setLocale: (locale: Locales) => Promise<Locales>;
7
7
  t: ReturnType<typeof getTranslate>;
8
8
  }
9
9
  export declare const initReact: (initialTranslation: TranslationType, initialLocale: Locales, allTranslations: Record<Locales, TranslationType | (() => Promise<TranslationType>)>, extraFormatters: ExtraFormatters) => {
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpG,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,oBAAoB,eAAe,EACnC,eAAe,OAAO,EACtB,iBAAiB,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,CAAC,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,EACpF,iBAAiB,eAAe;wCAKW;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;CAgExE,CAAC"}
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpG,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;CACnC;AAGD,eAAO,MAAM,SAAS,GACrB,oBAAoB,eAAe,EACnC,eAAe,OAAO,EACtB,iBAAiB,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,CAAC,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,EACpF,iBAAiB,eAAe;wCAKW;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;CAsExE,CAAC"}
package/dist/react.js CHANGED
@@ -23,7 +23,7 @@ export const initReact = (initialTranslation, initialLocale, allTranslations, ex
23
23
  translationData = translationOrLoader;
24
24
  }
25
25
  setState({
26
- translate: getTranslate(translationData, targetLocale, extraFormatters, initialTranslate),
26
+ translate: getTranslate(translationData, targetLocale, extraFormatters, initialLocale === targetLocale ? undefined : initialTranslate),
27
27
  locale: targetLocale,
28
28
  isLoading: false,
29
29
  });
@@ -40,6 +40,7 @@ export const initReact = (initialTranslation, initialLocale, allTranslations, ex
40
40
  if (newLocale !== state.locale) {
41
41
  await loadTranslation(newLocale);
42
42
  }
43
+ return newLocale;
43
44
  },
44
45
  t: state.translate,
45
46
  }, children: children }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typed-locales",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "Type safe utilities for translating strings",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",