-
-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Re-introduce locale
argument for getRequestConfig
to be used for overriding the locale
#1625
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
9 tasks
# Conflicts: # docs/src/pages/blog/_meta.tsx # docs/src/pages/blog/index.mdx # docs/src/pages/blog/next-intl-4-0.mdx
amannn
changed the title
feat: Support usage of
feat: Update Dec 20, 2024
rootParams
in i18n/request.ts
({locale})
in i18n/request.ts
to be used with rootParams
amannn
changed the title
feat: Update
feat: Re-introduce Dec 20, 2024
({locale})
in i18n/request.ts
to be used with rootParams
locale
argument for getRequestConfig
to be used with rootParams
amannn
changed the title
feat: Re-introduce
feat: Re-introduce Dec 20, 2024
locale
argument for getRequestConfig
to be used with rootParams
locale
argument for getRequestConfig
to be used for overriding the locale
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
tldr; — Do you use i18n routing and have you already switched to
await requestLocale
ingetRequestConfig
? If yes, you can skip this.Deprecation of
locale
in favor ofawait requestLocale
In next-intl 3.22, the
locale
argument that was passed togetRequestConfig
was deprecated in favor ofawait requestLocale
:This change was done in preparation for Next.js 15 where reading from headers became async. If you're using i18n routing, please upgrade to
requestLocale
now.Preview:
rootParams
are coming to Next.jsNow, with
rootParams
being on the horizon, this API will allow you to read a locale without receiving any param passed togetRequestConfig
:Among other simplifications, this allows to remove manual overrides like this that were merely done for enabling static rendering:
However, in some rare cases, you might want to render messages from multiple locales on the same page:
If you're using this pattern, you'll be able to accept the overridden locale in
getRequestConfig
as follows:This is quite an edge case, but this use case will remain supported via the re-introduced
locale
argument. Note thatawait requestLocale
considers a potential locale override, therefore thelocale
argument will only be relevant oncerootParams
are a thing.I hope to have more to share on this in the future!