nuxt-modules / i18n

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

lazy:true doesn't work correctly #2902

Closed kominov closed 7 months ago

kominov commented 7 months ago

Environment


Reproduction

https://stackblitz.com/edit/nuxt-starter-cro1om?file=locales%2Fen.json,locales%2Fru.json,nuxt.config.ts,app.vue,pages%2Findex.vue,components%2Fmenu.vue

Describe the bug

I expect json with ru text will be loading only when i click ru locale. But instead, both files are downloaded at the same time image

Additional context

No response

Logs

No response

kazupon commented 7 months ago

Thank you for your reporting!

Unfortunately, I could not reproduce this issue in my enviroment. 😞

Your nuxt.config.ts has defaultLocale: 'en'. When you access the root of the page only en.json is loaded. If you switch to ru once and reload, both en.json and ru.json will be loaded. This behavior is correct. This behavior is correct, because the defaultLocale: 'en' and the switched ru are required.