i18nexus / next-i18n-router

Next.js App Router internationalized routing and locale detection.
MIT License
260 stars 18 forks source link

【Bug】the language does not switch when changing the defaultLocal #81

Closed piesuke closed 5 months ago

piesuke commented 5 months ago

It might be an issue with react-i18next, so if that is the case, I will raise an issue with react-i18next.

Steps to Reproduce

I created a codeSandbox example.

  1. Tap "en" on the Link type or Button type to switch to English.
  2. Then, try to switch back to Japanese by pressing "ja", but the text does not change to Japanese. This issue is resolved by reloading the page.

https://github.com/i18nexus/next-i18n-router/assets/30724683/ab7fccb8-b524-4641-b4c1-c8f490871702

Expected Behavior

When switching from English to Japanese (the default language), the switch operates correctly.

Actual Behavior

When switching from English to Japanese (the default language), the switch operates incorrectly.

i18nexus commented 5 months ago

It looks like you have quite a custom i18next setup and several console errors. I highly recommend using our example i18next project to setup your project: https://github.com/i18nexus/next-i18n-router/tree/main/examples/i18next-example

piesuke commented 5 months ago

Implementing according to the example resolved the issue. Thank you!