nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.67k stars 469 forks source link

nuxt/i18n custom route paths doesn't work #2923

Open Gizem346 opened 2 months ago

Gizem346 commented 2 months ago

Environment

My nuxt and i18n version are: "@nuxtjs/i18n": "^8.3.0", "nuxt": "^3.10.1"

Reproduction

It's my github repo: https://github.com/Gizem346/i18n-testing and stackblitz reproduction link is here : https://stackblitz.com/~/github.com/Gizem346/i18n-testing

Describe the bug

Current locale is: en When i change language as deutch, also i want to change url path as de/uber-uns and de/kontaktiere-uns but it doesn't. When I manually type the address de/uber-uns into the search bar, I can access the page, but not when I change it via links. Here is nuxt/i18n custom route paths documantation: https://i18n.nuxtjs.org/docs/guide/custom-paths

What is Expected?

What is actually happening?

Additional context

No response

Logs

No response

BobbieGoede commented 2 months ago

Your stackblitz reproduction doesn't seem to work for me (I haven't checked your repo repro locally yet either) but I think the issue here is that you're configuring custom routes for about and not for about-us.

My guess is that changing the configuration to the following should make things work as expected:

    pages: {
      'about-us': {
        en: '/about-us',
        de: '/uber-uns'
      }
    },
Gizem346 commented 2 months ago

First of all, thank you for your contribution. @BobbieGoede Yes, when I updated it as you said, I saw that the url changed depending on the link I clicked. Thanks a lot. Expected: de/uber-uns Happened: de/uber-uns

But before, when I manually typed de/uber-uns in the search bar, I could see the "Uber Uns" page in RouterView. Now I can't see the relevant pages even though the router has changed.

ss-of-vue-dev-tool