diff options
Diffstat (limited to 'client/src/app/menu')
-rw-r--r-- | client/src/app/menu/language-chooser.component.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/client/src/app/menu/language-chooser.component.ts b/client/src/app/menu/language-chooser.component.ts index b42e41855..f7ae69717 100644 --- a/client/src/app/menu/language-chooser.component.ts +++ b/client/src/app/menu/language-chooser.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' |
2 | import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers' | 2 | import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { objectKeysTyped } from '@shared/core-utils' | ||
4 | import { getCompleteLocale, getShortLocale, I18N_LOCALES } from '@shared/core-utils/i18n' | 5 | import { getCompleteLocale, getShortLocale, I18N_LOCALES } from '@shared/core-utils/i18n' |
5 | 6 | ||
6 | @Component({ | 7 | @Component({ |
@@ -17,8 +18,8 @@ export class LanguageChooserComponent { | |||
17 | private modalService: NgbModal, | 18 | private modalService: NgbModal, |
18 | @Inject(LOCALE_ID) private localeId: string | 19 | @Inject(LOCALE_ID) private localeId: string |
19 | ) { | 20 | ) { |
20 | const l = Object.keys(I18N_LOCALES) | 21 | const l = objectKeysTyped(I18N_LOCALES) |
21 | .map(k => ({ id: k, label: I18N_LOCALES[k], iso: getShortLocale(k) })) | 22 | .map(k => ({ id: k, label: I18N_LOCALES[k], iso: getShortLocale(k) })) |
22 | 23 | ||
23 | this.languages = sortBy(l, 'label') | 24 | this.languages = sortBy(l, 'label') |
24 | } | 25 | } |
@@ -35,7 +36,7 @@ export class LanguageChooserComponent { | |||
35 | const english = 'English' | 36 | const english = 'English' |
36 | const locale = isOnDevLocale() ? getDevLocale() : getCompleteLocale(this.localeId) | 37 | const locale = isOnDevLocale() ? getDevLocale() : getCompleteLocale(this.localeId) |
37 | 38 | ||
38 | if (locale) return I18N_LOCALES[locale] || english | 39 | if (locale) return I18N_LOCALES[locale as keyof typeof I18N_LOCALES] || english |
39 | return english | 40 | return english |
40 | } | 41 | } |
41 | } | 42 | } |