From b4999d16346e94fe57ee038be4717bd5c5220aa1 Mon Sep 17 00:00:00 2001 From: Konstantin Lukas <86915341+konstantin-lukas@users.noreply.github.com> Date: Sun, 5 Oct 2025 21:12:58 +0200 Subject: [PATCH] Update locale-select.md The nuxt-i18n docs state that you are not supposed to directly change the value of locale. However, this was the case in the code example, because locale was passed to v-model which caused undesirable behavior. Specifically, this changed the locale before it was loaded from the server. This would result in a console error and the translation key rendering instead of the translation for a brief moment. --- docs/content/docs/2.components/locale-select.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/content/docs/2.components/locale-select.md b/docs/content/docs/2.components/locale-select.md index 0a76cf0739..33e3f397a7 100644 --- a/docs/content/docs/2.components/locale-select.md +++ b/docs/content/docs/2.components/locale-select.md @@ -68,11 +68,15 @@ You can use it with Nuxt i18n: import * as locales from '@nuxt/ui/locale' const { locale, setLocale } = useI18n() +const selectedLang = ref(locale.value) // This ref is needed for lazy loaded translations +watch(locale, newLocale => { + selectedLang.value = newLocale +})