Using @nuxtjs/i18n version 8.3.3, implementing auto redirect on success.

Hi, i have a struggle using "@nuxtjs/i18n": "^8.3.3" in my nuxt project. On submit form on success i want to implement auto redirtect and for that i am using await router.push(localePath("/registration/complete")); to navigate to lokalization path based on a cookie I also imported: import { useI18n } from "vue-i18n"; import { useRouter } from "vue-router"; const router = useRouter(); const { locale, t, localePath } = useI18n(); But i am getting error: localePath is not a function. My nuxt config: i18n: { lazy: true, langDir: "locales", strategy: "prefix_except_default", locales: [ { code: "en", iso: "en", name: "English", file: "en.json", }, { code: "fr", iso: "fr", name: "Français", file: "fr.json", }, { code: "de", iso: "de", name: "Deutsch", file: "de.json", }, { code: "cs", iso: "cs", name: "Čeština", file: "cs.json", }, { code: "es", iso: "es", name: "Español", file: "es.json", }, { code: "pl", iso: "pl", name: "Polski", file: "pl.json", }, ], defaultLocale: "en", detectBrowserLanguage: { useCookie: true, cookieKey: "locale", alwaysRedirect: true, fallbackLocale: "en", }, }, Am i doing something wrong?
5 Replies
dwol
dwol5mo ago
localepath is a separate composable. You need to do const localePath = useLocalePath()
maison margiela
maison margielaOP5mo ago
wow, thank you man
Cue
Cue5mo ago
In case you missed this in the docs, right at the beginning in the usage section. https://i18n.nuxtjs.org/docs/getting-started/usage#url-path
@nuxtjs/i18n
Usage
The basics to get started with the Nuxt i18n module is to translate with Vue I18n via the vueI18n option.
maison margiela
maison margielaOP5mo ago
thank you, but i am getting error 404 😄 I will try to find it, thank you
No description
Cue
Cue5mo ago
I know, the whole docs don’t work unless you navigate from the start page. Truly awful.
Want results from more Discord servers?
Add your server