blob: 6511eccd08f3c7f1d7499dd53694f6e1b37a7f11 (
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" bind:value={l} onchange={handleChange}>
{#each $locales as locale}
<option value={locale}>{$t(`lang.${locale}`)}</option>
{/each}
</select>
|