aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/app.component.ts17
-rw-r--r--client/src/app/header/search-typeahead.component.html1
2 files changed, 15 insertions, 3 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index a464e90fa..aba91aad2 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,13 +1,13 @@
1import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core' 1import { Component, OnInit, ViewChild, AfterViewInit, Inject } from '@angular/core'
2import { DomSanitizer, SafeHtml } from '@angular/platform-browser' 2import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
3import { Event, GuardsCheckStart, NavigationEnd, Router, Scroll } from '@angular/router' 3import { Event, GuardsCheckStart, NavigationEnd, Router, Scroll } from '@angular/router'
4import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core' 4import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core'
5import { is18nPath } from '../../../shared/models/i18n' 5import { is18nPath, getShortLocale } from '../../../shared/models/i18n'
6import { ScreenService } from '@app/shared/misc/screen.service' 6import { ScreenService } from '@app/shared/misc/screen.service'
7import { filter, map, pairwise, first } from 'rxjs/operators' 7import { filter, map, pairwise, first } from 'rxjs/operators'
8import { Hotkey, HotkeysService } from 'angular2-hotkeys' 8import { Hotkey, HotkeysService } from 'angular2-hotkeys'
9import { I18n } from '@ngx-translate/i18n-polyfill' 9import { I18n } from '@ngx-translate/i18n-polyfill'
10import { PlatformLocation, ViewportScroller } from '@angular/common' 10import { PlatformLocation, ViewportScroller, DOCUMENT } from '@angular/common'
11import { PluginService } from '@app/core/plugins/plugin.service' 11import { PluginService } from '@app/core/plugins/plugin.service'
12import { HooksService } from '@app/core/plugins/hooks.service' 12import { HooksService } from '@app/core/plugins/hooks.service'
13import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 13import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
@@ -42,6 +42,7 @@ export class AppComponent implements OnInit, AfterViewInit {
42 private serverConfig: ServerConfig 42 private serverConfig: ServerConfig
43 43
44 constructor ( 44 constructor (
45 @Inject(DOCUMENT) private document: Document,
45 private i18n: I18n, 46 private i18n: I18n,
46 private viewportScroller: ViewportScroller, 47 private viewportScroller: ViewportScroller,
47 private router: Router, 48 private router: Router,
@@ -170,6 +171,16 @@ export class AppComponent implements OnInit, AfterViewInit {
170 filter(pathname => !pathname || pathname === '/' || is18nPath(pathname)) 171 filter(pathname => !pathname || pathname === '/' || is18nPath(pathname))
171 ).subscribe(() => this.redirectService.redirectToHomepage(true)) 172 ).subscribe(() => this.redirectService.redirectToHomepage(true))
172 173
174 navigationEndEvent.pipe(
175 map(() => window.location.pathname),
176 ).subscribe(pathname => {
177 if (is18nPath(pathname)) {
178 this.document.documentElement.lang = getShortLocale(pathname.split('/')[1])
179 } else {
180 this.document.documentElement.lang = 'en'
181 }
182 })
183
173 navigationEndEvent.subscribe(e => { 184 navigationEndEvent.subscribe(e => {
174 this.hooks.runAction('action:router.navigation-end', 'common', { path: e.url }) 185 this.hooks.runAction('action:router.navigation-end', 'common', { path: e.url })
175 }) 186 })
diff --git a/client/src/app/header/search-typeahead.component.html b/client/src/app/header/search-typeahead.component.html
index 710268664..6d931db20 100644
--- a/client/src/app/header/search-typeahead.component.html
+++ b/client/src/app/header/search-typeahead.component.html
@@ -2,6 +2,7 @@
2 <input 2 <input
3 type="text" id="search-video" name="search-video" #searchVideo i18n-placeholder placeholder="Search videos, channels…" 3 type="text" id="search-video" name="search-video" #searchVideo i18n-placeholder placeholder="Search videos, channels…"
4 [(ngModel)]="search" (ngModelChange)="onSearchChange()" (keyup)="handleKey($event)" (keydown.enter)="doSearch()" 4 [(ngModel)]="search" (ngModelChange)="onSearchChange()" (keyup)="handleKey($event)" (keydown.enter)="doSearch()"
5 aria-label="Search"
5 > 6 >
6 <span class="icon icon-search" (click)="doSearch()"></span> 7 <span class="icon icon-search" (click)="doSearch()"></span>
7 8