@intlayer/next-intl 9.7.0 → 9.7.2
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/NextIntlClientProvider.cjs.map +1 -1
- 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/middleware.cjs.map +1 -1
- package/dist/cjs/navigation/Link.cjs +4 -5
- package/dist/cjs/navigation/Link.cjs.map +1 -1
- package/dist/cjs/navigation/createNavigation.cjs +4 -5
- package/dist/cjs/navigation/createNavigation.cjs.map +1 -1
- package/dist/cjs/navigation/hooks.cjs +2 -3
- package/dist/cjs/navigation/hooks.cjs.map +1 -1
- 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/NextIntlClientProvider.mjs.map +1 -1
- 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 +2 -2
- package/dist/esm/middleware.mjs +1 -2
- package/dist/esm/middleware.mjs.map +1 -1
- package/dist/esm/navigation/Link.mjs +2 -3
- package/dist/esm/navigation/Link.mjs.map +1 -1
- package/dist/esm/navigation/createNavigation.mjs +3 -4
- package/dist/esm/navigation/createNavigation.mjs.map +1 -1
- package/dist/esm/navigation/hooks.mjs +1 -2
- package/dist/esm/navigation/hooks.mjs.map +1 -1
- 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/index.d.ts +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 +51 -51
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const require_server_setLocale = require(
|
|
10
|
-
const require_server_setRequestLocale = require(
|
|
2
|
+
const require_getDictionary = require("../getDictionary.cjs");
|
|
3
|
+
const require_getDictionaryDynamic = require("../getDictionaryDynamic.cjs");
|
|
4
|
+
const require_server_getLocale = require("./getLocale.cjs");
|
|
5
|
+
const require_server_getMessages = require("./getMessages.cjs");
|
|
6
|
+
const require_server_getRequestConfig = require("./getRequestConfig.cjs");
|
|
7
|
+
const require_server_getTranslations = require("./getTranslations.cjs");
|
|
8
|
+
const require_server_helpers = require("./helpers.cjs");
|
|
9
|
+
const require_server_setLocale = require("./setLocale.cjs");
|
|
10
|
+
const require_server_setRequestLocale = require("./setRequestLocale.cjs");
|
|
11
11
|
|
|
12
12
|
exports.getDictionary = require_getDictionary.getDictionary;
|
|
13
13
|
exports.getDictionaryDynamic = require_getDictionaryDynamic.getDictionaryDynamic;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_server_react_useLocale = require(
|
|
2
|
+
const require_server_react_useLocale = require("./useLocale.cjs");
|
|
3
3
|
let _intlayer_use_intl = require("@intlayer/use-intl");
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/server/react/helpers.ts
|
|
6
6
|
/**
|
|
7
7
|
* Server counterparts of use-intl's ambient hooks. They mirror the client
|
|
8
8
|
* versions' signatures so the same component code type-checks on both sides.
|
|
@@ -16,7 +16,6 @@ const useNow = (() => /* @__PURE__ */ new Date());
|
|
|
16
16
|
*/
|
|
17
17
|
const useTimeZone = (() => Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
18
18
|
|
|
19
|
-
//#endregion
|
|
20
19
|
exports.useFormatter = useFormatter;
|
|
21
20
|
exports.useNow = useNow;
|
|
22
21
|
exports.useTimeZone = useTimeZone;
|
|
@@ -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";
|
|
7
|
+
import { IntlayerProvider } from "next-intlayer";
|
|
8
8
|
import { usePathname } from "next/navigation";
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextIntlClientProvider.mjs","names":[],"sources":["../../../src/client/NextIntlClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport { log, routing } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getLocaleFromPath } from '@intlayer/core/localization';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport {
|
|
1
|
+
{"version":3,"file":"NextIntlClientProvider.mjs","names":[],"sources":["../../../src/client/NextIntlClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport { log, routing } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getLocaleFromPath } from '@intlayer/core/localization';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { NextIntlClientProvider as _NextIntlClientProvider } from 'next-intl';\nimport { IntlayerProvider } from 'next-intlayer';\nimport { usePathname } from 'next/navigation';\nimport type { ComponentProps } from 'react';\n\n/**\n * Drop-in for next-intl's `NextIntlClientProvider`.\n * `messages`, `timeZone`, and `now` are accepted for API compatibility\n * but have no effect — Intlayer uses its own compiled dictionaries.\n */\nexport const NextIntlClientProvider: typeof _NextIntlClientProvider = ({\n locale,\n children,\n messages: _messages,\n timeZone: _timeZone,\n now: _now,\n ...rest\n}) => {\n if (\n process.env.NODE_ENV === 'development' &&\n typeof _messages !== 'undefined'\n ) {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('NextIntlClientProvider', CYAN)} do not pass the messages prop with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n // next-intl drives the locale from the request: apps render\n // `<NextIntlClientProvider>` without a `locale` prop and the server resolves it\n // from the `[locale]` route segment. As a client component we cannot read the\n // server request here, so when no explicit `locale` is given we derive it from\n // the URL (the same `[locale]` segment) using Intlayer's routing config. This\n // keeps `useLocale`, `Link` and the locale switcher in sync with the URL\n // instead of falling back to the stored cookie / default locale.\n //\n // Only prefix-based routing carries the locale in the path. For `no-prefix` /\n // `search-params` the path has no locale segment, so we leave `locale`\n // undefined and let the provider resolve it from storage (cookie) — deriving\n // from the path there would wrongly clobber the cookie with the default locale.\n const pathname = usePathname();\n const mode = routing?.mode ?? 'prefix-no-default';\n const isPrefixMode = mode === 'prefix-all' || mode === 'prefix-no-default';\n const resolvedLocale =\n locale ?? (isPrefixMode ? getLocaleFromPath(pathname) : undefined);\n\n // `key={resolvedLocale}` remounts the provider when the locale changes via\n // navigation (next-intl switches locale by routing to a locale-prefixed path).\n // This re-seeds the client locale context so client components re-render in\n // the new language instead of keeping the previous one.\n return (\n <IntlayerProvider\n key={String(resolvedLocale)}\n locale={resolvedLocale}\n {...rest}\n >\n {children}\n </IntlayerProvider>\n );\n};\n\n/**\n *\n */\nexport type NextIntlClientProviderProps = Omit<\n ComponentProps<typeof _NextIntlClientProvider>,\n 'messages'\n> & {\n /**\n * @deprecated\n * has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason\n */\n messages?: never;\n /**\n * locale\n */\n locale: LocalesValues;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAa,0BAA0D,EACrE,QACA,UACA,UAAU,WACV,UAAU,WACV,KAAK,MACL,GAAG,WACC;CACJ,6BAC2B,iBACzB,OAAO,cAAc,aAGrB,AADkB,aAAa,EAAE,IAAI,CAC7B,CAAC,CACP,GAAG,SAAS,0BAA0B,IAAI,EAAE,8HAC9C;CAeF,MAAM,WAAW,YAAY;CAC7B,MAAM,OAAO,SAAS,QAAQ;CAE9B,MAAM,iBACJ,WAFmB,SAAS,gBAAgB,SAAS,sBAE3B,kBAAkB,QAAQ,IAAI;CAM1D,OACE,oBAAC,kBAAD;EAEE,QAAQ;EACR,GAAI;EAEH;CACe,GALX,OAAO,cAAc,CAKV;AAEtB"}
|
|
@@ -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 {
|
|
1
|
+
import { IntlProvider, useDictionary, useDictionaryDynamic, useExtracted, useFormatter, useMessages, useNow, useTimeZone, useTranslations } from "./client/index.mjs";
|
|
2
2
|
import { NextIntlClientProvider } from "./client/NextIntlClientProvider.mjs";
|
|
3
3
|
import { useLocale } from "./client/useLocale.mjs";
|
|
4
|
-
import {
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.mjs","names":[],"sources":["../../src/middleware.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"middleware.mjs","names":[],"sources":["../../src/middleware.ts"],"sourcesContent":["import type _createMiddleware from 'next-intl/middleware';\nimport { intlayerMiddleware } from 'next-intlayer/middleware';\nimport type { NextFetchEvent, NextRequest } from 'next/server';\n\n/**\n * Drop-in replacement for next-intl's `createMiddleware`.\n *\n * Returns Intlayer's proxy/middleware, which handles locale detection and\n * routing from the Intlayer configuration. The `routing` argument is accepted\n * for API compatibility but ignored — locales come from `intlayer.config`.\n *\n * @example\n * ```ts\n * // proxy.ts (or middleware.ts on Next <= 15)\n * import createMiddleware from 'next-intl/middleware';\n * export default createMiddleware(routing);\n * export const config = { matcher: ['/((?!api|_next|.*\\\\..*).*)'] };\n * ```\n */\nexport const createMiddleware: typeof _createMiddleware =\n (_routing?: unknown) => (request: NextRequest, event?: NextFetchEvent) => {\n const response = intlayerMiddleware(request, event);\n\n if (response) {\n // Intlayer middleware writes the resolved locale to the x-intlayer-locale header\n // We read it and explicitly set the NEXT_LOCALE cookie to maintain compatibility with next-intl\n const resolvedLocale = response.headers.get('x-intlayer-locale');\n if (resolvedLocale) {\n response.cookies.set('NEXT_LOCALE', resolvedLocale, {\n path: '/',\n sameSite: 'lax',\n maxAge: 60 * 60 * 24 * 365,\n });\n }\n }\n\n return response;\n };\n\nexport default createMiddleware;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAa,oBACV,cAAwB,SAAsB,UAA2B;CACxE,MAAM,WAAW,mBAAmB,SAAS,KAAK;CAElD,IAAI,UAAU;EAGZ,MAAM,iBAAiB,SAAS,QAAQ,IAAI,mBAAmB;EAC/D,IAAI,gBACF,SAAS,QAAQ,IAAI,eAAe,gBAAgB;GAClD,MAAM;GACN,UAAU;GACV,QAAQ;EACV,CAAC;CAEL;CAEA,OAAO;AACT"}
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.mjs","names":[],"sources":["../../../src/navigation/Link.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"file":"Link.mjs","names":[],"sources":["../../../src/navigation/Link.tsx"],"sourcesContent":["'use client';\n\nimport { useLocale } from 'next-intlayer';\nimport NextLink from 'next/link';\nimport { type ComponentPropsWithoutRef, forwardRef, type Ref } from 'react';\nimport { localizeHref, type NextIntlHref } from './localizeHref';\n\n/**\n * Props for the compat `Link`: identical to `next/link` except `href` accepts a\n * `next-intl` href and an optional `locale` overrides the current one.\n */\nexport type LinkProps = Omit<\n ComponentPropsWithoutRef<typeof NextLink>,\n 'href' | 'locale'\n> & {\n href: NextIntlHref;\n locale?: string;\n};\n\n/**\n * Drop-in for the `Link` returned by next-intl's `createNavigation`. Prefixes\n * `href` with the active locale (or the `locale` prop) before delegating to\n * `next/link`.\n */\nexport const Link = forwardRef(\n ({ href, locale, ...rest }: LinkProps, ref: Ref<HTMLAnchorElement>) => {\n const { locale: currentLocale } = useLocale();\n const targetLocale = locale ?? (currentLocale as string);\n\n return (\n <NextLink ref={ref} href={localizeHref(href, targetLocale)} {...rest} />\n );\n }\n);\n\nLink.displayName = 'Link';\n"],"mappings":";;;;;;;;;;;;;;AAwBA,MAAa,OAAO,YACjB,EAAE,MAAM,QAAQ,GAAG,QAAmB,QAAgC;CACrE,MAAM,EAAE,QAAQ,kBAAkB,UAAU;CAG5C,OACE,oBAAC,UAAD;EAAe;EAAK,MAAM,aAAa,MAHpB,UAAW,aAG2B;EAAG,GAAI;CAAO;AAE3E,CACF;AAEA,KAAK,cAAc"}
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNavigation.mjs","names":["redirect","nextRedirect","permanentRedirect","nextPermanentRedirect"],"sources":["../../../src/navigation/createNavigation.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"createNavigation.mjs","names":["redirect","nextRedirect","permanentRedirect","nextPermanentRedirect"],"sources":["../../../src/navigation/createNavigation.ts"],"sourcesContent":["import type { createNavigation as _createNavigation } from 'next-intl/navigation';\nimport {\n permanentRedirect as nextPermanentRedirect,\n redirect as nextRedirect,\n} from 'next/navigation';\nimport { usePathname, useRouter } from './hooks';\nimport { Link } from './Link';\nimport { localizeHref, type NextIntlHref } from './localizeHref';\n\n/** Arguments shared by `getPathname`, `redirect` and `permanentRedirect`. */\ntype LocalizedHrefArgs = { href: NextIntlHref; locale: string };\n\n/** The optional `RedirectType` accepted by `next/navigation`'s redirect APIs. */\ntype RedirectTypeArg = Parameters<typeof nextRedirect>[1];\n\n/**\n * Drop-in replacement for next-intl's `createNavigation`.\n *\n * Returns locale-aware navigation APIs (`Link`, `usePathname`, `useRouter`,\n * `getPathname`, `redirect`, `permanentRedirect`) backed by Intlayer's routing\n * configuration. The `routing` argument is accepted for API compatibility;\n * locales come from the Intlayer configuration.\n *\n * @example\n * ```ts\n * export const { Link, redirect, usePathname, useRouter, getPathname } =\n * createNavigation();\n * ```\n */\nexport const createNavigation: typeof _createNavigation = (\n _routing?: unknown\n) => {\n const getPathname = ({ href, locale }: LocalizedHrefArgs): string =>\n localizeHref(href, locale);\n\n const redirect = (\n { href, locale }: LocalizedHrefArgs,\n type?: RedirectTypeArg\n ) => nextRedirect(localizeHref(href, locale), type);\n\n const permanentRedirect = (\n { href, locale }: LocalizedHrefArgs,\n type?: RedirectTypeArg\n ) => nextPermanentRedirect(localizeHref(href, locale), type);\n\n return {\n Link: Link as ReturnType<typeof _createNavigation>['Link'],\n usePathname,\n useRouter,\n getPathname,\n redirect,\n permanentRedirect,\n } as ReturnType<typeof _createNavigation>;\n};\n\nexport default createNavigation;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,oBACX,aACG;CACH,MAAM,eAAe,EAAE,MAAM,aAC3B,aAAa,MAAM,MAAM;CAE3B,MAAMA,cACJ,EAAE,MAAM,UACR,SACGC,SAAa,aAAa,MAAM,MAAM,GAAG,IAAI;CAElD,MAAMC,uBACJ,EAAE,MAAM,UACR,SACGC,kBAAsB,aAAa,MAAM,MAAM,GAAG,IAAI;CAE3D,OAAO;EACC;EACN;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -4,7 +4,7 @@ import { localizeHref } from "./localizeHref.mjs";
|
|
|
4
4
|
import { useLocale } from "next-intlayer";
|
|
5
5
|
import { usePathname as usePathname$1, useRouter as useRouter$1 } from "next/navigation";
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.mjs","names":["useNextPathname","useNextRouter"],"sources":["../../../src/navigation/hooks.ts"],"sourcesContent":["'use client';\n\nimport {\n usePathname as useNextPathname,\n useRouter as useNextRouter,\n} from 'next/navigation';\nimport {
|
|
1
|
+
{"version":3,"file":"hooks.mjs","names":["useNextPathname","useNextRouter"],"sources":["../../../src/navigation/hooks.ts"],"sourcesContent":["'use client';\n\nimport { useLocale } from 'next-intlayer';\nimport {\n usePathname as useNextPathname,\n useRouter as useNextRouter,\n} from 'next/navigation';\nimport { localizeHref, type NextIntlHref } from './localizeHref';\n\n/**\n * Options accepted by the locale-aware router methods: the standard Next.js\n * navigate options plus an optional target `locale`.\n */\ntype NavigateOptions = { locale?: string } & Record<string, unknown>;\n\n/**\n * Drop-in for the `usePathname` returned by next-intl's `createNavigation`.\n * Returns the current pathname with the locale prefix stripped.\n */\nexport const usePathname = (): string => {\n const pathname = useNextPathname();\n const { locale } = useLocale();\n const prefix = `/${locale}`;\n\n if (pathname === prefix) return '/';\n if (pathname.startsWith(`${prefix}/`)) return pathname.slice(prefix.length);\n return pathname;\n};\n\n/**\n * Drop-in for the `useRouter` returned by next-intl's `createNavigation`.\n * Wraps the Next.js router so `push`/`replace`/`prefetch` localize their href\n * (honouring an optional `locale` option) before navigating.\n */\nexport const useRouter = () => {\n const router = useNextRouter();\n const { locale: currentLocale } = useLocale();\n\n const localize = (href: NextIntlHref, locale?: string): string =>\n localizeHref(href, locale ?? (currentLocale as string));\n\n return {\n ...router,\n push: (href: NextIntlHref, options?: NavigateOptions) =>\n router.push(\n localize(href, options?.locale),\n options as Parameters<typeof router.push>[1]\n ),\n replace: (href: NextIntlHref, options?: NavigateOptions) =>\n router.replace(\n localize(href, options?.locale),\n options as Parameters<typeof router.replace>[1]\n ),\n prefetch: (href: NextIntlHref, options?: NavigateOptions) =>\n router.prefetch(localize(href, options?.locale)),\n };\n};\n"],"mappings":";;;;;;;;;;;AAmBA,MAAa,oBAA4B;CACvC,MAAM,WAAWA,cAAgB;CACjC,MAAM,EAAE,WAAW,UAAU;CAC7B,MAAM,SAAS,IAAI;CAEnB,IAAI,aAAa,QAAQ,OAAO;CAChC,IAAI,SAAS,WAAW,GAAG,OAAO,EAAE,GAAG,OAAO,SAAS,MAAM,OAAO,MAAM;CAC1E,OAAO;AACT;;;;;;AAOA,MAAa,kBAAkB;CAC7B,MAAM,SAASC,YAAc;CAC7B,MAAM,EAAE,QAAQ,kBAAkB,UAAU;CAE5C,MAAM,YAAY,MAAoB,WACpC,aAAa,MAAM,UAAW,aAAwB;CAExD,OAAO;EACL,GAAG;EACH,OAAO,MAAoB,YACzB,OAAO,KACL,SAAS,MAAM,SAAS,MAAM,GAC9B,OACF;EACF,UAAU,MAAoB,YAC5B,OAAO,QACL,SAAS,MAAM,SAAS,MAAM,GAC9B,OACF;EACF,WAAW,MAAoB,YAC7B,OAAO,SAAS,SAAS,MAAM,SAAS,MAAM,CAAC;CACnD;AACF"}
|
|
@@ -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
|