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

Closed
NoudH opened this issue Sep 5, 2024 · 2 comments

Comments

@NoudH
Copy link

NoudH commented Sep 5, 2024

Environment



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

@BobbieGoede
Copy link
Collaborator

This has been resolved in the next major version (alpha currently), updated reproduction: https://stackblitz.com/edit/github-qmsqbq-ayzaed?file=package.json. We're hard at work to have a release candidate ready soon!

@BobbieGoede
Copy link
Collaborator

This will be resolved with #3137 since I've fixed the issue upstream! Here's an updated reproduction with using a preview release https://stackblitz.com/edit/github-qmsqbq-ayzaed?file=package.json,nuxt.config.ts,lang%2Fen-GB.json

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

2 participants