-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
How can I define localized dynamic slug routes #3331
Comments
Would you be able to provide a reproduction? 🙏 More infoWhy do I need to provide a reproduction?Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making. What will happen?If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect. If How can I create a reproduction?We have a couple of templates for starting with a minimal reproduction: 👉 Reproduction starter (v8) A public GitHub repository is also perfect. 👌 Please ensure that the reproduction is as minimal as possible. See more details in our guide. You might also find these other articles interesting and/or helpful: |
Ok here we go: You can see that the navigation between yesterday, today and tomorrow works as expected (incl. langswitch) Thank you for looking into it. |
Oh and I believe there is a problem with v9.
If I downgrade to v8: Both Langswitch AND messages work. (The translations in the footer are now displayed correctly). I did not see how I missed some things I would have to do differently in v9 docs, so I believe this is a bug. My initial question remains though. Thank you |
Please make sure to check out the migration docs to see the breaking changes introduced in v9. It sounds like the translations are not loaded as you haven't updated or configured the new directory structure.
I tried running your reproduction in stackblitz but it exits when trying to start a dev server 🤔 https://stackblitz.com/edit/jones-s-nuxt-i18n-demo-q1cjubg8?file=package.json. Could you take a look if you experience the same thing, otherwise I'll try and run it locally when I have more time. |
Thanks a lot for looking into it. 🙏 I'll post here again, when I've updated the repo. |
Ok I pushed the removal of husky. The migration guide says:
but I dont have any json files. I have the locales directly in my nuxt config and my i18n.config.ts is defining the messages. Should work too, right? Then my problems remain:
PS: I tried to run direclty on blitzstack. Now I don't see an error but it seems not to be able to connect to localhost port 3000. |
The module now looks for the You should update to v9.1.4 as it fixes a regression related to locale detection and loading on the server side. I'm not sure how other projects use nuxt content combined with nuxt i18n, specifically the routing aspect of it, custom routes are mapped based on pages/routes, for dynamic parameters the page itself should set the translated versions of the current page using Perhaps this helps you a bit further, I'm not sure when I have more time to check out how i18n routing can be fully utilized in this setup. |
Oh alright, I did not get the restructuring of the directory. Sorry. Just to summarize. I can now define the slugs with setI18nParams, and I managed to get a lang switch. but If I have a navigation, how can I set the correct link depending on the set locale? Assuming I have a link like
The text is now switching depending on the language, but the path is not. I do see other possibilities, but I wonder how this could be done: But I wondered if I could do this differently. Thanks for clarification. |
I know there is some documentation out there but I think they are unclear with the following issue:
I want to define some localized slugs somewhere. I tried for example to set them in my nuxt config:
I do have a page template
yesterday.vue
and there everything works great. But for imprint and dataprivacy I want to use either[...slug].vue
or[slug].vue
.For my lang switch I need to somehow have a function where I can pass in the wanted locale and the identifier.
I expected that this would work:
I also tried with localeRoute
But none of this will get me back the correct paths.
I tried to also do something like:
But also that approach was not successful.
I do see this entry:
https://i18n.nuxtjs.org/docs/guide/custom-paths#dynamic-route-parameters
But somehow I just can't translate this to my case.
In the end I only want to have an access to my localized page name map.
But I also am not able to log out the vue app.i18n or something alike to get access to the raw config...
I would really be interested to get to know how I can achieve this.
Thanks a lot.
The text was updated successfully, but these errors were encountered: