mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
web/LanguageDropdown: unbind locale
from select dropdown
This commit is contained in:
parent
86268eab3f
commit
d93e97e06b
1 changed files with 5 additions and 5 deletions
|
@ -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}
|
||||||
|
|
Loading…
Reference in a new issue