@intlayer/next-intl 9.4.4 → 9.5.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.
- package/README.md +0 -2
- package/dist/cjs/plugin/index.cjs +36 -11
- package/dist/cjs/plugin/index.cjs.map +1 -1
- package/dist/cjs/react-server/helpers.cjs +20 -0
- package/dist/cjs/react-server/helpers.cjs.map +1 -0
- package/dist/cjs/react-server/index.cjs +61 -0
- package/dist/cjs/react-server/resolveLocale.cjs +19 -0
- package/dist/cjs/react-server/resolveLocale.cjs.map +1 -0
- package/dist/cjs/react-server/useDictionary.cjs +23 -0
- package/dist/cjs/react-server/useDictionary.cjs.map +1 -0
- package/dist/cjs/react-server/useDictionaryDynamic.cjs +19 -0
- package/dist/cjs/react-server/useDictionaryDynamic.cjs.map +1 -0
- package/dist/cjs/react-server/useLocale.cjs +13 -0
- package/dist/cjs/react-server/useLocale.cjs.map +1 -0
- package/dist/cjs/react-server/useTranslations.cjs +42 -0
- package/dist/cjs/react-server/useTranslations.cjs.map +1 -0
- package/dist/cjs/server/react/helpers.cjs +23 -0
- package/dist/cjs/server/react/helpers.cjs.map +1 -0
- package/dist/cjs/server/react/index.cjs +61 -0
- package/dist/cjs/server/react/resolveLocale.cjs +27 -0
- package/dist/cjs/server/react/resolveLocale.cjs.map +1 -0
- package/dist/cjs/server/react/useDictionary.cjs +23 -0
- package/dist/cjs/server/react/useDictionary.cjs.map +1 -0
- package/dist/cjs/server/react/useDictionaryDynamic.cjs +19 -0
- package/dist/cjs/server/react/useDictionaryDynamic.cjs.map +1 -0
- package/dist/cjs/server/react/useLocale.cjs +13 -0
- package/dist/cjs/server/react/useLocale.cjs.map +1 -0
- package/dist/cjs/server/react/useTranslations.cjs +42 -0
- package/dist/cjs/server/react/useTranslations.cjs.map +1 -0
- package/dist/esm/plugin/index.mjs +37 -12
- package/dist/esm/plugin/index.mjs.map +1 -1
- package/dist/esm/react-server/helpers.mjs +17 -0
- package/dist/esm/react-server/helpers.mjs.map +1 -0
- package/dist/esm/react-server/index.mjs +10 -0
- package/dist/esm/react-server/resolveLocale.mjs +18 -0
- package/dist/esm/react-server/resolveLocale.mjs.map +1 -0
- package/dist/esm/react-server/useDictionary.mjs +22 -0
- package/dist/esm/react-server/useDictionary.mjs.map +1 -0
- package/dist/esm/react-server/useDictionaryDynamic.mjs +18 -0
- package/dist/esm/react-server/useDictionaryDynamic.mjs.map +1 -0
- package/dist/esm/react-server/useLocale.mjs +12 -0
- package/dist/esm/react-server/useLocale.mjs.map +1 -0
- package/dist/esm/react-server/useTranslations.mjs +41 -0
- package/dist/esm/react-server/useTranslations.mjs.map +1 -0
- package/dist/esm/server/react/helpers.mjs +20 -0
- package/dist/esm/server/react/helpers.mjs.map +1 -0
- package/dist/esm/server/react/index.mjs +10 -0
- package/dist/esm/server/react/resolveLocale.mjs +26 -0
- package/dist/esm/server/react/resolveLocale.mjs.map +1 -0
- package/dist/esm/server/react/useDictionary.mjs +22 -0
- package/dist/esm/server/react/useDictionary.mjs.map +1 -0
- package/dist/esm/server/react/useDictionaryDynamic.mjs +18 -0
- package/dist/esm/server/react/useDictionaryDynamic.mjs.map +1 -0
- package/dist/esm/server/react/useLocale.mjs +12 -0
- package/dist/esm/server/react/useLocale.mjs.map +1 -0
- package/dist/esm/server/react/useTranslations.mjs +41 -0
- package/dist/esm/server/react/useTranslations.mjs.map +1 -0
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/react-server/helpers.d.ts +12 -0
- package/dist/types/react-server/helpers.d.ts.map +1 -0
- package/dist/types/react-server/index.d.ts +9 -0
- package/dist/types/react-server/resolveLocale.d.ts +14 -0
- package/dist/types/react-server/resolveLocale.d.ts.map +1 -0
- package/dist/types/react-server/useDictionary.d.ts +24 -0
- package/dist/types/react-server/useDictionary.d.ts.map +1 -0
- package/dist/types/react-server/useDictionaryDynamic.d.ts +15 -0
- package/dist/types/react-server/useDictionaryDynamic.d.ts.map +1 -0
- package/dist/types/react-server/useLocale.d.ts +9 -0
- package/dist/types/react-server/useLocale.d.ts.map +1 -0
- package/dist/types/react-server/useTranslations.d.ts +23 -0
- package/dist/types/react-server/useTranslations.d.ts.map +1 -0
- package/dist/types/server/react/helpers.d.ts +15 -0
- package/dist/types/server/react/helpers.d.ts.map +1 -0
- package/dist/types/server/react/index.d.ts +9 -0
- package/dist/types/server/react/resolveLocale.d.ts +18 -0
- package/dist/types/server/react/resolveLocale.d.ts.map +1 -0
- package/dist/types/server/react/useDictionary.d.ts +24 -0
- package/dist/types/server/react/useDictionary.d.ts.map +1 -0
- package/dist/types/server/react/useDictionaryDynamic.d.ts +15 -0
- package/dist/types/server/react/useDictionaryDynamic.d.ts.map +1 -0
- package/dist/types/server/react/useLocale.d.ts +9 -0
- package/dist/types/server/react/useLocale.d.ts.map +1 -0
- package/dist/types/server/react/useTranslations.d.ts +23 -0
- package/dist/types/server/react/useTranslations.d.ts.map +1 -0
- package/package.json +11 -10
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NextIntlClientProvider, NextIntlClientProviderProps } from "../client/NextIntlClientProvider.js";
|
|
2
|
+
import { Routing, defineRouting } from "../routing.js";
|
|
3
|
+
import { useFormatter, useNow, useTimeZone } from "./helpers.js";
|
|
4
|
+
import { useDictionary } from "./useDictionary.js";
|
|
5
|
+
import { useDictionaryDynamic } from "./useDictionaryDynamic.js";
|
|
6
|
+
import { useLocale } from "./useLocale.js";
|
|
7
|
+
import { useTranslations } from "./useTranslations.js";
|
|
8
|
+
import { IntlError, IntlErrorCode, createFormatter, createTranslator, hasLocale, initializeConfig, useMessages } from "@intlayer/use-intl";
|
|
9
|
+
export { IntlError, IntlErrorCode, NextIntlClientProvider, type NextIntlClientProviderProps, type Routing, createFormatter, createTranslator, defineRouting, hasLocale, initializeConfig, useDictionary, useDictionaryDynamic, useFormatter, useLocale, useMessages, useNow, useTimeZone, useTranslations };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
+
//#region src/react-server/resolveLocale.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Locale for a synchronous server hook, resolved the same way `getLocale()`
|
|
5
|
+
* resolves it — so server-rendered content and the client provider never
|
|
6
|
+
* disagree about which locale the request is in.
|
|
7
|
+
*
|
|
8
|
+
* 1. The locale forwarded through `setRequestLocale(locale)` (the `[locale]`
|
|
9
|
+
* route segment), which is next-intl's source of truth for URL routing.
|
|
10
|
+
* 2. Otherwise Intlayer's ambient locale (server context, then the request).
|
|
11
|
+
*/
|
|
12
|
+
export declare const resolveServerLocale: () => LocalesValues;
|
|
13
|
+
//#endregion
|
|
14
|
+
//# sourceMappingURL=resolveLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveLocale.d.ts","names":[],"sources":["../../../src/react-server/resolveLocale.ts"],"mappings":";;;;;;;;;;;qBAaa,2BAA0B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DictionaryKeys } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { ScopedTranslateFunction, TranslateFunction } from "@intlayer/use-intl";
|
|
3
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
+
//#region src/react-server/useDictionary.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Overload set mirroring the client `useDictionary` exactly, so the optimize
|
|
7
|
+
* pass can emit the same call shape whichever side of the boundary the
|
|
8
|
+
* component ends up on.
|
|
9
|
+
*/
|
|
10
|
+
type UseDictionary = {
|
|
11
|
+
<T extends Dictionary>(dictionary: T): TranslateFunction<T['key'] & DictionaryKeys>;
|
|
12
|
+
<T extends Dictionary, Prefix extends string>(dictionary: T, namespacePrefix: Prefix): ScopedTranslateFunction<T['key'] & DictionaryKeys, Prefix>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Server counterpart of `@intlayer/use-intl`'s `useDictionary`.
|
|
16
|
+
*
|
|
17
|
+
* The optimize pass rewrites every `useTranslations(...)` call to this helper
|
|
18
|
+
* with the dictionary pre-imported. Resolving it here — rather than in a client
|
|
19
|
+
* component — keeps the dictionary out of the client bundle entirely: the
|
|
20
|
+
* server renders the text and only the rendered output crosses the boundary.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useDictionary: UseDictionary;
|
|
23
|
+
//#endregion
|
|
24
|
+
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../src/react-server/useDictionary.ts"],"mappings":";;;;;;;;;KAkBK;GACF,UAAU,YACT,YAAY,IACX,kBAAkB,WAAW;GAC/B,UAAU,YAAY,uBACrB,YAAY,GACZ,iBAAiB,SAChB,wBAAwB,WAAW,gBAAgB;;;;;;;;;;qBAW3C,eAYP"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DictionaryKeys } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { ScopedTranslateFunction, TranslateFunction } from "@intlayer/use-intl";
|
|
3
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
+
//#region src/react-server/useDictionaryDynamic.d.ts
|
|
5
|
+
type UseDictionaryDynamic = {
|
|
6
|
+
<T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: Record<string, () => Promise<T>>, key: K): TranslateFunction<K>;
|
|
7
|
+
<T extends Dictionary, K extends DictionaryKeys, Prefix extends string>(dictionaryPromise: Record<string, () => Promise<T>>, key: K, namespacePrefix: Prefix): ScopedTranslateFunction<K, Prefix>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Server counterpart of `useDictionaryDynamic`, emitted by the optimize pass
|
|
11
|
+
* for dictionaries on the per-locale loader.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useDictionaryDynamic: UseDictionaryDynamic;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../src/react-server/useDictionaryDynamic.ts"],"mappings":";;;;KAaK;GACF,UAAU,YAAY,UAAU,gBAC/B,mBAAmB,qBAAqB,QAAQ,KAChD,KAAK,IACJ,kBAAkB;GACpB,UAAU,YAAY,UAAU,gBAAgB,uBAC/C,mBAAmB,qBAAqB,QAAQ,KAChD,KAAK,GACL,iBAAiB,SAChB,wBAAwB,GAAG;;;;;;qBAOnB,sBAiBP"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useLocale as useLocale$1 } from "next-intl";
|
|
2
|
+
//#region src/react-server/useLocale.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Server counterpart of `useLocale`, resolved from the `[locale]` route segment
|
|
5
|
+
* forwarded through `setRequestLocale` when the app provides one.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useLocale: typeof useLocale$1;
|
|
8
|
+
//#endregion
|
|
9
|
+
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/react-server/useLocale.ts"],"mappings":";;;;;;qBAOa,kBAAkB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DictionaryKeys } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { LooseTranslateFunction, TranslateFunction, TranslateFunctionForNamespace } from "@intlayer/use-intl";
|
|
3
|
+
//#region src/react-server/useTranslations.d.ts
|
|
4
|
+
type UseTranslations = {
|
|
5
|
+
<N extends DictionaryKeys>(namespace: N): TranslateFunction<N>;
|
|
6
|
+
<N extends `${string}.${string}`>(namespace: N): TranslateFunctionForNamespace<N>;
|
|
7
|
+
(): LooseTranslateFunction;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Server counterpart of `useTranslations`.
|
|
11
|
+
*
|
|
12
|
+
* next-intl's `useTranslations` is isomorphic — the same component code runs in
|
|
13
|
+
* a Server or a Client Component — so the adapter has to be too. Without this
|
|
14
|
+
* every component calling it is forced across the client boundary, which drags
|
|
15
|
+
* its dictionary into a client chunk that Next shares across every locale.
|
|
16
|
+
*
|
|
17
|
+
* The optimize pass normally rewrites these calls to `useDictionary` with the
|
|
18
|
+
* dictionary inlined; this runtime path covers the calls it could not resolve
|
|
19
|
+
* statically (a dynamic namespace, or an unoptimized build).
|
|
20
|
+
*/
|
|
21
|
+
export declare const useTranslations: UseTranslations;
|
|
22
|
+
//#endregion
|
|
23
|
+
//# sourceMappingURL=useTranslations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslations.d.ts","names":[],"sources":["../../../src/react-server/useTranslations.ts"],"mappings":";;;KAUK;GACF,UAAU,gBAAgB,WAAW,IAAI,kBAAkB;GAC3D,iCACC,WAAW,IACV,8BAA8B;MAC7B;;;;;;;;;;;;;;qBAsBO,iBAmBP"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/server/react/helpers.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Server counterparts of use-intl's ambient hooks. They mirror the client
|
|
4
|
+
* versions' signatures so the same component code type-checks on both sides.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useFormatter: typeof import('@intlayer/use-intl').useFormatter;
|
|
7
|
+
/** Current time on the server render. */
|
|
8
|
+
export declare const useNow: typeof import('@intlayer/use-intl').useNow;
|
|
9
|
+
/**
|
|
10
|
+
* Time zone the formatters resolve against — the same value the async
|
|
11
|
+
* `getTimeZone()` reports, so both server surfaces agree.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useTimeZone: typeof import('@intlayer/use-intl').useTimeZone;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","names":[],"sources":["../../../../src/server/react/helpers.ts"],"mappings":";;;;;qBAOa,kDAAkD;;qBAIlD,4CAA4C;;;;;qBAO5C,iDAAiD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NextIntlClientProvider, NextIntlClientProviderProps } from "../../client/NextIntlClientProvider.js";
|
|
2
|
+
import { Routing, defineRouting } from "../../routing.js";
|
|
3
|
+
import { useFormatter, useNow, useTimeZone } from "./helpers.js";
|
|
4
|
+
import { useDictionary } from "./useDictionary.js";
|
|
5
|
+
import { useDictionaryDynamic } from "./useDictionaryDynamic.js";
|
|
6
|
+
import { useLocale } from "./useLocale.js";
|
|
7
|
+
import { useTranslations } from "./useTranslations.js";
|
|
8
|
+
import { IntlError, IntlErrorCode, createFormatter, createTranslator, hasLocale, initializeConfig, useMessages } from "@intlayer/use-intl";
|
|
9
|
+
export { IntlError, IntlErrorCode, NextIntlClientProvider, type NextIntlClientProviderProps, type Routing, createFormatter, createTranslator, defineRouting, hasLocale, initializeConfig, useDictionary, useDictionaryDynamic, useFormatter, useLocale, useMessages, useNow, useTimeZone, useTranslations };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
+
//#region src/server/react/resolveLocale.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Locale for the synchronous server hooks, resolved the way `getLocale()`
|
|
5
|
+
* resolves it — so server-rendered output and the client provider never
|
|
6
|
+
* disagree about which locale the request is in.
|
|
7
|
+
*
|
|
8
|
+
* 1. The locale forwarded through `setRequestLocale(locale)` (the `[locale]`
|
|
9
|
+
* route segment), which is next-intl's source of truth for URL routing.
|
|
10
|
+
* 2. Otherwise Intlayer's ambient locale (server context, then the request).
|
|
11
|
+
*
|
|
12
|
+
* The second rung must stay lazy. It ends in `headers()` / `cookies()`, which
|
|
13
|
+
* opts the route into dynamic rendering: evaluating it eagerly took this
|
|
14
|
+
* package's own benchmark app from 14 prerendered pages to 0.
|
|
15
|
+
*/
|
|
16
|
+
export declare const resolveServerLocale: () => LocalesValues;
|
|
17
|
+
//#endregion
|
|
18
|
+
//# sourceMappingURL=resolveLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveLocale.d.ts","names":[],"sources":["../../../../src/server/react/resolveLocale.ts"],"mappings":";;;;;;;;;;;;;;;qBAsBa,2BAA0B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DictionaryKeys } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { ScopedTranslateFunction, TranslateFunction } from "@intlayer/use-intl";
|
|
3
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
+
//#region src/server/react/useDictionary.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Overload set mirroring the client `useDictionary` exactly, so the optimize
|
|
7
|
+
* pass can emit the same call shape whichever side of the boundary the
|
|
8
|
+
* component ends up on.
|
|
9
|
+
*/
|
|
10
|
+
type UseDictionary = {
|
|
11
|
+
<T extends Dictionary>(dictionary: T): TranslateFunction<T['key'] & DictionaryKeys>;
|
|
12
|
+
<T extends Dictionary, Prefix extends string>(dictionary: T, namespacePrefix: Prefix): ScopedTranslateFunction<T['key'] & DictionaryKeys, Prefix>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Server counterpart of `@intlayer/use-intl`'s `useDictionary`.
|
|
16
|
+
*
|
|
17
|
+
* The optimize pass rewrites every `useTranslations(...)` call to this helper
|
|
18
|
+
* with the dictionary pre-imported. Resolving it here — rather than in a client
|
|
19
|
+
* component — keeps the dictionary out of the client bundle entirely: the
|
|
20
|
+
* server renders the text and only the rendered output crosses the boundary.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useDictionary: UseDictionary;
|
|
23
|
+
//#endregion
|
|
24
|
+
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../../../src/server/react/useDictionary.ts"],"mappings":";;;;;;;;;KAeK;GACF,UAAU,YACT,YAAY,IACX,kBAAkB,WAAW;GAC/B,UAAU,YAAY,uBACrB,YAAY,GACZ,iBAAiB,SAChB,wBAAwB,WAAW,gBAAgB;;;;;;;;;;qBAW3C,eAQP"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DictionaryKeys } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { ScopedTranslateFunction, TranslateFunction } from "@intlayer/use-intl";
|
|
3
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
+
//#region src/server/react/useDictionaryDynamic.d.ts
|
|
5
|
+
type UseDictionaryDynamic = {
|
|
6
|
+
<T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: Record<string, () => Promise<T>>, key: K): TranslateFunction<K>;
|
|
7
|
+
<T extends Dictionary, K extends DictionaryKeys, Prefix extends string>(dictionaryPromise: Record<string, () => Promise<T>>, key: K, namespacePrefix: Prefix): ScopedTranslateFunction<K, Prefix>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Server counterpart of `useDictionaryDynamic`, emitted by the optimize pass
|
|
11
|
+
* for dictionaries on the per-locale loader.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useDictionaryDynamic: UseDictionaryDynamic;
|
|
14
|
+
//#endregion
|
|
15
|
+
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../../../src/server/react/useDictionaryDynamic.ts"],"mappings":";;;;KAUK;GACF,UAAU,YAAY,UAAU,gBAC/B,mBAAmB,qBAAqB,QAAQ,KAChD,KAAK,IACJ,kBAAkB;GACpB,UAAU,YAAY,UAAU,gBAAgB,uBAC/C,mBAAmB,qBAAqB,QAAQ,KAChD,KAAK,GACL,iBAAiB,SAChB,wBAAwB,GAAG;;;;;;qBAOnB,sBAaP"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useLocale as useLocale$1 } from "next-intl";
|
|
2
|
+
//#region src/server/react/useLocale.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Server counterpart of `useLocale`, resolved from the `[locale]` route segment
|
|
5
|
+
* forwarded through `setRequestLocale` when the app provides one.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useLocale: typeof useLocale$1;
|
|
8
|
+
//#endregion
|
|
9
|
+
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../../src/server/react/useLocale.ts"],"mappings":";;;;;;qBAOa,kBAAkB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DictionaryKeys } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { LooseTranslateFunction, TranslateFunction, TranslateFunctionForNamespace } from "@intlayer/use-intl";
|
|
3
|
+
//#region src/server/react/useTranslations.d.ts
|
|
4
|
+
type UseTranslations = {
|
|
5
|
+
<N extends DictionaryKeys>(namespace: N): TranslateFunction<N>;
|
|
6
|
+
<N extends `${string}.${string}`>(namespace: N): TranslateFunctionForNamespace<N>;
|
|
7
|
+
(): LooseTranslateFunction;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Server counterpart of `useTranslations`.
|
|
11
|
+
*
|
|
12
|
+
* next-intl's `useTranslations` is isomorphic — the same component code runs in
|
|
13
|
+
* a Server or a Client Component — so the adapter has to be too. Without this
|
|
14
|
+
* every component calling it is forced across the client boundary, which drags
|
|
15
|
+
* its dictionary into a client chunk that Next shares across every locale.
|
|
16
|
+
*
|
|
17
|
+
* The optimize pass normally rewrites these calls to `useDictionary` with the
|
|
18
|
+
* dictionary inlined; this runtime path covers the calls it could not resolve
|
|
19
|
+
* statically (a dynamic namespace, or an unoptimized build).
|
|
20
|
+
*/
|
|
21
|
+
export declare const useTranslations: UseTranslations;
|
|
22
|
+
//#endregion
|
|
23
|
+
//# sourceMappingURL=useTranslations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTranslations.d.ts","names":[],"sources":["../../../../src/server/react/useTranslations.ts"],"mappings":";;;KAUK;GACF,UAAU,gBAAgB,WAAW,IAAI,kBAAkB;GAC3D,iCACC,WAAW,IACV,8BAA8B;MAC7B;;;;;;;;;;;;;;qBAsBO,iBAmBP"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/next-intl",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "next-intl API adapter for intlayer — useTranslations, useLocale, getTranslations, getLocale, NextIntlClientProvider backed by next-intlayer",
|
|
6
6
|
"keywords": [
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"exports": {
|
|
37
37
|
".": {
|
|
38
38
|
"types": "./dist/types/index.d.ts",
|
|
39
|
+
"react-server": "./dist/esm/server/react/index.mjs",
|
|
39
40
|
"require": "./dist/cjs/index.cjs",
|
|
40
41
|
"import": "./dist/esm/index.mjs"
|
|
41
42
|
},
|
|
@@ -110,17 +111,17 @@
|
|
|
110
111
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
111
112
|
},
|
|
112
113
|
"dependencies": {
|
|
113
|
-
"@intlayer/config": "9.
|
|
114
|
-
"@intlayer/core": "9.
|
|
115
|
-
"@intlayer/dictionaries-entry": "9.
|
|
116
|
-
"@intlayer/engine": "9.
|
|
117
|
-
"@intlayer/types": "9.
|
|
118
|
-
"@intlayer/use-intl": "9.
|
|
119
|
-
"next-intlayer": "9.
|
|
120
|
-
"react-intlayer": "9.
|
|
114
|
+
"@intlayer/config": "9.5.0",
|
|
115
|
+
"@intlayer/core": "9.5.0",
|
|
116
|
+
"@intlayer/dictionaries-entry": "9.5.0",
|
|
117
|
+
"@intlayer/engine": "9.5.0",
|
|
118
|
+
"@intlayer/types": "9.5.0",
|
|
119
|
+
"@intlayer/use-intl": "9.5.0",
|
|
120
|
+
"next-intlayer": "9.5.0",
|
|
121
|
+
"react-intlayer": "9.5.0"
|
|
121
122
|
},
|
|
122
123
|
"devDependencies": {
|
|
123
|
-
"@types/node": "26.
|
|
124
|
+
"@types/node": "26.5.0",
|
|
124
125
|
"@types/react": "19.2.18",
|
|
125
126
|
"@utils/ts-config": "1.0.4",
|
|
126
127
|
"@utils/ts-config-types": "1.0.4",
|