web/LanguageDropdown: unbind locale from select dropdown

This commit is contained in:
dumbmoron 2024-09-16 15:13:24 +00:00
parent 86268eab3f
commit d93e97e06b
No known key found for this signature in database

View file

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import locale from "$lib/i18n/locale";
import languages from "$i18n/languages.json"; import languages from "$i18n/languages.json";
import { t, locales } from "$lib/i18n/translations"; import { t, locales } from "$lib/i18n/translations";
@ -10,10 +9,12 @@
$: currentSetting = $settings.appearance.language; $: currentSetting = $settings.appearance.language;
$: disabled = $settings.appearance.autoLanguage; $: disabled = $settings.appearance.autoLanguage;
const updateLocale = (lang: string) => { const updateLocale = (event: Event) => {
const target = event.target as HTMLSelectElement;
updateSetting({ updateSetting({
appearance: { appearance: {
language: lang as keyof typeof languages, language: target.value as keyof typeof languages,
}, },
}); });
}; };
@ -34,8 +35,7 @@
</div> </div>
<select <select
id="setting-dropdown-appearance-language" id="setting-dropdown-appearance-language"
bind:value={$locale} on:change={updateLocale}
on:change={() => updateLocale($locale)}
{disabled} {disabled}
> >
{#each $locales as value} {#each $locales as value}