Skip to content

Commit 7984140

Browse files
author
Your Name
committed
feat: Fixed language switch so it updates immediately (no refresh)
1 parent 8b57e4e commit 7984140

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/pages/settings.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ const setLocale: typeof setNuxti18nLocale = newLocale => {
4040
settings.value.selectedLocale = newLocale
4141
return setNuxti18nLocale(newLocale)
4242
}
43+
44+
function handleLocaleChange(newLocale?: string) {
45+
if (!newLocale) return
46+
setLocale(newLocale)
47+
}
4348
</script>
4449

4550
<template>
@@ -244,8 +249,8 @@ const setLocale: typeof setNuxti18nLocale = newLocale => {
244249
<SelectField
245250
id="language-select"
246251
:items="locales.map(loc => ({ label: loc.name ?? '', value: loc.code }))"
247-
v-model="currentLocale"
248-
@update:modelValue="setLocale($event as typeof currentLocale)"
252+
:modelValue="currentLocale"
253+
@update:modelValue="handleLocaleChange"
249254
block
250255
size="sm"
251256
class="max-w-48"

0 commit comments

Comments
 (0)