Nuxt 3 - server-side: i18n switches back to default locale after setting locale #2184
Unanswered
githubnikola
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Node: 18.16.0
Nuxt: 3.4.3
@nuxtjs/i18n: 8.0.0-beta.7
@pinia/nuxt: 0.4.7
pinia: 2.0.33
Initial request comes with query param
?lang=sr
. I want to set i18n to use this locale on server and that locale to persist on client.i18n.config.mjs
nuxt.config.js
Now, I created plugin that runs only on server which uses store to load some app data among which is setting locale using await
$i18n.setLocale(localeFromCustomCookie)
. Looking at the console usingonBeforeLanguageSwitch
i see that the locale changed but then it switches back to default.What is the correct way to do this?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions