next-intl 3.26.0 → 3.26.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/README.md +5 -5
- package/dist/development/config.js +1 -1
- package/dist/development/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/development/navigation/react-client/createNavigation.js +4 -4
- package/dist/development/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
- package/dist/development/navigation/shared/createSharedNavigationFns.js +1 -1
- package/dist/development/navigation/shared/utils.js +1 -1
- package/dist/development/plugin.js +2 -2
- package/dist/development/react-client/index.js +1 -1
- package/dist/development/react-server/useConfig.js +1 -1
- package/dist/development/server/react-server/RequestLocale.js +1 -1
- package/dist/development/server/react-server/RequestLocaleLegacy.js +2 -2
- package/dist/development/server/react-server/getConfig.js +2 -2
- package/dist/development/server/react-server/getMessages.js +1 -1
- package/dist/development/shared/NextIntlClientProvider.js +1 -1
- package/dist/esm/config.js +1 -1
- package/dist/esm/navigation/shared/utils.js +1 -1
- package/dist/esm/plugin.js +1 -1
- package/dist/esm/react-client/index.js +1 -1
- package/dist/esm/react-server/useConfig.js +1 -1
- package/dist/esm/server/react-server/RequestLocale.js +1 -1
- package/dist/esm/server/react-server/RequestLocaleLegacy.js +1 -1
- package/dist/esm/server/react-server/getConfig.js +1 -1
- package/dist/esm/server/react-server/getMessages.js +1 -1
- package/dist/esm/shared/NextIntlClientProvider.js +1 -1
- package/dist/production/config.js +1 -1
- package/dist/production/plugin.js +1 -1
- package/dist/production/react-server/useConfig.js +1 -1
- package/dist/production/server/react-server/RequestLocale.js +1 -1
- package/dist/production/server/react-server/RequestLocaleLegacy.js +1 -1
- package/dist/production/server/react-server/getMessages.js +1 -1
- package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.d.ts +1 -1
- package/dist/types/src/navigation/react-client/createNavigation.d.ts +6 -4
- package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +1 -1
- package/dist/types/src/navigation/shared/createSharedNavigationFns.d.ts +8 -8
- package/dist/types/src/routing/config.d.ts +8 -8
- package/dist/types/src/server/react-server/getRequestConfig.d.ts +2 -2
- package/dist/types/src/server/react-server/getTranslations.d.ts +9 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<h1 align="center">
|
|
2
2
|
<br>
|
|
3
|
-
<a href="https://next-intl
|
|
3
|
+
<a href="https://next-intl.dev">
|
|
4
4
|
<picture>
|
|
5
5
|
<source media="(prefers-color-scheme: dark)" srcset="media/logo-dark-mode.svg">
|
|
6
6
|
<source media="(prefers-color-scheme: light)" srcset="media/logo.svg">
|
|
@@ -29,10 +29,10 @@ Internationalization (i18n) is an essential part of the user experience, therefo
|
|
|
29
29
|
```jsx
|
|
30
30
|
// UserProfile.tsx
|
|
31
31
|
import {useTranslations} from 'next-intl';
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
export default function UserProfile({user}) {
|
|
34
34
|
const t = useTranslations('UserProfile');
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
return (
|
|
37
37
|
<section>
|
|
38
38
|
<h1>{t('title', {firstName: user.firstName})}</h1>
|
|
@@ -58,10 +58,10 @@ export default function UserProfile({user}) {
|
|
|
58
58
|
}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
### [→ Read the docs](https://next-intl
|
|
61
|
+
### [→ Read the docs](https://next-intl.dev)
|
|
62
62
|
|
|
63
63
|
<div align="center">
|
|
64
|
-
<a href="https://next-intl
|
|
64
|
+
<a href="https://next-intl.dev/redirect?href=https://crowdin.com" target="_blank">
|
|
65
65
|
<img width="350" src="media/partner.svg" alt="Crowdin logo">
|
|
66
66
|
</a>
|
|
67
67
|
<br>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function getConfig() {
|
|
6
|
-
throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl
|
|
6
|
+
throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl.dev/docs/getting-started/app-router");
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
exports.default = getConfig;
|
|
@@ -17,7 +17,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
17
17
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* @deprecated Consider switching to `createNavigation` (see https://next-intl
|
|
20
|
+
* @deprecated Consider switching to `createNavigation` (see https://next-intl.dev/blog/next-intl-3-22#create-navigation)
|
|
21
21
|
**/
|
|
22
22
|
function createLocalizedPathnamesNavigation(routing) {
|
|
23
23
|
const config$1 = config.receiveRoutingConfig(routing);
|
|
@@ -21,7 +21,7 @@ function createNavigation(routing) {
|
|
|
21
21
|
...redirects
|
|
22
22
|
} = createSharedNavigationFns.default(useTypedLocale, routing);
|
|
23
23
|
|
|
24
|
-
/** @see https://next-intl
|
|
24
|
+
/** @see https://next-intl.dev/docs/routing/navigation#usepathname */
|
|
25
25
|
function usePathname() {
|
|
26
26
|
const pathname = useBasePathname.default(config);
|
|
27
27
|
const locale = useTypedLocale();
|
|
@@ -62,11 +62,11 @@ function createNavigation(routing) {
|
|
|
62
62
|
}
|
|
63
63
|
return {
|
|
64
64
|
...router,
|
|
65
|
-
/** @see https://next-intl
|
|
65
|
+
/** @see https://next-intl.dev/docs/routing/navigation#userouter */
|
|
66
66
|
push: createHandler(router.push),
|
|
67
|
-
/** @see https://next-intl
|
|
67
|
+
/** @see https://next-intl.dev/docs/routing/navigation#userouter */
|
|
68
68
|
replace: createHandler(router.replace),
|
|
69
|
-
/** @see https://next-intl
|
|
69
|
+
/** @see https://next-intl.dev/docs/routing/navigation#userouter */
|
|
70
70
|
prefetch: createHandler(router.prefetch)
|
|
71
71
|
};
|
|
72
72
|
}, [curLocale, nextPathname, router]);
|
|
@@ -15,7 +15,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
15
15
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* @deprecated Consider switching to `createNavigation` (see https://next-intl
|
|
18
|
+
* @deprecated Consider switching to `createNavigation` (see https://next-intl.dev/blog/next-intl-3-22#create-navigation)
|
|
19
19
|
**/
|
|
20
20
|
function createSharedPathnamesNavigation(routing) {
|
|
21
21
|
const localePrefix = config.receiveLocalePrefixConfig(routing === null || routing === void 0 ? void 0 : routing.localePrefix);
|
|
@@ -124,7 +124,7 @@ function createSharedNavigationFns(getLocale, routing) {
|
|
|
124
124
|
args.domain, _forcePrefix);
|
|
125
125
|
}
|
|
126
126
|
function getRedirectFn(fn) {
|
|
127
|
-
/** @see https://next-intl
|
|
127
|
+
/** @see https://next-intl.dev/docs/routing/navigation#redirect */
|
|
128
128
|
return function redirectFn(args) {
|
|
129
129
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
130
130
|
rest[_key - 1] = arguments[_key];
|
|
@@ -140,7 +140,7 @@ function applyPathnamePrefix(pathname, locale, routing, domain, force) {
|
|
|
140
140
|
defaultLocale = domainConfig.defaultLocale;
|
|
141
141
|
} else {
|
|
142
142
|
if (!domain) {
|
|
143
|
-
console.error("You're using a routing configuration with `localePrefix: 'as-needed'` in combination with `domains`. In order to compute a correct pathname, you need to provide a `domain` parameter.\n\nSee: https://next-intl
|
|
143
|
+
console.error("You're using a routing configuration with `localePrefix: 'as-needed'` in combination with `domains`. In order to compute a correct pathname, you need to provide a `domain` parameter.\n\nSee: https://next-intl.dev/docs/routing#domains-localeprefix-asneeded");
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -38,7 +38,7 @@ function resolveI18nPath(providedPath, cwd) {
|
|
|
38
38
|
for (const candidate of [...withExtensions('./i18n'), ...withExtensions('./src/i18n')]) {
|
|
39
39
|
if (pathExists(candidate)) {
|
|
40
40
|
if (!hasWarnedForDeprecatedI18nConfig) {
|
|
41
|
-
console.warn("\n[next-intl] Reading request configuration from ".concat(candidate, " is deprecated, please see https://next-intl
|
|
41
|
+
console.warn("\n[next-intl] Reading request configuration from ".concat(candidate, " is deprecated, please see https://next-intl.dev/blog/next-intl-3-22#i18n-request \u2014 you can either move your configuration to ./i18n/request.ts or provide a custom path in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n"));
|
|
42
42
|
hasWarnedForDeprecatedI18nConfig = true;
|
|
43
43
|
}
|
|
44
44
|
return candidate;
|
|
@@ -49,7 +49,7 @@ function resolveI18nPath(providedPath, cwd) {
|
|
|
49
49
|
}
|
|
50
50
|
function initPlugin(i18nPath, nextConfig) {
|
|
51
51
|
if ((nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.i18n) != null) {
|
|
52
|
-
console.warn("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl
|
|
52
|
+
console.warn("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl.dev/examples#app-router-migration\n");
|
|
53
53
|
}
|
|
54
54
|
const useTurbo = process.env.TURBOPACK != null;
|
|
55
55
|
const nextIntlConfig = {};
|
|
@@ -21,7 +21,7 @@ function callHook(name, hook) {
|
|
|
21
21
|
try {
|
|
22
22
|
return hook(...arguments);
|
|
23
23
|
} catch (_unused) {
|
|
24
|
-
throw new Error("Failed to call `".concat(name, "` because the context from `NextIntlClientProvider` was not found.\n\nThis can happen because:\n1) You intended to render this component as a Server Component, the render\n failed, and therefore React attempted to render the component on the client\n instead. If this is the case, check the console for server errors.\n2) You intended to render this component on the client side, but no context was found.\n Learn more about this error here: https://next-intl
|
|
24
|
+
throw new Error("Failed to call `".concat(name, "` because the context from `NextIntlClientProvider` was not found.\n\nThis can happen because:\n1) You intended to render this component as a Server Component, the render\n failed, and therefore React attempted to render the component on the client\n instead. If this is the case, check the console for server errors.\n2) You intended to render this component on the client side, but no context was found.\n Learn more about this error here: https://next-intl.dev/docs/environments/server-client-components#missing-context") );
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -10,7 +10,7 @@ function useHook(hookName, promise) {
|
|
|
10
10
|
return React.use(promise);
|
|
11
11
|
} catch (error) {
|
|
12
12
|
if (error instanceof TypeError && error.message.includes("Cannot read properties of null (reading 'use')")) {
|
|
13
|
-
throw new Error("`".concat(hookName, "` is not callable within an async component. Please refer to https://next-intl
|
|
13
|
+
throw new Error("`".concat(hookName, "` is not callable within an async component. Please refer to https://next-intl.dev/docs/environments/server-client-components#async-components"), {
|
|
14
14
|
cause: error
|
|
15
15
|
});
|
|
16
16
|
} else {
|
|
@@ -20,7 +20,7 @@ async function getLocaleFromHeaderImpl() {
|
|
|
20
20
|
locale = (await getHeaders()).get(constants.HEADER_LOCALE_NAME) || undefined;
|
|
21
21
|
} catch (error) {
|
|
22
22
|
if (error instanceof Error && error.digest === 'DYNAMIC_SERVER_USAGE') {
|
|
23
|
-
const wrappedError = new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl
|
|
23
|
+
const wrappedError = new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#static-rendering', {
|
|
24
24
|
cause: error
|
|
25
25
|
});
|
|
26
26
|
wrappedError.digest = error.digest;
|
|
@@ -20,7 +20,7 @@ function getLocaleFromHeaderImpl() {
|
|
|
20
20
|
locale = getHeaders().get(constants.HEADER_LOCALE_NAME);
|
|
21
21
|
} catch (error) {
|
|
22
22
|
if (error instanceof Error && error.digest === 'DYNAMIC_SERVER_USAGE') {
|
|
23
|
-
throw new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl
|
|
23
|
+
throw new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#static-rendering', {
|
|
24
24
|
cause: error
|
|
25
25
|
});
|
|
26
26
|
} else {
|
|
@@ -29,7 +29,7 @@ function getLocaleFromHeaderImpl() {
|
|
|
29
29
|
}
|
|
30
30
|
if (!locale) {
|
|
31
31
|
{
|
|
32
|
-
console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl
|
|
32
|
+
console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl.dev/docs/routing/middleware#unable-to-find-locale. The `notFound()` function will be called as a result.\n");
|
|
33
33
|
}
|
|
34
34
|
navigation.notFound();
|
|
35
35
|
}
|
|
@@ -27,7 +27,7 @@ function getDefaultTimeZoneImpl() {
|
|
|
27
27
|
const getDefaultTimeZone = React.cache(getDefaultTimeZoneImpl);
|
|
28
28
|
async function receiveRuntimeConfigImpl(getConfig, localeOverride) {
|
|
29
29
|
if (typeof getConfig !== 'function') {
|
|
30
|
-
throw new Error("Invalid i18n request configuration detected.\n\nPlease verify that:\n1. In case you've specified a custom location in your Next.js config, make sure that the path is correct.\n2. You have a default export in your i18n request configuration file.\n\nSee also: https://next-intl
|
|
30
|
+
throw new Error("Invalid i18n request configuration detected.\n\nPlease verify that:\n1. In case you've specified a custom location in your Next.js config, make sure that the path is correct.\n2. You have a default export in your i18n request configuration file.\n\nSee also: https://next-intl.dev/docs/usage/configuration#i18n-request\n");
|
|
31
31
|
}
|
|
32
32
|
const params = {
|
|
33
33
|
// In case the consumer doesn't read `params.locale` and instead provides the
|
|
@@ -47,7 +47,7 @@ async function receiveRuntimeConfigImpl(getConfig, localeOverride) {
|
|
|
47
47
|
const locale = result.locale || (await params.requestLocale);
|
|
48
48
|
if (!locale) {
|
|
49
49
|
{
|
|
50
|
-
console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request and no `locale` was returned in `getRequestConfig`. See https://next-intl
|
|
50
|
+
console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request and no `locale` was returned in `getRequestConfig`. See https://next-intl.dev/docs/routing/middleware#unable-to-find-locale. The `notFound()` function will be called as a result.\n");
|
|
51
51
|
}
|
|
52
52
|
navigation.notFound();
|
|
53
53
|
}
|
|
@@ -7,7 +7,7 @@ var getConfig = require('./getConfig.js');
|
|
|
7
7
|
|
|
8
8
|
function getMessagesFromConfig(config) {
|
|
9
9
|
if (!config.messages) {
|
|
10
|
-
throw new Error('No messages found. Have you configured them correctly? See https://next-intl
|
|
10
|
+
throw new Error('No messages found. Have you configured them correctly? See https://next-intl.dev/docs/configuration#messages');
|
|
11
11
|
}
|
|
12
12
|
return config.messages;
|
|
13
13
|
}
|
|
@@ -20,7 +20,7 @@ function NextIntlClientProvider(_ref) {
|
|
|
20
20
|
// for `locale`, but this would require dropping Next.js <13.
|
|
21
21
|
|
|
22
22
|
if (!locale) {
|
|
23
|
-
throw new Error('Failed to determine locale in `NextIntlClientProvider`, please provide the `locale` prop explicitly.\n\nSee https://next-intl
|
|
23
|
+
throw new Error('Failed to determine locale in `NextIntlClientProvider`, please provide the `locale` prop explicitly.\n\nSee https://next-intl.dev/docs/configuration#locale' );
|
|
24
24
|
}
|
|
25
25
|
return /*#__PURE__*/React__default.default.createElement(_IntlProvider.IntlProvider, _rollupPluginBabelHelpers.extends({
|
|
26
26
|
locale: locale
|
package/dist/esm/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(){throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl
|
|
1
|
+
function t(){throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl.dev/docs/getting-started/app-router")}export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getSortedPathnames as e,matchesPathname as n,isLocalizableHref as t,prefixPathname as r,getLocalePrefix as o,normalizeTrailingSlash as a}from"../../shared/utils.js";function i(e){return"string"==typeof e?{pathname:e}:e}function c(e){function n(e){return String(e)}const t=new URLSearchParams;for(const[r,o]of Object.entries(e))Array.isArray(o)?o.forEach((e=>{t.append(r,n(e))})):t.set(r,n(o));return"?"+t.toString()}function
|
|
1
|
+
import{getSortedPathnames as e,matchesPathname as n,isLocalizableHref as t,prefixPathname as r,getLocalePrefix as o,normalizeTrailingSlash as a}from"../../shared/utils.js";function i(e){return"string"==typeof e?{pathname:e}:e}function c(e){function n(e){return String(e)}const t=new URLSearchParams;for(const[r,o]of Object.entries(e))Array.isArray(o)?o.forEach((e=>{t.append(r,n(e))})):t.set(r,n(o));return"?"+t.toString()}function f(e){let{pathname:n,locale:t,params:r,pathnames:o,query:i}=e;function f(e){let n=o[e];return n||(n=e),n}function s(e){const n="string"==typeof e?e:e[t];let o=n;if(r&&Object.entries(r).forEach((e=>{let n,t,[r,a]=e;Array.isArray(a)?(n="(\\[)?\\[...".concat(r,"\\](\\])?"),t=a.map((e=>String(e))).join("/")):(n="\\[".concat(r,"\\]"),t=String(a)),o=o.replace(new RegExp(n,"g"),t)})),o=o.replace(/\[\[\.\.\..+\]\]/g,""),o=a(o),o.includes("["))throw new Error("Insufficient params provided for localized pathname.\nTemplate: ".concat(n,"\nParams: ").concat(JSON.stringify(r)));return i&&(o+=c(i)),o}if("string"==typeof n){return s(f(n))}{const{pathname:e,...t}=n;return{...t,pathname:s(f(e))}}}function s(t,r,o){const a=e(Object.keys(o)),i=decodeURI(r);for(const e of a){const r=o[e];if("string"==typeof r){if(n(r,i))return e}else if(n(r[t],i))return e}return r}function l(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.pathname;return"/"===e?n:n.replace(e,"")}function d(e,n,a,i,c){const{mode:f}=a.localePrefix;let s;if(void 0!==c)s=c;else if(t(e))if("always"===f)s=!0;else if("as-needed"===f){let e=a.defaultLocale;if(a.domains){const n=a.domains.find((e=>e.domain===i));n?e=n.defaultLocale:i||console.error("You're using a routing configuration with `localePrefix: 'as-needed'` in combination with `domains`. In order to compute a correct pathname, you need to provide a `domain` parameter.\n\nSee: https://next-intl.dev/docs/routing#domains-localeprefix-asneeded")}s=e!==n}return s?r(o(n,a.localePrefix),e):e}function u(e){var n;if("as-needed"===(null===(n=e.localePrefix)||void 0===n?void 0:n.mode)&&!("defaultLocale"in e))throw new Error("`localePrefix: 'as-needed' requires a `defaultLocale`.")}export{d as applyPathnamePrefix,f as compileLocalizedPathname,l as getBasePath,s as getRoute,i as normalizeNameOrNameWithParams,c as serializeSearchParams,u as validateReceivedConfig};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"fs";import t from"path";function e(n){return["".concat(n,".ts"),"".concat(n,".tsx"),"".concat(n,".js"),"".concat(n,".jsx")]}let o=!1;function r(r,i){function s(e){return n.existsSync(function(n){const e=[];return i&&e.push(i),e.push(n),t.resolve(...e)}(e))}if(r){if(!s(r))throw new Error("[next-intl] Could not find i18n config at ".concat(r,", please provide a valid path."));return r}for(const n of[...e("./i18n/request"),...e("./src/i18n/request")])if(s(n))return n;for(const n of[...e("./i18n"),...e("./src/i18n")])if(s(n))return o||(console.warn("\n[next-intl] Reading request configuration from ".concat(n," is deprecated, please see https://next-intl
|
|
1
|
+
import n from"fs";import t from"path";function e(n){return["".concat(n,".ts"),"".concat(n,".tsx"),"".concat(n,".js"),"".concat(n,".jsx")]}let o=!1;function r(r,i){function s(e){return n.existsSync(function(n){const e=[];return i&&e.push(i),e.push(n),t.resolve(...e)}(e))}if(r){if(!s(r))throw new Error("[next-intl] Could not find i18n config at ".concat(r,", please provide a valid path."));return r}for(const n of[...e("./i18n/request"),...e("./src/i18n/request")])if(s(n))return n;for(const n of[...e("./i18n"),...e("./src/i18n")])if(s(n))return o||(console.warn("\n[next-intl] Reading request configuration from ".concat(n," is deprecated, please see https://next-intl.dev/blog/next-intl-3-22#i18n-request — you can either move your configuration to ./i18n/request.ts or provide a custom path in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n")),o=!0),n;throw new Error("\n[next-intl] Could not locate request configuration module.\n\nThis path is supported by default: ./(src/)i18n/request.{js,jsx,ts,tsx}\n\nAlternatively, you can specify a custom location in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n")}module.exports=function(n){return function(e){return function(n,e){null!=(null==e?void 0:e.i18n)&&console.warn("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl.dev/examples#app-router-migration\n");const o={};if(null!=process.env.TURBOPACK){var i,s;if(null!=n&&n.startsWith("/"))throw new Error("[next-intl] Turbopack support for next-intl currently does not support absolute paths, please provide a relative one (e.g. './src/i18n/config.ts').\n\nFound: "+n+"\n");o.experimental={...null==e?void 0:e.experimental,turbo:{...null==e||null===(i=e.experimental)||void 0===i?void 0:i.turbo,resolveAlias:{...null==e||null===(s=e.experimental)||void 0===s||null===(s=s.turbo)||void 0===s?void 0:s.resolveAlias,"next-intl/config":r(n)}}}}else o.webpack=function(){for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];let[l,u]=i;return l.resolve.alias["next-intl/config"]=t.resolve(l.context,r(n,l.context)),"function"==typeof(null==e?void 0:e.webpack)?e.webpack(l,u):l};return o.env={...null==e?void 0:e.env,_next_intl_trailing_slash:null!=e&&e.trailingSlash?"true":void 0},Object.assign({},e,o)}(n,e)}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useTranslations as e,useFormatter as t}from"use-intl";export*from"use-intl";function n(e,t){return function(){try{return t(...arguments)}catch(t){throw new Error("Failed to call `".concat(e,"` because the context from `NextIntlClientProvider` was not found.\n\nThis can happen because:\n1) You intended to render this component as a Server Component, the render\n failed, and therefore React attempted to render the component on the client\n instead. If this is the case, check the console for server errors.\n2) You intended to render this component on the client side, but no context was found.\n Learn more about this error here: https://next-intl
|
|
1
|
+
import{useTranslations as e,useFormatter as t}from"use-intl";export*from"use-intl";function n(e,t){return function(){try{return t(...arguments)}catch(t){throw new Error("Failed to call `".concat(e,"` because the context from `NextIntlClientProvider` was not found.\n\nThis can happen because:\n1) You intended to render this component as a Server Component, the render\n failed, and therefore React attempted to render the component on the client\n instead. If this is the case, check the console for server errors.\n2) You intended to render this component on the client side, but no context was found.\n Learn more about this error here: https://next-intl.dev/docs/environments/server-client-components#missing-context"))}}}const o=n("useTranslations",e),r=n("useFormatter",t);export{r as useFormatter,o as useTranslations};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{use as e}from"react";import n from"../server/react-server/getConfig.js";function r(r){return function(n,r){try{return e(r)}catch(e){throw e instanceof TypeError&&e.message.includes("Cannot read properties of null (reading 'use')")?new Error("`".concat(n,"` is not callable within an async component. Please refer to https://next-intl
|
|
1
|
+
import{use as e}from"react";import n from"../server/react-server/getConfig.js";function r(r){return function(n,r){try{return e(r)}catch(e){throw e instanceof TypeError&&e.message.includes("Cannot read properties of null (reading 'use')")?new Error("`".concat(n,"` is not callable within an async component. Please refer to https://next-intl.dev/docs/environments/server-client-components#async-components"),{cause:e}):e}}(r,n())}export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{headers as t}from"next/headers";import{cache as e}from"react";import{HEADER_LOCALE_NAME as n}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const o=e((async function(){const e=t();return e instanceof Promise?await e:e}));const i=e((async function(){let t;try{t=(await o()).get(n)||void 0}catch(t){if(t instanceof Error&&"DYNAMIC_SERVER_USAGE"===t.digest){const e=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl
|
|
1
|
+
import{headers as t}from"next/headers";import{cache as e}from"react";import{HEADER_LOCALE_NAME as n}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const o=e((async function(){const e=t();return e instanceof Promise?await e:e}));const i=e((async function(){let t;try{t=(await o()).get(n)||void 0}catch(t){if(t instanceof Error&&"DYNAMIC_SERVER_USAGE"===t.digest){const e=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:t});throw e.digest=t.digest,e}throw t}return t}));async function s(){return r()||await i()}export{s as getRequestLocale};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{headers as e}from"next/headers";import{notFound as t}from"next/navigation";import{cache as n}from"react";import{HEADER_LOCALE_NAME as o}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const i=n((function(){let n;try{n=e().get(o)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl
|
|
1
|
+
import{headers as e}from"next/headers";import{notFound as t}from"next/navigation";import{cache as n}from"react";import{HEADER_LOCALE_NAME as o}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const i=n((function(){let n;try{n=e().get(o)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e}):e}return n||(console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl.dev/docs/routing/middleware#unable-to-find-locale. The `notFound()` function will be called as a result.\n"),t()),n}));function s(){return r()||i()}export{s as getRequestLocale};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{notFound as e}from"next/navigation";import{cache as t}from"react";import{_createIntlFormatters as n,_createCache as o,initializeConfig as r}from"use-intl/core";import{getRequestLocale as i}from"./RequestLocale.js";import{getRequestLocale as a}from"./RequestLocaleLegacy.js";import s from"next-intl/config";const c=t((function(){return new Date}));const l=t((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const u=t((async function(t,n){if("function"!=typeof t)throw new Error("Invalid i18n request configuration detected.\n\nPlease verify that:\n1. In case you've specified a custom location in your Next.js config, make sure that the path is correct.\n2. You have a default export in your i18n request configuration file.\n\nSee also: https://next-intl
|
|
1
|
+
import{notFound as e}from"next/navigation";import{cache as t}from"react";import{_createIntlFormatters as n,_createCache as o,initializeConfig as r}from"use-intl/core";import{getRequestLocale as i}from"./RequestLocale.js";import{getRequestLocale as a}from"./RequestLocaleLegacy.js";import s from"next-intl/config";const c=t((function(){return new Date}));const l=t((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const u=t((async function(t,n){if("function"!=typeof t)throw new Error("Invalid i18n request configuration detected.\n\nPlease verify that:\n1. In case you've specified a custom location in your Next.js config, make sure that the path is correct.\n2. You have a default export in your i18n request configuration file.\n\nSee also: https://next-intl.dev/docs/usage/configuration#i18n-request\n");const o={get locale(){return n||a()},get requestLocale(){return n?Promise.resolve(n):i()}};let r=t(o);r instanceof Promise&&(r=await r);const s=r.locale||await o.requestLocale;return s||(console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request and no `locale` was returned in `getRequestConfig`. See https://next-intl.dev/docs/routing/middleware#unable-to-find-locale. The `notFound()` function will be called as a result.\n"),e()),{...r,locale:s,now:r.now||c(),timeZone:r.timeZone||l()}})),f=t(n),m=t(o);const d=t((async function(e){const t=await u(s,e);return{...r(t),_formatters:f(m())}}));export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cache as e}from"react";import o from"./getConfig.js";function t(e){if(!e.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl
|
|
1
|
+
import{cache as e}from"react";import o from"./getConfig.js";function t(e){if(!e.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl.dev/docs/configuration#messages");return e.messages}const n=e((async function(e){return t(await o(e))}));async function r(e){return n(null==e?void 0:e.locale)}export{r as default,t as getMessagesFromConfig};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{extends as e}from"../_virtual/_rollupPluginBabelHelpers.js";import l from"react";import{IntlProvider as t}from"use-intl/_IntlProvider";function r(r){let{locale:o,...i}=r;if(!o)throw new Error("Failed to determine locale in `NextIntlClientProvider`, please provide the `locale` prop explicitly.\n\nSee https://next-intl
|
|
2
|
+
import{extends as e}from"../_virtual/_rollupPluginBabelHelpers.js";import l from"react";import{IntlProvider as t}from"use-intl/_IntlProvider";function r(r){let{locale:o,...i}=r;if(!o)throw new Error("Failed to determine locale in `NextIntlClientProvider`, please provide the `locale` prop explicitly.\n\nSee https://next-intl.dev/docs/configuration#locale");return l.createElement(t,e({locale:o},i))}export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(){throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(){throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl.dev/docs/getting-started/app-router")};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var n=require("fs"),
|
|
1
|
+
"use strict";var n=require("fs"),t=require("path");function e(n){return n&&n.__esModule?n:{default:n}}var o=e(n),r=e(t);function i(n){return["".concat(n,".ts"),"".concat(n,".tsx"),"".concat(n,".js"),"".concat(n,".jsx")]}let l=!1;function s(n,t){function e(n){return o.default.existsSync(function(n){const e=[];return t&&e.push(t),e.push(n),r.default.resolve(...e)}(n))}if(n){if(!e(n))throw new Error("[next-intl] Could not find i18n config at ".concat(n,", please provide a valid path."));return n}for(const n of[...i("./i18n/request"),...i("./src/i18n/request")])if(e(n))return n;for(const n of[...i("./i18n"),...i("./src/i18n")])if(e(n))return l||(console.warn("\n[next-intl] Reading request configuration from ".concat(n," is deprecated, please see https://next-intl.dev/blog/next-intl-3-22#i18n-request — you can either move your configuration to ./i18n/request.ts or provide a custom path in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n")),l=!0),n;throw new Error("\n[next-intl] Could not locate request configuration module.\n\nThis path is supported by default: ./(src/)i18n/request.{js,jsx,ts,tsx}\n\nAlternatively, you can specify a custom location in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n")}module.exports=function(n){return function(t){return function(n,t){null!=(null==t?void 0:t.i18n)&&console.warn("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl.dev/examples#app-router-migration\n");const e={};if(null!=process.env.TURBOPACK){var o,i;if(null!=n&&n.startsWith("/"))throw new Error("[next-intl] Turbopack support for next-intl currently does not support absolute paths, please provide a relative one (e.g. './src/i18n/config.ts').\n\nFound: "+n+"\n");e.experimental={...null==t?void 0:t.experimental,turbo:{...null==t||null===(o=t.experimental)||void 0===o?void 0:o.turbo,resolveAlias:{...null==t||null===(i=t.experimental)||void 0===i||null===(i=i.turbo)||void 0===i?void 0:i.resolveAlias,"next-intl/config":s(n)}}}}else e.webpack=function(){for(var e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];let[l,u]=o;return l.resolve.alias["next-intl/config"]=r.default.resolve(l.context,s(n,l.context)),"function"==typeof(null==t?void 0:t.webpack)?t.webpack(l,u):l};return e.env={...null==t?void 0:t.env,_next_intl_trailing_slash:null!=t&&t.trailingSlash?"true":void 0},Object.assign({},t,e)}(n,t)}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("../server/react-server/getConfig.js");exports.default=function(n){return function(r,n){try{return e.use(n)}catch(e){throw e instanceof TypeError&&e.message.includes("Cannot read properties of null (reading 'use')")?new Error("`".concat(r,"` is not callable within an async component. Please refer to https://next-intl
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("../server/react-server/getConfig.js");exports.default=function(n){return function(r,n){try{return e.use(n)}catch(e){throw e instanceof TypeError&&e.message.includes("Cannot read properties of null (reading 'use')")?new Error("`".concat(r,"` is not callable within an async component. Please refer to https://next-intl.dev/docs/environments/server-client-components#async-components"),{cause:e}):e}}(n,r.default())};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("react"),n=require("../../shared/constants.js"),r=require("./RequestLocaleCache.js");const s=t.cache((async function(){const t=e.headers();return t instanceof Promise?await t:t}));const a=t.cache((async function(){let e;try{e=(await s()).get(n.HEADER_LOCALE_NAME)||void 0}catch(e){if(e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest){const t=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("react"),n=require("../../shared/constants.js"),r=require("./RequestLocaleCache.js");const s=t.cache((async function(){const t=e.headers();return t instanceof Promise?await t:t}));const a=t.cache((async function(){let e;try{e=(await s()).get(n.HEADER_LOCALE_NAME)||void 0}catch(e){if(e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest){const t=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e});throw t.digest=e.digest,t}throw e}return e}));exports.getRequestLocale=async function(){return r.getCachedRequestLocale()||await a()};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("next/navigation"),r=require("react"),n=require("../../shared/constants.js"),s=require("./RequestLocaleCache.js");const i=r.cache((function(){let r;try{r=e.headers().get(n.HEADER_LOCALE_NAME)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("next/navigation"),r=require("react"),n=require("../../shared/constants.js"),s=require("./RequestLocaleCache.js");const i=r.cache((function(){let r;try{r=e.headers().get(n.HEADER_LOCALE_NAME)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e}):e}return r||t.notFound(),r}));exports.getRequestLocale=function(){return s.getCachedRequestLocale()||i()};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("./getConfig.js");function r(e){if(!e.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl.dev/docs/configuration#messages");return e.messages}const s=e.cache((async function(e){return r(await t.default(e))}));exports.default=async function(e){return s(null==e?void 0:e.locale)},exports.getMessagesFromConfig=r;
|
|
@@ -4,7 +4,7 @@ import { DomainsConfig, LocalePrefixMode, Locales, Pathnames } from '../../routi
|
|
|
4
4
|
import { HrefOrHrefWithParams } from '../shared/utils';
|
|
5
5
|
import ClientLink from './ClientLink';
|
|
6
6
|
/**
|
|
7
|
-
* @deprecated Consider switching to `createNavigation` (see https://next-intl
|
|
7
|
+
* @deprecated Consider switching to `createNavigation` (see https://next-intl.dev/blog/next-intl-3-22#create-navigation)
|
|
8
8
|
**/
|
|
9
9
|
export default function createLocalizedPathnamesNavigation<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode = 'always', AppPathnames extends Pathnames<AppLocales> = never, AppDomains extends DomainsConfig<AppLocales> = never>(routing: RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>): {
|
|
10
10
|
Link: <Pathname extends keyof AppPathnames>(props: (Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
@@ -18,7 +18,9 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
18
18
|
legacyBehavior?: boolean | undefined;
|
|
19
19
|
onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
20
20
|
onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
21
|
-
onClick?: React.
|
|
21
|
+
onClick?: React.
|
|
22
|
+
/** @see https://next-intl.dev/docs/routing/navigation#userouter */
|
|
23
|
+
MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
22
24
|
download?: any;
|
|
23
25
|
hrefLang?: string | undefined;
|
|
24
26
|
media?: string | undefined;
|
|
@@ -310,7 +312,7 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
310
312
|
}, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
311
313
|
usePathname: () => [AppPathnames] extends [never] ? string : keyof AppPathnames;
|
|
312
314
|
useRouter: () => {
|
|
313
|
-
/** @see https://next-intl
|
|
315
|
+
/** @see https://next-intl.dev/docs/routing/navigation#userouter */
|
|
314
316
|
push: (href: Parameters<(args: {
|
|
315
317
|
href: [AppPathnames] extends [never] ? string | {
|
|
316
318
|
pathname: string;
|
|
@@ -336,7 +338,7 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
336
338
|
} : {})) => string>[0]["href"], options?: (Partial<import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions> & {
|
|
337
339
|
locale?: string;
|
|
338
340
|
}) | undefined) => void;
|
|
339
|
-
/** @see https://next-intl
|
|
341
|
+
/** @see https://next-intl.dev/docs/routing/navigation#userouter */
|
|
340
342
|
replace: (href: Parameters<(args: {
|
|
341
343
|
href: [AppPathnames] extends [never] ? string | {
|
|
342
344
|
pathname: string;
|
|
@@ -362,7 +364,7 @@ export default function createNavigation<const AppLocales extends Locales, const
|
|
|
362
364
|
} : {})) => string>[0]["href"], options?: (Partial<import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions> & {
|
|
363
365
|
locale?: string;
|
|
364
366
|
}) | undefined) => void;
|
|
365
|
-
/** @see https://next-intl
|
|
367
|
+
/** @see https://next-intl.dev/docs/routing/navigation#userouter */
|
|
366
368
|
prefetch: (href: Parameters<(args: {
|
|
367
369
|
href: [AppPathnames] extends [never] ? string | {
|
|
368
370
|
pathname: string;
|
|
@@ -2,7 +2,7 @@ import React, { ReactElement } from 'react';
|
|
|
2
2
|
import { RoutingConfigSharedNavigation } from '../../routing/config';
|
|
3
3
|
import { DomainsConfig, LocalePrefixMode, Locales } from '../../routing/types';
|
|
4
4
|
/**
|
|
5
|
-
* @deprecated Consider switching to `createNavigation` (see https://next-intl
|
|
5
|
+
* @deprecated Consider switching to `createNavigation` (see https://next-intl.dev/blog/next-intl-3-22#create-navigation)
|
|
6
6
|
**/
|
|
7
7
|
export default function createSharedPathnamesNavigation<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppDomains extends DomainsConfig<AppLocales> = never>(routing?: RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains>): {
|
|
8
8
|
Link: (props: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
@@ -329,7 +329,7 @@ export default function createSharedNavigationFns<const AppLocales extends Local
|
|
|
329
329
|
} & Omit<import("url").UrlObject, "pathname">) : never : never;
|
|
330
330
|
}, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
331
331
|
redirect: (args: Omit<Parameters<(args: {
|
|
332
|
-
/** @see https://next-intl
|
|
332
|
+
/** @see https://next-intl.dev/docs/routing/navigation#getpathname */
|
|
333
333
|
href: [AppPathnames] extends [never] ? string | {
|
|
334
334
|
pathname: string;
|
|
335
335
|
query?: QueryParams;
|
|
@@ -338,18 +338,18 @@ export default function createSharedNavigationFns<const AppLocales extends Local
|
|
|
338
338
|
} & (([AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>) | undefined extends undefined ? {} : AppLocalePrefixMode extends "as-needed" ? [AppDomains] extends [never] ? {} : {
|
|
339
339
|
/**
|
|
340
340
|
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned.
|
|
341
|
-
* @see https://next-intl
|
|
341
|
+
* @see https://next-intl.dev/docs/routing/navigation#getpathname
|
|
342
342
|
*/
|
|
343
343
|
domain: AppDomains[number]["domain"];
|
|
344
344
|
} : {}), _forcePrefix?: boolean) => string>[0], "domain"> & Partial<([AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>) | undefined extends undefined ? {} : AppLocalePrefixMode extends "as-needed" ? [AppDomains] extends [never] ? {} : {
|
|
345
345
|
/**
|
|
346
346
|
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned.
|
|
347
|
-
* @see https://next-intl
|
|
347
|
+
* @see https://next-intl.dev/docs/routing/navigation#getpathname
|
|
348
348
|
*/
|
|
349
349
|
domain: AppDomains[number]["domain"];
|
|
350
350
|
} : {}>, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
351
351
|
permanentRedirect: (args: Omit<Parameters<(args: {
|
|
352
|
-
/** @see https://next-intl
|
|
352
|
+
/** @see https://next-intl.dev/docs/routing/navigation#getpathname */
|
|
353
353
|
href: [AppPathnames] extends [never] ? string | {
|
|
354
354
|
pathname: string;
|
|
355
355
|
query?: QueryParams;
|
|
@@ -358,18 +358,18 @@ export default function createSharedNavigationFns<const AppLocales extends Local
|
|
|
358
358
|
} & (([AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>) | undefined extends undefined ? {} : AppLocalePrefixMode extends "as-needed" ? [AppDomains] extends [never] ? {} : {
|
|
359
359
|
/**
|
|
360
360
|
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned.
|
|
361
|
-
* @see https://next-intl
|
|
361
|
+
* @see https://next-intl.dev/docs/routing/navigation#getpathname
|
|
362
362
|
*/
|
|
363
363
|
domain: AppDomains[number]["domain"];
|
|
364
364
|
} : {}), _forcePrefix?: boolean) => string>[0], "domain"> & Partial<([AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>) | undefined extends undefined ? {} : AppLocalePrefixMode extends "as-needed" ? [AppDomains] extends [never] ? {} : {
|
|
365
365
|
/**
|
|
366
366
|
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned.
|
|
367
|
-
* @see https://next-intl
|
|
367
|
+
* @see https://next-intl.dev/docs/routing/navigation#getpathname
|
|
368
368
|
*/
|
|
369
369
|
domain: AppDomains[number]["domain"];
|
|
370
370
|
} : {}>, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
371
371
|
getPathname: (args: Parameters<(args: {
|
|
372
|
-
/** @see https://next-intl
|
|
372
|
+
/** @see https://next-intl.dev/docs/routing/navigation#getpathname */
|
|
373
373
|
href: [AppPathnames] extends [never] ? string | {
|
|
374
374
|
pathname: string;
|
|
375
375
|
query?: QueryParams;
|
|
@@ -378,7 +378,7 @@ export default function createSharedNavigationFns<const AppLocales extends Local
|
|
|
378
378
|
} & (([AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>) | undefined extends undefined ? {} : AppLocalePrefixMode extends "as-needed" ? [AppDomains] extends [never] ? {} : {
|
|
379
379
|
/**
|
|
380
380
|
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned.
|
|
381
|
-
* @see https://next-intl
|
|
381
|
+
* @see https://next-intl.dev/docs/routing/navigation#getpathname
|
|
382
382
|
*/
|
|
383
383
|
domain: AppDomains[number]["domain"];
|
|
384
384
|
} : {}), _forcePrefix?: boolean) => string>[0]) => string;
|
|
@@ -4,43 +4,43 @@ type CookieAttributes = Pick<NonNullable<Parameters<typeof NextResponse.prototyp
|
|
|
4
4
|
export type RoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined> = {
|
|
5
5
|
/**
|
|
6
6
|
* All available locales.
|
|
7
|
-
* @see https://next-intl
|
|
7
|
+
* @see https://next-intl.dev/docs/routing
|
|
8
8
|
*/
|
|
9
9
|
locales: AppLocales;
|
|
10
10
|
/**
|
|
11
11
|
* Used when no locale matches.
|
|
12
|
-
* @see https://next-intl
|
|
12
|
+
* @see https://next-intl.dev/docs/routing
|
|
13
13
|
*/
|
|
14
14
|
defaultLocale: AppLocales[number];
|
|
15
15
|
/**
|
|
16
16
|
* Configures whether and which prefix is shown for a given locale.
|
|
17
|
-
* @see https://next-intl
|
|
17
|
+
* @see https://next-intl.dev/docs/routing#locale-prefix
|
|
18
18
|
**/
|
|
19
19
|
localePrefix?: LocalePrefix<AppLocales, AppLocalePrefixMode>;
|
|
20
20
|
/**
|
|
21
21
|
* Can be used to change the locale handling per domain.
|
|
22
|
-
* @see https://next-intl
|
|
22
|
+
* @see https://next-intl.dev/docs/routing#domains
|
|
23
23
|
**/
|
|
24
24
|
domains?: AppDomains;
|
|
25
25
|
/**
|
|
26
26
|
* Can be used to disable the locale cookie or to customize it.
|
|
27
|
-
* @see https://next-intl
|
|
27
|
+
* @see https://next-intl.dev/docs/routing/middleware#locale-cookie
|
|
28
28
|
*/
|
|
29
29
|
localeCookie?: boolean | CookieAttributes;
|
|
30
30
|
/**
|
|
31
31
|
* Sets the `Link` response header to notify search engines about content in other languages (defaults to `true`). See https://developers.google.com/search/docs/specialty/international/localized-versions#http
|
|
32
|
-
* @see https://next-intl
|
|
32
|
+
* @see https://next-intl.dev/docs/routing/middleware#alternate-links
|
|
33
33
|
**/
|
|
34
34
|
alternateLinks?: boolean;
|
|
35
35
|
/**
|
|
36
36
|
* By setting this to `false`, the cookie as well as the `accept-language` header will no longer be used for locale detection.
|
|
37
|
-
* @see https://next-intl
|
|
37
|
+
* @see https://next-intl.dev/docs/routing/middleware#locale-detection
|
|
38
38
|
**/
|
|
39
39
|
localeDetection?: boolean;
|
|
40
40
|
} & ([AppPathnames] extends [never] ? {} : {
|
|
41
41
|
/**
|
|
42
42
|
* A map of localized pathnames per locale.
|
|
43
|
-
* @see https://next-intl
|
|
43
|
+
* @see https://next-intl.dev/docs/routing#pathnames
|
|
44
44
|
**/
|
|
45
45
|
pathnames: AppPathnames;
|
|
46
46
|
});
|
|
@@ -14,7 +14,7 @@ export type RequestConfig = Omit<IntlConfig, 'locale'> & {
|
|
|
14
14
|
};
|
|
15
15
|
export type GetRequestConfigParams = {
|
|
16
16
|
/**
|
|
17
|
-
* Deprecated in favor of `requestLocale` (see https://next-intl
|
|
17
|
+
* Deprecated in favor of `requestLocale` (see https://next-intl.dev/blog/next-intl-3-22#await-request-locale).
|
|
18
18
|
*
|
|
19
19
|
* The locale that was matched by the `[locale]` path segment. Note however
|
|
20
20
|
* that this can be overridden in async APIs when the `locale` is explicitly
|
|
@@ -36,7 +36,7 @@ export type GetRequestConfigParams = {
|
|
|
36
36
|
* catch-all for unknown routes (e.g. `/unknown.txt`), invalid values should
|
|
37
37
|
* be replaced with a valid locale.
|
|
38
38
|
*
|
|
39
|
-
* @see https://next-intl
|
|
39
|
+
* @see https://next-intl.dev/docs/usage/configuration#i18n-request
|
|
40
40
|
*/
|
|
41
41
|
requestLocale: Promise<string | undefined>;
|
|
42
42
|
};
|
|
@@ -87,6 +87,15 @@ declare function getTranslations<NestedKey extends NamespaceKeys<IntlMessages, N
|
|
|
87
87
|
}, [
|
|
88
88
|
NestedKey
|
|
89
89
|
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey): any;
|
|
90
|
+
has<TargetKey extends MessageKeys<NestedValueOf<{
|
|
91
|
+
'!': IntlMessages;
|
|
92
|
+
}, [
|
|
93
|
+
NestedKey
|
|
94
|
+
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
95
|
+
'!': IntlMessages;
|
|
96
|
+
}, [
|
|
97
|
+
NestedKey
|
|
98
|
+
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: [TargetKey] extends [never] ? string : TargetKey): boolean;
|
|
90
99
|
}>;
|
|
91
100
|
declare const _default: typeof getTranslations;
|
|
92
101
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "3.26.
|
|
3
|
+
"version": "3.26.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"funding": [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"description": "Internationalization (i18n) for Next.js",
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"homepage": "https://next-intl
|
|
14
|
+
"homepage": "https://next-intl.dev",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
17
|
"url": "https://github.com/amannn/next-intl"
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@formatjs/intl-localematcher": "^0.5.4",
|
|
90
90
|
"negotiator": "^1.0.0",
|
|
91
|
-
"use-intl": "^3.26.
|
|
91
|
+
"use-intl": "^3.26.2"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
95
95
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "a6e070b57d71f829456c8338020f29643805015e"
|
|
98
98
|
}
|