blob: 135c8d793930b64bf16fc228c9f5b64fda3c5cb0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<script lang="ts">
import { run } from "svelte/legacy";
import { t, locale, locales } from "$lib/translations";
let { style = "" }: any = $props();
let l = $state($locale);
const handleChange = ({ currentTarget }) => {
const { value } = currentTarget;
document.cookie = `lang=${value}; path=/`;
$locale = value;
l = value;
};
</script>
<select name="language" aria-label="Language" bind:value={l} onchange={handleChange}>
{#each $locales as locale}
<option value={locale}>{$t(`lang.${locale}`)}</option>
{/each}
</select>
|