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',
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 () {