nuxt-modules / i18n

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

Unable to translate route of custom pages when those pages are not in the Nuxt pages folder #2873

Open benjamindedonder opened 6 months ago

benjamindedonder commented 6 months ago

Environment

Local environment:

Reproduction

https://stackblitz.com/edit/github-8ok7gy

Describe the bug

I am adding new pages from my own module as documented here. I am configuring route translations as documented here.

And I get a warning: Couldn't find AnalyzedNuxtPageMeta by NuxtPage (...), so no custom route for it.

Additional context

Use case: I want to add and configure new pages in a headless CMS.

I debugged the issue to the getRouteOptionsFromPages function and it seems that the problem is that these pages I added and wish to translate the route of are not present in the Nuxt pages folder.

Logs

No response

benjamindedonder commented 5 months ago

Update: I was able to resolve this issue by moving my module into it's own Nuxt Layer and making the module create and delete the page components itself inside the Nuxt pages folder of that layer.