What’s the best practice for defining i18n resources when using nested routes? #106
Unanswered
sakurawaifu
asked this question in
Q&A
Replies: 1 comment
-
For such a task, routesLocaleLinks exists. You can simply create one translation for several pages. https://s00d.github.io/nuxt-i18n-micro/guide/getting-started#%F0%9F%94%97-routeslocalelinks |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background
the
title
is inlocales/pages/post/{locale}.json
Question
When I visit
/post/123456
, thetitle
can't be found, because only the locale.json file that exactly matches the current route will be loaded, and the parent route's locale.json file won't. locale.json only works intuitively in leaf routes.If I use
defineI18nRoute
to define i18n resources inpost.vue
, I can make it work. Because whenpost.vue
is created, the i18n resources defined this way are merged into the translation cache. Sopost.vue
(and all its descendants, including child route page components/post/[id].vue
) can access it. These are just my guesses :)Maybe I did something wrong?😕
Related issue:
#6
Beta Was this translation helpful? Give feedback.
All reactions