Skip to content
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

Add NEXT_LOCALE cookie note to docs #20045

Merged
merged 1 commit into from
Dec 9, 2020
Merged

Conversation

ijjk
Copy link
Member

@ijjk ijjk commented Dec 9, 2020

Closes: #20044

@vercel vercel bot temporarily deployed to Preview December 9, 2020 21:54 Inactive
@ijjk
Copy link
Member Author

ijjk commented Dec 9, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
buildDuration 7.4s 7.5s ⚠️ +129ms
nodeModulesSize 82.5 MB 82.5 MB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
/ failed reqs 0 0
/ total time (seconds) 1.843 1.961 ⚠️ +0.12
/ avg req/sec 1356.22 1274.79 ⚠️ -81.43
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 0.966 1.019 ⚠️ +0.05
/error-in-render avg req/sec 2588.2 2452.37 ⚠️ -135.83
Client Bundles (main, webpack, commons)
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
677f882d2ed8..34b9.js gzip 12.8 kB 12.8 kB
framework.HASH.js gzip 39 kB 39 kB
main-899eb31..d9d9.js gzip 6.56 kB 6.56 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 59 kB 59 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
_app-7231d4b..5856.js gzip 1.28 kB 1.28 kB
_error-01375..90b6.js gzip 3.69 kB 3.69 kB
hooks-d4591d..e7c2.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-db223d9..dbd7.js gzip 1.61 kB 1.61 kB
routerDirect..fd29.js gzip 303 B 303 B
withRouter-b..76ae.js gzip 302 B 302 B
Overall change 8.31 kB 8.31 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
_buildManifest.js gzip 322 B 322 B
Overall change 322 B 322 B
Rendered Page Sizes
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
index.html gzip 614 B 614 B
link.html gzip 621 B 621 B
withRouter.html gzip 608 B 608 B
Overall change 1.84 kB 1.84 kB

Serverless Mode
General
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
buildDuration 8.8s 8.8s -7ms
nodeModulesSize 82.5 MB 82.5 MB
Client Bundles (main, webpack, commons)
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
677f882d2ed8..34b9.js gzip 12.8 kB 12.8 kB
framework.HASH.js gzip 39 kB 39 kB
main-899eb31..d9d9.js gzip 6.56 kB 6.56 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 59 kB 59 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
_app-7231d4b..5856.js gzip 1.28 kB 1.28 kB
_error-01375..90b6.js gzip 3.69 kB 3.69 kB
hooks-d4591d..e7c2.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-db223d9..dbd7.js gzip 1.61 kB 1.61 kB
routerDirect..fd29.js gzip 303 B 303 B
withRouter-b..76ae.js gzip 302 B 302 B
Overall change 8.31 kB 8.31 kB
Client Build Manifests
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
_buildManifest.js gzip 322 B 322 B
Overall change 322 B 322 B
Serverless bundles
vercel/next.js canary ijjk/next.js docs/locale-cookie Change
_error.js 1 MB 1 MB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB
link.js 1.06 MB 1.06 MB
routerDirect.js 1.05 MB 1.05 MB
withRouter.js 1.05 MB 1.05 MB
Overall change 5.16 MB 5.16 MB
Commit: cbae674

@kodiakhq kodiakhq bot merged commit 782537d into vercel:canary Dec 9, 2020
@ijjk ijjk deleted the docs/locale-cookie branch December 10, 2020 16:38
@@ -214,6 +214,12 @@ export default function IndexPage(props) {
}
```

## 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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is actually no note that this feature works only when user requesting /. That's why there are many issues about NEXT_LOCALE not working.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I opened a PR here explaining this behavior more #22736

kodiakhq bot pushed a commit that referenced this pull request Mar 3, 2021
This updates the `NEXT_LOCALE` cookie docs to mention how it is used for redirecting from `/` more specifically. 

x-ref: #20045 (comment)
@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The NEXT_LOCALE cookie should be documented
3 participants