@intlayer/react-i18next 9.9.2 → 9.9.3-canary.0

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,6 +1,7 @@
1
+ import { getI18n } from "./globalI18n.mjs";
2
+ import { getInterpolationValues, resolveTranslation } from "@intlayer/i18next";
1
3
  import { getHTMLTextDir } from "@intlayer/core/localization";
2
4
  import { resolveMessageNodeToString } from "@intlayer/core/messageFormat";
3
- import { getInterpolationValues, resolveTranslation } from "@intlayer/i18next";
4
5
 
5
6
  // src/createTranslationApi.ts
6
7
  /**
@@ -12,14 +13,18 @@ import { getInterpolationValues, resolveTranslation } from "@intlayer/i18next";
12
13
  * namespace prefixes (`ns:key`), the `ns` option, plural suffixes
13
14
  * (`key_one`/`key_other` via `Intl.PluralRules`), context suffixes
14
15
  * (`key_male`), `$t()` nesting, `defaultValue` and `{{var}}` interpolation
15
- * are all supported.
16
+ * are all supported, as is the `fallbackNS` of the i18n instance registered
17
+ * through `initReactI18next`. Values are not HTML-escaped: React escapes
18
+ * rendered text already.
16
19
  */
17
20
  const createTranslationApi = ({ locale, setLocale, availableLocales, namespace, keyPrefix, dictionaryContent }) => {
21
+ const fallbackNamespaces = getI18n()?.options?.fallbackNS;
18
22
  const resolveSingleKey = (key, translateOptions) => resolveTranslation({
19
23
  locale,
20
24
  namespace,
21
25
  key: keyPrefix ? `${keyPrefix}.${key}` : key,
22
26
  options: translateOptions,
27
+ fallbackNamespaces,
23
28
  dictionaryContent
24
29
  });
25
30
  const translate = (key, optionsOrDefaultValue, extraOptions) => {
@@ -54,6 +59,7 @@ const createTranslationApi = ({ locale, setLocale, availableLocales, namespace,
54
59
  namespace,
55
60
  key,
56
61
  options: existsOptions,
62
+ fallbackNamespaces,
57
63
  dictionaryContent
58
64
  }) !== void 0,
59
65
  t: translate,
@@ -63,6 +69,7 @@ const createTranslationApi = ({ locale, setLocale, availableLocales, namespace,
63
69
  namespace: fixedNamespace ?? namespace,
64
70
  key,
65
71
  options: fixedOptions,
72
+ fallbackNamespaces,
66
73
  dictionaryContent: (language ?? locale) === locale && (fixedNamespace ?? namespace) === namespace ? dictionaryContent : void 0
67
74
  });
68
75
  return resolved !== void 0 ? resolved : key;
@@ -1 +1 @@
1
- {"version":3,"file":"createTranslationApi.mjs","names":[],"sources":["../../src/createTranslationApi.ts"],"sourcesContent":["import { getHTMLTextDir } from '@intlayer/core/localization';\nimport { resolveMessageNodeToString } from '@intlayer/core/messageFormat';\nimport {\n getInterpolationValues,\n resolveTranslation,\n type TypedTFunction,\n} from '@intlayer/i18next';\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type { TOptions } from 'i18next';\n\n/** Untyped runtime `t()` produced by {@link createTranslationApi}. */\nexport type TranslateFunction = (\n key: string | string[],\n optionsOrDefaultValue?: TOptions | string,\n extraOptions?: TOptions\n) => string;\n\n/**\n * The `i18n` facade with `t` and `getFixedT` typed against the dictionary the\n * hook is bound to: `t` is the hook's translate function type `TFn`, and\n * `getFixedT` returns a fully-typed `t()` for the requested namespace (or the\n * hook's own `t()` when no namespace is given).\n */\nexport type TypedI18nFacade<TFn = TranslateFunction> = Omit<\n I18nFacade,\n 't' | 'getFixedT'\n> & {\n t: TFn;\n getFixedT: {\n <N extends DictionaryKeys>(\n language: string | null | undefined,\n fixedNamespace: N\n ): TypedTFunction<N>;\n (language?: string | null, fixedNamespace?: null): TFn;\n };\n};\n\n/** Result shape of the typed translation hooks: `{ t, i18n, ready }`. */\nexport type TypedTranslationResult<TFn = TranslateFunction> = {\n t: TFn;\n i18n: TypedI18nFacade<TFn>;\n ready: true;\n};\n\n/** `i18n` facade shape produced by {@link createTranslationApi}. */\nexport type I18nFacade = {\n language: string;\n languages: string[];\n resolvedLanguage: string;\n isInitialized: boolean;\n changeLanguage: (newLanguage: string) => Promise<void>;\n dir: (language?: string) => 'ltr' | 'rtl';\n exists: (key: string, existsOptions?: TOptions) => boolean;\n t: TranslateFunction;\n getFixedT: (\n language?: string | null,\n fixedNamespace?: string | null\n ) => (key: string, fixedOptions?: TOptions) => string;\n};\n\nexport type CreateTranslationApiParams = {\n /** Active locale. */\n locale: LocalesValues;\n /** Locale setter backing `i18n.changeLanguage`. */\n setLocale: (newLocale: LocalesValues) => void;\n /** Configured locales backing `i18n.languages`. */\n availableLocales: LocalesValues[];\n /** Default namespace (dictionary key) for `t()` lookups. */\n namespace: string;\n /** Optional prefix prepended to every `t()` key. */\n keyPrefix?: string;\n /**\n * Pre-resolved dictionary content for `namespace` — supplied by the\n * build-optimized `useDictionary` / `useDictionaryDynamic` variants so\n * lookups skip the runtime registry.\n */\n dictionaryContent?: unknown;\n};\n\n/**\n * Builds the `{ t, i18n }` pair shared by `useTranslation` (runtime\n * registry lookup) and `useDictionary` / `useDictionaryDynamic`\n * (build-time-imported dictionary content).\n *\n * Translation lookup goes through the shared i18next-dialect resolver:\n * namespace prefixes (`ns:key`), the `ns` option, plural suffixes\n * (`key_one`/`key_other` via `Intl.PluralRules`), context suffixes\n * (`key_male`), `$t()` nesting, `defaultValue` and `{{var}}` interpolation\n * are all supported.\n */\nexport const createTranslationApi = ({\n locale,\n setLocale,\n availableLocales,\n namespace,\n keyPrefix,\n dictionaryContent,\n}: CreateTranslationApiParams): {\n translate: TranslateFunction;\n i18n: I18nFacade;\n} => {\n const resolveSingleKey = (\n key: string,\n translateOptions?: TOptions\n ): unknown =>\n resolveTranslation({\n locale,\n namespace,\n key: keyPrefix ? `${keyPrefix}.${key}` : key,\n options: translateOptions,\n dictionaryContent,\n });\n\n const translate: TranslateFunction = (\n key,\n optionsOrDefaultValue,\n extraOptions\n ) => {\n const translateOptions: TOptions =\n typeof optionsOrDefaultValue === 'string'\n ? { defaultValue: optionsOrDefaultValue, ...extraOptions }\n : (optionsOrDefaultValue ?? {});\n\n const keys = Array.isArray(key) ? key : [key];\n\n for (const candidateKey of keys) {\n const resolved = resolveSingleKey(candidateKey, translateOptions);\n if (resolved !== undefined) return resolved as string;\n }\n\n const defaultValue = translateOptions.defaultValue;\n if (typeof defaultValue === 'string') {\n return resolveMessageNodeToString(\n defaultValue,\n getInterpolationValues(translateOptions),\n locale\n );\n }\n\n return keys[keys.length - 1] as string;\n };\n\n const i18n: I18nFacade = {\n language: locale as string,\n languages: (availableLocales ?? []) as string[],\n resolvedLanguage: locale as string,\n isInitialized: true,\n changeLanguage: async (newLanguage: string) => {\n setLocale(newLanguage as LocalesValues);\n },\n dir: (language?: string): 'ltr' | 'rtl' => {\n const direction = getHTMLTextDir((language ?? locale) as LocalesValues);\n return direction === 'rtl' ? 'rtl' : 'ltr';\n },\n exists: (key: string, existsOptions?: TOptions): boolean =>\n resolveTranslation({\n locale,\n namespace,\n key,\n options: existsOptions,\n dictionaryContent,\n }) !== undefined,\n t: translate,\n getFixedT:\n (language?: string | null, fixedNamespace?: string | null) =>\n (key: string, fixedOptions?: TOptions): string => {\n const resolved = resolveTranslation({\n locale: (language ?? locale) as LocalesValues,\n namespace: fixedNamespace ?? namespace,\n key,\n options: fixedOptions,\n dictionaryContent:\n (language ?? locale) === locale &&\n (fixedNamespace ?? namespace) === namespace\n ? dictionaryContent\n : undefined,\n });\n return resolved !== undefined ? (resolved as string) : key;\n },\n };\n\n return { translate, i18n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA6FA,MAAa,wBAAwB,EACnC,QACA,WACA,kBACA,WACA,WACA,wBAIG;CACH,MAAM,oBACJ,KACA,qBAEA,mBAAmB;EACjB;EACA;EACA,KAAK,YAAY,GAAG,UAAU,GAAG,QAAQ;EACzC,SAAS;EACT;CACF,CAAC;CAEH,MAAM,aACJ,KACA,uBACA,iBACG;EACH,MAAM,mBACJ,OAAO,0BAA0B,WAC7B;GAAE,cAAc;GAAuB,GAAG;EAAa,IACtD,yBAAyB,CAAC;EAEjC,MAAM,OAAO,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;EAE5C,KAAK,MAAM,gBAAgB,MAAM;GAC/B,MAAM,WAAW,iBAAiB,cAAc,gBAAgB;GAChE,IAAI,aAAa,QAAW,OAAO;EACrC;EAEA,MAAM,eAAe,iBAAiB;EACtC,IAAI,OAAO,iBAAiB,UAC1B,OAAO,2BACL,cACA,uBAAuB,gBAAgB,GACvC,MACF;EAGF,OAAO,KAAK,KAAK,SAAS;CAC5B;CAyCA,OAAO;EAAE;EAAW;GAtClB,UAAU;GACV,WAAY,oBAAoB,CAAC;GACjC,kBAAkB;GAClB,eAAe;GACf,gBAAgB,OAAO,gBAAwB;IAC7C,UAAU,WAA4B;GACxC;GACA,MAAM,aAAqC;IAEzC,OADkB,eAAgB,YAAY,MAC/B,MAAM,QAAQ,QAAQ;GACvC;GACA,SAAS,KAAa,kBACpB,mBAAmB;IACjB;IACA;IACA;IACA,SAAS;IACT;GACF,CAAC,MAAM;GACT,GAAG;GACH,YACG,UAA0B,oBAC1B,KAAa,iBAAoC;IAChD,MAAM,WAAW,mBAAmB;KAClC,QAAS,YAAY;KACrB,WAAW,kBAAkB;KAC7B;KACA,SAAS;KACT,oBACG,YAAY,YAAY,WACxB,kBAAkB,eAAe,YAC9B,oBACA;IACR,CAAC;IACD,OAAO,aAAa,SAAa,WAAsB;GACzD;EAGmB;CAAE;AAC3B"}
1
+ {"version":3,"file":"createTranslationApi.mjs","names":[],"sources":["../../src/createTranslationApi.ts"],"sourcesContent":["import { getHTMLTextDir } from '@intlayer/core/localization';\nimport { resolveMessageNodeToString } from '@intlayer/core/messageFormat';\nimport {\n getInterpolationValues,\n resolveTranslation,\n type TypedTFunction,\n} from '@intlayer/i18next';\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type { TOptions } from 'i18next';\nimport { getI18n } from './globalI18n';\n\n/** Untyped runtime `t()` produced by {@link createTranslationApi}. */\nexport type TranslateFunction = (\n key: string | string[],\n optionsOrDefaultValue?: TOptions | string,\n extraOptions?: TOptions\n) => string;\n\n/**\n * The `i18n` facade with `t` and `getFixedT` typed against the dictionary the\n * hook is bound to: `t` is the hook's translate function type `TFn`, and\n * `getFixedT` returns a fully-typed `t()` for the requested namespace (or the\n * hook's own `t()` when no namespace is given).\n */\nexport type TypedI18nFacade<TFn = TranslateFunction> = Omit<\n I18nFacade,\n 't' | 'getFixedT'\n> & {\n t: TFn;\n getFixedT: {\n <N extends DictionaryKeys>(\n language: string | null | undefined,\n fixedNamespace: N\n ): TypedTFunction<N>;\n (language?: string | null, fixedNamespace?: null): TFn;\n };\n};\n\n/** Result shape of the typed translation hooks: `{ t, i18n, ready }`. */\nexport type TypedTranslationResult<TFn = TranslateFunction> = {\n t: TFn;\n i18n: TypedI18nFacade<TFn>;\n ready: true;\n};\n\n/** `i18n` facade shape produced by {@link createTranslationApi}. */\nexport type I18nFacade = {\n language: string;\n languages: string[];\n resolvedLanguage: string;\n isInitialized: boolean;\n changeLanguage: (newLanguage: string) => Promise<void>;\n dir: (language?: string) => 'ltr' | 'rtl';\n exists: (key: string, existsOptions?: TOptions) => boolean;\n t: TranslateFunction;\n getFixedT: (\n language?: string | null,\n fixedNamespace?: string | null\n ) => (key: string, fixedOptions?: TOptions) => string;\n};\n\nexport type CreateTranslationApiParams = {\n /** Active locale. */\n locale: LocalesValues;\n /** Locale setter backing `i18n.changeLanguage`. */\n setLocale: (newLocale: LocalesValues) => void;\n /** Configured locales backing `i18n.languages`. */\n availableLocales: LocalesValues[];\n /** Default namespace (dictionary key) for `t()` lookups. */\n namespace: string;\n /** Optional prefix prepended to every `t()` key. */\n keyPrefix?: string;\n /**\n * Pre-resolved dictionary content for `namespace` — supplied by the\n * build-optimized `useDictionary` / `useDictionaryDynamic` variants so\n * lookups skip the runtime registry.\n */\n dictionaryContent?: unknown;\n};\n\n/**\n * Builds the `{ t, i18n }` pair shared by `useTranslation` (runtime\n * registry lookup) and `useDictionary` / `useDictionaryDynamic`\n * (build-time-imported dictionary content).\n *\n * Translation lookup goes through the shared i18next-dialect resolver:\n * namespace prefixes (`ns:key`), the `ns` option, plural suffixes\n * (`key_one`/`key_other` via `Intl.PluralRules`), context suffixes\n * (`key_male`), `$t()` nesting, `defaultValue` and `{{var}}` interpolation\n * are all supported, as is the `fallbackNS` of the i18n instance registered\n * through `initReactI18next`. Values are not HTML-escaped: React escapes\n * rendered text already.\n */\nexport const createTranslationApi = ({\n locale,\n setLocale,\n availableLocales,\n namespace,\n keyPrefix,\n dictionaryContent,\n}: CreateTranslationApiParams): {\n translate: TranslateFunction;\n i18n: I18nFacade;\n} => {\n const fallbackNamespaces = getI18n()?.options?.fallbackNS;\n\n const resolveSingleKey = (\n key: string,\n translateOptions?: TOptions\n ): unknown =>\n resolveTranslation({\n locale,\n namespace,\n key: keyPrefix ? `${keyPrefix}.${key}` : key,\n options: translateOptions,\n fallbackNamespaces,\n dictionaryContent,\n });\n\n const translate: TranslateFunction = (\n key,\n optionsOrDefaultValue,\n extraOptions\n ) => {\n const translateOptions: TOptions =\n typeof optionsOrDefaultValue === 'string'\n ? { defaultValue: optionsOrDefaultValue, ...extraOptions }\n : (optionsOrDefaultValue ?? {});\n\n const keys = Array.isArray(key) ? key : [key];\n\n for (const candidateKey of keys) {\n const resolved = resolveSingleKey(candidateKey, translateOptions);\n if (resolved !== undefined) return resolved as string;\n }\n\n const defaultValue = translateOptions.defaultValue;\n if (typeof defaultValue === 'string') {\n return resolveMessageNodeToString(\n defaultValue,\n getInterpolationValues(translateOptions),\n locale\n );\n }\n\n return keys[keys.length - 1] as string;\n };\n\n const i18n: I18nFacade = {\n language: locale as string,\n languages: (availableLocales ?? []) as string[],\n resolvedLanguage: locale as string,\n isInitialized: true,\n changeLanguage: async (newLanguage: string) => {\n setLocale(newLanguage as LocalesValues);\n },\n dir: (language?: string): 'ltr' | 'rtl' => {\n const direction = getHTMLTextDir((language ?? locale) as LocalesValues);\n return direction === 'rtl' ? 'rtl' : 'ltr';\n },\n exists: (key: string, existsOptions?: TOptions): boolean =>\n resolveTranslation({\n locale,\n namespace,\n key,\n options: existsOptions,\n fallbackNamespaces,\n dictionaryContent,\n }) !== undefined,\n t: translate,\n getFixedT:\n (language?: string | null, fixedNamespace?: string | null) =>\n (key: string, fixedOptions?: TOptions): string => {\n const resolved = resolveTranslation({\n locale: (language ?? locale) as LocalesValues,\n namespace: fixedNamespace ?? namespace,\n key,\n options: fixedOptions,\n fallbackNamespaces,\n dictionaryContent:\n (language ?? locale) === locale &&\n (fixedNamespace ?? namespace) === namespace\n ? dictionaryContent\n : undefined,\n });\n return resolved !== undefined ? (resolved as string) : key;\n },\n };\n\n return { translate, i18n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgGA,MAAa,wBAAwB,EACnC,QACA,WACA,kBACA,WACA,WACA,wBAIG;CACH,MAAM,qBAAqB,QAAQ,CAAC,EAAE,SAAS;CAE/C,MAAM,oBACJ,KACA,qBAEA,mBAAmB;EACjB;EACA;EACA,KAAK,YAAY,GAAG,UAAU,GAAG,QAAQ;EACzC,SAAS;EACT;EACA;CACF,CAAC;CAEH,MAAM,aACJ,KACA,uBACA,iBACG;EACH,MAAM,mBACJ,OAAO,0BAA0B,WAC7B;GAAE,cAAc;GAAuB,GAAG;EAAa,IACtD,yBAAyB,CAAC;EAEjC,MAAM,OAAO,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;EAE5C,KAAK,MAAM,gBAAgB,MAAM;GAC/B,MAAM,WAAW,iBAAiB,cAAc,gBAAgB;GAChE,IAAI,aAAa,QAAW,OAAO;EACrC;EAEA,MAAM,eAAe,iBAAiB;EACtC,IAAI,OAAO,iBAAiB,UAC1B,OAAO,2BACL,cACA,uBAAuB,gBAAgB,GACvC,MACF;EAGF,OAAO,KAAK,KAAK,SAAS;CAC5B;CA2CA,OAAO;EAAE;EAAW;GAxClB,UAAU;GACV,WAAY,oBAAoB,CAAC;GACjC,kBAAkB;GAClB,eAAe;GACf,gBAAgB,OAAO,gBAAwB;IAC7C,UAAU,WAA4B;GACxC;GACA,MAAM,aAAqC;IAEzC,OADkB,eAAgB,YAAY,MAC/B,MAAM,QAAQ,QAAQ;GACvC;GACA,SAAS,KAAa,kBACpB,mBAAmB;IACjB;IACA;IACA;IACA,SAAS;IACT;IACA;GACF,CAAC,MAAM;GACT,GAAG;GACH,YACG,UAA0B,oBAC1B,KAAa,iBAAoC;IAChD,MAAM,WAAW,mBAAmB;KAClC,QAAS,YAAY;KACrB,WAAW,kBAAkB;KAC7B;KACA,SAAS;KACT;KACA,oBACG,YAAY,YAAY,WACxB,kBAAkB,eAAe,YAC9B,oBACA;IACR,CAAC;IACD,OAAO,aAAa,SAAa,WAAsB;GACzD;EAGmB;CAAE;AAC3B"}
@@ -0,0 +1,17 @@
1
+ // src/globalI18n.ts
2
+ /**
3
+ * The i18n instance registered through `initReactI18next` / `setI18n`.
4
+ *
5
+ * Kept apart from `helpers.tsx` so the translation API can read its options
6
+ * (e.g. `fallbackNS`) without an import cycle through `useTranslation`.
7
+ */
8
+ let globalI18n = null;
9
+ /** Registers the i18n instance, as react-i18next's `setI18n` does. */
10
+ const setI18n = (instance) => {
11
+ globalI18n = instance;
12
+ };
13
+ /** Returns the registered i18n instance (`null` before registration). */
14
+ const getI18n = () => globalI18n;
15
+
16
+ export { getI18n, setI18n };
17
+ //# sourceMappingURL=globalI18n.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalI18n.mjs","names":[],"sources":["../../src/globalI18n.ts"],"sourcesContent":["import type { i18n } from 'i18next';\n\n/**\n * The i18n instance registered through `initReactI18next` / `setI18n`.\n *\n * Kept apart from `helpers.tsx` so the translation API can read its options\n * (e.g. `fallbackNS`) without an import cycle through `useTranslation`.\n */\nlet globalI18n: i18n | null = null;\n\n/** Registers the i18n instance, as react-i18next's `setI18n` does. */\nexport const setI18n = (instance: i18n): void => {\n globalI18n = instance;\n};\n\n/** Returns the registered i18n instance (`null` before registration). */\nexport const getI18n = (): i18n => globalI18n as i18n;\n"],"mappings":";;;;;;;AAQA,IAAI,aAA0B;;AAG9B,MAAa,WAAW,aAAyB;CAC/C,aAAa;AACf;;AAGA,MAAa,gBAAsB"}
@@ -19,14 +19,7 @@ const nodesToString = (children, _i18nOptions, _i18n, _i18nKey) => {
19
19
  if (childElement.props?.children) return nodesToString(childElement.props.children);
20
20
  return "";
21
21
  };
22
- let globalI18n = null;
23
22
  let globalDefaults = {};
24
- const setI18n = (instance) => {
25
- globalI18n = instance;
26
- };
27
- const getI18n = () => {
28
- return globalI18n;
29
- };
30
23
  const setDefaults = (options) => {
31
24
  globalDefaults = options;
32
25
  };
@@ -49,5 +42,5 @@ const getInitialProps = () => ({
49
42
  initialLanguage: "en"
50
43
  });
51
44
 
52
- export { I18nContext, Translation, composeInitialProps, getDefaults, getI18n, getInitialProps, nodesToString, setDefaults, setI18n, useSSR, withSSR };
45
+ export { I18nContext, Translation, composeInitialProps, getDefaults, getInitialProps, nodesToString, setDefaults, useSSR, withSSR };
53
46
  //# sourceMappingURL=helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/helpers.tsx"],"sourcesContent":["import type { i18n, TFunction } from 'i18next';\nimport * as React from 'react';\nimport { useTranslationLoose } from './useTranslation';\n\n// Context\nexport const I18nContext = React.createContext<{ i18n: i18n }>({\n i18n: null as unknown as i18n,\n});\n\nexport interface TranslationProps {\n children: (\n t: TFunction,\n options: { i18n: i18n; lng: string },\n ready: boolean\n ) => React.ReactNode;\n ns?: string | string[];\n keyPrefix?: string;\n}\n\n// Translation Render-Prop Component\nexport const Translation = ({\n children,\n ns,\n keyPrefix,\n}: TranslationProps): React.ReactElement => {\n const { t, i18n } = useTranslationLoose(ns, { keyPrefix });\n return children(\n t as unknown as TFunction,\n { i18n: i18n as unknown as i18n, lng: i18n.language },\n true\n ) as React.ReactElement;\n};\n\n// nodesToString implementation\nexport const nodesToString = (\n children: React.ReactNode,\n _i18nOptions?: unknown,\n _i18n?: unknown,\n _i18nKey?: string\n): string => {\n if (typeof children === 'string' || typeof children === 'number') {\n return String(children);\n }\n if (!children) return '';\n if (Array.isArray(children)) {\n return children.map((c) => nodesToString(c)).join('');\n }\n const childElement = children as React.ReactElement<{\n children?: React.ReactNode;\n }>;\n\n if (childElement.props?.children) {\n return nodesToString(childElement.props.children);\n }\n\n return '';\n};\n\n// Global Instance Getters/Setters\nlet globalI18n: i18n | null = null;\nlet globalDefaults: unknown = {};\n\nexport const setI18n = (instance: i18n): void => {\n globalI18n = instance;\n};\n\nexport const getI18n = (): i18n => {\n return globalI18n as i18n;\n};\n\nexport const setDefaults = (options: unknown): void => {\n globalDefaults = options;\n};\n\nexport const getDefaults = (): unknown => {\n return globalDefaults;\n};\n\n// SSR Stubs\nexport const useSSR = (\n _initialI18nStore: unknown,\n _initialLanguage: string\n): void => {};\n\nexport const withSSR = () => {\n const Hoc = <P extends object>(\n WrappedComponent: React.ComponentType<P>\n ): React.ComponentType<P> => {\n const Component = (props: P) => <WrappedComponent {...props} />;\n const ExtendedComponent = Component as typeof Component & {\n getInitialProps: (ctx: unknown) => Promise<Record<string, unknown>>;\n };\n ExtendedComponent.getInitialProps = async (_ctx: unknown) => ({});\n return ExtendedComponent;\n };\n return Hoc;\n};\n\nexport const composeInitialProps =\n (_ForComponent: unknown) => async (_ctx: unknown) => ({});\n\nexport const getInitialProps = () => ({\n initialI18nStore: {},\n initialLanguage: 'en',\n});\n"],"mappings":";;;;;AAKA,MAAa,cAAc,MAAM,cAA8B,EAC7D,MAAM,KACR,CAAC;AAaD,MAAa,eAAe,EAC1B,UACA,IACA,gBAC0C;CAC1C,MAAM,EAAE,GAAG,SAAS,oBAAoB,IAAI,EAAE,UAAU,CAAC;CACzD,OAAO,SACL,GACA;EAAQ;EAAyB,KAAK,KAAK;CAAS,GACpD,IACF;AACF;AAGA,MAAa,iBACX,UACA,cACA,OACA,aACW;CACX,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,QAAQ;CAExB,IAAI,CAAC,UAAU,OAAO;CACtB,IAAI,MAAM,QAAQ,QAAQ,GACxB,OAAO,SAAS,KAAK,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE;CAEtD,MAAM,eAAe;CAIrB,IAAI,aAAa,OAAO,UACtB,OAAO,cAAc,aAAa,MAAM,QAAQ;CAGlD,OAAO;AACT;AAGA,IAAI,aAA0B;AAC9B,IAAI,iBAA0B,CAAC;AAE/B,MAAa,WAAW,aAAyB;CAC/C,aAAa;AACf;AAEA,MAAa,gBAAsB;CACjC,OAAO;AACT;AAEA,MAAa,eAAe,YAA2B;CACrD,iBAAiB;AACnB;AAEA,MAAa,oBAA6B;CACxC,OAAO;AACT;AAGA,MAAa,UACX,mBACA,qBACS,CAAC;AAEZ,MAAa,gBAAgB;CAC3B,MAAM,OACJ,qBAC2B;EAC3B,MAAM,aAAa,UAAa,oBAAC,kBAAD,EAAkB,GAAI,MAAQ;EAC9D,MAAM,oBAAoB;EAG1B,kBAAkB,kBAAkB,OAAO,UAAmB,CAAC;EAC/D,OAAO;CACT;CACA,OAAO;AACT;AAEA,MAAa,uBACV,kBAA2B,OAAO,UAAmB,CAAC;AAEzD,MAAa,yBAAyB;CACpC,kBAAkB,CAAC;CACnB,iBAAiB;AACnB"}
1
+ {"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/helpers.tsx"],"sourcesContent":["import type { i18n, TFunction } from 'i18next';\nimport * as React from 'react';\nimport { useTranslationLoose } from './useTranslation';\n\n// Context\nexport const I18nContext = React.createContext<{ i18n: i18n }>({\n i18n: null as unknown as i18n,\n});\n\nexport interface TranslationProps {\n children: (\n t: TFunction,\n options: { i18n: i18n; lng: string },\n ready: boolean\n ) => React.ReactNode;\n ns?: string | string[];\n keyPrefix?: string;\n}\n\n// Translation Render-Prop Component\nexport const Translation = ({\n children,\n ns,\n keyPrefix,\n}: TranslationProps): React.ReactElement => {\n const { t, i18n } = useTranslationLoose(ns, { keyPrefix });\n return children(\n t as unknown as TFunction,\n { i18n: i18n as unknown as i18n, lng: i18n.language },\n true\n ) as React.ReactElement;\n};\n\n// nodesToString implementation\nexport const nodesToString = (\n children: React.ReactNode,\n _i18nOptions?: unknown,\n _i18n?: unknown,\n _i18nKey?: string\n): string => {\n if (typeof children === 'string' || typeof children === 'number') {\n return String(children);\n }\n if (!children) return '';\n if (Array.isArray(children)) {\n return children.map((c) => nodesToString(c)).join('');\n }\n const childElement = children as React.ReactElement<{\n children?: React.ReactNode;\n }>;\n\n if (childElement.props?.children) {\n return nodesToString(childElement.props.children);\n }\n\n return '';\n};\n\n// Global Instance Getters/Setters\nlet globalDefaults: unknown = {};\n\nexport const setDefaults = (options: unknown): void => {\n globalDefaults = options;\n};\n\nexport const getDefaults = (): unknown => {\n return globalDefaults;\n};\n\n// SSR Stubs\nexport const useSSR = (\n _initialI18nStore: unknown,\n _initialLanguage: string\n): void => {};\n\nexport const withSSR = () => {\n const Hoc = <P extends object>(\n WrappedComponent: React.ComponentType<P>\n ): React.ComponentType<P> => {\n const Component = (props: P) => <WrappedComponent {...props} />;\n const ExtendedComponent = Component as typeof Component & {\n getInitialProps: (ctx: unknown) => Promise<Record<string, unknown>>;\n };\n ExtendedComponent.getInitialProps = async (_ctx: unknown) => ({});\n return ExtendedComponent;\n };\n return Hoc;\n};\n\nexport const composeInitialProps =\n (_ForComponent: unknown) => async (_ctx: unknown) => ({});\n\nexport const getInitialProps = () => ({\n initialI18nStore: {},\n initialLanguage: 'en',\n});\n"],"mappings":";;;;;AAKA,MAAa,cAAc,MAAM,cAA8B,EAC7D,MAAM,KACR,CAAC;AAaD,MAAa,eAAe,EAC1B,UACA,IACA,gBAC0C;CAC1C,MAAM,EAAE,GAAG,SAAS,oBAAoB,IAAI,EAAE,UAAU,CAAC;CACzD,OAAO,SACL,GACA;EAAQ;EAAyB,KAAK,KAAK;CAAS,GACpD,IACF;AACF;AAGA,MAAa,iBACX,UACA,cACA,OACA,aACW;CACX,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,QAAQ;CAExB,IAAI,CAAC,UAAU,OAAO;CACtB,IAAI,MAAM,QAAQ,QAAQ,GACxB,OAAO,SAAS,KAAK,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE;CAEtD,MAAM,eAAe;CAIrB,IAAI,aAAa,OAAO,UACtB,OAAO,cAAc,aAAa,MAAM,QAAQ;CAGlD,OAAO;AACT;AAGA,IAAI,iBAA0B,CAAC;AAE/B,MAAa,eAAe,YAA2B;CACrD,iBAAiB;AACnB;AAEA,MAAa,oBAA6B;CACxC,OAAO;AACT;AAGA,MAAa,UACX,mBACA,qBACS,CAAC;AAEZ,MAAa,gBAAgB;CAC3B,MAAM,OACJ,qBAC2B;EAC3B,MAAM,aAAa,UAAa,oBAAC,kBAAD,EAAkB,GAAI,MAAQ;EAC9D,MAAM,oBAAoB;EAG1B,kBAAkB,kBAAkB,OAAO,UAAmB,CAAC;EAC/D,OAAO;CACT;CACA,OAAO;AACT;AAEA,MAAa,uBACV,kBAA2B,OAAO,UAAmB,CAAC;AAEzD,MAAa,yBAAyB;CACpC,kBAAkB,CAAC;CACnB,iBAAiB;AACnB"}
@@ -1,4 +1,5 @@
1
- import { I18nContext as I18nContext$1, Translation as Translation$1, composeInitialProps as composeInitialProps$1, getDefaults as getDefaults$1, getI18n as getI18n$1, getInitialProps as getInitialProps$1, nodesToString as nodesToString$1, setDefaults as setDefaults$1, setI18n as setI18n$1, useSSR as useSSR$1, withSSR as withSSR$1 } from "./helpers.mjs";
1
+ import { getI18n as getI18n$1, setI18n as setI18n$1 } from "./globalI18n.mjs";
2
+ import { I18nContext as I18nContext$1, Translation as Translation$1, composeInitialProps as composeInitialProps$1, getDefaults as getDefaults$1, getInitialProps as getInitialProps$1, nodesToString as nodesToString$1, setDefaults as setDefaults$1, useSSR as useSSR$1, withSSR as withSSR$1 } from "./helpers.mjs";
2
3
  import { Trans } from "./Trans.mjs";
3
4
  import { I18nextProvider } from "./I18nextProvider.mjs";
4
5
  import { initReactI18next } from "./initReactI18next.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["nodesToStringImpl","setDefaultsImpl","getDefaultsImpl","setI18nImpl","getI18nImpl","composeInitialPropsImpl","getInitialPropsImpl","useSSRImpl","withSSRImpl","TranslationImpl","I18nContextImpl"],"sources":["../../src/index.ts"],"sourcesContent":["import type {\n composeInitialProps as _composeInitialProps,\n getDefaults as _getDefaults,\n getI18n as _getI18n,\n getInitialProps as _getInitialProps,\n I18nContext as _I18nContext,\n setDefaults as _setDefaults,\n setI18n as _setI18n,\n Trans as _Trans,\n Translation as _Translation,\n TransWithoutContext as _TransWithoutContext,\n useSSR as _useSSR,\n withSSR as _withSSR,\n} from 'react-i18next';\nimport {\n composeInitialProps as composeInitialPropsImpl,\n getDefaults as getDefaultsImpl,\n getI18n as getI18nImpl,\n getInitialProps as getInitialPropsImpl,\n I18nContext as I18nContextImpl,\n nodesToString as nodesToStringImpl,\n setDefaults as setDefaultsImpl,\n setI18n as setI18nImpl,\n Translation as TranslationImpl,\n useSSR as useSSRImpl,\n withSSR as withSSRImpl,\n} from './helpers';\nimport { Trans } from './Trans';\n\n// Re-export common types from react-i18next so consumers don't need both packages\nexport type {\n I18nextProviderProps,\n TransProps,\n UseTranslationOptions,\n UseTranslationResponse,\n WithTranslation,\n WithTranslationProps,\n} from 'react-i18next';\nexport { I18nextProvider } from './I18nextProvider';\nexport { initReactI18next } from './initReactI18next';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useTranslation } from './useTranslation';\nexport { withTranslation } from './withTranslation';\nexport { Trans };\n\n// Wrap and export all implementation functions.\n// `nodesToString` is not part of react-i18next's public type surface in all\n// supported versions, so the local implementation's inferred type is exposed.\nexport const nodesToString = nodesToStringImpl;\nexport const setDefaults = setDefaultsImpl as typeof _setDefaults;\nexport const getDefaults = getDefaultsImpl as typeof _getDefaults;\nexport const setI18n = setI18nImpl as typeof _setI18n;\nexport const getI18n = getI18nImpl as typeof _getI18n;\nexport const composeInitialProps =\n composeInitialPropsImpl as typeof _composeInitialProps;\nexport const getInitialProps = getInitialPropsImpl as typeof _getInitialProps;\nexport const useSSR = useSSRImpl as typeof _useSSR;\nexport const withSSR = withSSRImpl as typeof _withSSR;\nexport const Translation = TranslationImpl as typeof _Translation;\nexport const I18nContext = I18nContextImpl as typeof _I18nContext;\n\nexport const TransWithoutContext = Trans as typeof _TransWithoutContext;\n// `IcuTrans` / `IcuTransWithoutContext` are aliases for the standard `Trans`\n// component (they only differ by interpolation engine, which the compat shim\n// does not distinguish). They are typed against `Trans` for broad version\n// compatibility, since the dedicated ICU exports are not present in every\n// supported react-i18next release.\nexport const IcuTrans = Trans as typeof _Trans;\nexport const IcuTransWithoutContext = Trans as typeof _Trans;\n"],"mappings":";;;;;;;;;;AAiDA,MAAa,gBAAgBA;AAC7B,MAAa,cAAcC;AAC3B,MAAa,cAAcC;AAC3B,MAAa,UAAUC;AACvB,MAAa,UAAUC;AACvB,MAAa,sBACXC;AACF,MAAa,kBAAkBC;AAC/B,MAAa,SAASC;AACtB,MAAa,UAAUC;AACvB,MAAa,cAAcC;AAC3B,MAAa,cAAcC;AAE3B,MAAa,sBAAsB;AAMnC,MAAa,WAAW;AACxB,MAAa,yBAAyB"}
1
+ {"version":3,"file":"index.mjs","names":["nodesToStringImpl","setDefaultsImpl","getDefaultsImpl","setI18nImpl","getI18nImpl","composeInitialPropsImpl","getInitialPropsImpl","useSSRImpl","withSSRImpl","TranslationImpl","I18nContextImpl"],"sources":["../../src/index.ts"],"sourcesContent":["import type {\n composeInitialProps as _composeInitialProps,\n getDefaults as _getDefaults,\n getI18n as _getI18n,\n getInitialProps as _getInitialProps,\n I18nContext as _I18nContext,\n setDefaults as _setDefaults,\n setI18n as _setI18n,\n Trans as _Trans,\n Translation as _Translation,\n TransWithoutContext as _TransWithoutContext,\n useSSR as _useSSR,\n withSSR as _withSSR,\n} from 'react-i18next';\nimport { getI18n as getI18nImpl, setI18n as setI18nImpl } from './globalI18n';\nimport {\n composeInitialProps as composeInitialPropsImpl,\n getDefaults as getDefaultsImpl,\n getInitialProps as getInitialPropsImpl,\n I18nContext as I18nContextImpl,\n nodesToString as nodesToStringImpl,\n setDefaults as setDefaultsImpl,\n Translation as TranslationImpl,\n useSSR as useSSRImpl,\n withSSR as withSSRImpl,\n} from './helpers';\nimport { Trans } from './Trans';\n\n// Re-export common types from react-i18next so consumers don't need both packages\nexport type {\n I18nextProviderProps,\n TransProps,\n UseTranslationOptions,\n UseTranslationResponse,\n WithTranslation,\n WithTranslationProps,\n} from 'react-i18next';\nexport { I18nextProvider } from './I18nextProvider';\nexport { initReactI18next } from './initReactI18next';\nexport { useDictionary } from './useDictionary';\nexport { useDictionaryDynamic } from './useDictionaryDynamic';\nexport { useTranslation } from './useTranslation';\nexport { withTranslation } from './withTranslation';\nexport { Trans };\n\n// Wrap and export all implementation functions.\n// `nodesToString` is not part of react-i18next's public type surface in all\n// supported versions, so the local implementation's inferred type is exposed.\nexport const nodesToString = nodesToStringImpl;\nexport const setDefaults = setDefaultsImpl as typeof _setDefaults;\nexport const getDefaults = getDefaultsImpl as typeof _getDefaults;\nexport const setI18n = setI18nImpl as typeof _setI18n;\nexport const getI18n = getI18nImpl as typeof _getI18n;\nexport const composeInitialProps =\n composeInitialPropsImpl as typeof _composeInitialProps;\nexport const getInitialProps = getInitialPropsImpl as typeof _getInitialProps;\nexport const useSSR = useSSRImpl as typeof _useSSR;\nexport const withSSR = withSSRImpl as typeof _withSSR;\nexport const Translation = TranslationImpl as typeof _Translation;\nexport const I18nContext = I18nContextImpl as typeof _I18nContext;\n\nexport const TransWithoutContext = Trans as typeof _TransWithoutContext;\n// `IcuTrans` / `IcuTransWithoutContext` are aliases for the standard `Trans`\n// component (they only differ by interpolation engine, which the compat shim\n// does not distinguish). They are typed against `Trans` for broad version\n// compatibility, since the dedicated ICU exports are not present in every\n// supported react-i18next release.\nexport const IcuTrans = Trans as typeof _Trans;\nexport const IcuTransWithoutContext = Trans as typeof _Trans;\n"],"mappings":";;;;;;;;;;;AAgDA,MAAa,gBAAgBA;AAC7B,MAAa,cAAcC;AAC3B,MAAa,cAAcC;AAC3B,MAAa,UAAUC;AACvB,MAAa,UAAUC;AACvB,MAAa,sBACXC;AACF,MAAa,kBAAkBC;AAC/B,MAAa,SAASC;AACtB,MAAa,UAAUC;AACvB,MAAa,cAAcC;AAC3B,MAAa,cAAcC;AAE3B,MAAa,sBAAsB;AAMnC,MAAa,WAAW;AACxB,MAAa,yBAAyB"}
@@ -1,4 +1,5 @@
1
- import { setDefaults, setI18n } from "./helpers.mjs";
1
+ import { setI18n } from "./globalI18n.mjs";
2
+ import { setDefaults } from "./helpers.mjs";
2
3
 
3
4
  // src/initReactI18next.ts
4
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"initReactI18next.mjs","names":[],"sources":["../../src/initReactI18next.ts"],"sourcesContent":["import type { initReactI18next as _initReactI18next } from 'react-i18next';\nimport { setDefaults, setI18n } from './helpers';\n\n/**\n * Drop-in for react-i18next's `initReactI18next` plugin.\n *\n * Implemented locally rather than re-exported from `react-i18next`: when the\n * compat alias plugin is enabled, `react-i18next` resolves back to this package,\n * so a re-export would be self-referential (resolving to `undefined`). The\n * plugin records the i18n instance via the compat `setI18n`/`setDefaults`\n * helpers; actual translation is served by Intlayer.\n */\nexport const initReactI18next: typeof _initReactI18next = {\n type: '3rdParty' as const,\n init: (instance) => {\n setI18n(instance as never);\n setDefaults({});\n },\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,mBAA6C;CACxD,MAAM;CACN,OAAO,aAAa;EAClB,QAAQ,QAAiB;EACzB,YAAY,CAAC,CAAC;CAChB;AACF"}
1
+ {"version":3,"file":"initReactI18next.mjs","names":[],"sources":["../../src/initReactI18next.ts"],"sourcesContent":["import type { initReactI18next as _initReactI18next } from 'react-i18next';\nimport { setI18n } from './globalI18n';\nimport { setDefaults } from './helpers';\n\n/**\n * Drop-in for react-i18next's `initReactI18next` plugin.\n *\n * Implemented locally rather than re-exported from `react-i18next`: when the\n * compat alias plugin is enabled, `react-i18next` resolves back to this package,\n * so a re-export would be self-referential (resolving to `undefined`). The\n * plugin records the i18n instance via the compat `setI18n`/`setDefaults`\n * helpers; actual translation is served by Intlayer.\n */\nexport const initReactI18next: typeof _initReactI18next = {\n type: '3rdParty' as const,\n init: (instance) => {\n setI18n(instance as never);\n setDefaults({});\n },\n};\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,mBAA6C;CACxD,MAAM;CACN,OAAO,aAAa;EAClB,QAAQ,QAAiB;EACzB,YAAY,CAAC,CAAC;CAChB;AACF"}
@@ -1,7 +1,7 @@
1
1
  import * as ANSIColors from "@intlayer/config/colors";
2
2
  import { colorize, getAppLogger } from "@intlayer/config/logger";
3
3
  import { join } from "node:path";
4
- import { REACT_I18NEXT_CALLERS } from "@intlayer/config/callers";
4
+ import { I18NEXT_CALLERS, REACT_I18NEXT_CALLERS } from "@intlayer/config/callers";
5
5
  import { getConfiguration } from "@intlayer/config/node";
6
6
  import { runOnce } from "@intlayer/engine/utils";
7
7
  import { intlayer } from "vite-intlayer";
@@ -19,7 +19,11 @@ const reactI18nextVitePlugin = (options) => {
19
19
  }, { cacheTimeoutMs: 36e5 });
20
20
  const basePlugins = intlayer({
21
21
  ...options,
22
- compatCallers: [...options?.compatCallers ?? [], ...REACT_I18NEXT_CALLERS]
22
+ compatCallers: [
23
+ ...options?.compatCallers ?? [],
24
+ ...REACT_I18NEXT_CALLERS,
25
+ ...I18NEXT_CALLERS
26
+ ]
23
27
  });
24
28
  const compatPlugin = {
25
29
  name: "vite-react-i18next-compat-plugin",
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugin/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { REACT_I18NEXT_CALLERS } from '@intlayer/config/callers';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { runOnce } from '@intlayer/engine/utils';\nimport type { PluginOption } from 'vite';\nimport { intlayer } from 'vite-intlayer';\n\n/**\n * A Vite plugin for react-i18next compat that wraps vite-intlayer\n * and configures resolve aliases for react-i18next and i18next.\n */\nexport const reactI18nextVitePlugin = (\n options?: Parameters<typeof intlayer>[0]\n): PluginOption[] => {\n const intlayerConfig = getConfiguration();\n const appLogger = getAppLogger(intlayerConfig);\n\n runOnce(\n join(\n intlayerConfig.system.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-issues-invitation.lock'\n ),\n () => {\n appLogger([\n colorize(\n 'Please report any issues you met on GitHub:',\n ANSIColors.GREY\n ),\n colorize(\n 'https://github.com/aymericzip/intlayer/issues',\n ANSIColors.GREY_LIGHT\n ),\n ]);\n },\n {\n cacheTimeoutMs: 1000 * 60 * 60, // 1 hour\n }\n );\n\n const basePlugins = intlayer({\n ...options,\n compatCallers: [\n ...(options?.compatCallers ?? []),\n ...REACT_I18NEXT_CALLERS,\n ],\n });\n\n const compatPlugin: PluginOption = {\n name: 'vite-react-i18next-compat-plugin',\n config: () => {\n return {\n resolve: {\n alias: {\n 'react-i18next': '@intlayer/react-i18next',\n i18next: '@intlayer/i18next',\n },\n },\n };\n },\n };\n\n return [\n ...(Array.isArray(basePlugins) ? basePlugins : [basePlugins]),\n compatPlugin,\n ];\n};\n\nexport default reactI18nextVitePlugin;\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,0BACX,YACmB;CACnB,MAAM,iBAAiB,iBAAiB;CACxC,MAAM,YAAY,aAAa,cAAc;CAE7C,QACE,KACE,eAAe,OAAO,SACtB,aACA,SACA,iCACF,SACM;EACJ,UAAU,CACR,SACE,+CACA,WAAW,IACb,GACA,SACE,iDACA,WAAW,UACb,CACF,CAAC;CACH,GACA,EACE,gBAAgB,KAClB,CACF;CAEA,MAAM,cAAc,SAAS;EAC3B,GAAG;EACH,eAAe,CACb,GAAI,SAAS,iBAAiB,CAAC,GAC/B,GAAG,qBACL;CACF,CAAC;CAED,MAAM,eAA6B;EACjC,MAAM;EACN,cAAc;GACZ,OAAO,EACL,SAAS,EACP,OAAO;IACL,iBAAiB;IACjB,SAAS;GACX,EACF,EACF;EACF;CACF;CAEA,OAAO,CACL,GAAI,MAAM,QAAQ,WAAW,IAAI,cAAc,CAAC,WAAW,GAC3D,YACF;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugin/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport {\n I18NEXT_CALLERS,\n REACT_I18NEXT_CALLERS,\n} from '@intlayer/config/callers';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { runOnce } from '@intlayer/engine/utils';\nimport type { PluginOption } from 'vite';\nimport { intlayer } from 'vite-intlayer';\n\n/**\n * A Vite plugin for react-i18next compat that wraps vite-intlayer\n * and configures resolve aliases for react-i18next and i18next.\n */\nexport const reactI18nextVitePlugin = (\n options?: Parameters<typeof intlayer>[0]\n): PluginOption[] => {\n const intlayerConfig = getConfiguration();\n const appLogger = getAppLogger(intlayerConfig);\n\n runOnce(\n join(\n intlayerConfig.system.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-issues-invitation.lock'\n ),\n () => {\n appLogger([\n colorize(\n 'Please report any issues you met on GitHub:',\n ANSIColors.GREY\n ),\n colorize(\n 'https://github.com/aymericzip/intlayer/issues',\n ANSIColors.GREY_LIGHT\n ),\n ]);\n },\n {\n cacheTimeoutMs: 1000 * 60 * 60, // 1 hour\n }\n );\n\n const basePlugins = intlayer({\n ...options,\n // `i18next` is aliased too, so its callers (`i18n.getFixedT`) are analysed\n compatCallers: [\n ...(options?.compatCallers ?? []),\n ...REACT_I18NEXT_CALLERS,\n ...I18NEXT_CALLERS,\n ],\n });\n\n const compatPlugin: PluginOption = {\n name: 'vite-react-i18next-compat-plugin',\n config: () => {\n return {\n resolve: {\n alias: {\n 'react-i18next': '@intlayer/react-i18next',\n i18next: '@intlayer/i18next',\n },\n },\n };\n },\n };\n\n return [\n ...(Array.isArray(basePlugins) ? basePlugins : [basePlugins]),\n compatPlugin,\n ];\n};\n\nexport default reactI18nextVitePlugin;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAa,0BACX,YACmB;CACnB,MAAM,iBAAiB,iBAAiB;CACxC,MAAM,YAAY,aAAa,cAAc;CAE7C,QACE,KACE,eAAe,OAAO,SACtB,aACA,SACA,iCACF,SACM;EACJ,UAAU,CACR,SACE,+CACA,WAAW,IACb,GACA,SACE,iDACA,WAAW,UACb,CACF,CAAC;CACH,GACA,EACE,gBAAgB,KAClB,CACF;CAEA,MAAM,cAAc,SAAS;EAC3B,GAAG;EAEH,eAAe;GACb,GAAI,SAAS,iBAAiB,CAAC;GAC/B,GAAG;GACH,GAAG;EACL;CACF,CAAC;CAED,MAAM,eAA6B;EACjC,MAAM;EACN,cAAc;GACZ,OAAO,EACL,SAAS,EACP,OAAO;IACL,iBAAiB;IACjB,SAAS;GACX,EACF,EACF;EACF;CACF;CAEA,OAAO,CACL,GAAI,MAAM,QAAQ,WAAW,IAAI,cAAc,CAAC,WAAW,GAC3D,YACF;AACF"}
@@ -1,7 +1,9 @@
1
1
  'use client';
2
2
 
3
3
  import { createTranslationApi } from "./createTranslationApi.mjs";
4
+ import { getI18n } from "./globalI18n.mjs";
4
5
  import { useLocale } from "react-intlayer";
6
+ import { toNamespaceList } from "@intlayer/i18next";
5
7
  import { useMemo } from "react";
6
8
 
7
9
  // src/useTranslation.ts
@@ -27,7 +29,8 @@ import { useMemo } from "react";
27
29
  * ```
28
30
  */
29
31
  const useTranslationImplementation = (ns, options) => {
30
- const namespace = Array.isArray(ns) ? ns[0] ?? "translation" : ns ?? "translation";
32
+ const defaultNamespace = toNamespaceList(getI18n()?.options?.defaultNS)[0] ?? "translation";
33
+ const namespace = Array.isArray(ns) ? ns[0] ?? defaultNamespace : ns ?? defaultNamespace;
31
34
  const { locale, setLocale, availableLocales } = useLocale();
32
35
  const keyPrefix = options?.keyPrefix;
33
36
  const { translate, i18n } = useMemo(() => createTranslationApi({
@@ -1 +1 @@
1
- {"version":3,"file":"useTranslation.mjs","names":[],"sources":["../../src/useTranslation.ts"],"sourcesContent":["'use client';\n\nimport type { ScopedTFunction, TypedTFunction } from '@intlayer/i18next';\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useMemo } from 'react';\nimport type { UseTranslationOptions } from 'react-i18next';\nimport { useLocale } from 'react-intlayer';\nimport {\n createTranslationApi,\n type TypedTranslationResult,\n} from './createTranslationApi';\n\n/**\n * Overload set for {@link useTranslation}: with a `keyPrefix` option the\n * returned `t()` accepts relative dot-paths under the prefix; otherwise keys\n * are the dictionary's full dot-paths. Return types are resolved from the\n * content at the key's path.\n */\ntype UseTranslation = {\n <N extends DictionaryKeys, Prefix extends string>(\n ns: N | N[],\n options: UseTranslationOptions<Prefix> & { keyPrefix: Prefix }\n ): TypedTranslationResult<ScopedTFunction<N, Prefix>>;\n <N extends DictionaryKeys>(\n ns?: N | N[],\n options?: UseTranslationOptions<undefined>\n ): TypedTranslationResult<TypedTFunction<N>>;\n};\n\n/**\n * Drop-in for react-i18next's `useTranslation`.\n *\n * Translation lookup goes through the shared i18next-dialect resolver:\n * namespace prefixes (`ns:key`), the `ns` option, plural suffixes\n * (`key_one`/`key_other` via `Intl.PluralRules`), context suffixes\n * (`key_male`), `$t()` nesting, `defaultValue` and `{{var}}` interpolation\n * are all supported.\n *\n * The returned `t()` is typed against the intlayer dictionary for namespace N:\n * keys are autocompleted, dot-paths are validated at compile time, and the\n * return type is resolved from the content at the key's path (with\n * `returnObjects: true` the raw content subtree type is returned).\n *\n * @example\n * ```tsx\n * const { t } = useTranslation('about');\n * t('counter.label'); // ✓ typed key and return value\n * t('items', { count: 3 }); // plural suffix resolution\n * ```\n */\nconst useTranslationImplementation = (\n ns?: string | string[],\n options?: UseTranslationOptions<string>\n) => {\n const namespace = Array.isArray(ns)\n ? (ns[0] ?? 'translation')\n : (ns ?? 'translation');\n\n const { locale, setLocale, availableLocales } = useLocale();\n\n const keyPrefix = options?.keyPrefix;\n\n const { translate, i18n } = useMemo(\n () =>\n createTranslationApi({\n locale: locale as LocalesValues,\n setLocale: setLocale as (newLocale: LocalesValues) => void,\n availableLocales: (availableLocales ?? []) as LocalesValues[],\n namespace,\n keyPrefix,\n }),\n [locale, setLocale, availableLocales, namespace, keyPrefix]\n );\n\n return { t: translate, i18n, ready: true };\n};\n\nexport const useTranslation = useTranslationImplementation as UseTranslation;\n\n/**\n * Loosely-typed view of {@link useTranslation} used by render-prop and HOC\n * wrappers (`Translation`, `withTranslation`, `Trans`) that forward `t` to\n * consumer-typed surfaces.\n */\nexport const useTranslationLoose = useTranslationImplementation as (\n ns?: string | string[],\n options?: UseTranslationOptions<string>\n) => TypedTranslationResult;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAM,gCACJ,IACA,YACG;CACH,MAAM,YAAY,MAAM,QAAQ,EAAE,IAC7B,GAAG,MAAM,gBACT,MAAM;CAEX,MAAM,EAAE,QAAQ,WAAW,qBAAqB,UAAU;CAE1D,MAAM,YAAY,SAAS;CAE3B,MAAM,EAAE,WAAW,SAAS,cAExB,qBAAqB;EACX;EACG;EACX,kBAAmB,oBAAoB,CAAC;EACxC;EACA;CACF,CAAC,GACH;EAAC;EAAQ;EAAW;EAAkB;EAAW;CAAS,CAC5D;CAEA,OAAO;EAAE,GAAG;EAAW;EAAM,OAAO;CAAK;AAC3C;AAEA,MAAa,iBAAiB;;;;;;AAO9B,MAAa,sBAAsB"}
1
+ {"version":3,"file":"useTranslation.mjs","names":[],"sources":["../../src/useTranslation.ts"],"sourcesContent":["'use client';\n\nimport {\n type ScopedTFunction,\n type TypedTFunction,\n toNamespaceList,\n} from '@intlayer/i18next';\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useMemo } from 'react';\nimport type { UseTranslationOptions } from 'react-i18next';\nimport { useLocale } from 'react-intlayer';\nimport {\n createTranslationApi,\n type TypedTranslationResult,\n} from './createTranslationApi';\nimport { getI18n } from './globalI18n';\n\n/**\n * Overload set for {@link useTranslation}: with a `keyPrefix` option the\n * returned `t()` accepts relative dot-paths under the prefix; otherwise keys\n * are the dictionary's full dot-paths. Return types are resolved from the\n * content at the key's path.\n */\ntype UseTranslation = {\n <N extends DictionaryKeys, Prefix extends string>(\n ns: N | N[],\n options: UseTranslationOptions<Prefix> & { keyPrefix: Prefix }\n ): TypedTranslationResult<ScopedTFunction<N, Prefix>>;\n <N extends DictionaryKeys>(\n ns?: N | N[],\n options?: UseTranslationOptions<undefined>\n ): TypedTranslationResult<TypedTFunction<N>>;\n};\n\n/**\n * Drop-in for react-i18next's `useTranslation`.\n *\n * Translation lookup goes through the shared i18next-dialect resolver:\n * namespace prefixes (`ns:key`), the `ns` option, plural suffixes\n * (`key_one`/`key_other` via `Intl.PluralRules`), context suffixes\n * (`key_male`), `$t()` nesting, `defaultValue` and `{{var}}` interpolation\n * are all supported.\n *\n * The returned `t()` is typed against the intlayer dictionary for namespace N:\n * keys are autocompleted, dot-paths are validated at compile time, and the\n * return type is resolved from the content at the key's path (with\n * `returnObjects: true` the raw content subtree type is returned).\n *\n * @example\n * ```tsx\n * const { t } = useTranslation('about');\n * t('counter.label'); // ✓ typed key and return value\n * t('items', { count: 3 }); // plural suffix resolution\n * ```\n */\nconst useTranslationImplementation = (\n ns?: string | string[],\n options?: UseTranslationOptions<string>\n) => {\n // Without a namespace, react-i18next uses the registered instance's\n // `defaultNS` (`common` under next-i18next), then i18next's `translation`.\n const defaultNamespace =\n toNamespaceList(getI18n()?.options?.defaultNS)[0] ?? 'translation';\n const namespace = Array.isArray(ns)\n ? (ns[0] ?? defaultNamespace)\n : (ns ?? defaultNamespace);\n\n const { locale, setLocale, availableLocales } = useLocale();\n\n const keyPrefix = options?.keyPrefix;\n\n const { translate, i18n } = useMemo(\n () =>\n createTranslationApi({\n locale: locale as LocalesValues,\n setLocale: setLocale as (newLocale: LocalesValues) => void,\n availableLocales: (availableLocales ?? []) as LocalesValues[],\n namespace,\n keyPrefix,\n }),\n [locale, setLocale, availableLocales, namespace, keyPrefix]\n );\n\n return { t: translate, i18n, ready: true };\n};\n\nexport const useTranslation = useTranslationImplementation as UseTranslation;\n\n/**\n * Loosely-typed view of {@link useTranslation} used by render-prop and HOC\n * wrappers (`Translation`, `withTranslation`, `Trans`) that forward `t` to\n * consumer-typed surfaces.\n */\nexport const useTranslationLoose = useTranslationImplementation as (\n ns?: string | string[],\n options?: UseTranslationOptions<string>\n) => TypedTranslationResult;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,gCACJ,IACA,YACG;CAGH,MAAM,mBACJ,gBAAgB,QAAQ,CAAC,EAAE,SAAS,SAAS,CAAC,CAAC,MAAM;CACvD,MAAM,YAAY,MAAM,QAAQ,EAAE,IAC7B,GAAG,MAAM,mBACT,MAAM;CAEX,MAAM,EAAE,QAAQ,WAAW,qBAAqB,UAAU;CAE1D,MAAM,YAAY,SAAS;CAE3B,MAAM,EAAE,WAAW,SAAS,cAExB,qBAAqB;EACX;EACG;EACX,kBAAmB,oBAAoB,CAAC;EACxC;EACA;CACF,CAAC,GACH;EAAC;EAAQ;EAAW;EAAkB;EAAW;CAAS,CAC5D;CAEA,OAAO;EAAE,GAAG;EAAW;EAAM,OAAO;CAAK;AAC3C;AAEA,MAAa,iBAAiB;;;;;;AAO9B,MAAa,sBAAsB"}
@@ -61,7 +61,9 @@ export type CreateTranslationApiParams = {
61
61
  * namespace prefixes (`ns:key`), the `ns` option, plural suffixes
62
62
  * (`key_one`/`key_other` via `Intl.PluralRules`), context suffixes
63
63
  * (`key_male`), `$t()` nesting, `defaultValue` and `{{var}}` interpolation
64
- * are all supported.
64
+ * are all supported, as is the `fallbackNS` of the i18n instance registered
65
+ * through `initReactI18next`. Values are not HTML-escaped: React escapes
66
+ * rendered text already.
65
67
  */
66
68
  export declare const createTranslationApi: ({ locale, setLocale, availableLocales, namespace, keyPrefix, dictionaryContent }: CreateTranslationApiParams) => {
67
69
  translate: TranslateFunction;
@@ -1 +1 @@
1
- {"version":3,"file":"createTranslationApi.d.ts","names":[],"sources":["../../src/createTranslationApi.ts"],"mappings":";;;;YAcY,qBACV,wBACA,wBAAwB,mBACxB,eAAe;;;;;;;YASL,gBAAgB,MAAM,qBAAqB,KACrD;EAGA,GAAG;EACH;KACG,UAAU,gBACT,qCACA,gBAAgB,IACf,eAAe;KACjB,0BAA0B,wBAAwB;;;;YAK3C,uBAAuB,MAAM;EACvC,GAAG;EACH,MAAM,gBAAgB;EACtB;;;YAIU;EACV;EACA;EACA;EACA;EACA,iBAAiB,wBAAwB;EACzC,MAAM;EACN,SAAS,aAAa,gBAAgB;EACtC,GAAG;EACH,YACE,0BACA,oCACI,aAAa,eAAe;;YAGxB;;EAEV,QAAQ;;EAER,YAAY,WAAW;;EAEvB,kBAAkB;;EAElB;;EAEA;;;;;;EAMA;;;;;;;;;;;;;qBAcW,yBAAoB,QAAA,WAAA,kBAAA,WAAA,WAAA,qBAO9B;EACD,WAAW;EACX,MAAM"}
1
+ {"version":3,"file":"createTranslationApi.d.ts","names":[],"sources":["../../src/createTranslationApi.ts"],"mappings":";;;;YAeY,qBACV,wBACA,wBAAwB,mBACxB,eAAe;;;;;;;YASL,gBAAgB,MAAM,qBAAqB,KACrD;EAGA,GAAG;EACH;KACG,UAAU,gBACT,qCACA,gBAAgB,IACf,eAAe;KACjB,0BAA0B,wBAAwB;;;;YAK3C,uBAAuB,MAAM;EACvC,GAAG;EACH,MAAM,gBAAgB;EACtB;;;YAIU;EACV;EACA;EACA;EACA;EACA,iBAAiB,wBAAwB;EACzC,MAAM;EACN,SAAS,aAAa,gBAAgB;EACtC,GAAG;EACH,YACE,0BACA,oCACI,aAAa,eAAe;;YAGxB;;EAEV,QAAQ;;EAER,YAAY,WAAW;;EAEvB,kBAAkB;;EAElB;;EAEA;;;;;;EAMA;;;;;;;;;;;;;;;qBAgBW,yBAAoB,QAAA,WAAA,kBAAA,WAAA,WAAA,qBAO9B;EACD,WAAW;EACX,MAAM"}
@@ -0,0 +1,6 @@
1
+ import { i18n } from "i18next";
2
+ /** Registers the i18n instance, as react-i18next's `setI18n` does. */
3
+ export declare const setI18n: (instance: i18n) => void;
4
+ /** Returns the registered i18n instance (`null` before registration). */
5
+ export declare const getI18n: () => i18n;
6
+ //# sourceMappingURL=globalI18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalI18n.d.ts","names":[],"sources":["../../src/globalI18n.ts"],"mappings":";;qBAWa,UAAO,UAAc;;qBAKrB,eAAc"}
@@ -13,8 +13,6 @@ export interface TranslationProps {
13
13
  }
14
14
  export declare const Translation: ({ children, ns, keyPrefix }: TranslationProps) => React.ReactElement;
15
15
  export declare const nodesToString: (children: React.ReactNode, _i18nOptions?: unknown, _i18n?: unknown, _i18nKey?: string) => string;
16
- export declare const setI18n: (instance: i18n) => void;
17
- export declare const getI18n: () => i18n;
18
16
  export declare const setDefaults: (options: unknown) => void;
19
17
  export declare const getDefaults: () => unknown;
20
18
  export declare const useSSR: (_initialI18nStore: unknown, _initialLanguage: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","names":[],"sources":["../../src/helpers.tsx"],"mappings":";;qBAKa,aAAW,MAAA;EAA+B,MAAA;;iBAItC;EACf,WACE,GAAG,WACH;IAAW,MAAM;IAAM;KACvB,mBACG,MAAM;EACX;EACA;;qBAIW,gBAAW,UAAA,IAAA,aAIrB,qBAAmB,MAAM;qBAUf,gBAAa,UACd,MAAM,WAAS,wBACH,iBACP;qBAyBJ,UAAO,UAAc;qBAIrB,eAAc;qBAId,cAAW;qBAIX;qBAKA,SAAM,4BACS;qBAIf,gBACE,kBAAgB,kBACT,MAAM,cAAc,OACrC,MAAM,cAAc;qBAWZ,sBAAmB,4BACP,kBAAyB;qBAErC;EACX;EACA"}
1
+ {"version":3,"file":"helpers.d.ts","names":[],"sources":["../../src/helpers.tsx"],"mappings":";;qBAKa,aAAW,MAAA;EAA+B,MAAA;;iBAItC;EACf,WACE,GAAG,WACH;IAAW,MAAM;IAAM;KACvB,mBACG,MAAM;EACX;EACA;;qBAIW,gBAAW,UAAA,IAAA,aAIrB,qBAAmB,MAAM;qBAUf,gBAAa,UACd,MAAM,WAAS,wBACH,iBACP;qBAwBJ,cAAW;qBAIX;qBAKA,SAAM,4BACS;qBAIf,gBACE,kBAAgB,kBACT,MAAM,cAAc,OACrC,MAAM,cAAc;qBAWZ,sBAAmB,4BACP,kBAAyB;qBAErC;EACX;EACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["nodesToStringImpl","_setDefaults","_getDefaults","_setI18n","_getI18n","_composeInitialProps","_getInitialProps","_useSSR","_withSSR","_Translation","_I18nContext","_TransWithoutContext","_Trans"],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;qBAiDa,sBAAaA;qBACb,oBAAwCC;qBACxC,oBAAwCC;qBACxC,gBAAgCC;qBAChC,gBAAgCC;qBAChC,4BACuBC;qBACvB,wBAAgDC;qBAChD,eAA8BC;qBAC9B,gBAAgCC;qBAChC,oBAAwCC;qBACxC,oBAAwCC;qBAExC,4BAAsCC;qBAMtC,iBAA2BC;qBAC3B,+BAAyCA"}
1
+ {"version":3,"file":"index.d.ts","names":["nodesToStringImpl","_setDefaults","_getDefaults","_setI18n","_getI18n","_composeInitialProps","_getInitialProps","_useSSR","_withSSR","_Translation","_I18nContext","_TransWithoutContext","_Trans"],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;qBAgDa,sBAAaA;qBACb,oBAAwCC;qBACxC,oBAAwCC;qBACxC,gBAAgCC;qBAChC,gBAAgCC;qBAChC,4BACuBC;qBACvB,wBAAgDC;qBAChD,eAA8BC;qBAC9B,gBAAgCC;qBAChC,oBAAwCC;qBACxC,oBAAwCC;qBAExC,4BAAsCC;qBAMtC,iBAA2BC;qBAC3B,+BAAyCA"}
@@ -1 +1 @@
1
- {"version":3,"file":"initReactI18next.d.ts","names":["_initReactI18next"],"sources":["../../src/initReactI18next.ts"],"mappings":";;;;;;;;;;qBAYa,yBAAyBA"}
1
+ {"version":3,"file":"initReactI18next.d.ts","names":["_initReactI18next"],"sources":["../../src/initReactI18next.ts"],"mappings":";;;;;;;;;;qBAaa,yBAAyBA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/plugin/index.ts"],"mappings":";;;;;;qBAaa,yBAAsB,UACvB,kBAAkB,iBAC3B"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/plugin/index.ts"],"mappings":";;;;;;qBAgBa,yBAAsB,UACvB,kBAAkB,iBAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTranslation.d.ts","names":[],"sources":["../../src/useTranslation.ts"],"mappings":";;;;;;;;;;KAqBK;GACF,UAAU,gBAAgB,uBACzB,IAAI,IAAI,KACR,SAAS,sBAAsB;IAAY,WAAW;MACrD,uBAAuB,gBAAgB,GAAG;GAC5C,UAAU,gBACT,KAAK,IAAI,KACT,UAAU,mCACT,uBAAuB,eAAe;;qBAmD9B,gBAAiD;;;;;;qBAOjD,sBACX,wBACA,UAAU,kCACP"}
1
+ {"version":3,"file":"useTranslation.d.ts","names":[],"sources":["../../src/useTranslation.ts"],"mappings":";;;;;;;;;;KA0BK;GACF,UAAU,gBAAgB,uBACzB,IAAI,IAAI,KACR,SAAS,sBAAsB;IAAY,WAAW;MACrD,uBAAuB,gBAAgB,GAAG;GAC5C,UAAU,gBACT,KAAK,IAAI,KACT,UAAU,mCACT,uBAAuB,eAAe;;qBAuD9B,gBAAiD;;;;;;qBAOjD,sBACX,wBACA,UAAU,kCACP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/react-i18next",
3
- "version": "9.9.2",
3
+ "version": "9.9.3-canary.0",
4
4
  "private": false,
5
5
  "description": "react-i18next API adapter for intlayer — useTranslation, Trans, withTranslation, I18nextProvider backed by react-intlayer",
6
6
  "keywords": [
@@ -77,15 +77,16 @@
77
77
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
78
78
  },
79
79
  "dependencies": {
80
- "@intlayer/config": "9.9.2",
81
- "@intlayer/core": "9.9.2",
82
- "@intlayer/engine": "9.9.2",
83
- "@intlayer/i18next": "9.9.2",
84
- "@intlayer/types": "9.9.2",
85
- "react-intlayer": "9.9.2",
86
- "vite-intlayer": "9.9.2"
80
+ "@intlayer/config": "9.9.3-canary.0",
81
+ "@intlayer/core": "9.9.3-canary.0",
82
+ "@intlayer/engine": "9.9.3-canary.0",
83
+ "@intlayer/i18next": "9.9.3-canary.0",
84
+ "@intlayer/types": "9.9.3-canary.0",
85
+ "react-intlayer": "9.9.3-canary.0",
86
+ "vite-intlayer": "9.9.3-canary.0"
87
87
  },
88
88
  "devDependencies": {
89
+ "@intlayer/dictionaries-entry": "9.9.3-canary.0",
89
90
  "@types/node": "^26",
90
91
  "@types/react": "19.3.3",
91
92
  "@utils/compat-api-parity": "1.0.0",