@intlayer/next-intl 9.0.0-canary.2 → 9.0.0-canary.4
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/cjs/client/NextIntlClientProvider.cjs +7 -3
- package/dist/cjs/client/NextIntlClientProvider.cjs.map +1 -1
- package/dist/cjs/client/index.cjs +56 -13
- package/dist/cjs/index.cjs +92 -15
- package/dist/cjs/server/getLocale.cjs +15 -1
- package/dist/cjs/server/getLocale.cjs.map +1 -1
- package/dist/cjs/server/getRequestConfig.cjs +28 -0
- package/dist/cjs/server/getRequestConfig.cjs.map +1 -0
- package/dist/cjs/server/getTranslations.cjs +9 -4
- package/dist/cjs/server/getTranslations.cjs.map +1 -1
- package/dist/cjs/server/helpers.cjs +5 -3
- package/dist/cjs/server/helpers.cjs.map +1 -1
- package/dist/cjs/server/index.cjs +5 -1
- package/dist/cjs/server/requestLocaleCache.cjs +36 -0
- package/dist/cjs/server/requestLocaleCache.cjs.map +1 -0
- package/dist/cjs/server/setRequestLocale.cjs +33 -0
- package/dist/cjs/server/setRequestLocale.cjs.map +1 -0
- package/dist/esm/client/NextIntlClientProvider.mjs +9 -4
- package/dist/esm/client/NextIntlClientProvider.mjs.map +1 -1
- package/dist/esm/client/index.mjs +1 -4
- package/dist/esm/index.mjs +3 -6
- package/dist/esm/server/getLocale.mjs +15 -1
- package/dist/esm/server/getLocale.mjs.map +1 -1
- package/dist/esm/server/getRequestConfig.mjs +25 -0
- package/dist/esm/server/getRequestConfig.mjs.map +1 -0
- package/dist/esm/server/getTranslations.mjs +8 -4
- package/dist/esm/server/getTranslations.mjs.map +1 -1
- package/dist/esm/server/helpers.mjs +4 -3
- package/dist/esm/server/helpers.mjs.map +1 -1
- package/dist/esm/server/index.mjs +3 -1
- package/dist/esm/server/requestLocaleCache.mjs +33 -0
- package/dist/esm/server/requestLocaleCache.mjs.map +1 -0
- package/dist/esm/server/setRequestLocale.mjs +32 -0
- package/dist/esm/server/setRequestLocale.mjs.map +1 -0
- package/dist/types/client/NextIntlClientProvider.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +1 -4
- package/dist/types/index.d.ts +3 -6
- package/dist/types/server/getLocale.d.ts +9 -0
- package/dist/types/server/getLocale.d.ts.map +1 -1
- package/dist/types/server/getRequestConfig.d.ts +19 -0
- package/dist/types/server/getRequestConfig.d.ts.map +1 -0
- package/dist/types/server/getTranslations.d.ts +7 -29
- package/dist/types/server/getTranslations.d.ts.map +1 -1
- package/dist/types/server/helpers.d.ts +2 -1
- package/dist/types/server/helpers.d.ts.map +1 -1
- package/dist/types/server/index.d.ts +3 -1
- package/dist/types/server/requestLocaleCache.d.ts +17 -0
- package/dist/types/server/requestLocaleCache.d.ts.map +1 -0
- package/dist/types/server/setRequestLocale.d.ts +29 -0
- package/dist/types/server/setRequestLocale.d.ts.map +1 -0
- package/package.json +11 -16
- package/dist/cjs/client/helpers.cjs +0 -66
- package/dist/cjs/client/helpers.cjs.map +0 -1
- package/dist/cjs/client/useTranslations.cjs +0 -39
- package/dist/cjs/client/useTranslations.cjs.map +0 -1
- package/dist/cjs/createFormatter.cjs +0 -59
- package/dist/cjs/createFormatter.cjs.map +0 -1
- package/dist/cjs/createTranslator.cjs +0 -111
- package/dist/cjs/createTranslator.cjs.map +0 -1
- package/dist/cjs/getTranslationsDictionary.cjs +0 -31
- package/dist/cjs/getTranslationsDictionary.cjs.map +0 -1
- package/dist/cjs/getTranslationsDictionaryDynamic.cjs +0 -27
- package/dist/cjs/getTranslationsDictionaryDynamic.cjs.map +0 -1
- package/dist/cjs/hasLocale.cjs +0 -25
- package/dist/cjs/hasLocale.cjs.map +0 -1
- package/dist/cjs/package.cjs +0 -122
- package/dist/cjs/package.cjs.map +0 -1
- package/dist/cjs/useDictionary.cjs +0 -45
- package/dist/cjs/useDictionary.cjs.map +0 -1
- package/dist/cjs/useDictionaryDynamic.cjs +0 -37
- package/dist/cjs/useDictionaryDynamic.cjs.map +0 -1
- package/dist/cjs/useTranslationsDictionary.cjs +0 -37
- package/dist/cjs/useTranslationsDictionary.cjs.map +0 -1
- package/dist/cjs/useTranslationsDictionaryDynamic.cjs +0 -29
- package/dist/cjs/useTranslationsDictionaryDynamic.cjs.map +0 -1
- package/dist/esm/_virtual/_rolldown/runtime.mjs +0 -8
- package/dist/esm/client/helpers.mjs +0 -59
- package/dist/esm/client/helpers.mjs.map +0 -1
- package/dist/esm/client/useTranslations.mjs +0 -37
- package/dist/esm/client/useTranslations.mjs.map +0 -1
- package/dist/esm/createFormatter.mjs +0 -57
- package/dist/esm/createFormatter.mjs.map +0 -1
- package/dist/esm/createTranslator.mjs +0 -108
- package/dist/esm/createTranslator.mjs.map +0 -1
- package/dist/esm/getTranslationsDictionary.mjs +0 -29
- package/dist/esm/getTranslationsDictionary.mjs.map +0 -1
- package/dist/esm/getTranslationsDictionaryDynamic.mjs +0 -25
- package/dist/esm/getTranslationsDictionaryDynamic.mjs.map +0 -1
- package/dist/esm/hasLocale.mjs +0 -23
- package/dist/esm/hasLocale.mjs.map +0 -1
- package/dist/esm/package.mjs +0 -119
- package/dist/esm/package.mjs.map +0 -1
- package/dist/esm/useDictionary.mjs +0 -43
- package/dist/esm/useDictionary.mjs.map +0 -1
- package/dist/esm/useDictionaryDynamic.mjs +0 -35
- package/dist/esm/useDictionaryDynamic.mjs.map +0 -1
- package/dist/esm/useTranslationsDictionary.mjs +0 -35
- package/dist/esm/useTranslationsDictionary.mjs.map +0 -1
- package/dist/esm/useTranslationsDictionaryDynamic.mjs +0 -27
- package/dist/esm/useTranslationsDictionaryDynamic.mjs.map +0 -1
- package/dist/types/client/helpers.d.ts +0 -45
- package/dist/types/client/helpers.d.ts.map +0 -1
- package/dist/types/client/useTranslations.d.ts +0 -74
- package/dist/types/client/useTranslations.d.ts.map +0 -1
- package/dist/types/createFormatter.d.ts +0 -15
- package/dist/types/createFormatter.d.ts.map +0 -1
- package/dist/types/createTranslator.d.ts +0 -40
- package/dist/types/createTranslator.d.ts.map +0 -1
- package/dist/types/getTranslationsDictionary.d.ts +0 -15
- package/dist/types/getTranslationsDictionary.d.ts.map +0 -1
- package/dist/types/getTranslationsDictionaryDynamic.d.ts +0 -12
- package/dist/types/getTranslationsDictionaryDynamic.d.ts.map +0 -1
- package/dist/types/hasLocale.d.ts +0 -20
- package/dist/types/hasLocale.d.ts.map +0 -1
- package/dist/types/useDictionary.d.ts +0 -22
- package/dist/types/useDictionary.d.ts.map +0 -1
- package/dist/types/useDictionaryDynamic.d.ts +0 -15
- package/dist/types/useDictionaryDynamic.d.ts.map +0 -1
- package/dist/types/useTranslationsDictionary.d.ts +0 -19
- package/dist/types/useTranslationsDictionary.d.ts.map +0 -1
- package/dist/types/useTranslationsDictionaryDynamic.d.ts +0 -12
- package/dist/types/useTranslationsDictionaryDynamic.d.ts.map +0 -1
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useDictionaryDynamic as useDictionaryDynamic$1 } from "react-intlayer";
|
|
4
|
-
|
|
5
|
-
//#region src/useDictionaryDynamic.ts
|
|
6
|
-
const navigatePath = (objectValue, path) => {
|
|
7
|
-
if (!path) return objectValue;
|
|
8
|
-
const parts = path.split(".");
|
|
9
|
-
let current = objectValue;
|
|
10
|
-
for (const part of parts) {
|
|
11
|
-
if (current === null || current === void 0 || typeof current !== "object") return;
|
|
12
|
-
current = current[part];
|
|
13
|
-
}
|
|
14
|
-
return current;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Dynamic dictionary-accepting variant of `useTranslations`.
|
|
18
|
-
*/
|
|
19
|
-
const useDictionaryDynamic = (dictionaryPromise, key, namespacePrefix) => {
|
|
20
|
-
const content = useDictionaryDynamic$1(dictionaryPromise, key);
|
|
21
|
-
const resolveKey = (lookupKey) => namespacePrefix ? `${namespacePrefix}.${lookupKey}` : lookupKey;
|
|
22
|
-
return Object.assign((lookup, params) => {
|
|
23
|
-
const rawValue = navigatePath(content, resolveKey(String(lookup)));
|
|
24
|
-
const str = String(rawValue ?? resolveKey(String(lookup)));
|
|
25
|
-
if (!params) return str;
|
|
26
|
-
return str.replace(/\{(\w+)\}/g, (_, k) => params[k] != null ? String(params[k]) : `{${k}}`);
|
|
27
|
-
}, {
|
|
28
|
-
has: (lookup) => navigatePath(content, resolveKey(String(lookup))) != null,
|
|
29
|
-
raw: (lookup) => navigatePath(content, resolveKey(String(lookup)))
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
export { useDictionaryDynamic };
|
|
35
|
-
//# sourceMappingURL=useDictionaryDynamic.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.mjs","names":["useDictionaryDynamicBase"],"sources":["../../src/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport type { ValidDotPathsFor } from '@intlayer/core/transpiler';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport { useDictionaryDynamic as useDictionaryDynamicBase } from 'react-intlayer';\n\nconst navigatePath = (objectValue: unknown, path: string): unknown => {\n if (!path) return objectValue;\n const parts = path.split('.');\n let current: unknown = objectValue;\n for (const part of parts) {\n if (\n current === null ||\n current === undefined ||\n typeof current !== 'object'\n ) {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n};\n\n/**\n * Dynamic dictionary-accepting variant of `useTranslations`.\n */\nexport const useDictionaryDynamic = <\n const T extends Dictionary,\n const K extends string,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n namespacePrefix?: string\n) => {\n const content = useDictionaryDynamicBase<T, any>(\n dictionaryPromise,\n key as any\n );\n\n const resolveKey = (lookupKey: string): string =>\n namespacePrefix ? `${namespacePrefix}.${lookupKey}` : lookupKey;\n\n return Object.assign(\n <P extends ValidDotPathsFor<any>>(\n lookup: P,\n params?: Record<string, unknown>\n ): string => {\n const rawValue = navigatePath(content, resolveKey(String(lookup)));\n const str = String(rawValue ?? resolveKey(String(lookup)));\n if (!params) return str;\n return str.replace(/\\{(\\w+)\\}/g, (_, k) =>\n params[k] != null ? String(params[k]) : `{${k}}`\n );\n },\n {\n has: <P extends ValidDotPathsFor<any>>(lookup: P): boolean =>\n navigatePath(content, resolveKey(String(lookup))) != null,\n raw: <P extends ValidDotPathsFor<any>>(lookup: P): unknown =>\n navigatePath(content, resolveKey(String(lookup))),\n }\n );\n};\n"],"mappings":";;;;;AAOA,MAAM,gBAAgB,aAAsB,SAA0B;AACpE,KAAI,CAAC,KAAM,QAAO;CAClB,MAAM,QAAQ,KAAK,MAAM,IAAI;CAC7B,IAAI,UAAmB;AACvB,MAAK,MAAM,QAAQ,OAAO;AACxB,MACE,YAAY,QACZ,YAAY,UACZ,OAAO,YAAY,SAEnB;AAEF,YAAW,QAAoC;;AAEjD,QAAO;;;;;AAMT,MAAa,wBAIX,mBACA,KACA,oBACG;CACH,MAAM,UAAUA,uBACd,mBACA,IACD;CAED,MAAM,cAAc,cAClB,kBAAkB,GAAG,gBAAgB,GAAG,cAAc;AAExD,QAAO,OAAO,QAEV,QACA,WACW;EACX,MAAM,WAAW,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC;EAClE,MAAM,MAAM,OAAO,YAAY,WAAW,OAAO,OAAO,CAAC,CAAC;AAC1D,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,IAAI,QAAQ,eAAe,GAAG,MACnC,OAAO,MAAM,OAAO,OAAO,OAAO,GAAG,GAAG,IAAI,EAAE,GAC/C;IAEH;EACE,MAAuC,WACrC,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC,IAAI;EACvD,MAAuC,WACrC,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC;EACpD,CACF"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useDictionary } from "react-intlayer";
|
|
4
|
-
|
|
5
|
-
//#region src/useTranslationsDictionary.ts
|
|
6
|
-
/**
|
|
7
|
-
* Dictionary-accepting variant of `useTranslations`.
|
|
8
|
-
*
|
|
9
|
-
* Used internally by the SWC optimization: instead of looking up the dictionary
|
|
10
|
-
* at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time
|
|
11
|
-
* and passes it directly here. This enables tree-shaking of unused locale content.
|
|
12
|
-
*
|
|
13
|
-
* @example (generated by SWC, not written manually)
|
|
14
|
-
* import _abc from '.intlayer/dictionaries/about.json' with { type: 'json' };
|
|
15
|
-
* const t = useTranslationsDictionary(_abc);
|
|
16
|
-
*/
|
|
17
|
-
const useTranslationsDictionary = (dictionary, namespacePrefix) => {
|
|
18
|
-
const content = useDictionary(dictionary);
|
|
19
|
-
return (lookup, params) => {
|
|
20
|
-
const lookupKey = namespacePrefix ? `${namespacePrefix}.${String(lookup)}` : String(lookup);
|
|
21
|
-
const parts = lookupKey.split(".");
|
|
22
|
-
let current = content;
|
|
23
|
-
for (const part of parts) {
|
|
24
|
-
if (current == null) break;
|
|
25
|
-
current = current[part];
|
|
26
|
-
}
|
|
27
|
-
const str = String(current ?? lookupKey);
|
|
28
|
-
if (!params) return str;
|
|
29
|
-
return str.replace(/\{(\w+)\}/g, (_, k) => params[k] != null ? String(params[k]) : `{${k}}`);
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
export { useTranslationsDictionary };
|
|
35
|
-
//# sourceMappingURL=useTranslationsDictionary.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslationsDictionary.mjs","names":[],"sources":["../../src/useTranslationsDictionary.ts"],"sourcesContent":["'use client';\n\nimport type { ValidDotPathsFor } from '@intlayer/core/transpiler';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { useDictionary } from 'react-intlayer';\n\n/**\n * Dictionary-accepting variant of `useTranslations`.\n *\n * Used internally by the SWC optimization: instead of looking up the dictionary\n * at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time\n * and passes it directly here. This enables tree-shaking of unused locale content.\n *\n * @example (generated by SWC, not written manually)\n * import _abc from '.intlayer/dictionaries/about.json' with { type: 'json' };\n * const t = useTranslationsDictionary(_abc);\n */\nexport const useTranslationsDictionary = <T extends Dictionary>(\n dictionary: T,\n namespacePrefix?: string\n) => {\n const content = useDictionary(dictionary);\n\n return <P extends ValidDotPathsFor<any>>(\n lookup: P,\n params?: Record<string, unknown>\n ): string => {\n const lookupKey = namespacePrefix\n ? `${namespacePrefix}.${String(lookup)}`\n : String(lookup);\n const parts = lookupKey.split('.');\n let current: any = content;\n for (const part of parts) {\n if (current == null) break;\n current = current[part];\n }\n const str = String(current ?? lookupKey);\n if (!params) return str;\n return str.replace(/\\{(\\w+)\\}/g, (_, k) =>\n params[k] != null ? String(params[k]) : `{${k}}`\n );\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAa,6BACX,YACA,oBACG;CACH,MAAM,UAAU,cAAc,WAAW;AAEzC,SACE,QACA,WACW;EACX,MAAM,YAAY,kBACd,GAAG,gBAAgB,GAAG,OAAO,OAAO,KACpC,OAAO,OAAO;EAClB,MAAM,QAAQ,UAAU,MAAM,IAAI;EAClC,IAAI,UAAe;AACnB,OAAK,MAAM,QAAQ,OAAO;AACxB,OAAI,WAAW,KAAM;AACrB,aAAU,QAAQ;;EAEpB,MAAM,MAAM,OAAO,WAAW,UAAU;AACxC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,IAAI,QAAQ,eAAe,GAAG,MACnC,OAAO,MAAM,OAAO,OAAO,OAAO,GAAG,GAAG,IAAI,EAAE,GAC/C"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useDictionaryDynamic } from "react-intlayer";
|
|
4
|
-
|
|
5
|
-
//#region src/useTranslationsDictionaryDynamic.ts
|
|
6
|
-
/**
|
|
7
|
-
* Dynamic dictionary-accepting variant of `useTranslations`.
|
|
8
|
-
*/
|
|
9
|
-
const useTranslationsDictionaryDynamic = (dictionaryPromise, key, namespacePrefix) => {
|
|
10
|
-
const content = useDictionaryDynamic(dictionaryPromise, key);
|
|
11
|
-
return (lookup, params) => {
|
|
12
|
-
const lookupKey = namespacePrefix ? `${namespacePrefix}.${String(lookup)}` : String(lookup);
|
|
13
|
-
const parts = lookupKey.split(".");
|
|
14
|
-
let current = content;
|
|
15
|
-
for (const part of parts) {
|
|
16
|
-
if (current == null) break;
|
|
17
|
-
current = current[part];
|
|
18
|
-
}
|
|
19
|
-
const str = String(current ?? lookupKey);
|
|
20
|
-
if (!params) return str;
|
|
21
|
-
return str.replace(/\{(\w+)\}/g, (_, k) => params[k] != null ? String(params[k]) : `{${k}}`);
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
export { useTranslationsDictionaryDynamic };
|
|
27
|
-
//# sourceMappingURL=useTranslationsDictionaryDynamic.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslationsDictionaryDynamic.mjs","names":[],"sources":["../../src/useTranslationsDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport type { ValidDotPathsFor } from '@intlayer/core/transpiler';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport { useDictionaryDynamic } from 'react-intlayer';\n\n/**\n * Dynamic dictionary-accepting variant of `useTranslations`.\n */\nexport const useTranslationsDictionaryDynamic = <\n const T extends Dictionary,\n const K extends string,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n namespacePrefix?: string\n) => {\n const content = useDictionaryDynamic<T, any>(dictionaryPromise, key as any);\n\n return <P extends ValidDotPathsFor<any>>(\n lookup: P,\n params?: Record<string, unknown>\n ): string => {\n const lookupKey = namespacePrefix\n ? `${namespacePrefix}.${String(lookup)}`\n : String(lookup);\n const parts = lookupKey.split('.');\n let current: any = content;\n for (const part of parts) {\n if (current == null) break;\n current = current[part];\n }\n const str = String(current ?? lookupKey);\n if (!params) return str;\n return str.replace(/\\{(\\w+)\\}/g, (_, k) =>\n params[k] != null ? String(params[k]) : `{${k}}`\n );\n };\n};\n"],"mappings":";;;;;;;;AAUA,MAAa,oCAIX,mBACA,KACA,oBACG;CACH,MAAM,UAAU,qBAA6B,mBAAmB,IAAW;AAE3E,SACE,QACA,WACW;EACX,MAAM,YAAY,kBACd,GAAG,gBAAgB,GAAG,OAAO,OAAO,KACpC,OAAO,OAAO;EAClB,MAAM,QAAQ,UAAU,MAAM,IAAI;EAClC,IAAI,UAAe;AACnB,OAAK,MAAM,QAAQ,OAAO;AACxB,OAAI,WAAW,KAAM;AACrB,aAAU,QAAQ;;EAEpB,MAAM,MAAM,OAAO,WAAW,UAAU;AACxC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,IAAI,QAAQ,eAAe,GAAG,MACnC,OAAO,MAAM,OAAO,OAAO,OAAO,GAAG,GAAG,IAAI,EAAE,GAC/C"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { IntlProvider as IntlProvider$1, useFormatter as useFormatter$1, useMessages as useMessages$1, useNow as useNow$1, useTimeZone as useTimeZone$1 } from "next-intl";
|
|
2
|
-
|
|
3
|
-
//#region src/client/helpers.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Drop-in for next-intl's `useNow`.
|
|
6
|
-
* Returns the current `Date`. The `updateInterval` option is ignored.
|
|
7
|
-
*/
|
|
8
|
-
declare const useNow: typeof useNow$1;
|
|
9
|
-
/**
|
|
10
|
-
* Drop-in for next-intl's `useTimeZone`.
|
|
11
|
-
* Returns the system time zone resolved from `Intl.DateTimeFormat`.
|
|
12
|
-
*/
|
|
13
|
-
declare const useTimeZone: typeof useTimeZone$1;
|
|
14
|
-
/**
|
|
15
|
-
* Drop-in for next-intl's `useMessages`.
|
|
16
|
-
*
|
|
17
|
-
* @deprecated useMessages has no use case with intlayer.
|
|
18
|
-
* Messages are loaded automatically under the hood.
|
|
19
|
-
* @returns An empty object.
|
|
20
|
-
*/
|
|
21
|
-
declare const useMessages: typeof useMessages$1;
|
|
22
|
-
/**
|
|
23
|
-
* Drop-in for next-intl's `useFormatter`.
|
|
24
|
-
* Returns locale-aware formatters backed by the native `Intl.*` APIs:
|
|
25
|
-
* `dateTime`, `number`, `dateTimeRange`, `relativeTime`, `list`, and
|
|
26
|
-
* `displayName`.
|
|
27
|
-
*/
|
|
28
|
-
declare const useFormatter: typeof useFormatter$1;
|
|
29
|
-
/**
|
|
30
|
-
* Drop-in for next-intl's `IntlProvider`.
|
|
31
|
-
* Renders children as-is — Intlayer provides its own context via
|
|
32
|
-
* `IntlayerClientProvider`.
|
|
33
|
-
*
|
|
34
|
-
* @deprecated IntlProvider has no use case with intlayer.
|
|
35
|
-
* Use `IntlayerClientProvider` or `NextIntlClientProvider` instead.
|
|
36
|
-
*/
|
|
37
|
-
declare const IntlProvider: typeof IntlProvider$1;
|
|
38
|
-
/**
|
|
39
|
-
* @internal Not part of the public next-intl API surface; provided for
|
|
40
|
-
* internal compatibility shims only.
|
|
41
|
-
*/
|
|
42
|
-
declare const useExtracted: (..._args: unknown[]) => {};
|
|
43
|
-
//#endregion
|
|
44
|
-
export { IntlProvider, useExtracted, useFormatter, useMessages, useNow, useTimeZone };
|
|
45
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","names":[],"sources":["../../../src/client/helpers.tsx"],"mappings":";;;;;AAoBA;;cAAa,MAAA,SAAe,QAAA;;;AAM5B;;cAAa,WAAA,SAAoB,aAAA;;;AAUjC;;;;;cAAa,WAAA,SAAoB,aAAA;;;;;AAmCjC;;cAlBa,YAAA,SAAqB,cAAA;;;AA0BlC;;;;;;cARa,YAAA,SAAqB,cAAA;;;;;cAQrB,YAAA,MAAmB,KAAA"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { MarkupChunkRenderer, RichChunkRenderer } from "../createTranslator.js";
|
|
2
|
-
import { DictionaryKeys } from "@intlayer/types/module_augmentation";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
|
-
import { ValidDotPathsFor } from "@intlayer/core/transpiler";
|
|
5
|
-
|
|
6
|
-
//#region src/client/useTranslations.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* The translation function returned by {@link useTranslations}.
|
|
9
|
-
*
|
|
10
|
-
* When the namespace is a bare dictionary key, `key` is validated against the
|
|
11
|
-
* dictionary's dot-paths. When the namespace is a nested scope
|
|
12
|
-
* (`'about.counter'`), `key` is a relative `string` path.
|
|
13
|
-
*
|
|
14
|
-
* Beyond the call signature, the function exposes:
|
|
15
|
-
* - `has(key)` — returns `true` when the key exists in the namespace.
|
|
16
|
-
* - `raw(key)` — returns the unprocessed content value.
|
|
17
|
-
* - `rich(key, values)` — resolves `<tag>chunks</tag>` markup to React nodes.
|
|
18
|
-
* - `markup(key, values)` — resolves `<tag>chunks</tag>` markup to a string.
|
|
19
|
-
*/
|
|
20
|
-
type TranslateFunction<N extends DictionaryKeys> = {
|
|
21
|
-
/** Translate a key to a string, with optional ICU interpolation params. */<P extends ValidDotPathsFor<N>>(key: P, params?: Record<string, unknown>): string; /** Returns `true` if the given key exists in the namespace. */
|
|
22
|
-
has<P extends ValidDotPathsFor<N>>(key: P): boolean; /** Returns the raw unprocessed content for the given key. */
|
|
23
|
-
raw<P extends ValidDotPathsFor<N>>(key: P): unknown; /** Resolves rich-text markup, mapping tags through React renderers. */
|
|
24
|
-
rich<P extends ValidDotPathsFor<N>>(key: P, values?: Record<string, RichChunkRenderer | ReactNode>): ReactNode; /** Resolves rich-text markup, mapping tags through string renderers. */
|
|
25
|
-
markup<P extends ValidDotPathsFor<N>>(key: P, values?: Record<string, MarkupChunkRenderer | string | number>): string;
|
|
26
|
-
};
|
|
27
|
-
/** Loosely-typed function returned for nested `'dict.scope'` namespaces. */
|
|
28
|
-
type LooseTranslateFunction = {
|
|
29
|
-
(key: string, params?: Record<string, unknown>): string;
|
|
30
|
-
has(key: string): boolean;
|
|
31
|
-
raw(key: string): unknown;
|
|
32
|
-
rich(key: string, values?: Record<string, RichChunkRenderer | ReactNode>): ReactNode;
|
|
33
|
-
markup(key: string, values?: Record<string, MarkupChunkRenderer | string | number>): string;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Overload set for {@link useTranslations}:
|
|
37
|
-
*
|
|
38
|
-
* 1. A bare dictionary key → fully-typed `t()` (autocompleted dot-paths).
|
|
39
|
-
* 2. A nested namespace `'dictionary.sub.scope'` → `t()` accepts relative
|
|
40
|
-
* `string` paths, matching next-intl's scoped-namespace behaviour.
|
|
41
|
-
* 3. No namespace → root scope; the first segment of each key designates
|
|
42
|
-
* the dictionary (`t('about.title')`).
|
|
43
|
-
*/
|
|
44
|
-
type UseTranslations = {
|
|
45
|
-
<N extends DictionaryKeys>(namespace: N): TranslateFunction<N>;
|
|
46
|
-
(namespace: `${string}.${string}`): LooseTranslateFunction;
|
|
47
|
-
(): LooseTranslateFunction;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Drop-in for next-intl's `useTranslations`.
|
|
51
|
-
*
|
|
52
|
-
* Messages support ICU MessageFormat syntax: simple arguments (`{name}`),
|
|
53
|
-
* plural (`{count, plural, one {…} other {…}}`, `#`), select, and formatted
|
|
54
|
-
* arguments (`{value, number}`). Rich text is available through `t.rich()`
|
|
55
|
-
* and `t.markup()`.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```tsx
|
|
59
|
-
* const t = useTranslations('about');
|
|
60
|
-
* t('counter.label'); // ✓ typed
|
|
61
|
-
* t('items', { count: 3 }); // ICU plural
|
|
62
|
-
*
|
|
63
|
-
* // Scoped to a nested object (next-intl idiom)
|
|
64
|
-
* const t = useTranslations('about.counter');
|
|
65
|
-
* t('label'); // resolves about → counter.label
|
|
66
|
-
*
|
|
67
|
-
* // Rich text
|
|
68
|
-
* t.rich('terms', { link: (chunks) => <a href="/terms">{chunks}</a> });
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
declare const useTranslations: UseTranslations;
|
|
72
|
-
//#endregion
|
|
73
|
-
export { useTranslations };
|
|
74
|
-
//# sourceMappingURL=useTranslations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslations.d.ts","names":[],"sources":["../../../src/client/useTranslations.ts"],"mappings":";;;;;;;;AAa6B;;;;;;;;;;;KAexB,iBAAA,WAA4B,cAAA;EASjB,sFAPH,gBAAA,CAAiB,CAAA,GAC1B,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,MAAA,4BAOqB;EAJhC,GAAA,WAAc,gBAAA,CAAiB,CAAA,GAAI,GAAA,EAAK,CAAA,YAKjC;EAHP,GAAA,WAAc,gBAAA,CAAiB,CAAA,GAAI,GAAA,EAAK,CAAA,YAIM;EAF9C,IAAA,WAAe,gBAAA,CAAiB,CAAA,GAC9B,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,MAAA,SAAe,iBAAA,GAAoB,SAAA,IAC3C,SAAA,EAAA;EAEH,MAAA,WAAiB,gBAAA,CAAiB,CAAA,GAChC,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,MAAA,SAAe,mBAAA;AAAA;;KAKvB,sBAAA;EAAA,CACF,GAAA,UAAa,MAAA,GAAS,MAAA;EACvB,GAAA,CAAI,GAAA;EACJ,GAAA,CAAI,GAAA;EACJ,IAAA,CACE,GAAA,UACA,MAAA,GAAS,MAAA,SAAe,iBAAA,GAAoB,SAAA,IAC3C,SAAA;EACH,MAAA,CACE,GAAA,UACA,MAAA,GAAS,MAAA,SAAe,mBAAA;AAAA;;;;;;;;;;KAavB,eAAA;EAAA,WACQ,cAAA,EAAgB,SAAA,EAAW,CAAA,GAAI,iBAAA,CAAkB,CAAA;EAAA,CAC3D,SAAA,0BAAmC,sBAAA;EAAA,IAChC,sBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;cAyBO,eAAA,EAOP,eAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useFormatter } from "next-intl";
|
|
2
|
-
|
|
3
|
-
//#region src/createFormatter.d.ts
|
|
4
|
-
/** The formatter object shape exposed by next-intl. */
|
|
5
|
-
type Formatter = ReturnType<typeof useFormatter>;
|
|
6
|
-
/**
|
|
7
|
-
* Builds a next-intl compatible formatter backed by the native `Intl.*`
|
|
8
|
-
* APIs for the given locale.
|
|
9
|
-
*
|
|
10
|
-
* Shared by `useFormatter` (client) and `getFormatter` (server).
|
|
11
|
-
*/
|
|
12
|
-
declare const createFormatter: (locale: string) => Formatter;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { Formatter, createFormatter };
|
|
15
|
-
//# sourceMappingURL=createFormatter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createFormatter.d.ts","names":[],"sources":["../../src/createFormatter.ts"],"mappings":";;;;KAGY,SAAA,GAAY,UAAA,QAAkB,YAAA;AAA1C;;;;;AAsBA;AAtBA,cAsBa,eAAA,GAAmB,MAAA,aAAiB,SAAA"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
-
import { ReactNode } from "react";
|
|
3
|
-
import { MessageValues } from "@intlayer/core/messageFormat";
|
|
4
|
-
|
|
5
|
-
//#region src/createTranslator.d.ts
|
|
6
|
-
/** Chunk renderer used by `t.rich()` — maps tag children to a React node. */
|
|
7
|
-
type RichChunkRenderer = (chunks: ReactNode) => ReactNode;
|
|
8
|
-
/** Chunk renderer used by `t.markup()` — maps tag children to a string. */
|
|
9
|
-
type MarkupChunkRenderer = (chunks: string) => string;
|
|
10
|
-
declare const navigatePath: (objectValue: unknown, path: string) => unknown;
|
|
11
|
-
/**
|
|
12
|
-
* The untyped runtime translator shared by `useTranslations` (client) and
|
|
13
|
-
* `getTranslations` (server).
|
|
14
|
-
*
|
|
15
|
-
* Behaviour matches next-intl:
|
|
16
|
-
* - namespace `'about'` → keys resolved inside the `about` dictionary
|
|
17
|
-
* - namespace `'about.counter'` → dictionary `about`, key prefix `counter`
|
|
18
|
-
* - no namespace → the first segment of each key is the dictionary key
|
|
19
|
-
* - messages support ICU syntax (plural, select, `#`, formatted arguments)
|
|
20
|
-
* - `t.rich` / `t.markup` map `<tag>chunks</tag>` through the provided
|
|
21
|
-
* renderers; `t.raw` returns the raw value; `t.has` checks existence
|
|
22
|
-
*/
|
|
23
|
-
declare const createTranslator: (locale: LocalesValues, namespace?: string) => ((key: string, values?: MessageValues) => string) & {
|
|
24
|
-
/** Returns `true` if the given key exists in the namespace. */has: (key: string) => boolean; /** Returns the raw unprocessed content for the given key. */
|
|
25
|
-
raw: (key: string) => unknown;
|
|
26
|
-
/**
|
|
27
|
-
* Resolves a message containing `<tag>chunks</tag>` markup, mapping each
|
|
28
|
-
* tag through the matching renderer in `values`.
|
|
29
|
-
*/
|
|
30
|
-
rich: (key: string, values?: Record<string, unknown>) => ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* Resolves a message containing `<tag>chunks</tag>` markup into a string,
|
|
33
|
-
* mapping each tag through the matching string renderer in `values`.
|
|
34
|
-
*/
|
|
35
|
-
markup: (key: string, values?: Record<string, unknown>) => string;
|
|
36
|
-
};
|
|
37
|
-
type CompatTranslator = ReturnType<typeof createTranslator>;
|
|
38
|
-
//#endregion
|
|
39
|
-
export { CompatTranslator, MarkupChunkRenderer, RichChunkRenderer, createTranslator, navigatePath };
|
|
40
|
-
//# sourceMappingURL=createTranslator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createTranslator.d.ts","names":[],"sources":["../../src/createTranslator.tsx"],"mappings":";;;;;;KAcY,iBAAA,IAAqB,MAAA,EAAQ,SAAA,KAAc,SAAA;AAAvD;AAAA,KAGY,mBAAA,IAAuB,MAAA;AAAA,cAEtB,YAAA,GAAgB,WAAA,WAAsB,IAAA;;;;;;;AAFnD;;;;;AAEA;cAqFa,gBAAA,GAAoB,MAAA,EAAQ,aAAA,EAAe,SAAA,gBAAkB,GAAA,UAsC1C,MAAA,GAAW,aAAA;gGA3HoB;;EA2J9D;;;;sBAlBqB,MAAA,GAAW,MAAA,sBAA0B,SAAA;EAAA;;;;wBAWnC,MAAA,GAAW,MAAA;AAAA;AAAA,KASvB,gBAAA,GAAmB,UAAA,QAAkB,gBAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ValidDotPathsFor } from "@intlayer/core/transpiler";
|
|
2
|
-
import { Dictionary } from "@intlayer/types/dictionary";
|
|
3
|
-
|
|
4
|
-
//#region src/getTranslationsDictionary.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Dictionary-accepting variant of `getTranslations`.
|
|
7
|
-
*
|
|
8
|
-
* Used internally by the SWC optimization: instead of looking up the dictionary
|
|
9
|
-
* at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time
|
|
10
|
-
* and passes it directly here. This enables tree-shaking of unused locale content.
|
|
11
|
-
*/
|
|
12
|
-
declare const getTranslationsDictionary: <T extends Dictionary>(dictionary: T, namespacePrefix?: string) => Promise<(<P extends ValidDotPathsFor<any>>(lookup: P, params?: Record<string, unknown>) => string)>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { getTranslationsDictionary };
|
|
15
|
-
//# sourceMappingURL=getTranslationsDictionary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getTranslationsDictionary.d.ts","names":[],"sources":["../../src/getTranslationsDictionary.ts"],"mappings":";;;;;;AAWA;;;;;cAAa,yBAAA,aAA6C,UAAA,EACxD,UAAA,EAAY,CAAA,EACZ,eAAA,cAAwB,OAAA,aAIN,gBAAA,OAAqB,MAAA,EAC7B,CAAA,EAAC,MAAA,GACA,MAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
2
|
-
import { ValidDotPathsFor } from "@intlayer/core/transpiler";
|
|
3
|
-
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
-
|
|
5
|
-
//#region src/getTranslationsDictionaryDynamic.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Dynamic dictionary-accepting variant of `getTranslations`.
|
|
8
|
-
*/
|
|
9
|
-
declare const getTranslationsDictionaryDynamic: <const T extends Dictionary, const K extends string>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, namespacePrefix?: string) => Promise<(<P extends ValidDotPathsFor<any>>(lookup: P, params?: Record<string, unknown>) => string)>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { getTranslationsDictionaryDynamic };
|
|
12
|
-
//# sourceMappingURL=getTranslationsDictionaryDynamic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getTranslationsDictionaryDynamic.d.ts","names":[],"sources":["../../src/getTranslationsDictionaryDynamic.ts"],"mappings":";;;;;;;AAQA;cAAa,gCAAA,mBACK,UAAA,0BAGhB,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,eAAA,cAAwB,OAAA,aAON,gBAAA,OAAqB,MAAA,EAC7B,CAAA,EAAC,MAAA,GACA,MAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { hasLocale as hasLocale$1 } from "next-intl";
|
|
2
|
-
|
|
3
|
-
//#region src/hasLocale.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Drop-in for next-intl's `hasLocale`.
|
|
6
|
-
*
|
|
7
|
-
* Checks that a locale candidate is part of the given locales list (or, when
|
|
8
|
-
* the list is read from routing, the locales configured in intlayer).
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* import { routing } from '@/i18n/routing';
|
|
13
|
-
*
|
|
14
|
-
* if (hasLocale(routing.locales, requested)) { … }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare const hasLocale: typeof hasLocale$1;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { hasLocale };
|
|
20
|
-
//# sourceMappingURL=hasLocale.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasLocale.d.ts","names":[],"sources":["../../src/hasLocale.ts"],"mappings":";;;;;AAgBA;;;;;;;;;;;cAAa,SAAA,SAAkB,WAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ValidDotPathsFor } from "@intlayer/core/transpiler";
|
|
2
|
-
import { Dictionary } from "@intlayer/types/dictionary";
|
|
3
|
-
|
|
4
|
-
//#region src/useDictionary.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Dictionary-accepting variant of `useTranslations`.
|
|
7
|
-
*
|
|
8
|
-
* Used internally by the SWC optimization: instead of looking up the dictionary
|
|
9
|
-
* at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time
|
|
10
|
-
* and passes it directly here. This enables tree-shaking of unused locale content.
|
|
11
|
-
*
|
|
12
|
-
* @example (generated by SWC, not written manually)
|
|
13
|
-
* import _abc from '.intlayer/dictionaries/about.json' with { type: 'json' };
|
|
14
|
-
* const t = useDictionary(_abc);
|
|
15
|
-
*/
|
|
16
|
-
declare const useDictionary: <T extends Dictionary>(dictionary: T, namespacePrefix?: string) => (<P extends ValidDotPathsFor<any>>(lookup: P, params?: Record<string, unknown>) => string) & {
|
|
17
|
-
has: <P extends ValidDotPathsFor<any>>(lookup: P) => boolean;
|
|
18
|
-
raw: <P extends ValidDotPathsFor<any>>(lookup: P) => unknown;
|
|
19
|
-
};
|
|
20
|
-
//#endregion
|
|
21
|
-
export { useDictionary };
|
|
22
|
-
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../src/useDictionary.ts"],"mappings":";;;;;;AAkCA;;;;;;;;;cAAa,aAAA,aAA2B,UAAA,EACtC,UAAA,EAAY,CAAA,EACZ,eAAA,0BAQa,gBAAA,OAAqB,MAAA,EACtB,CAAA,EAAC,MAAA,GACA,MAAA;kBAUO,gBAAA,OAAqB,MAAA,EAAU,CAAA;kBAE/B,gBAAA,OAAqB,MAAA,EAAU,CAAA;AAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
2
|
-
import { ValidDotPathsFor } from "@intlayer/core/transpiler";
|
|
3
|
-
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
-
|
|
5
|
-
//#region src/useDictionaryDynamic.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Dynamic dictionary-accepting variant of `useTranslations`.
|
|
8
|
-
*/
|
|
9
|
-
declare const useDictionaryDynamic: <const T extends Dictionary, const K extends string>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, namespacePrefix?: string) => (<P extends ValidDotPathsFor<any>>(lookup: P, params?: Record<string, unknown>) => string) & {
|
|
10
|
-
has: <P extends ValidDotPathsFor<any>>(lookup: P) => boolean;
|
|
11
|
-
raw: <P extends ValidDotPathsFor<any>>(lookup: P) => unknown;
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { useDictionaryDynamic };
|
|
15
|
-
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../src/useDictionaryDynamic.ts"],"mappings":";;;;;;;AA2BA;cAAa,oBAAA,mBACK,UAAA,0BAGhB,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,eAAA,0BAWa,gBAAA,OAAqB,MAAA,EACtB,CAAA,EAAC,MAAA,GACA,MAAA;kBAUO,gBAAA,OAAqB,MAAA,EAAU,CAAA;kBAE/B,gBAAA,OAAqB,MAAA,EAAU,CAAA;AAAA"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ValidDotPathsFor } from "@intlayer/core/transpiler";
|
|
2
|
-
import { Dictionary } from "@intlayer/types/dictionary";
|
|
3
|
-
|
|
4
|
-
//#region src/useTranslationsDictionary.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Dictionary-accepting variant of `useTranslations`.
|
|
7
|
-
*
|
|
8
|
-
* Used internally by the SWC optimization: instead of looking up the dictionary
|
|
9
|
-
* at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time
|
|
10
|
-
* and passes it directly here. This enables tree-shaking of unused locale content.
|
|
11
|
-
*
|
|
12
|
-
* @example (generated by SWC, not written manually)
|
|
13
|
-
* import _abc from '.intlayer/dictionaries/about.json' with { type: 'json' };
|
|
14
|
-
* const t = useTranslationsDictionary(_abc);
|
|
15
|
-
*/
|
|
16
|
-
declare const useTranslationsDictionary: <T extends Dictionary>(dictionary: T, namespacePrefix?: string) => <P extends ValidDotPathsFor<any>>(lookup: P, params?: Record<string, unknown>) => string;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { useTranslationsDictionary };
|
|
19
|
-
//# sourceMappingURL=useTranslationsDictionary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslationsDictionary.d.ts","names":[],"sources":["../../src/useTranslationsDictionary.ts"],"mappings":";;;;;;AAiBA;;;;;;;;;cAAa,yBAAA,aAAuC,UAAA,EAClD,UAAA,EAAY,CAAA,EACZ,eAAA,yBAIkB,gBAAA,OAChB,MAAA,EAAQ,CAAA,EACR,MAAA,GAAS,MAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
2
|
-
import { ValidDotPathsFor } from "@intlayer/core/transpiler";
|
|
3
|
-
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
-
|
|
5
|
-
//#region src/useTranslationsDictionaryDynamic.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Dynamic dictionary-accepting variant of `useTranslations`.
|
|
8
|
-
*/
|
|
9
|
-
declare const useTranslationsDictionaryDynamic: <const T extends Dictionary, const K extends string>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, namespacePrefix?: string) => <P extends ValidDotPathsFor<any>>(lookup: P, params?: Record<string, unknown>) => string;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { useTranslationsDictionaryDynamic };
|
|
12
|
-
//# sourceMappingURL=useTranslationsDictionaryDynamic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslationsDictionaryDynamic.d.ts","names":[],"sources":["../../src/useTranslationsDictionaryDynamic.ts"],"mappings":";;;;;;;AAUA;cAAa,gCAAA,mBACK,UAAA,0BAGhB,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,eAAA,yBAIkB,gBAAA,OAChB,MAAA,EAAQ,CAAA,EACR,MAAA,GAAS,MAAA"}
|