i18n
i18n copied to clipboard
setRouteParams should also control if the route is valid or not
Hi, We are in a situation where some of our pages are translated and some are not. It would really help if there was a way to disable the route using setRouteParams.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I think it makes sense to call context.error
in this case, without using setRouteParams
.
I would also love to see this feature. Currently, I am fetching the content in setup() (GraphQL) which returns a list in which locales the content is available, the route slugs are dynamic for each locale too.
Example
/en/blog/:slug
The current behaviour is that non translated pages are still showing the the alternative links in <head>
and locales on the locale selector, which results in 404 because the slugs are wrong for non-existing languages.
Disabling it with https://i18n.nuxtjs.org/ignoring-localized-routes is not working since the decision if that specific entry is available or not happens during the rendering and not on a per page component basis.
Something like the following would really help with solving this:
await $store.dispatch('i18n/setRouteParams', {
de: { slug: 'eintrag123' },
en: { slug: 'entry123' },
ja: false,
});