Closed jxk-developer closed 2 weeks ago
Try this:
const { locale } = useI18n()
const { data: navigation } = await useAsyncData(
'navigation',
() => fetchContentNavigation(
queryContent()
.where({ _locale: locale.value })
), {
watch: [locale]
})
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity.
Environment
Build Modules: -
Reproduction
Vue component file:
[...slug].vue
Code snippet attempting to fetch French navigation content:
Expected Outcome: The navigation data should be in French. Actual Outcome: The navigation data is returned in the default language (English).
Link to reproduce: https://stackblitz.com/edit/nuxt-starter-aww5hu?file=pages%2F%5B...slug%5D.vue
Describe the bug
Configuration
nuxt.config.ts
Problem Description
When attempting to fetch navigation content in the French language from a Vue component, the expected result should be content returned in French (fr). However, the content is being returned in the default language (English) instead of the specified French language.
Additional context
It would be greatly appreciated if you could provide documentation on integrating @nuxt/i18n with @nuxt/content. This guidance would be invaluable for developers looking to leverage both modules effectively in their projects.
Logs
No response