next-intl 4.0.0-beta-7e7011d → 4.0.0-beta-ddd5ae5

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.
@@ -10,8 +10,6 @@ function receiveRoutingConfig(input) {
10
10
  function receiveLocaleCookie(localeCookie) {
11
11
  return localeCookie ?? true ? {
12
12
  name: 'NEXT_LOCALE',
13
- maxAge: 5 * 60 * 60,
14
- // 5 hours
15
13
  sameSite: 'lax',
16
14
  ...(typeof localeCookie === 'object' && localeCookie)
17
15
 
@@ -21,6 +21,7 @@ See also: https://next-intl.dev/docs/usage/configuration#i18n-request
21
21
  `);
22
22
  }
23
23
  const params = {
24
+ locale: localeOverride,
24
25
  // In case the consumer doesn't read `params.locale` and instead provides the
25
26
  // `locale` (either in a single-language workflow or because the locale is
26
27
  // read from the user settings), don't attempt to read the request locale.
@@ -1 +1 @@
1
- function e(e){return{...e,localePrefix:(a=e.localePrefix,"object"==typeof a?a:{mode:a||"always"}),localeCookie:(o=e.localeCookie,!!(o??1)&&{name:"NEXT_LOCALE",maxAge:18e3,sameSite:"lax",..."object"==typeof o&&o}),localeDetection:e.localeDetection??!0,alternateLinks:e.alternateLinks??!0};var o,a}export{e as receiveRoutingConfig};
1
+ function e(e){return{...e,localePrefix:(a=e.localePrefix,"object"==typeof a?a:{mode:a||"always"}),localeCookie:(o=e.localeCookie,!!(o??1)&&{name:"NEXT_LOCALE",sameSite:"lax",..."object"==typeof o&&o}),localeDetection:e.localeDetection??!0,alternateLinks:e.alternateLinks??!0};var o,a}export{e as receiveRoutingConfig};
@@ -1 +1 @@
1
- import{cache as e}from"react";import{_createIntlFormatters as t,_createCache as o,initializeConfig as n}from"use-intl/core";import{getRequestLocale as r}from"./RequestLocale.js";import i from"next-intl/config";const s=e((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const a=e((async function(e,t){let o=e({get requestLocale(){return t?Promise.resolve(t):r()}});if(o instanceof Promise&&(o=await o),!o.locale)throw new Error("No locale was returned from `getRequestConfig`.\n\nSee https://next-intl.dev/docs/usage/configuration#i18n-request");return o})),c=e(t),m=e(o);const u=e((async function(e){const t=await a(i,e);return{...n(t),_formatters:c(m()),timeZone:t.timeZone||s()}}));export{u as default};
1
+ import{cache as e}from"react";import{_createIntlFormatters as t,_createCache as o,initializeConfig as n}from"use-intl/core";import{getRequestLocale as r}from"./RequestLocale.js";import i from"next-intl/config";const s=e((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const a=e((async function(e,t){let o=e({locale:t,get requestLocale(){return t?Promise.resolve(t):r()}});if(o instanceof Promise&&(o=await o),!o.locale)throw new Error("No locale was returned from `getRequestConfig`.\n\nSee https://next-intl.dev/docs/usage/configuration#i18n-request");return o})),c=e(t),m=e(o);const l=e((async function(e){const t=await a(i,e);return{...n(t),_formatters:c(m()),timeZone:t.timeZone||s()}}));export{l as default};
@@ -69,5 +69,5 @@ export declare function receiveRoutingConfig<AppLocales extends Locales, AppLoca
69
69
  alternateLinks: boolean | NonNullable<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>["alternateLinks"]>;
70
70
  };
71
71
  export type InitializedLocaleCookieConfig = false | LocaleCookieConfig;
72
- export type LocaleCookieConfig = Omit<CookieAttributes, 'name' | 'maxAge' | 'sameSite'> & Required<Pick<CookieAttributes, 'name' | 'maxAge' | 'sameSite'>>;
72
+ export type LocaleCookieConfig = Omit<CookieAttributes, 'name' | 'maxAge' | 'sameSite'> & Required<Pick<CookieAttributes, 'name' | 'sameSite'>>;
73
73
  export {};
@@ -1,4 +1,4 @@
1
- import type { IntlConfig } from 'use-intl/core';
1
+ import type { IntlConfig, Locale } from 'use-intl/core';
2
2
  export type RequestConfig = Omit<IntlConfig, 'locale'> & {
3
3
  /**
4
4
  * @see https://next-intl.dev/docs/usage/configuration#i18n-request
@@ -6,6 +6,12 @@ export type RequestConfig = Omit<IntlConfig, 'locale'> & {
6
6
  locale: IntlConfig['locale'];
7
7
  };
8
8
  export type GetRequestConfigParams = {
9
+ /**
10
+ * If you provide an explicit locale to an async server-side function like
11
+ * `getTranslations({locale: 'en'})`, it will be passed via `locale` to
12
+ * `getRequestConfig` so you can use it instead of the segment value.
13
+ */
14
+ locale?: Locale;
9
15
  /**
10
16
  * Typically corresponds to the `[locale]` segment that was matched by the middleware.
11
17
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "4.0.0-beta-7e7011d",
3
+ "version": "4.0.0-beta-ddd5ae5",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -112,7 +112,7 @@
112
112
  "dependencies": {
113
113
  "@formatjs/intl-localematcher": "^0.5.4",
114
114
  "negotiator": "^1.0.0",
115
- "use-intl": "4.0.0-beta-7e7011d"
115
+ "use-intl": "4.0.0-beta-ddd5ae5"
116
116
  },
117
117
  "peerDependencies": {
118
118
  "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
@@ -124,5 +124,5 @@
124
124
  "optional": true
125
125
  }
126
126
  },
127
- "gitHead": "8b5006b6a3d8bec471a5e9a4564c31befb5241b0"
127
+ "gitHead": "1f0e953c2dd85407f7f386eee8ee17181f5d03df"
128
128
  }