-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
Migrating hook i18n:extend-messages to i18n:registerModule does not work #2141
Comments
Thank you for your feedback!
And, please give us a minimal reproduction of the code in the stackblize or github repo 🙏 |
I put a stackblitz link into description 👍 |
Any updates on this? |
Nice that there seems a fix. When it will be released I would like to test it |
@devonik I was hoping my PR would fix the issue in your setup but after some digging it looks like your reproduction reveals more issues that are still present... 😅 I've edited your reproduction to demonstrate the issues I ran into here. This reproduction uses the latest edge branch which includes my PR.
It may be less than ideal, but these issues can be worked around until we have fixes for them. With the latest edge version, not using inline config and having the module inside the project folder should make it work. I'll try and get these issues resolved in the meantime 😄 |
You have to come on it for now 😅 What a strange issue. Thanks your investigate your time. Looking forward to the fix. The workaround is sadly not a solution for my case but thanks for sharing. |
Mh I cannot make it running with npm:@nuxtjs/i18n-edge. Can your show it in stackblitz how it works now ? |
@devonik |
Mh now i am getting Cannot start nuxt: Cannot find module '/home/projects/github-asw9fc-i4vtwp/playground/@nuxtjs/i18n' in stackblitz https://stackblitz.com/edit/github-asw9fc-i4vtwp?file=package.json,src%2Fmodule.ts,playground%2Fpackage.json |
It looks like you installed After installing the edge channel there are still some changes you would have to make in the project to make it work. I have made the changes here. It's not possible to pass configuration from the experimental: {
jsTsFormatResource: true,
} Unfortunately at this moment you can only lazy-load locales from modules, so the project needs to be set up with the properties required for lazy loading (see docs). So you will have to add a directory in your project, with a locale file (could be an empty json file containing In the project with the changes I made you can see I added the following to the lazy: true,
langDir: 'lang',
locales: [{ code: 'en', file: 'en.json' }], And added a file ( {} I'm still working on some changes to remove these extra steps and make adding modules and layers with |
Could you ping it here if there is something done on this good approach ? :) |
@devonik It is still not possible to set other i18n configuration from a module, I can imagine it would complicate the priority of overrides between modules and layers and modules within layers. Here is an example of a basic i18n project with a module that provides translations. I think just setting |
Environment
Reproduction
Write a simple nuxt module and try to register messages to i18n with the new hook i18n:registerModule within modules setup().
https://stackblitz.com/edit/github-asw9fc
Describe the bug
My new hook in the module setup() looks like this:
In https://v8.i18n.nuxtjs.org/guide/lazy-load-translations I saw the required experimental.jsTsFormatResource but with no effect
The defineI18nLocale() in general.ts function is not called by server start.
Additional context
My old setup with hook i18n:extend-messages was running
Logs
No response
The text was updated successfully, but these errors were encountered: