X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fapp.component.ts;h=c77dc97deb2b78c685034a8ea16384dd7f262806;hb=b27b12552b1442db0f88bc891ceffc8c8ad79c43;hp=a464e90fac65fee5d3c711025b9eea93b75cac0f;hpb=b763f88dd0f455ce0ccae9cb81182c985a47c101;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index a464e90fa..c77dc97de 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -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 () {