Open Alolu opened 2 weeks ago
Hey! I know I have some problems with stratagies as it kept changing with nuxtjs-i18n betas. I planned on refactoring everything but I don't have much time :( You can already check the 4.0 branch but don't think it works yet
Hi again, thanks for your reply, I managed to make it work in my environment while retaining the desired functionality, but the way I made it work leaves me to believe there might be something wrong with my solution.
I simply removed this whole block, effectively removing modifiers for the prefix_and_default
strategy.
https://github.com/victorgarciaesgi/nuxt-typed-router/blob/673762d2c50266705faaf4fadff523b7d486285f/src/core/parser/i18n.modifiers.ts#L28-L42
The typing still works, while the routes are now correctly named, allowing navigation even in default. Can you tell me if my solution breaks a functionality or retro compatibility ?
Describe the bug
Hello, the
localePath
method from i18n and all its derivative (NuxtLinkLocale for instance) always returns an empty string when the current locale is the default one.The method works again when nuxt-typed-router is removed from the modules. I am using
prefix_and_default
as my i18n strategy and the latest version of nuxt-typed-router.After some digging, it seems that nuxt-typed-router removes the
___[locale]___default
suffix from the default route name, but i18n still localizes the route by suffixing with___[locale]___default
when using the default locale, causing the resolver to throw an error as there are no match found.Thank you for your work on this module, it is really helpful!
Expected behavior
the
localePath
method and its derivative should return the correct path if am using theprefix_and_defaut
strategy even if I am using the default locale.Screenshots
Environnement infos
Your
pages
folder structureYour nuxt.config.ts