Unverified Commit fdeff57c authored by Anatolii Kurochkin's avatar Anatolii Kurochkin Committed by GitHub

docs: clarify `Internationalization (i18n) Routing` (#63853)

## Description

Updated [Internationalization (i18n)
Routing](https://nextjs.org/docs/pages/building-your-application/routing/internationalization#leveraging-the-next_locale-cookie)
to clarify that `NEXT_LOCALE` does not override the `accept-language`
header value; rather, it prioritizes the `NEXT_LOCALE` cookie value over
`accept-language`.

## How has this been tested?

Ran `pnpm prettier-fix`
parent 6fb9efbc
...@@ -279,7 +279,7 @@ export default function IndexPage(props) { ...@@ -279,7 +279,7 @@ export default function IndexPage(props) {
## Leveraging the `NEXT_LOCALE` cookie ## Leveraging the `NEXT_LOCALE` cookie
Next.js supports overriding the accept-language header with a `NEXT_LOCALE=the-locale` cookie. This cookie can be set using a language switcher and then when a user comes back to the site it will leverage the locale specified in the cookie when redirecting from `/` to the correct locale location. Next.js allows setting a `NEXT_LOCALE=the-locale` cookie, which takes priority over the accept-language header. This cookie can be set using a language switcher and then when a user comes back to the site it will leverage the locale specified in the cookie when redirecting from `/` to the correct locale location.
For example, if a user prefers the locale `fr` in their accept-language header but a `NEXT_LOCALE=en` cookie is set the `en` locale when visiting `/` the user will be redirected to the `en` locale location until the cookie is removed or expired. For example, if a user prefers the locale `fr` in their accept-language header but a `NEXT_LOCALE=en` cookie is set the `en` locale when visiting `/` the user will be redirected to the `en` locale location until the cookie is removed or expired.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment