mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-14 13:36:36 +00:00
fix: update lang toggle component
This commit is contained in:
@@ -1,24 +1,22 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
let lang = $state("RU");
|
import { LOCALES, type Locale } from "$lib/i18n/dict";
|
||||||
|
import { getLocale, setLocale } from "$lib/i18n/locale.svelte";
|
||||||
|
|
||||||
// TODO: change to sectioned dual buttons
|
const LANG_LABELS: Record<Locale, string> = { ru: "RU", en: "EN" };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="lang" role="group" aria-label="Language">
|
<div class="lang" role="group" aria-label="Language">
|
||||||
|
{#each LOCALES as l (l)}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="lang-btn"
|
class="lang-btn"
|
||||||
class:active={lang === "RU"}
|
class:active={getLocale() === l}
|
||||||
onclick={() => (lang = "RU")}
|
aria-pressed={getLocale() === l}
|
||||||
|
onclick={() => setLocale(l)}
|
||||||
>
|
>
|
||||||
RU
|
{LANG_LABELS[l]}
|
||||||
</button>
|
</button>
|
||||||
<button
|
{/each}
|
||||||
type="button"
|
|
||||||
class="lang-btn"
|
|
||||||
class:active={lang === "EN"}
|
|
||||||
onclick={() => (lang = "EN")}>EN</button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user