web/LanguageDropdown: refactor

This commit is contained in:
wukko 2024-08-30 17:17:43 +06:00
parent b3954b9209
commit 1850264da7
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -1,14 +1,13 @@
<script lang="ts"> <script lang="ts">
import settings, { updateSetting } from "$lib/state/settings";
import { t, locales } from "$lib/i18n/translations";
import locale from "$lib/i18n/locale"; 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 settings, { updateSetting } from "$lib/state/settings";
import IconSelector from "@tabler/icons-svelte/IconSelector.svelte"; import IconSelector from "@tabler/icons-svelte/IconSelector.svelte";
$: currentSetting = $settings.appearance.language; $: currentSetting = $settings.appearance.language;
$: disabled = $settings.appearance.autoLanguage; $: disabled = $settings.appearance.autoLanguage;
const updateLocale = (lang: string) => { const updateLocale = (lang: string) => {
@ -37,7 +36,7 @@
id="setting-dropdown-appearance-language" id="setting-dropdown-appearance-language"
bind:value={$locale} bind:value={$locale}
on:change={() => updateLocale($locale)} on:change={() => updateLocale($locale)}
disabled={disabled} {disabled}
> >
{#each $locales as value} {#each $locales as value}
<option {value} selected={currentSetting === value}> <option {value} selected={currentSetting === value}>