next-intl 3.13.0 → 3.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/navigation/shared/basePermanentRedirect.js +1 -1
- package/dist/development/navigation/shared/baseRedirect.js +1 -1
- package/dist/development/react-server/useConfig.js +1 -3
- package/dist/development/react-server/useLocale.js +3 -2
- package/dist/development/server/react-server/getConfig.js +23 -14
- package/dist/development/server/react-server/getFormatter.js +1 -3
- package/dist/development/server/react-server/getLocale.js +7 -3
- package/dist/development/server/react-server/getMessages.js +1 -3
- package/dist/development/server/react-server/getNow.js +1 -3
- package/dist/development/server/react-server/getTimeZone.js +1 -3
- package/dist/development/server/react-server/getTranslations.js +1 -2
- package/dist/esm/navigation/shared/basePermanentRedirect.js +1 -1
- package/dist/esm/navigation/shared/baseRedirect.js +1 -1
- package/dist/esm/react-server/useConfig.js +1 -1
- package/dist/esm/react-server/useLocale.js +1 -1
- package/dist/esm/server/react-server/getConfig.js +1 -1
- package/dist/esm/server/react-server/getFormatter.js +1 -1
- package/dist/esm/server/react-server/getLocale.js +1 -1
- package/dist/esm/server/react-server/getMessages.js +1 -1
- package/dist/esm/server/react-server/getNow.js +1 -1
- package/dist/esm/server/react-server/getTimeZone.js +1 -1
- package/dist/esm/server/react-server/getTranslations.js +1 -1
- package/dist/production/navigation/shared/basePermanentRedirect.js +1 -1
- package/dist/production/navigation/shared/baseRedirect.js +1 -1
- package/dist/production/react-server/useConfig.js +1 -1
- package/dist/production/react-server/useLocale.js +1 -1
- package/dist/production/server/react-server/getConfig.js +1 -1
- package/dist/production/server/react-server/getFormatter.js +1 -1
- package/dist/production/server/react-server/getLocale.js +1 -1
- package/dist/production/server/react-server/getMessages.js +1 -1
- package/dist/production/server/react-server/getNow.js +1 -1
- package/dist/production/server/react-server/getTimeZone.js +1 -1
- package/dist/production/server/react-server/getTranslations.js +1 -1
- package/dist/types/src/server/react-client/index.d.ts +2 -2
- package/dist/types/src/server/react-server/getConfig.d.ts +1 -1
- package/dist/types/src/server/react-server/getLocale.d.ts +3 -1
- package/dist/types/src/server/react-server/getRequestConfig.d.ts +11 -1
- package/dist/types/test/navigation/shared/basePermanentRedirect.test.d.ts +1 -0
- package/dist/types/test/navigation/shared/baseRedirect.test.d.ts +1 -0
- package/package.json +7 -7
- package/dist/development/server/react-server/resolveLocaleArg.js +0 -15
- package/dist/esm/server/react-server/resolveLocaleArg.js +0 -1
- package/dist/production/server/react-server/resolveLocaleArg.js +0 -1
- package/dist/types/src/server/react-server/resolveLocaleArg.d.ts +0 -3
|
@@ -6,7 +6,7 @@ var navigation = require('next/navigation');
|
|
|
6
6
|
var utils = require('../../shared/utils.js');
|
|
7
7
|
|
|
8
8
|
function basePermanentRedirect(params) {
|
|
9
|
-
const localizedPathname = params.localePrefix === 'never' ? params.pathname : utils.prefixPathname(params.locale, params.pathname);
|
|
9
|
+
const localizedPathname = params.localePrefix === 'never' || !utils.isLocalHref(params.pathname) ? params.pathname : utils.prefixPathname(params.locale, params.pathname);
|
|
10
10
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
11
11
|
args[_key - 1] = arguments[_key];
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@ var navigation = require('next/navigation');
|
|
|
6
6
|
var utils = require('../../shared/utils.js');
|
|
7
7
|
|
|
8
8
|
function baseRedirect(params) {
|
|
9
|
-
const localizedPathname = params.localePrefix === 'never' ? params.pathname : utils.prefixPathname(params.locale, params.pathname);
|
|
9
|
+
const localizedPathname = params.localePrefix === 'never' || !utils.isLocalHref(params.pathname) ? params.pathname : utils.prefixPathname(params.locale, params.pathname);
|
|
10
10
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
11
11
|
args[_key - 1] = arguments[_key];
|
|
12
12
|
}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var getConfig = require('../server/react-server/getConfig.js');
|
|
7
|
-
var useLocale = require('./useLocale.js');
|
|
8
7
|
|
|
9
8
|
function useHook(hookName, promise) {
|
|
10
9
|
try {
|
|
@@ -20,8 +19,7 @@ function useHook(hookName, promise) {
|
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
function useConfig(hookName) {
|
|
23
|
-
|
|
24
|
-
return useHook(hookName, getConfig.default(locale));
|
|
22
|
+
return useHook(hookName, getConfig.default());
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
exports.default = useConfig;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var useConfig = require('./useConfig.js');
|
|
6
6
|
|
|
7
7
|
function useLocale() {
|
|
8
8
|
for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9
9
|
_ref[_key] = arguments[_key];
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
const config = useConfig.default('useLocale');
|
|
12
|
+
return config.locale;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
exports.default = useLocale;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var core = require('use-intl/core');
|
|
7
|
+
var RequestLocale = require('./RequestLocale.js');
|
|
7
8
|
var getRuntimeConfig = require('next-intl/config');
|
|
8
9
|
|
|
9
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -22,28 +23,36 @@ function getDefaultTimeZoneImpl() {
|
|
|
22
23
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
23
24
|
}
|
|
24
25
|
const getDefaultTimeZone = React.cache(getDefaultTimeZoneImpl);
|
|
25
|
-
async function receiveRuntimeConfigImpl(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
async function receiveRuntimeConfigImpl(getConfig, localeOverride) {
|
|
27
|
+
let hasReadLocale = false;
|
|
28
|
+
|
|
29
|
+
// In case the consumer doesn't read `params.locale` and instead provides the
|
|
30
|
+
// `locale` (either in a single-language workflow or because the locale is
|
|
31
|
+
// read from the user settings), don't attempt to read the request locale.
|
|
32
|
+
const params = {
|
|
33
|
+
get locale() {
|
|
34
|
+
hasReadLocale = true;
|
|
35
|
+
return localeOverride || RequestLocale.getRequestLocale();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
let result = getConfig(params);
|
|
30
39
|
if (result instanceof Promise) {
|
|
31
40
|
result = await result;
|
|
32
41
|
}
|
|
42
|
+
if (result.locale && hasReadLocale) {
|
|
43
|
+
console.error("\nYou've read the `locale` param that was passed to `getRequestConfig` but have also returned one from the function. This is likely an error, please ensure that you're consistently using a setup with or without i18n routing: https://next-intl-docs.vercel.app/docs/getting-started/app-router\n");
|
|
44
|
+
}
|
|
33
45
|
return {
|
|
34
46
|
...result,
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
locale: result.locale || params.locale,
|
|
48
|
+
now: result.now || getDefaultNow(),
|
|
49
|
+
timeZone: result.timeZone || getDefaultTimeZone()
|
|
37
50
|
};
|
|
38
51
|
}
|
|
39
52
|
const receiveRuntimeConfig = React.cache(receiveRuntimeConfigImpl);
|
|
40
|
-
async function getConfigImpl(
|
|
41
|
-
const runtimeConfig = await receiveRuntimeConfig(
|
|
42
|
-
|
|
43
|
-
...runtimeConfig,
|
|
44
|
-
locale
|
|
45
|
-
};
|
|
46
|
-
return core.initializeConfig(opts);
|
|
53
|
+
async function getConfigImpl(localeOverride) {
|
|
54
|
+
const runtimeConfig = await receiveRuntimeConfig(getRuntimeConfig__default.default, localeOverride);
|
|
55
|
+
return core.initializeConfig(runtimeConfig);
|
|
47
56
|
}
|
|
48
57
|
const getConfig = React.cache(getConfigImpl);
|
|
49
58
|
var getConfig$1 = getConfig;
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var core = require('use-intl/core');
|
|
7
7
|
var getConfig = require('./getConfig.js');
|
|
8
|
-
var resolveLocaleArg = require('./resolveLocaleArg.js');
|
|
9
8
|
|
|
10
9
|
async function getFormatterCachedImpl(locale) {
|
|
11
10
|
const config = await getConfig.default(locale);
|
|
@@ -20,8 +19,7 @@ const getFormatterCached = React.cache(getFormatterCachedImpl);
|
|
|
20
19
|
* you can override it by passing in additional options.
|
|
21
20
|
*/
|
|
22
21
|
async function getFormatter(opts) {
|
|
23
|
-
|
|
24
|
-
return getFormatterCached(locale);
|
|
22
|
+
return getFormatterCached(opts === null || opts === void 0 ? void 0 : opts.locale);
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
exports.default = getFormatter;
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var getConfig = require('./getConfig.js');
|
|
6
7
|
|
|
7
|
-
function
|
|
8
|
-
|
|
8
|
+
async function getLocaleCachedImpl() {
|
|
9
|
+
const config = await getConfig.default();
|
|
10
|
+
return Promise.resolve(config.locale);
|
|
9
11
|
}
|
|
12
|
+
const getLocaleCached = React.cache(getLocaleCachedImpl);
|
|
13
|
+
var getLocale = getLocaleCached;
|
|
10
14
|
|
|
11
15
|
exports.default = getLocale;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var getConfig = require('./getConfig.js');
|
|
7
|
-
var resolveLocaleArg = require('./resolveLocaleArg.js');
|
|
8
7
|
|
|
9
8
|
function getMessagesFromConfig(config) {
|
|
10
9
|
if (!config.messages) {
|
|
@@ -18,8 +17,7 @@ async function getMessagesCachedImpl(locale) {
|
|
|
18
17
|
}
|
|
19
18
|
const getMessagesCached = React.cache(getMessagesCachedImpl);
|
|
20
19
|
async function getMessages(opts) {
|
|
21
|
-
|
|
22
|
-
return getMessagesCached(locale);
|
|
20
|
+
return getMessagesCached(opts === null || opts === void 0 ? void 0 : opts.locale);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
exports.default = getMessages;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var getConfig = require('./getConfig.js');
|
|
7
|
-
var resolveLocaleArg = require('./resolveLocaleArg.js');
|
|
8
7
|
|
|
9
8
|
async function getNowCachedImpl(locale) {
|
|
10
9
|
const config = await getConfig.default(locale);
|
|
@@ -12,8 +11,7 @@ async function getNowCachedImpl(locale) {
|
|
|
12
11
|
}
|
|
13
12
|
const getNowCached = React.cache(getNowCachedImpl);
|
|
14
13
|
async function getNow(opts) {
|
|
15
|
-
|
|
16
|
-
return getNowCached(locale);
|
|
14
|
+
return getNowCached(opts === null || opts === void 0 ? void 0 : opts.locale);
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
exports.default = getNow;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var getConfig = require('./getConfig.js');
|
|
7
|
-
var resolveLocaleArg = require('./resolveLocaleArg.js');
|
|
8
7
|
|
|
9
8
|
async function getTimeZoneCachedImpl(locale) {
|
|
10
9
|
const config = await getConfig.default(locale);
|
|
@@ -12,8 +11,7 @@ async function getTimeZoneCachedImpl(locale) {
|
|
|
12
11
|
}
|
|
13
12
|
const getTimeZoneCached = React.cache(getTimeZoneCachedImpl);
|
|
14
13
|
async function getTimeZone(opts) {
|
|
15
|
-
|
|
16
|
-
return getTimeZoneCached(locale);
|
|
14
|
+
return getTimeZoneCached(opts === null || opts === void 0 ? void 0 : opts.locale);
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
exports.default = getTimeZone;
|
|
@@ -6,7 +6,6 @@ var React = require('react');
|
|
|
6
6
|
var core = require('use-intl/core');
|
|
7
7
|
var messageFormatCache = require('../../shared/messageFormatCache.js');
|
|
8
8
|
var getConfig = require('./getConfig.js');
|
|
9
|
-
var getLocale = require('./getLocale.js');
|
|
10
9
|
|
|
11
10
|
// Maintainer note: `getTranslations` has two different call signatures.
|
|
12
11
|
// We need to define these with function overloads, otherwise TypeScript
|
|
@@ -24,7 +23,7 @@ async function getTranslations(namespaceOrOpts) {
|
|
|
24
23
|
locale = namespaceOrOpts.locale;
|
|
25
24
|
namespace = namespaceOrOpts.namespace;
|
|
26
25
|
}
|
|
27
|
-
const config = await getConfig.default(locale
|
|
26
|
+
const config = await getConfig.default(locale);
|
|
28
27
|
return core.createTranslator({
|
|
29
28
|
...config,
|
|
30
29
|
messageFormatCache: messageFormatCache.getMessageFormatCache(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{permanentRedirect as
|
|
1
|
+
import{permanentRedirect as a}from"next/navigation";import{isLocalHref as e,prefixPathname as r}from"../../shared/utils.js";function t(t){const n="never"!==t.localePrefix&&e(t.pathname)?r(t.locale,t.pathname):t.pathname;for(var o=arguments.length,i=new Array(o>1?o-1:0),l=1;l<o;l++)i[l-1]=arguments[l];return a(n,...i)}export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{redirect as
|
|
1
|
+
import{redirect as a}from"next/navigation";import{isLocalHref as e,prefixPathname as r}from"../../shared/utils.js";function t(t){const n="never"!==t.localePrefix&&e(t.pathname)?r(t.locale,t.pathname):t.pathname;for(var o=arguments.length,i=new Array(o>1?o-1:0),l=1;l<o;l++)i[l-1]=arguments[l];return a(n,...i)}export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{use as e}from"react";import
|
|
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-docs.vercel.app/docs/environments/server-client-components#async-components"),{cause:e}):e}}(r,n())}export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"./useConfig.js";function r(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return e("useLocale").locale}export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cache as
|
|
1
|
+
import{cache as t}from"react";import{initializeConfig as e}from"use-intl/core";import{getRequestLocale as o}from"./RequestLocale.js";import n from"next-intl/config";const r=t((function(){return new Date}));const a=t((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const i=t((async function(t,e){let n=!1;const i={get locale(){return n=!0,e||o()}};let s=t(i);return s instanceof Promise&&(s=await s),s.locale&&n&&console.error("\nYou've read the `locale` param that was passed to `getRequestConfig` but have also returned one from the function. This is likely an error, please ensure that you're consistently using a setup with or without i18n routing: https://next-intl-docs.vercel.app/docs/getting-started/app-router\n"),{...s,locale:s.locale||i.locale,now:s.now||r(),timeZone:s.timeZone||a()}}));var s=t((async function(t){const o=await i(n,t);return e(o)}));export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cache as o}from"react";import{createFormatter as t}from"use-intl/core";import
|
|
1
|
+
import{cache as o}from"react";import{createFormatter as t}from"use-intl/core";import n from"./getConfig.js";const r=o((async function(o){const r=await n(o);return t(r)}));async function c(o){return r(null==o?void 0:o.locale)}export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{cache as o}from"react";import r from"./getConfig.js";var t=o((async function(){const o=await r();return Promise.resolve(o.locale)}));export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cache as e}from"react";import o from"./getConfig.js";
|
|
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-docs.vercel.app/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 +1 @@
|
|
|
1
|
-
import{cache as
|
|
1
|
+
import{cache as n}from"react";import o from"./getConfig.js";const t=n((async function(n){return(await o(n)).now}));async function r(n){return t(null==n?void 0:n.locale)}export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cache as t}from"react";import
|
|
1
|
+
import{cache as t}from"react";import n from"./getConfig.js";const o=t((async function(t){return(await n(t)).timeZone}));async function r(t){return o(null==t?void 0:t.locale)}export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cache as e}from"react";import{createTranslator as a}from"use-intl/core";import{getMessageFormatCache as s}from"../../shared/messageFormatCache.js";import
|
|
1
|
+
import{cache as e}from"react";import{createTranslator as a}from"use-intl/core";import{getMessageFormatCache as s}from"../../shared/messageFormatCache.js";import r from"./getConfig.js";var t=e((async function(e){let t,o;"string"==typeof e?t=e:e&&(o=e.locale,t=e.namespace);const m=await r(o);return a({...m,messageFormatCache:s(),namespace:t,messages:m.messages})}));export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),r=require("../../shared/utils.js");exports.default=function(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),r=require("../../shared/utils.js");exports.default=function(a){const t="never"!==a.localePrefix&&r.isLocalHref(a.pathname)?r.prefixPathname(a.locale,a.pathname):a.pathname;for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return e.permanentRedirect(t,...i)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),r=require("../../shared/utils.js");exports.default=function(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),r=require("../../shared/utils.js");exports.default=function(a){const t="never"!==a.localePrefix&&r.isLocalHref(a.pathname)?r.prefixPathname(a.locale,a.pathname):a.pathname;for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return e.redirect(t,...i)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("../server/react-server/getConfig.js")
|
|
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-docs.vercel.app/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("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./useConfig.js");exports.default=function(){for(var r=arguments.length,t=new Array(r),u=0;u<r;u++)t[u]=arguments[u];return e.default("useLocale").locale};
|
|
@@ -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("use-intl/core"),n=require("./RequestLocale.js");function o(e){return e&&e.__esModule?e:{default:e}}var r=o(require("next-intl/config"));const a=e.cache((function(){return new Date}));const i=e.cache((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const c=e.cache((async function(e,t){let o=!1;const r={get locale(){return o=!0,t||n.getRequestLocale()}};let c=e(r);return c instanceof Promise&&(c=await c),c.locale&&o&&console.error("\nYou've read the `locale` param that was passed to `getRequestConfig` but have also returned one from the function. This is likely an error, please ensure that you're consistently using a setup with or without i18n routing: https://next-intl-docs.vercel.app/docs/getting-started/app-router\n"),{...c,locale:c.locale||r.locale,now:c.now||a(),timeZone:c.timeZone||i()}}));var s=e.cache((async function(e){const n=await c(r.default,e);return t.initializeConfig(n)}));exports.default=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("use-intl/core"),t=require("./getConfig.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("use-intl/core"),t=require("./getConfig.js");const c=e.cache((async function(e){const c=await t.default(e);return r.createFormatter(c)}));exports.default=async function(e){return c(null==e?void 0:e.locale)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./getConfig.js");var t=e.cache((async function(){const e=await r.default();return Promise.resolve(e.locale)}));exports.default=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./getConfig.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./getConfig.js");function s(e){if(!e.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages");return e.messages}const t=e.cache((async function(e){return s(await r.default(e))}));exports.default=async function(e){return t(null==e?void 0:e.locale)},exports.getMessagesFromConfig=s;
|
|
@@ -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");const r=e.cache((async function(e){return(await t.default(e)).now}));exports.default=async function(e){return r(null==e?void 0:e.locale)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("./getConfig.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("./getConfig.js");const r=e.cache((async function(e){return(await t.default(e)).timeZone}));exports.default=async function(e){return r(null==e?void 0:e.locale)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),a=require("use-intl/core"),r=require("../../shared/messageFormatCache.js"),s=require("./getConfig.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),a=require("use-intl/core"),r=require("../../shared/messageFormatCache.js"),s=require("./getConfig.js");var t=e.cache((async function(e){let t,c;"string"==typeof e?t=e:e&&(c=e.locale,t=e.namespace);const o=await s.default(c);return a.createTranslator({...o,messageFormatCache:r.getMessageFormatCache(),namespace:t,messages:o.messages})}));exports.default=t;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { getRequestConfig as getRequestConfig_type, getFormatter as getFormatter_type, getNow as getNow_type, getTimeZone as getTimeZone_type, getMessages as getMessages_type,
|
|
1
|
+
import type { getRequestConfig as getRequestConfig_type, getFormatter as getFormatter_type, getNow as getNow_type, getTimeZone as getTimeZone_type, getMessages as getMessages_type, unstable_setRequestLocale as unstable_setRequestLocale_type } from '../react-server';
|
|
2
2
|
export declare function getRequestConfig(...args: Parameters<typeof getRequestConfig_type>): ReturnType<typeof getRequestConfig_type>;
|
|
3
3
|
export declare const getFormatter: typeof getFormatter_type;
|
|
4
4
|
export declare const getNow: typeof getNow_type;
|
|
5
5
|
export declare const getTimeZone: typeof getTimeZone_type;
|
|
6
6
|
export declare const getMessages: typeof getMessages_type;
|
|
7
|
-
export declare const getLocale:
|
|
7
|
+
export declare const getLocale: () => Promise<string>;
|
|
8
8
|
export declare const getTranslations: () => never;
|
|
9
9
|
export declare const unstable_setRequestLocale: typeof unstable_setRequestLocale_type;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntlConfig } from 'use-intl/core';
|
|
2
|
-
declare function getConfigImpl(
|
|
2
|
+
declare function getConfigImpl(localeOverride?: string): Promise<IntlConfig & {
|
|
3
3
|
getMessageFallback: NonNullable<IntlConfig['getMessageFallback']>;
|
|
4
4
|
now: NonNullable<IntlConfig['now']>;
|
|
5
5
|
onError: NonNullable<IntlConfig['onError']>;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { IntlConfig } from 'use-intl/core';
|
|
2
|
-
type RequestConfig = Omit<IntlConfig, 'locale'
|
|
2
|
+
type RequestConfig = Omit<IntlConfig, 'locale'> & {
|
|
3
|
+
/**
|
|
4
|
+
* Instead of reading a `locale` from the argument that's passed to the
|
|
5
|
+
* function within `getRequestConfig`, you can include a locale as part of the
|
|
6
|
+
* returned request configuration.
|
|
7
|
+
*
|
|
8
|
+
* This is helpful for apps that only support a single language and for apps
|
|
9
|
+
* where the locale should be read from user settings instead of the pathname.
|
|
10
|
+
**/
|
|
11
|
+
locale?: IntlConfig['locale'];
|
|
12
|
+
};
|
|
3
13
|
export type GetRequestConfigParams = {
|
|
4
14
|
locale: string;
|
|
5
15
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"funding": [
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@formatjs/intl-localematcher": "^0.2.32",
|
|
84
84
|
"negotiator": "^0.6.3",
|
|
85
|
-
"use-intl": "^3.
|
|
85
|
+
"use-intl": "^3.14.1"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
@@ -118,15 +118,15 @@
|
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
"path": "dist/production/index.react-server.js",
|
|
121
|
-
"limit": "16.
|
|
121
|
+
"limit": "16.66 KB"
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
"path": "dist/production/navigation.react-client.js",
|
|
125
|
-
"limit": "2.
|
|
125
|
+
"limit": "2.965 KB"
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
"path": "dist/production/navigation.react-server.js",
|
|
129
|
-
"limit": "
|
|
129
|
+
"limit": "17.64 KB"
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
132
|
"path": "dist/production/server.react-client.js",
|
|
@@ -134,12 +134,12 @@
|
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
136
|
"path": "dist/production/server.react-server.js",
|
|
137
|
-
"limit": "15.
|
|
137
|
+
"limit": "15.84 KB"
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
"path": "dist/production/middleware.js",
|
|
141
141
|
"limit": "6.19 KB"
|
|
142
142
|
}
|
|
143
143
|
],
|
|
144
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "d2668b856468b7203dd9e16cf134ea0219e59b39"
|
|
145
145
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var getLocale = require('./getLocale.js');
|
|
6
|
-
|
|
7
|
-
function resolveLocaleArg(opts) {
|
|
8
|
-
if (opts !== null && opts !== void 0 && opts.locale) {
|
|
9
|
-
return Promise.resolve(opts.locale);
|
|
10
|
-
} else {
|
|
11
|
-
return getLocale.default();
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
exports.default = resolveLocaleArg;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"./getLocale.js";function l(l){return null!=l&&l.locale?Promise.resolve(l.locale):e()}export{l as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./getLocale.js");exports.default=function(l){return null!=l&&l.locale?Promise.resolve(l.locale):e.default()};
|