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

Locale code has similar part as page name #99

Closed
acibilous opened this issue Jun 7, 2023 · 5 comments
Closed

Locale code has similar part as page name #99

acibilous opened this issue Jun 7, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@acibilous
Copy link

I have the project config:

export default defineNuxtConfig({
  devtools: { enabled: true },
  modules: [
    'nuxt-typed-router',
    '@nuxtjs/i18n'
  ],
  i18n: {
    defaultLocale: 'us',
    locales: ['us', 'ca'],
  },
})

and page with name cart.vue
As cart.vue is similar 'ca' locale code generation of this route definition will be broken.
image
This condition will return true and } else if (route.name && !isLocaleRoute) { will not be achieved
image

Expected result:
route for cart page is generating

@acibilous
Copy link
Author

probably regexp should looks like this:

return !!route.path?.match(new RegExp(`/?(${i18LocalesRecognizer})(?=\/)`, "g"));

@victorgarciaesgi
Copy link
Owner

Hi! Thanks for the detailed explanation, i'll look at it, weird i didn't catch it

@victorgarciaesgi victorgarciaesgi added the bug Something isn't working label Jun 7, 2023
@victorgarciaesgi
Copy link
Owner

Should probably make a big cleanup of the code, sorry you had to dig in that 😅

@victorgarciaesgi
Copy link
Owner

Fixed in 3.2.3

@acibilous
Copy link
Author

acibilous commented Jun 8, 2023

Thanks for fixing it!
Now it works perfect :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants