]>
Commit | Line | Data |
---|---|---|
862a5f9c | 1 | <script> |
58f7d521 RBR |
2 | import { locale, locales } from 'svelte-i18n'; |
3 | import { getLangNameFromCode } from 'language-name-map'; | |
862a5f9c | 4 | |
58f7d521 RBR |
5 | $: namedLocales = $locales |
6 | .map((code) => ({ | |
7 | code, | |
8 | ...getLangNameFromCode(code) | |
9 | })) | |
10 | .sort((a, b) => a.native - b.native); | |
862a5f9c | 11 | |
58f7d521 | 12 | let selected = $locale; |
862a5f9c | 13 | |
58f7d521 | 14 | $: { |
58f7d521 RBR |
15 | locale.set(selected); |
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> |