-
Notifications
You must be signed in to change notification settings - Fork 12
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
feature: prevent path generation for default language when rewriteDefaultLanguage is false #25
base: master
Are you sure you want to change the base?
feature: prevent path generation for default language when rewriteDefaultLanguage is false #25
Conversation
I just noticed that, while the |
Hi @nuria-fl, not sure to fully understand. Why isn't enough the already provided options I think something can go wrong here const pathSegment = this.setLocalePath(locale)
this.pagesToGenerate.push({
path: this.mergePathParts(pathSegment, options.path),
component: route.component, is path segment has no changes (for example with |
Even when disabling the path rewrite, the
I'll take a look at the implementation, I didn't see any warnings but I'll double check! |
totally agree! Perhaps a fix is more appropriate in this case directly fixing this behaviour (like an early return before pushing page into |
That makes sense! Honestly I started looking into the strategy solution before realising what |
For your use case, you should just set Disabling I agree with you that when |
@daaru00 thanks for the explanation, much clearer now :) I'm a bit busy with other projects but I'll try to adjust this in the next couple of weeks! |
…tLanguage is false
d5e9fa9
to
c088709
Compare
hi @daaru00, I adjusted the behavior to what we discussed, let me know what you think :) By the way, I noticed that the readme says that the default value for |
For a project I'm working on I needed the default language to not have the
/en/
path prefix. I checked how this is handled in Nuxt and there are these possible strategies:https://nuxt-community.github.io/nuxt-i18n/routing.html#strategy
This PR implements the
prefix_and_default
as the default, and also adds the option forprefix_except_default
.Let me know how you feel about this implementation, I'm open to any change :) I was unsure if it should throw an error if the strategy name is invalid, or if it should just fallback to the default option (that's what I did).