aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/menu/language-chooser.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-28 13:59:48 +0200
committerChocobozzz <me@florianbigard.com>2018-06-28 15:53:12 +0200
commit8afc19a6121569da054462c7cb351a3f13030a32 (patch)
tree6dba42963681062536e635dd3ca401e1c7b0ca9f /client/src/app/menu/language-chooser.component.ts
parent3ea9a1c311c3e3c55fb95560d4dd99a77c52df4a (diff)
downloadPeerTube-8afc19a6121569da054462c7cb351a3f13030a32.tar.gz
PeerTube-8afc19a6121569da054462c7cb351a3f13030a32.tar.zst
PeerTube-8afc19a6121569da054462c7cb351a3f13030a32.zip
Add ability to choose the language
Diffstat (limited to 'client/src/app/menu/language-chooser.component.ts')
-rw-r--r--client/src/app/menu/language-chooser.component.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/client/src/app/menu/language-chooser.component.ts b/client/src/app/menu/language-chooser.component.ts
new file mode 100644
index 000000000..3de6a129d
--- /dev/null
+++ b/client/src/app/menu/language-chooser.component.ts
@@ -0,0 +1,32 @@
1import { Component, ViewChild } from '@angular/core'
2import { ModalDirective } from 'ngx-bootstrap/modal'
3import { I18N_LOCALES } from '../../../../shared'
4
5@Component({
6 selector: 'my-language-chooser',
7 templateUrl: './language-chooser.component.html',
8 styleUrls: [ './language-chooser.component.scss' ]
9})
10export class LanguageChooserComponent {
11 @ViewChild('modal') modal: ModalDirective
12
13 languages: { [ id: string ]: string }[] = []
14
15 constructor () {
16 this.languages = Object.keys(I18N_LOCALES)
17 .map(k => ({ id: k, label: I18N_LOCALES[k] }))
18 }
19
20 show () {
21 this.modal.show()
22 }
23
24 hide () {
25 this.modal.hide()
26 }
27
28 buildLanguageLink (lang: { id: string }) {
29 return window.location.origin + '/' + lang.id
30 }
31
32}