Skip to content

Commit c2af326

Browse files
committedDec 19, 2024
Re-introduce ({locale})
1 parent a7930c7 commit c2af326

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
 

‎packages/next-intl/src/server/react-server/getConfig.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ See also: https://next-intl.dev/docs/usage/configuration#i18n-request
3838
}
3939

4040
const params: GetRequestConfigParams = {
41+
locale: localeOverride,
42+
4143
// In case the consumer doesn't read `params.locale` and instead provides the
4244
// `locale` (either in a single-language workflow or because the locale is
4345
// read from the user settings), don't attempt to read the request locale.

‎packages/next-intl/src/server/react-server/getRequestConfig.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {IntlConfig} from 'use-intl/core';
1+
import type {IntlConfig, Locale} from 'use-intl/core';
22

33
export type RequestConfig = Omit<IntlConfig, 'locale'> & {
44
/**
@@ -8,6 +8,13 @@ export type RequestConfig = Omit<IntlConfig, 'locale'> & {
88
};
99

1010
export type GetRequestConfigParams = {
11+
/**
12+
* If you provide an explicit locale to an async server-side function like
13+
* `getTranslations({locale: 'en'})`, it will be passed via `locale` to
14+
* `getRequestConfig` so you can use it instead of the segment value.
15+
*/
16+
locale?: Locale;
17+
1118
/**
1219
* Typically corresponds to the `[locale]` segment that was matched by the middleware.
1320
*

0 commit comments

Comments
 (0)