mirror of https://github.com/Chocobozzz/PeerTube
Add lang attribute in languages list menu
parent
e7809de955
commit
0c23363a2d
|
@ -10,6 +10,6 @@
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<a *ngFor="let lang of languages" [href]="buildLanguageLink(lang)">{{ lang.label }}</a>
|
<a *ngFor="let lang of languages" [href]="buildLanguageLink(lang)" [lang]=lang.iso>{{ lang.label }}</a>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Component, ElementRef, ViewChild, Inject, LOCALE_ID } from '@angular/core'
|
import { Component, ElementRef, ViewChild, Inject, LOCALE_ID } from '@angular/core'
|
||||||
import { I18N_LOCALES } from '../../../../shared'
|
import { I18N_LOCALES, getShortLocale } from '../../../../shared'
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { sortBy } from '@app/shared/misc/utils'
|
import { sortBy } from '@app/shared/misc/utils'
|
||||||
import { getCompleteLocale } from '@shared/models/i18n'
|
import { getCompleteLocale } from '@shared/models/i18n'
|
||||||
|
@ -13,14 +13,14 @@ import { isOnDevLocale, getDevLocale } from '@app/shared/i18n/i18n-utils'
|
||||||
export class LanguageChooserComponent {
|
export class LanguageChooserComponent {
|
||||||
@ViewChild('modal', { static: true }) modal: ElementRef
|
@ViewChild('modal', { static: true }) modal: ElementRef
|
||||||
|
|
||||||
languages: { id: string, label: string }[] = []
|
languages: { id: string, label: string, iso: string }[] = []
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private modalService: NgbModal,
|
private modalService: NgbModal,
|
||||||
@Inject(LOCALE_ID) private localeId: string
|
@Inject(LOCALE_ID) private localeId: string
|
||||||
) {
|
) {
|
||||||
const l = Object.keys(I18N_LOCALES)
|
const l = Object.keys(I18N_LOCALES)
|
||||||
.map(k => ({ id: k, label: I18N_LOCALES[k] }))
|
.map(k => ({ id: k, label: I18N_LOCALES[k] , iso: getShortLocale(k)}))
|
||||||
|
|
||||||
this.languages = sortBy(l, 'label')
|
this.languages = sortBy(l, 'label')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue