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