@intlayer/next-intl 9.4.3 → 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/client/NextIntlClientProvider.d.ts +2 -3
- package/dist/types/client/NextIntlClientProvider.d.ts.map +1 -1
- package/dist/types/client/useLocale.d.ts +1 -2
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/getDictionary.d.ts +1 -2
- package/dist/types/getDictionary.d.ts.map +1 -1
- package/dist/types/getDictionaryDynamic.d.ts +1 -2
- package/dist/types/getDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/middleware.d.ts +2 -2
- package/dist/types/middleware.d.ts.map +1 -1
- package/dist/types/navigation/Link.d.ts +2 -3
- package/dist/types/navigation/Link.d.ts.map +1 -1
- package/dist/types/navigation/createNavigation.d.ts +2 -2
- package/dist/types/navigation/createNavigation.d.ts.map +1 -1
- package/dist/types/navigation/hooks.d.ts +2 -3
- package/dist/types/navigation/hooks.d.ts.map +1 -1
- package/dist/types/navigation/localizeHref.d.ts +2 -3
- package/dist/types/navigation/localizeHref.d.ts.map +1 -1
- package/dist/types/plugin/index.d.ts +2 -2
- 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/routing.d.ts +2 -3
- package/dist/types/routing.d.ts.map +1 -1
- package/dist/types/server/getLocale.d.ts +1 -2
- package/dist/types/server/getLocale.d.ts.map +1 -1
- package/dist/types/server/getMessages.d.ts +1 -2
- package/dist/types/server/getMessages.d.ts.map +1 -1
- package/dist/types/server/getRequestConfig.d.ts +2 -2
- package/dist/types/server/getRequestConfig.d.ts.map +1 -1
- package/dist/types/server/getTranslations.d.ts +1 -2
- package/dist/types/server/getTranslations.d.ts.map +1 -1
- package/dist/types/server/helpers.d.ts +3 -4
- package/dist/types/server/helpers.d.ts.map +1 -1
- 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/dist/types/server/requestLocaleCache.d.ts +2 -3
- package/dist/types/server/requestLocaleCache.d.ts.map +1 -1
- package/dist/types/server/setLocale.d.ts +1 -2
- package/dist/types/server/setLocale.d.ts.map +1 -1
- package/dist/types/server/setRequestLocale.d.ts +1 -2
- package/dist/types/server/setRequestLocale.d.ts.map +1 -1
- package/package.json +14 -13
|
@@ -3,7 +3,6 @@ import { useLocale as useLocale$1 } from "next-intl";
|
|
|
3
3
|
/**
|
|
4
4
|
* Drop-in for next-intl's `useLocale`.
|
|
5
5
|
*/
|
|
6
|
-
declare const useLocale: typeof useLocale$1;
|
|
6
|
+
export declare const useLocale: typeof useLocale$1;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { useLocale };
|
|
9
8
|
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;;;;qBAQa,kBAAkB"}
|
|
@@ -29,7 +29,6 @@ type GetDictionary = {
|
|
|
29
29
|
* `getTranslations` is always awaited, so an async resolver is a drop-in
|
|
30
30
|
* replacement.
|
|
31
31
|
*/
|
|
32
|
-
declare const getDictionary: GetDictionary;
|
|
32
|
+
export declare const getDictionary: GetDictionary;
|
|
33
33
|
//#endregion
|
|
34
|
-
export { getDictionary };
|
|
35
34
|
//# sourceMappingURL=getDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../src/getDictionary.ts"],"mappings":";;;;;;;;;;KAkCK;GACF,UAAU,YAAY,uBACrB,YAAY,GACZ,iBAAiB,SAChB,QAAQ,wBAAwB,WAAW,gBAAgB;GAC7D,UAAU,YACT,YAAY,GACZ;IAAY,SAAS;MACpB,QAAQ,kBAAkB,WAAW;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getDictionary.d.ts","names":[],"sources":["../../src/getDictionary.ts"],"mappings":";;;;;;;;;;KAkCK;GACF,UAAU,YAAY,uBACrB,YAAY,GACZ,iBAAiB,SAChB,QAAQ,wBAAwB,WAAW,gBAAgB;GAC7D,UAAU,YACT,YAAY,GACZ;IAAY,SAAS;MACpB,QAAQ,kBAAkB,WAAW;;;;;;;;;;;;;;;;;qBAkB7B,eASP"}
|
|
@@ -17,7 +17,6 @@ type GetDictionaryDynamic = {
|
|
|
17
17
|
* Counterpart to {@link getDictionary} for dictionaries imported lazily per
|
|
18
18
|
* locale. Used internally by the build-time optimization.
|
|
19
19
|
*/
|
|
20
|
-
declare const getDictionaryDynamic: GetDictionaryDynamic;
|
|
20
|
+
export declare const getDictionaryDynamic: GetDictionaryDynamic;
|
|
21
21
|
//#endregion
|
|
22
|
-
export { getDictionaryDynamic };
|
|
23
22
|
//# sourceMappingURL=getDictionaryDynamic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionaryDynamic.d.ts","names":[],"sources":["../../src/getDictionaryDynamic.ts"],"mappings":";;;;;;;;;KAmBK;GACF,UAAU,YAAY,UAAU,gBAC/B,mBAAmB,0BAA0B,QAAQ,KACrD,KAAK,IACJ,QAAQ,kBAAkB;GAC5B,UAAU,YAAY,UAAU,gBAAgB,uBAC/C,mBAAmB,0BAA0B,QAAQ,KACrD,KAAK,GACL,iBAAiB,SAChB,QAAQ,wBAAwB,GAAG;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getDictionaryDynamic.d.ts","names":[],"sources":["../../src/getDictionaryDynamic.ts"],"mappings":";;;;;;;;;KAmBK;GACF,UAAU,YAAY,UAAU,gBAC/B,mBAAmB,0BAA0B,QAAQ,KACrD,KAAK,IACJ,QAAQ,kBAAkB;GAC5B,UAAU,YAAY,UAAU,gBAAgB,uBAC/C,mBAAmB,0BAA0B,QAAQ,KACrD,KAAK,GACL,iBAAiB,SAChB,QAAQ,wBAAwB,GAAG;;;;;;;;qBAS3B,sBAYP"}
|
|
@@ -15,7 +15,7 @@ import _createMiddleware from "next-intl/middleware";
|
|
|
15
15
|
* export const config = { matcher: ['/((?!api|_next|.*\\..*).*)'] };
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
declare const createMiddleware: typeof _createMiddleware;
|
|
18
|
+
export declare const createMiddleware: typeof _createMiddleware;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { createMiddleware
|
|
20
|
+
export { createMiddleware as default };
|
|
21
21
|
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","names":[],"sources":["../../src/middleware.ts"],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","names":[],"sources":["../../src/middleware.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAmBa,yBAAyB"}
|
|
@@ -6,7 +6,7 @@ import NextLink from "next/link";
|
|
|
6
6
|
* Props for the compat `Link`: identical to `next/link` except `href` accepts a
|
|
7
7
|
* `next-intl` href and an optional `locale` overrides the current one.
|
|
8
8
|
*/
|
|
9
|
-
type LinkProps = Omit<ComponentPropsWithoutRef<typeof NextLink>, 'href' | 'locale'> & {
|
|
9
|
+
export type LinkProps = Omit<ComponentPropsWithoutRef<typeof NextLink>, 'href' | 'locale'> & {
|
|
10
10
|
href: NextIntlHref;
|
|
11
11
|
locale?: string;
|
|
12
12
|
};
|
|
@@ -15,12 +15,11 @@ type LinkProps = Omit<ComponentPropsWithoutRef<typeof NextLink>, 'href' | 'local
|
|
|
15
15
|
* `href` with the active locale (or the `locale` prop) before delegating to
|
|
16
16
|
* `next/link`.
|
|
17
17
|
*/
|
|
18
|
-
declare const Link: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, keyof import("next/link").LinkProps<any>> & import("next/link").LinkProps<any> & {
|
|
18
|
+
export declare const Link: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, keyof import("next/link").LinkProps<any>> & import("next/link").LinkProps<any> & {
|
|
19
19
|
children?: React.ReactNode | undefined;
|
|
20
20
|
} & import("react").RefAttributes<HTMLAnchorElement>, "ref">, "href" | "locale"> & {
|
|
21
21
|
href: NextIntlHref;
|
|
22
22
|
locale?: string;
|
|
23
23
|
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { Link, LinkProps };
|
|
26
25
|
//# sourceMappingURL=Link.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","names":[],"sources":["../../../src/navigation/Link.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"Link.d.ts","names":[],"sources":["../../../src/navigation/Link.tsx"],"mappings":";;;;;;;;YAWY,YAAY,KACtB,gCAAgC;EAGhC,MAAM;EACN;;;;;;;qBAQW,sBAAI,0BAAA,KAAA,KAAA,qBAAA,qBAAA,8CAAA,sCAAA;;;EATT,MAAA;EACG;oBAiBV,cAAA"}
|
|
@@ -14,7 +14,7 @@ import { createNavigation as createNavigation$1 } from "next-intl/navigation";
|
|
|
14
14
|
* createNavigation();
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
declare const createNavigation: typeof createNavigation$1;
|
|
17
|
+
export declare const createNavigation: typeof createNavigation$1;
|
|
18
18
|
//#endregion
|
|
19
|
-
export { createNavigation
|
|
19
|
+
export { createNavigation as default };
|
|
20
20
|
//# sourceMappingURL=createNavigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNavigation.d.ts","names":[],"sources":["../../../src/navigation/createNavigation.ts"],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"createNavigation.d.ts","names":[],"sources":["../../../src/navigation/createNavigation.ts"],"mappings":";;;;;;;;;;;;;;;;qBA6Ba,yBAAyB"}
|
|
@@ -11,13 +11,13 @@ type NavigateOptions = {
|
|
|
11
11
|
* Drop-in for the `usePathname` returned by next-intl's `createNavigation`.
|
|
12
12
|
* Returns the current pathname with the locale prefix stripped.
|
|
13
13
|
*/
|
|
14
|
-
declare const usePathname: () => string;
|
|
14
|
+
export declare const usePathname: () => string;
|
|
15
15
|
/**
|
|
16
16
|
* Drop-in for the `useRouter` returned by next-intl's `createNavigation`.
|
|
17
17
|
* Wraps the Next.js router so `push`/`replace`/`prefetch` localize their href
|
|
18
18
|
* (honouring an optional `locale` option) before navigating.
|
|
19
19
|
*/
|
|
20
|
-
declare const useRouter: () => {
|
|
20
|
+
export declare const useRouter: () => {
|
|
21
21
|
back(): void;
|
|
22
22
|
forward(): void;
|
|
23
23
|
refresh(): void;
|
|
@@ -28,5 +28,4 @@ declare const useRouter: () => {
|
|
|
28
28
|
prefetch: (href: NextIntlHref, options?: NavigateOptions) => void;
|
|
29
29
|
};
|
|
30
30
|
//#endregion
|
|
31
|
-
export { usePathname, useRouter };
|
|
32
31
|
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","names":[],"sources":["../../../src/navigation/hooks.ts"],"mappings":";;;;;;KAaK;EAAoB;IAAoB;;;;;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","names":[],"sources":["../../../src/navigation/hooks.ts"],"mappings":";;;;;;KAaK;EAAoB;IAAoB;;;;;qBAMhC;;;;;;qBAeA;;;;;;EASI,OAAA,MAAA,cAAY,UAAY;EAKrB,UAAA,MAAA,cAAY,UAAY;EAKvB,WAAA,MAAA,cAAY,UAAY"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `pathname` and optional `query`. The `pathnames` (typed routes) feature is
|
|
5
5
|
* accepted for API compatibility but not interpolated.
|
|
6
6
|
*/
|
|
7
|
-
type NextIntlHref = string | {
|
|
7
|
+
export type NextIntlHref = string | {
|
|
8
8
|
pathname: string;
|
|
9
9
|
query?: Record<string, string | number | (string | number)[]>;
|
|
10
10
|
params?: Record<string, string | number | (string | number)[]>;
|
|
@@ -17,7 +17,6 @@ type NextIntlHref = string | {
|
|
|
17
17
|
* @param locale - The locale to localize the href for.
|
|
18
18
|
* @returns The localized URL string.
|
|
19
19
|
*/
|
|
20
|
-
declare const localizeHref: (href: NextIntlHref, locale: string) => string;
|
|
20
|
+
export declare const localizeHref: (href: NextIntlHref, locale: string) => string;
|
|
21
21
|
//#endregion
|
|
22
|
-
export { NextIntlHref, localizeHref };
|
|
23
22
|
//# sourceMappingURL=localizeHref.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localizeHref.d.ts","names":[],"sources":["../../../src/navigation/localizeHref.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"localizeHref.d.ts","names":[],"sources":["../../../src/navigation/localizeHref.ts"],"mappings":";;;;;;YAQY;EAGN;EACA,QAAQ;EACR,SAAS;;;;;;;;;;qBAWF,eAAY,MAAU,cAAY"}
|
|
@@ -5,7 +5,7 @@ import { NextConfig } from "next";
|
|
|
5
5
|
* and configures resolve aliases so `next-intl` imports are served by
|
|
6
6
|
* `@intlayer/next-intl`.
|
|
7
7
|
*/
|
|
8
|
-
declare const createNextIntlPlugin: (_i18nPath?: string) => (nextConfig?: NextConfig) => Promise<NextConfig>;
|
|
8
|
+
export declare const createNextIntlPlugin: (_i18nPath?: string) => (nextConfig?: NextConfig) => Promise<NextConfig>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { createNextIntlPlugin
|
|
10
|
+
export { createNextIntlPlugin as default };
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/plugin/index.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/plugin/index.ts"],"mappings":";;;;;;;qBA0Ia,uBAAoB,wBAAsB,aAC3B,eAAkB,QAAQ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/react-server/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
|
+
/** Time zone used by the formatters; UTC unless the app overrides it. */
|
|
10
|
+
export declare const useTimeZone: typeof import('@intlayer/use-intl').useTimeZone;
|
|
11
|
+
//#endregion
|
|
12
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","names":[],"sources":["../../../src/react-server/helpers.ts"],"mappings":";;;;;qBAOa,kDAAkD;;qBAIlD,4CAA4C;;qBAI5C,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,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"}
|
package/dist/types/routing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
2
|
//#region src/routing.d.ts
|
|
3
|
-
type Routing = {
|
|
3
|
+
export type Routing = {
|
|
4
4
|
locales: LocalesValues[];
|
|
5
5
|
defaultLocale: LocalesValues;
|
|
6
6
|
localePrefix?: 'always' | 'as-needed' | 'never';
|
|
@@ -21,7 +21,6 @@ type Routing = {
|
|
|
21
21
|
* });
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
declare const defineRouting: (config?: Partial<Routing>) => Routing;
|
|
24
|
+
export declare const defineRouting: (config?: Partial<Routing>) => Routing;
|
|
25
25
|
//#endregion
|
|
26
|
-
export { Routing, defineRouting };
|
|
27
26
|
//# sourceMappingURL=routing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","names":[],"sources":["../../src/routing.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"routing.d.ts","names":[],"sources":["../../src/routing.ts"],"mappings":";;YAGY;EACV,SAAS;EACT,eAAe;EACf;EACA,YAAY,wBAAwB;;;;;;;;;;;;;;;;;qBAkBzB,gBAAgB,SAAS,QAAQ,aAAa"}
|
|
@@ -12,7 +12,6 @@ import { getLocale as getLocale$1 } from "next-intl/server";
|
|
|
12
12
|
* 2. Otherwise Intlayer's own resolution (cookie / header / Accept-Language),
|
|
13
13
|
* for apps that drive the locale from storage rather than the route.
|
|
14
14
|
*/
|
|
15
|
-
declare const getLocale: typeof getLocale$1;
|
|
15
|
+
export declare const getLocale: typeof getLocale$1;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { getLocale };
|
|
18
17
|
//# sourceMappingURL=getLocale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocale.d.ts","names":[],"sources":["../../../src/server/getLocale.ts"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getLocale.d.ts","names":[],"sources":["../../../src/server/getLocale.ts"],"mappings":";;;;;;;;;;;;;;qBAgBa,kBAAkB"}
|
|
@@ -15,7 +15,6 @@ import { getMessages as getMessages$1 } from "next-intl/server";
|
|
|
15
15
|
* @deprecated getMessages has no use case with intlayer.
|
|
16
16
|
* Messages are loaded automatically under the hood
|
|
17
17
|
*/
|
|
18
|
-
declare const getMessages: typeof getMessages$1;
|
|
18
|
+
export declare const getMessages: typeof getMessages$1;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { getMessages };
|
|
21
20
|
//# sourceMappingURL=getMessages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMessages.d.ts","names":[],"sources":["../../../src/server/getMessages.ts"],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getMessages.d.ts","names":[],"sources":["../../../src/server/getMessages.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAoBa,oBAAoB"}
|
|
@@ -12,7 +12,7 @@ import { getRequestConfig as getRequestConfig$1 } from "next-intl/server";
|
|
|
12
12
|
* @deprecated getRequestConfig has no use case with intlayer. The locale and
|
|
13
13
|
* messages are resolved automatically; the file can be removed.
|
|
14
14
|
*/
|
|
15
|
-
declare const getRequestConfig: typeof getRequestConfig$1;
|
|
15
|
+
export declare const getRequestConfig: typeof getRequestConfig$1;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { getRequestConfig as default
|
|
17
|
+
export { getRequestConfig as default };
|
|
18
18
|
//# sourceMappingURL=getRequestConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRequestConfig.d.ts","names":[],"sources":["../../../src/server/getRequestConfig.ts"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getRequestConfig.d.ts","names":[],"sources":["../../../src/server/getRequestConfig.ts"],"mappings":";;;;;;;;;;;;;;qBAiBa,yBAAyB"}
|
|
@@ -59,7 +59,6 @@ type GetTranslations = {
|
|
|
59
59
|
* t.rich('terms', { link: (chunks) => <a href="/terms">{chunks}</a> });
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
|
-
declare const getTranslations: GetTranslations;
|
|
62
|
+
export declare const getTranslations: GetTranslations;
|
|
63
63
|
//#endregion
|
|
64
|
-
export { getTranslations };
|
|
65
64
|
//# sourceMappingURL=getTranslations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTranslations.d.ts","names":[],"sources":["../../../src/server/getTranslations.ts"],"mappings":";;;;;;KAeK,uBAAuB,UAAU;;EAEpC,YAAY;;EAEZ,SAAS;;;;;;;;;;;;;;;;;KAkBN;GACF,UAAU,gBAAgB,WAAW,IAAI,QAAQ,kBAAkB;GACnE,UAAU,gBACT,SAAS,uBAAuB,KAC/B,QAAQ,kBAAkB;GAC5B,iCACC,WAAW,IACV,QAAQ,8BAA8B;MACrC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getTranslations.d.ts","names":[],"sources":["../../../src/server/getTranslations.ts"],"mappings":";;;;;;KAeK,uBAAuB,UAAU;;EAEpC,YAAY;;EAEZ,SAAS;;;;;;;;;;;;;;;;;KAkBN;GACF,UAAU,gBAAgB,WAAW,IAAI,QAAQ,kBAAkB;GACnE,UAAU,gBACT,SAAS,uBAAuB,KAC/B,QAAQ,kBAAkB;GAC5B,iCACC,WAAW,IACV,QAAQ,8BAA8B;MACrC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA+BD,iBAAiB"}
|
|
@@ -5,17 +5,16 @@ import { getFormatter as getFormatter$1, getNow as getNow$1, getTimeZone as getT
|
|
|
5
5
|
* Returns locale-aware formatters backed by the native `Intl.*` APIs,
|
|
6
6
|
* built by `@intlayer/use-intl`'s `createFormatter`.
|
|
7
7
|
*/
|
|
8
|
-
declare const getFormatter: typeof getFormatter$1;
|
|
8
|
+
export declare const getFormatter: typeof getFormatter$1;
|
|
9
9
|
/**
|
|
10
10
|
* Drop-in for next-intl's server `getNow()`.
|
|
11
11
|
* Returns the current `Date`.
|
|
12
12
|
*/
|
|
13
|
-
declare const getNow: typeof getNow$1;
|
|
13
|
+
export declare const getNow: typeof getNow$1;
|
|
14
14
|
/**
|
|
15
15
|
* Drop-in for next-intl's server `getTimeZone()`.
|
|
16
16
|
* Returns the system time zone resolved from `Intl.DateTimeFormat`.
|
|
17
17
|
*/
|
|
18
|
-
declare const getTimeZone: typeof getTimeZone$1;
|
|
18
|
+
export declare const getTimeZone: typeof getTimeZone$1;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { getFormatter, getNow, getTimeZone };
|
|
21
20
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","names":[],"sources":["../../../src/server/helpers.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","names":[],"sources":["../../../src/server/helpers.ts"],"mappings":";;;;;;;qBAaa,qBAAqB;;;;;qBAWrB,eAAe;;;;;qBAOf,oBAAoB"}
|
|
@@ -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"}
|
|
@@ -4,13 +4,12 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
|
4
4
|
* Read the locale stored for the current request, or `undefined` when
|
|
5
5
|
* `setRequestLocale` has not been called.
|
|
6
6
|
*/
|
|
7
|
-
declare const getCachedRequestLocale: () => LocalesValues | undefined;
|
|
7
|
+
export declare const getCachedRequestLocale: () => LocalesValues | undefined;
|
|
8
8
|
/**
|
|
9
9
|
* Store the locale for the current request. Called by `setRequestLocale`.
|
|
10
10
|
*
|
|
11
11
|
* @param locale - The locale resolved from the `[locale]` route segment.
|
|
12
12
|
*/
|
|
13
|
-
declare const setCachedRequestLocale: (locale: LocalesValues) => void;
|
|
13
|
+
export declare const setCachedRequestLocale: (locale: LocalesValues) => void;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { getCachedRequestLocale, setCachedRequestLocale };
|
|
16
15
|
//# sourceMappingURL=requestLocaleCache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestLocaleCache.d.ts","names":[],"sources":["../../../src/server/requestLocaleCache.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"requestLocaleCache.d.ts","names":[],"sources":["../../../src/server/requestLocaleCache.ts"],"mappings":";;;;;;qBAuBa,8BAA6B;;;;;;qBAQ7B,yBAAsB,QAAY"}
|