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
Configured locales get overridden when installing @nuxtjs/i18n using Nuxt Kit's installModule utility #2874
Comments
Related #2809 |
It seemed to me that the |
The main issue I have with supporting So basically, I know we can support |
Here's a reproduction of what I'm thinking of is an issue: https://stackblitz.com/edit/github-a3adyq-gefcfu?file=nuxt.config.ts |
Yes, you are right. When you use However, I don't think that issue is related to my issue here. I'm using This issue already was reported in #2802 as well. |
As suggested in #2802, the EDIT: Actually, I think I see the issue. I think this line needs to be changed from: return mergeConfigLocales(configs) to: return mergeConfigLocales(configs, options.locales) |
Hey, this issue is still present. I updated the StackBlitz reproduction to use @nuxtjs/i18n version 8.3.0. |
Sorry about that, you're right, I'll have to change my fix to also take into account string locales (and object locales without files). I noticed your other issue comment (#2873 (comment)) about using layers as a workaround for that issue, the same will work for this issue. Even though
I just want to clarify using Only the options passed with the first call of |
I understand the issue with multiple For my use case however, I don’t see another way around using So in my module I am retrieving this data, and then I’m adding those pages as described in my other issue. To reslove that issue, I’m now creating those page components in a separate Nuxt Layer, so that I can distinguish the pages from my CMS from the pages in my Nuxt App so that I can delete them as well. So my module is located in that separate Nuxt Layer, but then I still need to extend the I know there is a |
In any case, thank you for your help and quick replies! If this issue could be resolved, then everything is working fine for me for now. :) |
Environment
Local environment:
StackBlitz reproduction environment:
Reproduction
https://stackblitz.com/edit/github-8ok7gy-kkmqkq
Describe the bug
I am adding new pages from my own module as documented here.
I am installing and configuring
@nuxtjs/i18n
from my own module after I added these new pages as documented here.The locales that I configured in the
moduleOptions
passed to theinstallModule
function are not present in the locales of thei18n
instance.Additional context
Use case: I want to add and configure new pages in a headless CMS, I want to translate the routes and I want to configure these route translations in the headless CMS as well.
I debugged the issue to the
applyLayerOptions
function. This is whereoptions.locales
is overridden bymergedLocales
.When generating
mergedLocales
in themergeLayerLocales
function, I can see thatoptions.locales
is made sure not empty, but I don't see it being used after that since themergeConfigLocales
function does not consideroptions
.Logs
No response
The text was updated successfully, but these errors were encountered: