fix: i18n nuxt context error

This commit is contained in:
Michael H.
2026-08-28 15:30:55 +02:00
parent c2cbf16434
commit a1b73d089e
+4 -1
View File
@@ -201,7 +201,10 @@ export default defineNuxtPlugin({
locale.value = newLocale
if (persist) {
useCookie('locale', { maxAge: 31536000, path: '/' }).value = newLocale
// Awaiting loadLocale above drops the Nuxt context on the server, where useCookie needs it
nuxtApp.runWithContext(() => {
useCookie('locale', { maxAge: 31536000, path: '/' }).value = newLocale
})
}
}