mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
only update lang when a valid one is typed/selected
This commit is contained in:
parent
d3d7769f81
commit
ab21dd8a3b
1 changed files with 13 additions and 2 deletions
|
@ -7,13 +7,14 @@
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
{{ $t("language-dialog.select-description") }}
|
{{ $t("language-dialog.select-description") }}
|
||||||
<v-autocomplete
|
<v-autocomplete
|
||||||
v-model="locale"
|
v-model="selectedLocale"
|
||||||
:items="locales"
|
:items="locales"
|
||||||
item-title="name"
|
item-title="name"
|
||||||
|
item-value="value"
|
||||||
class="my-3"
|
class="my-3"
|
||||||
hide-details
|
hide-details
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
offset
|
@update:model-value="onLocaleSelect"
|
||||||
>
|
>
|
||||||
<template #item="{ item, props }">
|
<template #item="{ item, props }">
|
||||||
<div
|
<div
|
||||||
|
@ -59,6 +60,14 @@ export default defineNuxtComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
const { locales: LOCALES, locale, i18n } = useLocales();
|
const { locales: LOCALES, locale, i18n } = useLocales();
|
||||||
|
|
||||||
|
const selectedLocale = ref(locale.value);
|
||||||
|
const onLocaleSelect = (value: string) => {
|
||||||
|
if (value && locales.some(l => l.value === value)) {
|
||||||
|
locale.value = value as any;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
watch(locale, () => {
|
watch(locale, () => {
|
||||||
dialog.value = false; // Close dialog when locale changes
|
dialog.value = false; // Close dialog when locale changes
|
||||||
});
|
});
|
||||||
|
@ -72,6 +81,8 @@ export default defineNuxtComponent({
|
||||||
i18n,
|
i18n,
|
||||||
locales,
|
locales,
|
||||||
locale,
|
locale,
|
||||||
|
selectedLocale,
|
||||||
|
onLocaleSelect,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue