@intlayer/next-intl 9.6.0 → 9.7.1
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/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/cjs/client/NextIntlClientProvider.cjs +2 -3
- package/dist/cjs/client/index.cjs +11 -11
- package/dist/cjs/client/useLocale.cjs +1 -2
- package/dist/cjs/getDictionary.cjs +2 -3
- package/dist/cjs/getDictionaryDynamic.cjs +2 -3
- package/dist/cjs/index.cjs +18 -18
- package/dist/cjs/middleware.cjs +1 -2
- package/dist/cjs/navigation/Link.cjs +4 -5
- package/dist/cjs/navigation/createNavigation.cjs +4 -5
- package/dist/cjs/navigation/hooks.cjs +3 -4
- package/dist/cjs/navigation/index.cjs +3 -3
- package/dist/cjs/navigation/localizeHref.cjs +1 -2
- package/dist/cjs/plugin/index.cjs +3 -4
- package/dist/cjs/routing.cjs +1 -2
- package/dist/cjs/server/getLocale.cjs +2 -3
- package/dist/cjs/server/getMessages.cjs +1 -2
- package/dist/cjs/server/getRequestConfig.cjs +1 -2
- package/dist/cjs/server/getTranslations.cjs +2 -3
- package/dist/cjs/server/helpers.cjs +2 -3
- package/dist/cjs/server/index.cjs +9 -9
- package/dist/cjs/server/react/helpers.cjs +2 -3
- package/dist/cjs/server/react/index.cjs +14 -14
- package/dist/cjs/server/react/resolveLocale.cjs +2 -3
- package/dist/cjs/server/react/useDictionary.cjs +2 -3
- package/dist/cjs/server/react/useDictionaryDynamic.cjs +2 -3
- package/dist/cjs/server/react/useLocale.cjs +2 -3
- package/dist/cjs/server/react/useTranslations.cjs +2 -3
- package/dist/cjs/server/requestLocaleCache.cjs +1 -2
- package/dist/cjs/server/setLocale.cjs +1 -2
- package/dist/cjs/server/setRequestLocale.cjs +2 -3
- package/dist/esm/client/NextIntlClientProvider.mjs +2 -3
- package/dist/esm/client/useLocale.mjs +1 -2
- package/dist/esm/getDictionary.mjs +1 -2
- package/dist/esm/getDictionaryDynamic.mjs +1 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/middleware.mjs +1 -2
- package/dist/esm/navigation/Link.mjs +2 -3
- package/dist/esm/navigation/createNavigation.mjs +3 -4
- package/dist/esm/navigation/hooks.mjs +2 -3
- package/dist/esm/navigation/index.mjs +2 -2
- package/dist/esm/navigation/localizeHref.mjs +1 -2
- package/dist/esm/plugin/index.mjs +2 -3
- package/dist/esm/routing.mjs +1 -2
- package/dist/esm/server/getLocale.mjs +1 -2
- package/dist/esm/server/getMessages.mjs +1 -2
- package/dist/esm/server/getRequestConfig.mjs +1 -2
- package/dist/esm/server/getTranslations.mjs +1 -2
- package/dist/esm/server/helpers.mjs +1 -2
- package/dist/esm/server/index.mjs +3 -3
- package/dist/esm/server/react/helpers.mjs +1 -2
- package/dist/esm/server/react/index.mjs +3 -3
- package/dist/esm/server/react/resolveLocale.mjs +1 -2
- package/dist/esm/server/react/useDictionary.mjs +1 -2
- package/dist/esm/server/react/useDictionaryDynamic.mjs +1 -2
- package/dist/esm/server/react/useLocale.mjs +1 -2
- package/dist/esm/server/react/useTranslations.mjs +1 -2
- package/dist/esm/server/requestLocaleCache.mjs +1 -2
- package/dist/esm/server/setLocale.mjs +1 -2
- package/dist/esm/server/setRequestLocale.mjs +1 -2
- package/dist/types/client/NextIntlClientProvider.d.ts +0 -2
- package/dist/types/client/NextIntlClientProvider.d.ts.map +1 -1
- package/dist/types/client/useLocale.d.ts +0 -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 +0 -2
- package/dist/types/middleware.d.ts.map +1 -1
- package/dist/types/navigation/Link.d.ts +0 -2
- package/dist/types/navigation/Link.d.ts.map +1 -1
- package/dist/types/navigation/createNavigation.d.ts +0 -2
- package/dist/types/navigation/createNavigation.d.ts.map +1 -1
- package/dist/types/navigation/hooks.d.ts +1 -2
- package/dist/types/navigation/hooks.d.ts.map +1 -1
- package/dist/types/navigation/index.d.ts +2 -2
- package/dist/types/navigation/localizeHref.d.ts +0 -2
- package/dist/types/navigation/localizeHref.d.ts.map +1 -1
- package/dist/types/plugin/index.d.ts +0 -2
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/routing.d.ts +0 -2
- package/dist/types/routing.d.ts.map +1 -1
- package/dist/types/server/getLocale.d.ts +0 -2
- package/dist/types/server/getLocale.d.ts.map +1 -1
- package/dist/types/server/getMessages.d.ts +0 -2
- package/dist/types/server/getMessages.d.ts.map +1 -1
- package/dist/types/server/getRequestConfig.d.ts +0 -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 +0 -2
- package/dist/types/server/helpers.d.ts.map +1 -1
- package/dist/types/server/react/helpers.d.ts +0 -2
- package/dist/types/server/react/helpers.d.ts.map +1 -1
- package/dist/types/server/react/resolveLocale.d.ts +0 -2
- package/dist/types/server/react/resolveLocale.d.ts.map +1 -1
- package/dist/types/server/react/useDictionary.d.ts +1 -2
- package/dist/types/server/react/useDictionary.d.ts.map +1 -1
- package/dist/types/server/react/useDictionaryDynamic.d.ts +1 -2
- package/dist/types/server/react/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/server/react/useLocale.d.ts +0 -2
- package/dist/types/server/react/useLocale.d.ts.map +1 -1
- package/dist/types/server/react/useTranslations.d.ts +1 -2
- package/dist/types/server/react/useTranslations.d.ts.map +1 -1
- package/dist/types/server/requestLocaleCache.d.ts +0 -2
- package/dist/types/server/requestLocaleCache.d.ts.map +1 -1
- package/dist/types/server/setLocale.d.ts +0 -2
- package/dist/types/server/setLocale.d.ts.map +1 -1
- package/dist/types/server/setRequestLocale.d.ts +0 -2
- package/dist/types/server/setRequestLocale.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const require_server_react_useDictionaryDynamic = require(
|
|
7
|
-
const
|
|
8
|
-
const require_server_react_useTranslations = require(
|
|
2
|
+
const require_client_NextIntlClientProvider = require("../../client/NextIntlClientProvider.cjs");
|
|
3
|
+
const require_routing = require("../../routing.cjs");
|
|
4
|
+
const require_server_react_helpers = require("./helpers.cjs");
|
|
5
|
+
const require_server_react_useDictionary = require("./useDictionary.cjs");
|
|
6
|
+
const require_server_react_useDictionaryDynamic = require("./useDictionaryDynamic.cjs");
|
|
7
|
+
const require_server_react_useLocale = require("./useLocale.cjs");
|
|
8
|
+
const require_server_react_useTranslations = require("./useTranslations.cjs");
|
|
9
9
|
let _intlayer_use_intl = require("@intlayer/use-intl");
|
|
10
10
|
|
|
11
|
-
Object.defineProperty(exports,
|
|
11
|
+
Object.defineProperty(exports, "IntlError", {
|
|
12
12
|
enumerable: true,
|
|
13
13
|
get: function () {
|
|
14
14
|
return _intlayer_use_intl.IntlError;
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports,
|
|
17
|
+
Object.defineProperty(exports, "IntlErrorCode", {
|
|
18
18
|
enumerable: true,
|
|
19
19
|
get: function () {
|
|
20
20
|
return _intlayer_use_intl.IntlErrorCode;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
exports.NextIntlClientProvider = require_client_NextIntlClientProvider.NextIntlClientProvider;
|
|
24
|
-
Object.defineProperty(exports,
|
|
24
|
+
Object.defineProperty(exports, "createFormatter", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function () {
|
|
27
27
|
return _intlayer_use_intl.createFormatter;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports,
|
|
30
|
+
Object.defineProperty(exports, "createTranslator", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function () {
|
|
33
33
|
return _intlayer_use_intl.createTranslator;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
exports.defineRouting = require_routing.defineRouting;
|
|
37
|
-
Object.defineProperty(exports,
|
|
37
|
+
Object.defineProperty(exports, "hasLocale", {
|
|
38
38
|
enumerable: true,
|
|
39
39
|
get: function () {
|
|
40
40
|
return _intlayer_use_intl.hasLocale;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
Object.defineProperty(exports,
|
|
43
|
+
Object.defineProperty(exports, "initializeConfig", {
|
|
44
44
|
enumerable: true,
|
|
45
45
|
get: function () {
|
|
46
46
|
return _intlayer_use_intl.initializeConfig;
|
|
@@ -50,7 +50,7 @@ exports.useDictionary = require_server_react_useDictionary.useDictionary;
|
|
|
50
50
|
exports.useDictionaryDynamic = require_server_react_useDictionaryDynamic.useDictionaryDynamic;
|
|
51
51
|
exports.useFormatter = require_server_react_helpers.useFormatter;
|
|
52
52
|
exports.useLocale = require_server_react_useLocale.useLocale;
|
|
53
|
-
Object.defineProperty(exports,
|
|
53
|
+
Object.defineProperty(exports, "useMessages", {
|
|
54
54
|
enumerable: true,
|
|
55
55
|
get: function () {
|
|
56
56
|
return _intlayer_use_intl.useMessages;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_server_requestLocaleCache = require(
|
|
2
|
+
const require_server_requestLocaleCache = require("../requestLocaleCache.cjs");
|
|
3
3
|
let next_intlayer_server = require("next-intlayer/server");
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/server/react/resolveLocale.ts
|
|
6
6
|
/**
|
|
7
7
|
* Locale for the synchronous server hooks, resolved the way `getLocale()`
|
|
8
8
|
* resolves it — so server-rendered output and the client provider never
|
|
@@ -22,6 +22,5 @@ const resolveServerLocale = () => {
|
|
|
22
22
|
return (0, next_intlayer_server.useLocale)().locale;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
//#endregion
|
|
26
25
|
exports.resolveServerLocale = resolveServerLocale;
|
|
27
26
|
//# sourceMappingURL=resolveLocale.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_server_react_resolveLocale = require(
|
|
2
|
+
const require_server_react_resolveLocale = require("./resolveLocale.cjs");
|
|
3
3
|
let _intlayer_use_intl = require("@intlayer/use-intl");
|
|
4
4
|
let next_intlayer_server = require("next-intlayer/server");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/server/react/useDictionary.ts
|
|
7
7
|
/**
|
|
8
8
|
* Server counterpart of `@intlayer/use-intl`'s `useDictionary`.
|
|
9
9
|
*
|
|
@@ -18,6 +18,5 @@ const useDictionary = ((dictionary, namespacePrefix) => {
|
|
|
18
18
|
return (0, _intlayer_use_intl.createDictionaryTranslator)(locale, content, namespacePrefix);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
//#endregion
|
|
22
21
|
exports.useDictionary = useDictionary;
|
|
23
22
|
//# sourceMappingURL=useDictionary.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_server_react_resolveLocale = require(
|
|
2
|
+
const require_server_react_resolveLocale = require("./resolveLocale.cjs");
|
|
3
3
|
let _intlayer_use_intl = require("@intlayer/use-intl");
|
|
4
4
|
let next_intlayer_server = require("next-intlayer/server");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/server/react/useDictionaryDynamic.ts
|
|
7
7
|
/**
|
|
8
8
|
* Server counterpart of `useDictionaryDynamic`, emitted by the optimize pass
|
|
9
9
|
* for dictionaries on the per-locale loader.
|
|
@@ -14,6 +14,5 @@ const useDictionaryDynamic = ((dictionaryPromise, key, namespacePrefix) => {
|
|
|
14
14
|
return (0, _intlayer_use_intl.createDictionaryTranslator)(locale, content, namespacePrefix);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
//#endregion
|
|
18
17
|
exports.useDictionaryDynamic = useDictionaryDynamic;
|
|
19
18
|
//# sourceMappingURL=useDictionaryDynamic.cjs.map
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_server_react_resolveLocale = require(
|
|
2
|
+
const require_server_react_resolveLocale = require("./resolveLocale.cjs");
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/server/react/useLocale.ts
|
|
5
5
|
/**
|
|
6
6
|
* Server counterpart of `useLocale`, resolved from the `[locale]` route segment
|
|
7
7
|
* forwarded through `setRequestLocale` when the app provides one.
|
|
8
8
|
*/
|
|
9
9
|
const useLocale = () => require_server_react_resolveLocale.resolveServerLocale();
|
|
10
10
|
|
|
11
|
-
//#endregion
|
|
12
11
|
exports.useLocale = useLocale;
|
|
13
12
|
//# sourceMappingURL=useLocale.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_server_react_resolveLocale = require(
|
|
2
|
+
const require_server_react_resolveLocale = require("./resolveLocale.cjs");
|
|
3
3
|
let _intlayer_use_intl = require("@intlayer/use-intl");
|
|
4
4
|
let _intlayer_core_interpreter = require("@intlayer/core/interpreter");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/server/react/useTranslations.ts
|
|
7
7
|
/** Splits `'about.counter'` into the dictionary key and its key prefix. */
|
|
8
8
|
const splitNamespace = (namespace) => {
|
|
9
9
|
const dotPosition = namespace.indexOf(".");
|
|
@@ -37,6 +37,5 @@ const useTranslations = ((namespace) => {
|
|
|
37
37
|
return (0, _intlayer_use_intl.createDictionaryTranslator)(locale, content, keyPrefix);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
40
|
exports.useTranslations = useTranslations;
|
|
42
41
|
//# sourceMappingURL=useTranslations.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
let react = require("react");
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/server/requestLocaleCache.ts
|
|
5
5
|
/**
|
|
6
6
|
* Request-scoped holder for the locale provided through {@link setRequestLocale}.
|
|
7
7
|
*
|
|
@@ -29,7 +29,6 @@ const setCachedRequestLocale = (locale) => {
|
|
|
29
29
|
getRequestLocaleHolder().locale = locale;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
//#endregion
|
|
33
32
|
exports.getCachedRequestLocale = getCachedRequestLocale;
|
|
34
33
|
exports.setCachedRequestLocale = setCachedRequestLocale;
|
|
35
34
|
//# sourceMappingURL=requestLocaleCache.cjs.map
|
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
let _intlayer_core_utils = require("@intlayer/core/utils");
|
|
3
3
|
let next_headers_js = require("next/headers.js");
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/server/setLocale.ts
|
|
6
6
|
/**
|
|
7
7
|
* Drop-in replacement for next-intl's `setLocale()` server action.
|
|
8
8
|
*
|
|
@@ -32,6 +32,5 @@ const setLocale = async (locale) => {
|
|
|
32
32
|
} });
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
//#endregion
|
|
36
35
|
exports.setLocale = setLocale;
|
|
37
36
|
//# sourceMappingURL=setLocale.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_server_requestLocaleCache = require(
|
|
2
|
+
const require_server_requestLocaleCache = require("./requestLocaleCache.cjs");
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/server/setRequestLocale.ts
|
|
5
5
|
/**
|
|
6
6
|
* Drop-in for next-intl's `setRequestLocale`.
|
|
7
7
|
*
|
|
@@ -28,6 +28,5 @@ const setRequestLocale = (locale) => {
|
|
|
28
28
|
require_server_requestLocaleCache.setCachedRequestLocale(locale);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
//#endregion
|
|
32
31
|
exports.setRequestLocale = setRequestLocale;
|
|
33
32
|
//# sourceMappingURL=setRequestLocale.cjs.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { IntlayerProvider } from "next-intlayer";
|
|
4
3
|
import { log, routing } from "@intlayer/config/built";
|
|
5
4
|
import { CYAN } from "@intlayer/config/colors";
|
|
6
5
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
7
6
|
import { getLocaleFromPath } from "@intlayer/core/localization";
|
|
8
7
|
import { usePathname } from "next/navigation";
|
|
8
|
+
import { IntlayerProvider } from "next-intlayer";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// src/client/NextIntlClientProvider.tsx
|
|
12
12
|
/**
|
|
13
13
|
* Drop-in for next-intl's `NextIntlClientProvider`.
|
|
14
14
|
* `messages`, `timeZone`, and `now` are accepted for API compatibility
|
|
@@ -26,6 +26,5 @@ const NextIntlClientProvider = ({ locale, children, messages: _messages, timeZon
|
|
|
26
26
|
}, String(resolvedLocale));
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
//#endregion
|
|
30
29
|
export { NextIntlClientProvider };
|
|
31
30
|
//# sourceMappingURL=NextIntlClientProvider.mjs.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useLocale as useLocale$1 } from "next-intlayer";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/client/useLocale.ts
|
|
6
6
|
/**
|
|
7
7
|
* Drop-in for next-intl's `useLocale`.
|
|
8
8
|
*/
|
|
@@ -11,6 +11,5 @@ const useLocale = () => {
|
|
|
11
11
|
return locale;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
//#endregion
|
|
15
14
|
export { useLocale };
|
|
16
15
|
//# sourceMappingURL=useLocale.mjs.map
|
|
@@ -2,7 +2,7 @@ import { getLocale } from "./server/getLocale.mjs";
|
|
|
2
2
|
import { createDictionaryTranslator } from "@intlayer/use-intl";
|
|
3
3
|
import { getDictionary as getDictionary$1 } from "next-intlayer";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/getDictionary.ts
|
|
6
6
|
const readRestArgument = (rest) => {
|
|
7
7
|
if (typeof rest === "string") return { namespacePrefix: rest };
|
|
8
8
|
return { localeOverride: rest?.locale };
|
|
@@ -29,6 +29,5 @@ const getDictionary = (async (dictionary, rest) => {
|
|
|
29
29
|
return createDictionaryTranslator(locale, content, namespacePrefix);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
//#endregion
|
|
33
32
|
export { getDictionary };
|
|
34
33
|
//# sourceMappingURL=getDictionary.mjs.map
|
|
@@ -2,7 +2,7 @@ import { getLocale as getLocale$1 } from "./server/getLocale.mjs";
|
|
|
2
2
|
import { createDictionaryTranslator } from "@intlayer/use-intl";
|
|
3
3
|
import { useDictionaryDynamic } from "next-intlayer/server";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/getDictionaryDynamic.ts
|
|
6
6
|
/**
|
|
7
7
|
* Dynamic dictionary-accepting variant of `getTranslations`.
|
|
8
8
|
*
|
|
@@ -15,6 +15,5 @@ const getDictionaryDynamic = (async (dictionaryPromise, key, namespacePrefix) =>
|
|
|
15
15
|
return createDictionaryTranslator(locale, content, namespacePrefix);
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
//#endregion
|
|
19
18
|
export { getDictionaryDynamic };
|
|
20
19
|
//# sourceMappingURL=getDictionaryDynamic.mjs.map
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineRouting } from "./routing.mjs";
|
|
2
1
|
import { NextIntlClientProvider } from "./client/NextIntlClientProvider.mjs";
|
|
3
2
|
import { useLocale } from "./client/useLocale.mjs";
|
|
4
3
|
import { IntlProvider, useDictionary, useDictionaryDynamic, useExtracted, useFormatter, useMessages, useNow, useTimeZone, useTranslations } from "./client/index.mjs";
|
|
4
|
+
import { defineRouting } from "./routing.mjs";
|
|
5
5
|
import { IntlError, IntlErrorCode, createFormatter, createTranslator, hasLocale, initializeConfig } from "@intlayer/use-intl";
|
|
6
6
|
|
|
7
7
|
export { IntlError, IntlErrorCode, IntlProvider, NextIntlClientProvider, createFormatter, createTranslator, defineRouting, hasLocale, initializeConfig, useDictionary, useDictionaryDynamic, useExtracted, useFormatter, useLocale, useMessages, useNow, useTimeZone, useTranslations };
|
package/dist/esm/middleware.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { intlayerMiddleware } from "next-intlayer/middleware";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/middleware.ts
|
|
4
4
|
/**
|
|
5
5
|
* Drop-in replacement for next-intl's `createMiddleware`.
|
|
6
6
|
*
|
|
@@ -29,6 +29,5 @@ const createMiddleware = (_routing) => (request, event) => {
|
|
|
29
29
|
return response;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
//#endregion
|
|
33
32
|
export { createMiddleware, createMiddleware as default };
|
|
34
33
|
//# sourceMappingURL=middleware.mjs.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { localizeHref } from "./localizeHref.mjs";
|
|
4
4
|
import { useLocale } from "next-intlayer";
|
|
5
|
-
import { forwardRef } from "react";
|
|
6
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { forwardRef } from "react";
|
|
7
7
|
import NextLink from "next/link";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/navigation/Link.tsx
|
|
10
10
|
/**
|
|
11
11
|
* Drop-in for the `Link` returned by next-intl's `createNavigation`. Prefixes
|
|
12
12
|
* `href` with the active locale (or the `locale` prop) before delegating to
|
|
@@ -22,6 +22,5 @@ const Link = forwardRef(({ href, locale, ...rest }, ref) => {
|
|
|
22
22
|
});
|
|
23
23
|
Link.displayName = "Link";
|
|
24
24
|
|
|
25
|
-
//#endregion
|
|
26
25
|
export { Link };
|
|
27
26
|
//# sourceMappingURL=Link.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { localizeHref } from "./localizeHref.mjs";
|
|
2
|
-
import { Link } from "./Link.mjs";
|
|
3
1
|
import { usePathname as usePathname$1, useRouter as useRouter$1 } from "./hooks.mjs";
|
|
2
|
+
import { Link } from "./Link.mjs";
|
|
3
|
+
import { localizeHref } from "./localizeHref.mjs";
|
|
4
4
|
import { permanentRedirect, redirect } from "next/navigation";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/navigation/createNavigation.ts
|
|
7
7
|
/**
|
|
8
8
|
* Drop-in replacement for next-intl's `createNavigation`.
|
|
9
9
|
*
|
|
@@ -32,6 +32,5 @@ const createNavigation = (_routing) => {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
//#endregion
|
|
36
35
|
export { createNavigation, createNavigation as default };
|
|
37
36
|
//# sourceMappingURL=createNavigation.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { localizeHref } from "./localizeHref.mjs";
|
|
4
|
-
import { useLocale } from "next-intlayer";
|
|
5
4
|
import { usePathname as usePathname$1, useRouter as useRouter$1 } from "next/navigation";
|
|
5
|
+
import { useLocale } from "next-intlayer";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/navigation/hooks.ts
|
|
8
8
|
/**
|
|
9
9
|
* Drop-in for the `usePathname` returned by next-intl's `createNavigation`.
|
|
10
10
|
* Returns the current pathname with the locale prefix stripped.
|
|
@@ -34,6 +34,5 @@ const useRouter = () => {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
//#endregion
|
|
38
37
|
export { usePathname, useRouter };
|
|
39
38
|
//# sourceMappingURL=hooks.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Link } from "./Link.mjs";
|
|
2
|
-
import { usePathname, useRouter } from "./hooks.mjs";
|
|
3
1
|
import { createNavigation } from "./createNavigation.mjs";
|
|
2
|
+
import { usePathname, useRouter } from "./hooks.mjs";
|
|
3
|
+
import { Link } from "./Link.mjs";
|
|
4
4
|
|
|
5
5
|
export { Link, createNavigation, createNavigation as default, usePathname, useRouter };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getLocalizedUrl } from "@intlayer/core/localization";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/navigation/localizeHref.ts
|
|
4
4
|
/**
|
|
5
5
|
* Prefix a `next-intl` href with the given locale using Intlayer's
|
|
6
6
|
* `getLocalizedUrl`, preserving any query parameters.
|
|
@@ -20,6 +20,5 @@ const localizeHref = (href, locale) => {
|
|
|
20
20
|
return queryString ? `${localizedPathname}?${queryString}` : localizedPathname;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
//#endregion
|
|
24
23
|
export { localizeHref };
|
|
25
24
|
//# sourceMappingURL=localizeHref.mjs.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { withIntlayer } from "next-intlayer/server";
|
|
2
1
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
3
2
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
3
|
+
import { withIntlayer } from "next-intlayer/server";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
6
6
|
import { NEXT_INTL_CALLERS } from "@intlayer/config/callers";
|
|
7
7
|
import { getConfiguration } from "@intlayer/config/node";
|
|
8
8
|
import { runOnce } from "@intlayer/engine/utils";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// src/plugin/index.ts
|
|
11
11
|
/**
|
|
12
12
|
* `require` that works in both the CJS and ESM builds of this plugin.
|
|
13
13
|
* `import.meta.url` is rewritten to the module path in the CJS output by the
|
|
@@ -173,6 +173,5 @@ const createNextIntlPlugin = (_i18nPath) => {
|
|
|
173
173
|
};
|
|
174
174
|
};
|
|
175
175
|
|
|
176
|
-
//#endregion
|
|
177
176
|
export { createNextIntlPlugin, createNextIntlPlugin as default };
|
|
178
177
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/routing.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { internationalization, routing } from "@intlayer/config/built";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/routing.ts
|
|
4
4
|
/**
|
|
5
5
|
* Drop-in replacement for next-intl's `defineRouting()`.
|
|
6
6
|
*
|
|
@@ -23,6 +23,5 @@ const defineRouting = (config) => ({
|
|
|
23
23
|
...config
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
//#endregion
|
|
27
26
|
export { defineRouting };
|
|
28
27
|
//# sourceMappingURL=routing.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCachedRequestLocale } from "./requestLocaleCache.mjs";
|
|
2
2
|
import { getLocale as getLocale$1 } from "next-intlayer/server";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/server/getLocale.ts
|
|
5
5
|
/**
|
|
6
6
|
* Drop-in for next-intl's `getLocale()` server function.
|
|
7
7
|
*
|
|
@@ -20,6 +20,5 @@ const getLocale = async () => {
|
|
|
20
20
|
return await getLocale$1();
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
//#endregion
|
|
24
23
|
export { getLocale };
|
|
25
24
|
//# sourceMappingURL=getLocale.mjs.map
|
|
@@ -2,7 +2,7 @@ import { log } from "@intlayer/config/built";
|
|
|
2
2
|
import { CYAN } from "@intlayer/config/colors";
|
|
3
3
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/server/getMessages.ts
|
|
6
6
|
/**
|
|
7
7
|
* Drop-in replacement for next-intl's `getMessages()` server function.
|
|
8
8
|
*
|
|
@@ -23,6 +23,5 @@ const getMessages = async () => {
|
|
|
23
23
|
return {};
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
//#endregion
|
|
27
26
|
export { getMessages };
|
|
28
27
|
//# sourceMappingURL=getMessages.mjs.map
|
|
@@ -2,7 +2,7 @@ import { log } from "@intlayer/config/built";
|
|
|
2
2
|
import { CYAN } from "@intlayer/config/colors";
|
|
3
3
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/server/getRequestConfig.ts
|
|
6
6
|
/**
|
|
7
7
|
* Drop-in for next-intl's `getRequestConfig`.
|
|
8
8
|
*
|
|
@@ -20,6 +20,5 @@ const getRequestConfig = (createRequestConfig) => {
|
|
|
20
20
|
return createRequestConfig;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
//#endregion
|
|
24
23
|
export { getRequestConfig as default, getRequestConfig };
|
|
25
24
|
//# sourceMappingURL=getRequestConfig.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLocale } from "./getLocale.mjs";
|
|
2
2
|
import { createTranslator } from "@intlayer/use-intl";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/server/getTranslations.ts
|
|
5
5
|
/**
|
|
6
6
|
* Drop-in for next-intl's server `getTranslations()`.
|
|
7
7
|
*
|
|
@@ -44,6 +44,5 @@ const getTranslations = (async (namespaceOrOptions) => {
|
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
//#endregion
|
|
48
47
|
export { getTranslations };
|
|
49
48
|
//# sourceMappingURL=getTranslations.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLocale } from "./getLocale.mjs";
|
|
2
2
|
import { createFormatter } from "@intlayer/use-intl";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/server/helpers.ts
|
|
5
5
|
/**
|
|
6
6
|
* Drop-in for next-intl's server `getFormatter()`.
|
|
7
7
|
* Returns locale-aware formatters backed by the native `Intl.*` APIs,
|
|
@@ -22,6 +22,5 @@ const getNow = (async () => /* @__PURE__ */ new Date());
|
|
|
22
22
|
*/
|
|
23
23
|
const getTimeZone = (async () => Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
24
24
|
|
|
25
|
-
//#endregion
|
|
26
25
|
export { getFormatter, getNow, getTimeZone };
|
|
27
26
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getLocale } from "./getLocale.mjs";
|
|
2
1
|
import { getDictionary } from "../getDictionary.mjs";
|
|
3
2
|
import { getDictionaryDynamic } from "../getDictionaryDynamic.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { getTranslations } from "./getTranslations.mjs";
|
|
3
|
+
import { getLocale } from "./getLocale.mjs";
|
|
6
4
|
import { getMessages } from "./getMessages.mjs";
|
|
7
5
|
import getRequestConfig from "./getRequestConfig.mjs";
|
|
6
|
+
import { getTranslations } from "./getTranslations.mjs";
|
|
7
|
+
import { getFormatter, getNow, getTimeZone } from "./helpers.mjs";
|
|
8
8
|
import { setLocale } from "./setLocale.mjs";
|
|
9
9
|
import { setRequestLocale } from "./setRequestLocale.mjs";
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useLocale } from "./useLocale.mjs";
|
|
2
2
|
import { createFormatter } from "@intlayer/use-intl";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/server/react/helpers.ts
|
|
5
5
|
/**
|
|
6
6
|
* Server counterparts of use-intl's ambient hooks. They mirror the client
|
|
7
7
|
* versions' signatures so the same component code type-checks on both sides.
|
|
@@ -15,6 +15,5 @@ const useNow = (() => /* @__PURE__ */ new Date());
|
|
|
15
15
|
*/
|
|
16
16
|
const useTimeZone = (() => Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
17
17
|
|
|
18
|
-
//#endregion
|
|
19
18
|
export { useFormatter, useNow, useTimeZone };
|
|
20
19
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineRouting } from "../../routing.mjs";
|
|
2
1
|
import { NextIntlClientProvider } from "../../client/NextIntlClientProvider.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { defineRouting } from "../../routing.mjs";
|
|
4
3
|
import { useFormatter, useNow, useTimeZone } from "./helpers.mjs";
|
|
5
|
-
import { useDictionaryDynamic } from "./useDictionaryDynamic.mjs";
|
|
6
4
|
import { useDictionary } from "./useDictionary.mjs";
|
|
5
|
+
import { useDictionaryDynamic } from "./useDictionaryDynamic.mjs";
|
|
6
|
+
import { useLocale } from "./useLocale.mjs";
|
|
7
7
|
import { useTranslations } from "./useTranslations.mjs";
|
|
8
8
|
import { IntlError, IntlErrorCode, createFormatter, createTranslator, hasLocale, initializeConfig, useMessages } from "@intlayer/use-intl";
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getCachedRequestLocale } from "../requestLocaleCache.mjs";
|
|
2
2
|
import { useLocale } from "next-intlayer/server";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/server/react/resolveLocale.ts
|
|
5
5
|
/**
|
|
6
6
|
* Locale for the synchronous server hooks, resolved the way `getLocale()`
|
|
7
7
|
* resolves it — so server-rendered output and the client provider never
|
|
@@ -21,6 +21,5 @@ const resolveServerLocale = () => {
|
|
|
21
21
|
return useLocale().locale;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
//#endregion
|
|
25
24
|
export { resolveServerLocale };
|
|
26
25
|
//# sourceMappingURL=resolveLocale.mjs.map
|
|
@@ -2,7 +2,7 @@ import { resolveServerLocale } from "./resolveLocale.mjs";
|
|
|
2
2
|
import { createDictionaryTranslator } from "@intlayer/use-intl";
|
|
3
3
|
import { useDictionary as useDictionary$1 } from "next-intlayer/server";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/server/react/useDictionary.ts
|
|
6
6
|
/**
|
|
7
7
|
* Server counterpart of `@intlayer/use-intl`'s `useDictionary`.
|
|
8
8
|
*
|
|
@@ -17,6 +17,5 @@ const useDictionary = ((dictionary, namespacePrefix) => {
|
|
|
17
17
|
return createDictionaryTranslator(locale, content, namespacePrefix);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
//#endregion
|
|
21
20
|
export { useDictionary };
|
|
22
21
|
//# sourceMappingURL=useDictionary.mjs.map
|
|
@@ -2,7 +2,7 @@ import { resolveServerLocale } from "./resolveLocale.mjs";
|
|
|
2
2
|
import { createDictionaryTranslator } from "@intlayer/use-intl";
|
|
3
3
|
import { useDictionaryDynamic as useDictionaryDynamic$1 } from "next-intlayer/server";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/server/react/useDictionaryDynamic.ts
|
|
6
6
|
/**
|
|
7
7
|
* Server counterpart of `useDictionaryDynamic`, emitted by the optimize pass
|
|
8
8
|
* for dictionaries on the per-locale loader.
|
|
@@ -13,6 +13,5 @@ const useDictionaryDynamic = ((dictionaryPromise, key, namespacePrefix) => {
|
|
|
13
13
|
return createDictionaryTranslator(locale, content, namespacePrefix);
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
//#endregion
|
|
17
16
|
export { useDictionaryDynamic };
|
|
18
17
|
//# sourceMappingURL=useDictionaryDynamic.mjs.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { resolveServerLocale } from "./resolveLocale.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/server/react/useLocale.ts
|
|
4
4
|
/**
|
|
5
5
|
* Server counterpart of `useLocale`, resolved from the `[locale]` route segment
|
|
6
6
|
* forwarded through `setRequestLocale` when the app provides one.
|
|
7
7
|
*/
|
|
8
8
|
const useLocale = () => resolveServerLocale();
|
|
9
9
|
|
|
10
|
-
//#endregion
|
|
11
10
|
export { useLocale };
|
|
12
11
|
//# sourceMappingURL=useLocale.mjs.map
|