Reapply "fix: i18n nuxt context error"

This reverts commit 0ab9100c46.
This commit is contained in:
Michael H.
2026-08-29 15:35:13 +02:00
parent 17aaf06590
commit 769bde8c0b
+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
})
}
}