nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.74k stars 480 forks source link

Nuxt generate (SSG) does not update components outside of NuxtPage on locale change #2944

Open Tienisto opened 6 months ago

Tienisto commented 6 months ago

Environment

Reproduction

Implementation:

  1. use prefix_except_default or prefix_and_default
  2. add locale switcher outside of <NuxtPage>
  3. build SSG (nuxt generate / pnpm run generate)

Steps to reproduce the issue:

  1. Change browser locale to de-DE and open the page.
  2. It should redirect to de version of the page (http://localhost:3000/de).
  3. Click on EN to switch to English version of the page.
  4. The error: See that EN is disappears (it should not) and also in the console you will see an error: TypeError: t is null

See minimal example repo: https://github.com/Tienisto/nuxt-i18n-bug

Describe the bug

When adding a locale switcher outside of <NuxtApp> and using SSG, switching locale after initial redirect based on browser locale fails.

See minimal example: https://github.com/Tienisto/nuxt-i18n-bug

Additional context

No response

Logs

No response

kazupon commented 4 months ago

Thank you for your reporting!

I've tried to reproduce your minimal reproduction! But, I have faced the error...

[nitro 17:51:18]  ERROR  Error: Could not load /path/to/node_modules/@nuxt/devtools/node_modules/unstorage/drivers/fs-lite.mjs (imported by virtual:#internal/nitro/virtual/storage): ENOENT: no such file or directory, open '/path/to/node_modules/@nuxt/devtools/node_modules/unstorage/drivers/fs-lite.mjs'

I could not reproduce. We do not know why that error occurs, but it is not related to this Issue.

@BobbieGoede if you have time, could you try to reproduce this issue? 🙏