File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<script lang="ts">
2+ const localeNames: Record <string , string > = {
3+ en: ' English' ,
4+ de: ' Deutsch' ,
5+ uk: ' Українська' ,
6+ es: ' Español' ,
7+ fr: ' Français' ,
8+ zh: ' 中文(简体)' ,
9+ ja: ' 日本語' ,
10+ ko: ' 한국어' ,
11+ ar: ' العربية' ,
12+ pt: ' Português' ,
13+ bg: ' Български' ,
14+ cs: ' Čeština' ,
15+ da: ' Dansk' ,
16+ el: ' Ελληνικά' ,
17+ hu: ' Magyar' ,
18+ it: ' Italiano' ,
19+ nl: ' Nederlands' ,
20+ pl: ' Polski' ,
21+ sv: ' Svenska' ,
22+ tr: ' Türkçe' ,
23+ sw: ' Kiswahili' ,
24+ ha: ' Hausa' ,
25+ am: ' አማርኛ' ,
26+ yo: ' Yorùbá' ,
27+ om: ' Afaan Oromoo' ,
28+ ff: ' Fulfulde' ,
29+ ig: ' Igbo' ,
30+ }
31+
232export default {
333 name: ' LanguageDropdown' ,
434
@@ -13,6 +43,11 @@ export default {
1343 this .open = false ;
1444 },
1545
46+ localeLabel(locale : string ) {
47+ const code = locale .toUpperCase ();
48+ return ` ${code } - ${localeNames [locale ] ?? code } ` ;
49+ },
50+
1651 onOutsideClick(e : MouseEvent ) {
1752 if (! (this .$el as HTMLElement ).contains (e .target as Node )) {
1853 this .open = false ;
@@ -48,7 +83,7 @@ export default {
4883 class =" dropdown-item"
4984 :class =" { active: $i18n.locale === locale }"
5085 @click =" changeLocale(locale)"
51- >{{ locale.toUpperCase( ) }}</button >
86+ >{{ localeLabel(locale ) }}</button >
5287 </li >
5388 </ul >
5489 </div >
You can’t perform that action at this time.
0 commit comments