X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fmenu%2Flanguage-chooser.component.ts;h=4a6e4c75ae4b044be8afd83ebd645c90e312b1d4;hb=10475dea7d2343c13014134b33bc75f7c59ac992;hp=45fa73e762a15dea6a001badc95d1e1a166afd85;hpb=63347a0ff966c7863e5b7431effa1cb0668df893;p=oweals%2Fpeertube.git diff --git a/client/src/app/menu/language-chooser.component.ts b/client/src/app/menu/language-chooser.component.ts index 45fa73e76..4a6e4c75a 100644 --- a/client/src/app/menu/language-chooser.component.ts +++ b/client/src/app/menu/language-chooser.component.ts @@ -1,6 +1,7 @@ import { Component, ElementRef, ViewChild } from '@angular/core' import { I18N_LOCALES } from '../../../../shared' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' +import { sortBy } from '@app/shared/misc/utils' @Component({ selector: 'my-language-chooser', @@ -8,13 +9,15 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap' styleUrls: [ './language-chooser.component.scss' ] }) export class LanguageChooserComponent { - @ViewChild('modal') modal: ElementRef + @ViewChild('modal', { static: true }) modal: ElementRef languages: { id: string, label: string }[] = [] constructor (private modalService: NgbModal) { - this.languages = Object.keys(I18N_LOCALES) - .map(k => ({ id: k, label: I18N_LOCALES[k] })) + const l = Object.keys(I18N_LOCALES) + .map(k => ({ id: k, label: I18N_LOCALES[k] })) + + this.languages = sortBy(l, 'label') } show () {