nicool
solved - Localized data from CMS API and i18n behaviour
Hello! I have a question regarding the i18n module when fetching data from an api (graphql endpoint from Directus CMS).
I'm sending my graphql requests from the
useAsyncData
composable (https://nuxt-graphql-request.vercel.app/usage/components)
I'm using the locale
from useI18n
as a graphql variable to only fetch the correct translations.
It works when I generate the static website, but in dev mode the distant translations are not updated when changing locales (with a language switcher from the docs). I have to reload the page to see the correct translations, which is not ideal.
I tried using a watcher both inside and outside of the function to refresh the query but no luck…
Is this expected? Thanks!
edit: might be related to this https://github.com/nuxt-modules/i18n/issues/2377 ?
edit 2: might also be related to CORS (console error of Allow Origin and then Preflight Did Not Succeed when I allowed localhost)2 replies