nuxt-modules / i18n

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

Custom Route Paths in nuxt.config dont work together with compiler macro defineI18nRoute #3029

Closed MickL closed 3 months ago

MickL commented 4 months ago

Environment

------------------------------
- Operating System: Darwin
- Node Version:     v21.6.1
- Nuxt Version:     3.12.3
- CLI Version:      3.12.0
- Nitro Version:    2.9.7
- Package Manager:  bun@1.1.18
- Builder:          -
- User Config:      extends, modules, future, experimental, runtimeConfig, i18n, routeRules, ignore, site, app, ogImage, sitemap, build
- Runtime Modules:  @nuxtjs/tailwindcss@^6.12.0, nuxt-icon@^0.6.10, @vee-validate/nuxt@^4.12.8, @nuxtjs/seo@^2.0.0-rc.11, nuxt-og-image
- Build Modules:    -
------------------------------

Reproduction

https://stackblitz.com/edit/github-o4bb8f?file=nuxt.config.ts

Describe the bug

Additional context

Mixed custom route paths in nuxt.config.ts and defineI18nRoute() is not possible. It must be either all in nuxt.config.ts or all with defineI18nRoute.

I dont know if this is supposed to work this way because the docs say:

You can use the defineI18nRoute compiler macro to set some custom paths for each page component.

Logs

No response

BobbieGoede commented 4 months ago

This is expected behavior, I suppose this should be documented more clearly.

The default value for customRoutes is 'pages', so by commenting customRoutes: 'config' it will switch back to its default value, options docs and custom routes docs for reference.

MickL commented 4 months ago

Thanks for the quick response! In this case I would suggest to remove the word 'some' and add the info that it is either one or the other :)

Btw. I added a question in the discussions if you might have time.

BobbieGoede commented 4 months ago

I agree the wording can be more definitive, the wording is a side effect of having contributors from across globe 💪 Feel free to open a PR if you find anything that needs fixing.