X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fmenu%2Flanguage-chooser.component.ts;h=43f622dfb1baf5f168de652c1358bc75d6b3a6be;hb=52cc0d54850e0acf069d2f95d063826f16ff5238;hp=45fa73e762a15dea6a001badc95d1e1a166afd85;hpb=63347a0ff966c7863e5b7431effa1cb0668df893;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/menu/language-chooser.component.ts b/client/src/app/menu/language-chooser.component.ts index 45fa73e76..43f622dfb 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,17 +9,19 @@ 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 () { - this.modalService.open(this.modal) + this.modalService.open(this.modal, { centered: true }) } buildLanguageLink (lang: { id: string }) {