i18n: lazy load files not working
Environment
npx nuxi info
Nuxi 3.6.1 18:48:21
18:48:21
RootDir: D:/work/projects/userquin/GitHub/userquin/vuetify-nuxt-module-main 18:48:21
Nuxt project info: 18:48:21
------------------------------
- Operating System: Windows_NT
- Node Version: v18.16.0
- Nuxt Version: 3.6.1
- Nitro Version: 2.5.2
- Package Manager: pnpm@8.6.5
- Builder: vite
- User Config: -
- Runtime Modules: -
- Build Modules: -
------------------------------
Reproduction
Fork https://github.com/userquin/vuetify-nuxt-module/ and then chekout feat-add-i18n-support branch:
https://github.com/userquin/vuetify-nuxt-module/tree/userquin/feat-add-i18n-support (I’m working in the PR to add i18n support to Vuetify 3)
Run pnpm install, and then you can run:
nr dev:prepare && nr dev: for single json file per localenr dev:prepare:multiple-json && nr dev:multiple-json: for multiple json files per locale
Describe the bug
Cannot load lazy translation files other than the default/fallback locale.
Additional context
I’m preparing a PR to fix the error, PR in a few minutes.
Logs
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 21 (10 by maintainers)
@BobbieGoede Yes, this is the case at the moment as edge channel currently relies on prerelease versions of both nitro/h3. Your workaround is correct, and won’t be needed once next nitro version is released.
Thank you for your mention about it.
We have already PR that can confirm it. https://github.com/nuxt-modules/i18n/pull/2294
@BobbieGoede Could you update #2294 please?
This issue is still present in builds, it looks like lazy loaded locales are all loaded on page load as prefetch scripts (this can be confirmed by building
playgroundand checking page source).I think the discussion in issue https://github.com/nuxt-modules/i18n/issues/1875 is on the right track, and https://github.com/nuxt-contrib/vue-bundle-renderer/pull/50 could make it possible to prevent prefetching/preloading, but I think Nuxt needs to include this change first.
In the meantime I will look into making the lazy loading tests more robusts, right now they only test whether lazy loaded files are loaded, not whether they are loaded on demand.
Following, have the same issue
All locale files are loading even though the
lazyoption is settrue. Below is my i18n config. Using version8.0.0-beta.13