diff options
author | Caroline Chuong <caroline.chuong@octo.com> | 2020-06-05 15:37:53 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-06-05 15:55:29 +0200 |
commit | 0c23363a2df0bf34538773f76d3c60865ac9f418 (patch) | |
tree | a7d7dbd13b77fd63384be54f5fae0153f1defd35 /client/src/app/menu | |
parent | e7809de95583c8c8c38427bd3c885b51e0f012ab (diff) | |
download | PeerTube-0c23363a2df0bf34538773f76d3c60865ac9f418.tar.gz PeerTube-0c23363a2df0bf34538773f76d3c60865ac9f418.tar.zst PeerTube-0c23363a2df0bf34538773f76d3c60865ac9f418.zip |
Add lang attribute in languages list menu
Diffstat (limited to 'client/src/app/menu')
-rw-r--r-- | client/src/app/menu/language-chooser.component.html | 2 | ||||
-rw-r--r-- | client/src/app/menu/language-chooser.component.ts | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/client/src/app/menu/language-chooser.component.html b/client/src/app/menu/language-chooser.component.html index a62b33dda..8aa7b9ab2 100644 --- a/client/src/app/menu/language-chooser.component.html +++ b/client/src/app/menu/language-chooser.component.html | |||
@@ -10,6 +10,6 @@ | |||
10 | </a> | 10 | </a> |
11 | 11 | ||
12 | <div class="modal-body"> | 12 | <div class="modal-body"> |
13 | <a *ngFor="let lang of languages" [href]="buildLanguageLink(lang)">{{ lang.label }}</a> | 13 | <a *ngFor="let lang of languages" [href]="buildLanguageLink(lang)" [lang]=lang.iso>{{ lang.label }}</a> |
14 | </div> | 14 | </div> |
15 | </ng-template> | 15 | </ng-template> |
diff --git a/client/src/app/menu/language-chooser.component.ts b/client/src/app/menu/language-chooser.component.ts index 9bc934ad4..dd4b35f5e 100644 --- a/client/src/app/menu/language-chooser.component.ts +++ b/client/src/app/menu/language-chooser.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, ElementRef, ViewChild, Inject, LOCALE_ID } from '@angular/core' | 1 | import { Component, ElementRef, ViewChild, Inject, LOCALE_ID } from '@angular/core' |
2 | import { I18N_LOCALES } from '../../../../shared' | 2 | import { I18N_LOCALES, getShortLocale } from '../../../../shared' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { sortBy } from '@app/shared/misc/utils' | 4 | import { sortBy } from '@app/shared/misc/utils' |
5 | import { getCompleteLocale } from '@shared/models/i18n' | 5 | import { getCompleteLocale } from '@shared/models/i18n' |
@@ -13,14 +13,14 @@ import { isOnDevLocale, getDevLocale } from '@app/shared/i18n/i18n-utils' | |||
13 | export class LanguageChooserComponent { | 13 | export class LanguageChooserComponent { |
14 | @ViewChild('modal', { static: true }) modal: ElementRef | 14 | @ViewChild('modal', { static: true }) modal: ElementRef |
15 | 15 | ||
16 | languages: { id: string, label: string }[] = [] | 16 | languages: { id: string, label: string, iso: string }[] = [] |
17 | 17 | ||
18 | constructor ( | 18 | constructor ( |
19 | private modalService: NgbModal, | 19 | private modalService: NgbModal, |
20 | @Inject(LOCALE_ID) private localeId: string | 20 | @Inject(LOCALE_ID) private localeId: string |
21 | ) { | 21 | ) { |
22 | const l = Object.keys(I18N_LOCALES) | 22 | const l = Object.keys(I18N_LOCALES) |
23 | .map(k => ({ id: k, label: I18N_LOCALES[k] })) | 23 | .map(k => ({ id: k, label: I18N_LOCALES[k] , iso: getShortLocale(k)})) |
24 | 24 | ||
25 | this.languages = sortBy(l, 'label') | 25 | this.languages = sortBy(l, 'label') |
26 | } | 26 | } |