]>
Commit | Line | Data |
---|---|---|
a7cf03c1 | 1 | <script lang="ts"> |
58f7d521 RBR |
2 | import { locale, locales } from 'svelte-i18n'; |
3 | import { getLangNameFromCode } from 'language-name-map'; | |
862a5f9c | 4 | |
58f7d521 | 5 | $: namedLocales = $locales |
cac85db0 RBR |
6 | .map((code) => ({ |
7 | code, | |
8 | ...getLangNameFromCode(code) | |
9 | })) | |
10 | .sort((a, b) => a.native - b.native); | |
862a5f9c | 11 | |
cac85db0 | 12 | let selected = $locale; |
862a5f9c | 13 | |
58f7d521 | 14 | $: { |
cac85db0 | 15 | locale.set(selected); |
58f7d521 | 16 | } |
862a5f9c BB |
17 | </script> |
18 | ||
19 | <select bind:value={selected}> | |
58f7d521 RBR |
20 | {#each namedLocales as namedLocale} |
21 | <option value={namedLocale.code}>{namedLocale.native}</option> | |
22 | {/each} | |
862a5f9c BB |
23 | </select> |
24 | ||
25 | <style> | |
26 | </style> |