The knowledge sources don’t mention @nuxtjs/i18n’s behavior with optional params ([[id]]) in the pages config, so I can’t give a documented, guaranteed‑correct i18n‑specific solution.
What is documented is how Nuxt generates and names routes for dynamic and optional params:
pages/my-page/edit/[[id]].vue will generate a route with an optional id param. [Dynamic routes]
- The route name will be derived from the path segments (e.g.
my-page-edit-id is consistent with Nuxt’s naming rules). [Routing pages]
Your warning:
Discarded invalid param(s) "id" when navigating
comes from vue-router when you pass a param that doesn’t exist in the route’s path. That means that, from the router’s point of view, the localized path you configured for that route does not contain :id, so the id param is considered invalid.
Given the lack of explicit i18n docs in the sources, the only configuration that is clearly compatible with how Nuxt/vue-router work is:
- Make sure the localized path includes the dynamic segment when you want to pass
id:
i18n: {
customRoutes: 'config',
pages: {
'my-page-edit-id': {
en: '/my-page/edit/[id]',
es: '/my-page/editar/[id]',
},
},
}
Then:
router.push(
localePath({
name: 'my-page-edit-id',
params: { id },
}),
)
This matches how dynamic routes are defined in Nuxt ([id] → :id), so vue-router will accept the param. [Dynamic routes]