Skip to content
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

prefix_except_default doesn't generate new routes #2527

Closed
wrkmartech opened this issue Oct 28, 2023 · 1 comment
Closed

prefix_except_default doesn't generate new routes #2527

wrkmartech opened this issue Oct 28, 2023 · 1 comment
Labels

Comments

@wrkmartech
Copy link

Environment

  • Operating System: Linux
  • Node Version: v18.17.1
  • Nuxt Version: 3.8.0
  • CLI Version: 3.9.1
  • Nitro Version: 2.7.1
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools, modules, i18n, css, app
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/nuxt-starter-7insz7

Describe the bug

I have 2 initial routes:
pages/index.vue
pages/about.vue

and 3 locales: en, fr, es

Using the option "prefix_except_default" I expect to get a new array of routes, as described in doc:

[
  {
    path: '/',
    name: 'index___en'
  },
  {
    path: '/fr',
    name: 'index___fr'
  },
  {
    path: '/es',
    name: 'index___es'
  },
  {
    path: '/about',
    name: 'about___en'
  },
  {
    path: '/fr/about',
    name: 'about___fr'
  },
  {
    path: '/es/about',
    name: 'about___es'
  },
]

But new routes are not created

Additional context

No response

Logs

[Vue Router warn]: No match found for location with path "/fr"
[Vue Router warn]: No match found for location with path "/es"
[Vue Router warn]: No match found for location with path "/fr/about"
[Vue Router warn]: No match found for location with path "/es/about"
[Vue Router warn]: No match found for location with path "/fr"
[Vue Router warn]: No match found for location with path "/es"
[Vue Router warn]: No match found for location with path "/fr/about"
[Vue Router warn]: No match found for location with path "/es/about"
@BobbieGoede
Copy link
Collaborator

You need to set the locales option in the i18n config for this to work, I changed your reproduction to demonstrate [here].(https://stackblitz.com/edit/nuxt-starter-72yjba?file=i18n.config.ts,nuxt.config.ts)

I understand this is confusing as vueI18n detects the locales based on configured messages in i18n.config.ts separate from this module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants