improve notification popup interactivity: read all, layout, position
[oweals/peertube.git] / client / src / app / menu / language-chooser.component.ts
index 45fa73e762a15dea6a001badc95d1e1a166afd85..4a6e4c75ae4b044be8afd83ebd645c90e312b1d4 100644 (file)
@@ -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 () {