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

The locale doesn't change for pages other than index page #619

Open
fr-irene opened this issue May 26, 2021 · 13 comments
Open

The locale doesn't change for pages other than index page #619

fr-irene opened this issue May 26, 2021 · 13 comments
Milestone

Comments

@fr-irene
Copy link

fr-irene commented May 26, 2021

I tried using next-translate v1.0.7
Using the sub path /ja

it works for index page localhost:3000/ja, but not working when navigating to other page, it keeps returning to default en locale localhost:3000/ja/product/detail

ready - started server on http://localhost:3000
next-translate - compiled page: /product/detail - locale: en - namespaces: common - used loader: getInitialProps
next-translate - compiled page: / - locale: ja - namespaces: common - used loader: getStaticProps
@aralroca
Copy link
Owner

aralroca commented May 26, 2021

You need to update to the last version of Next.js. Should be fixed after this PR vercel/next.js#21930.

Try Next.js 10.2.3 😊

@Gyaniultimate
Copy link

I too have this issue, even after updating to latest version of react, and next-translate.

@choo737
Copy link

choo737 commented Aug 26, 2021

Upgrade to nextjs 10.2.3 solved my issue

@aralroca
Copy link
Owner

aralroca commented Sep 6, 2021

@Gyaniultimate after migrate Next.js solve it?

@peggy1000423
Copy link

peggy1000423 commented Oct 6, 2021

@aralroca I have a same issue but upgrade next.js to 10 cannot solve it.

The locale language can only be detected when I entered the website for the first time. When the page changed by using Router.push, the locale language keep showing the defaultLocale that sets in config file.

Also, I tried to set NEXT_LOCALE into cookie, the value is correct but the pages keep getting the wrong defaultLocale.

@choo737
Copy link

choo737 commented Oct 7, 2021

@peggy1000423 can try to use specifically this version 10.2.3

@faaaaabi
Copy link

faaaaabi commented Jan 9, 2022

I'm experiencing the same issue with next 12.0.7 and next-translate 1.2.0. For the index page the browser gets redirected to the correct locale prefix. For subpages this does not happen.

Update:

defaultLocale: "en"
Browser-Language: "de"

  • domain.tld --- redirects to ---> domain.tld/de
  • domain.tld/imprint delivers version with default locale

@molimat
Copy link

molimat commented Feb 22, 2022

Check if you are using Link from next/link. I had the same problem but it was using link from Material Ui which overrides locales.

@MarkMurphy
Copy link

This still seems to be an issue in v12.1.4

@aralroca aralroca added this to the next release milestone Apr 9, 2022
@sanesanyo
Copy link

Any news of this? I can confirm that the issue is there in the latest version of NextJS. If I directly go to a particular route, it does not redirect to the specific locale page but rather go to the page for the default locale. I tried to play around with the middleware but that is no help either as the request object does any information on the right locale. It would be great if you could at least provide a direction how to fix this issue in case the bug is not already fixed.

Thanks a lot in advance.

@james104
Copy link

james104 commented Dec 7, 2022

With NextJS 13, my middleware works fine under development environment while not trigger at all under production environment...

@black197
Copy link

Still have this issue under dev environment with NEXT_LOCALE set.
Package versions:

├── next-translate@2.5.3
├── next@13.4.19

@ljk1291
Copy link

ljk1291 commented Oct 15, 2023

Did anyone figure out how to fix this? I'm having the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests