]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/app.component.ts
Add video dropdown in discover page
[github/Chocobozzz/PeerTube.git] / client / src / app / app.component.ts
index a464e90fac65fee5d3c711025b9eea93b75cac0f..c77dc97deb2b78c685034a8ea16384dd7f262806 100644 (file)
@@ -1,13 +1,13 @@
-import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core'
+import { Component, OnInit, ViewChild, AfterViewInit, Inject, LOCALE_ID } from '@angular/core'
 import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
 import { Event, GuardsCheckStart, NavigationEnd, Router, Scroll } from '@angular/router'
 import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core'
-import { is18nPath } from '../../../shared/models/i18n'
+import { is18nPath, getShortLocale } from '../../../shared/models/i18n'
 import { ScreenService } from '@app/shared/misc/screen.service'
 import { filter, map, pairwise, first } from 'rxjs/operators'
 import { Hotkey, HotkeysService } from 'angular2-hotkeys'
 import { I18n } from '@ngx-translate/i18n-polyfill'
-import { PlatformLocation, ViewportScroller } from '@angular/common'
+import { PlatformLocation, ViewportScroller, DOCUMENT } from '@angular/common'
 import { PluginService } from '@app/core/plugins/plugin.service'
 import { HooksService } from '@app/core/plugins/hooks.service'
 import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
@@ -42,6 +42,8 @@ export class AppComponent implements OnInit, AfterViewInit {
   private serverConfig: ServerConfig
 
   constructor (
+    @Inject(DOCUMENT) private document: Document,
+    @Inject(LOCALE_ID) private localeId: string,
     private i18n: I18n,
     private viewportScroller: ViewportScroller,
     private router: Router,
@@ -96,6 +98,8 @@ export class AppComponent implements OnInit, AfterViewInit {
     this.location.onPopState(() => this.modalService.dismissAll(POP_STATE_MODAL_DISMISS))
 
     this.openModalsIfNeeded()
+
+    this.document.documentElement.lang = getShortLocale(this.localeId)
   }
 
   ngAfterViewInit () {