]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/menu/language-chooser.component.ts
Regroup abuse and blacklisted videos inside "moderation"
[github/Chocobozzz/PeerTube.git] / client / src / app / menu / language-chooser.component.ts
1 import { Component, ElementRef, ViewChild } from '@angular/core'
2 import { I18N_LOCALES } from '../../../../shared'
3 import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
4
5 @Component({
6 selector: 'my-language-chooser',
7 templateUrl: './language-chooser.component.html',
8 styleUrls: [ './language-chooser.component.scss' ]
9 })
10 export class LanguageChooserComponent {
11 @ViewChild('modal') modal: ElementRef
12
13 languages: { id: string, label: string }[] = []
14
15 constructor (private modalService: NgbModal) {
16 this.languages = Object.keys(I18N_LOCALES)
17 .map(k => ({ id: k, label: I18N_LOCALES[k] }))
18 }
19
20 show () {
21 this.modalService.open(this.modal)
22 }
23
24 buildLanguageLink (lang: { id: string }) {
25 return window.location.origin + '/' + lang.id
26 }
27
28 }