typed-locales 1.0.59 → 1.0.60
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/adapters/react.d.ts.map +1 -1
- package/dist/adapters/react.js +3 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/adapters/react.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAEf,OAAO,EACN,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,OAAO,EAEZ,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;CACnC;AAMD,KAAK,gBAAgB,GAAG;KACtB,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,MAAM;CAC5B,GAAG;IACH,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,KAAK,iBAAiB,GAAG,gBAAgB,EAAE,CAAC;AA2B5C,eAAO,MAAM,SAAS,GACrB,qBAAqB,MAAM,EAC3B,iBAAiB,MAAM,CACtB,OAAO,EACP,MAAM,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAClC,EACD,iBAAiB,eAAe,EAChC,eAAe,OAAO,EACtB,oBAAoB,iBAAiB,oBAEM;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/adapters/react.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAEf,OAAO,EACN,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,OAAO,EAEZ,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;CACnC;AAMD,KAAK,gBAAgB,GAAG;KACtB,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,MAAM;CAC5B,GAAG;IACH,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,KAAK,iBAAiB,GAAG,gBAAgB,EAAE,CAAC;AA2B5C,eAAO,MAAM,SAAS,GACrB,qBAAqB,MAAM,EAC3B,iBAAiB,MAAM,CACtB,OAAO,EACP,MAAM,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAClC,EACD,iBAAiB,eAAe,EAChC,eAAe,OAAO,EACtB,oBAAoB,iBAAiB,oBAEM;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4CAiExE,CAAC;AAEF,eAAO,MAAM,cAAc,8BAM1B,CAAC"}
|
package/dist/adapters/react.js
CHANGED
|
@@ -30,6 +30,9 @@ export const initReact = (defaultTranslations, allTranslations, extraFormatters,
|
|
|
30
30
|
translate: defaultTranslate,
|
|
31
31
|
});
|
|
32
32
|
const setLocale = useCallback(async (targetLocale) => {
|
|
33
|
+
if (state.locale === targetLocale) {
|
|
34
|
+
return targetLocale;
|
|
35
|
+
}
|
|
33
36
|
try {
|
|
34
37
|
const translationOrLoader = allTranslations[targetLocale];
|
|
35
38
|
const translationData = await translationOrLoader().then(t => t.default);
|
package/dist/index.d.ts
CHANGED
|
@@ -83,9 +83,9 @@ export { initZustand } from './adapters/zustand.js';
|
|
|
83
83
|
export { type Formatter, default as defaultFormatters } from './formatters.js';
|
|
84
84
|
export { type ValidateTranslation, type EnsureValidTranslation, } from './validation.js';
|
|
85
85
|
/**
|
|
86
|
-
* @description Convert import.meta.glob to a record of locales and
|
|
86
|
+
* @description Convert import.meta.glob to a record of locales and the function to import the translations
|
|
87
87
|
* @param files - The files to convert
|
|
88
|
-
* @returns A record of locales and
|
|
88
|
+
* @returns A record of locales and the function to import the translations
|
|
89
89
|
* @example
|
|
90
90
|
* ```ts
|
|
91
91
|
* const translations = translationsFromImportMeta(import.meta.glob('../translations/*.ts'));
|
package/dist/index.js
CHANGED
|
@@ -86,9 +86,9 @@ export { initReact, useTranslation } from './adapters/react.js';
|
|
|
86
86
|
export { initZustand } from './adapters/zustand.js';
|
|
87
87
|
export { default as defaultFormatters } from './formatters.js';
|
|
88
88
|
/**
|
|
89
|
-
* @description Convert import.meta.glob to a record of locales and
|
|
89
|
+
* @description Convert import.meta.glob to a record of locales and the function to import the translations
|
|
90
90
|
* @param files - The files to convert
|
|
91
|
-
* @returns A record of locales and
|
|
91
|
+
* @returns A record of locales and the function to import the translations
|
|
92
92
|
* @example
|
|
93
93
|
* ```ts
|
|
94
94
|
* const translations = translationsFromImportMeta(import.meta.glob('../translations/*.ts'));
|