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

When using multiple lazy loaded files the original messages will be overwritten, but cannot be restored. #3089

Open
NoudH opened this issue Sep 5, 2024 · 0 comments

Comments

@NoudH
Copy link

NoudH commented Sep 5, 2024

Environment


  • Operating System: Windows_NT
  • Node Version: v22.2.0
  • Nuxt Version: 3.13.1
  • CLI Version: 3.13.1
  • Nitro Version: 2.9.7
  • Package Manager: npm@10.7.0
  • Builder: -
  • User Config: devtools, modules, css, compatibilityDate, supabase, i18n, eslint
  • Runtime Modules: @nuxt/ui@2.18.4, @nuxtjs/supabase@1.4.0, @nuxtjs/i18n@8.5.2, @nuxt/eslint@0.5.5, @nuxt/fonts@0.7.2
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-qmsqbq?file=pages%2Findex.vue

Describe the bug

When using multiple lazy loaded files the original messages will be overwritten, but cannot be restored.

Imagine the following scenario:

en.json

{
  "welcome": "welcome!"
}

en-GB.json

{
  "welcome": "Test!"
}

nuxt.config.ts

...
i18n: {
    lazy: true,
    langDir: 'lang',
    locales: [
      {
        name: 'English (American)',
        locale: 'en-US',
        code: 'en-US',
        files: ['en.json'],
      },
      {
        name: 'English (British)',
        locale: 'en-GB',
        code: 'en-GB',
        files: ['en.json', 'en-GB.json'],
      },
    ],
  },
...

Originally, when first navigating to the page the message will read "welcome!", then when switching to en-GB it will switch to "Test!" (So far so good). However, when switching back to en-US the text will still read "Test!". When force reloading the page it will turn back to "welcome!".

Expected behavior

When swapping back to a locale that was previously overwritten/inherited the original messages should be restored.

Additional context

No response

Logs

No response

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

No branches or pull requests

1 participant