Change browser language detection to only redirect from default locale route
See original GitHub issueWhat problem does this feature solve?
When using strategies with prefixes, and detectBrowserLanguage
enabled, when user goes directly to a route with non-default locale, it would be better if we didn’t redirect to browser’s locale. The user’s intention, in theory, was to visit the site in that specific locale
Some more context in #451
What does the proposed changes look like?
Only redirect and change locale if first navigation is to route that matches defaultLocale
.
That would be a breaking change and would require major version.
<div align="right">This feature request is available on Nuxt community (#c301)</div>Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:9
Top Results From Across the Web
Change browser language detection to only redirect from ...
Only redirect and change locale if first navigation is to route that matches defaultLocale . That would be a breaking change and would...
Read more >Advanced Features: Internationalized Routing - Next.js
When localeDetection is set to false Next.js will no longer automatically redirect based on the user's preferred locale and will only provide locale...
Read more >Redirection to english version if browser language is not russian
1 Answer 1 ; language || navigator.userLanguage ; if (navLang != 'ru-RU'){ ; var path = window ; pathname; // Redirect to an...
Read more >Browser language detection and redirect - Performance
I want the Cloudflare to detect the preferred browser language and redirect the user to the appropriate language.
Read more >Browser language detection - i18n-module
Browser language is detected either from navigator when running on client-side, or from the accept-language HTTP header. Configured locales (or locales iso and/ ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@laurentdebricon A quick workaround https://github.com/konr4d/nuxt-i18n/commit/37f394dba13c055faae1890d7d2d6997a25904e5
Edit: I was able to make nuxt-i18n redirect from root path only and respect the saved cookie. E.g., a new user from France is initially redirected to /fr per hers/his Accept-Language. Then, every
/
entry results in a redirect to a locale path based on the value in that cookie. I wish I had time to write a proper non-kludge code and form it into a PR. Alas, for now it lives but here: https://github.com/konr4d/nuxt-i18n/tree/only-root-redirectFix released in v6.15.0