Closed kaboume closed 8 months ago
nuxt.config.js :
i18n: { vueI18n: "./i18n.config.ts", locales: ["en", "fr"], defaultLocale: "fr", customRoutes: "config", // disable custom route with page components pages: { index: { fr: "/", en: "/", }, contact: { fr: "/contact", en: "/contact", }, "formations/[uid]": { fr: "/formation/[uid]", en: "/training/[uid]", },
I use useSetI18nParams because I have Dynamic route parameters. Here is my page tree: /pages/training/[uid].view
In my page /pages/formations/[uid].vue, I have:
<script setup> const setI18nParams = useSetI18nParams(); const { data, pending, error } = await useLazyAsyncData(async () => { .... setI18nParams({ en: { uid: tabUrlsLanguage.get("en") }, fr: { uid: tabUrlsLanguage.get("fr") }, }); } }
When the switchLocalePath() is executed, the page laughs refreshing with this message in the log:
Locale ISO code is required to generate alternate link
No response
You should configure your locales as objects with an iso property, see https://i18n.nuxtjs.org/docs/guide/seo#requirements for an example. Let me know if that resolves the issue for you.
iso
Thanks, it works !
Environment
Build Modules: -
Reproduction
nuxt.config.js :
Describe the bug
I use useSetI18nParams because I have Dynamic route parameters. Here is my page tree: /pages/training/[uid].view
In my page /pages/formations/[uid].vue, I have:
When the switchLocalePath() is executed, the page laughs refreshing with this message in the log:
Locale ISO code is required to generate alternate link
Additional context
No response
Logs
No response