]> git.r.bdr.sh - rbdr/forum/blame_incremental - src/components/language_selector/language_selector.svelte
Add gitlab CI config
[rbdr/forum] / src / components / language_selector / language_selector.svelte
... / ...
CommitLineData
1<script>
2 import { locale, locales } from 'svelte-i18n';
3 import { getLangNameFromCode } from 'language-name-map';
4
5 $: namedLocales = $locales
6 .map((code) => ({
7 code,
8 ...getLangNameFromCode(code)
9 }))
10 .sort((a, b) => a.native - b.native);
11
12 let selected = $locale;
13
14 $: {
15 locale.set(selected);
16 }
17</script>
18
19<select bind:value={selected}>
20 {#each namedLocales as namedLocale}
21 <option value={namedLocale.code}>{namedLocale.native}</option>
22 {/each}
23</select>
24
25<style>
26</style>