Commit 7490923c authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Modify the page title

parent b9070552
Pipeline #4361 passed with stage
in 3 minutes and 56 seconds
import { Component, OnInit } from '@angular/core';
import { Router, NavigationEnd, ActivatedRoute } from '../../node_modules/@angular/router';
import { filter, map } from 'rxjs/operators';
import { AppRoutes } from './routes';
import { NavigationHistoryService } from './core/services';
import { Title } from '@angular/platform-browser';
import { Angulartics2Piwik } from 'angulartics2/piwik';
import { filter, map } from 'rxjs/operators';
import { ActivatedRoute, NavigationEnd, Router } from '../../node_modules/@angular/router';
import { environment } from '../environments/environment';
import { NavigationHistoryService } from './core/services';
import { AppRoutes } from './routes';
@Component({
selector: 'app-root',
......@@ -34,7 +35,7 @@ export class AppComponent implements OnInit {
filter(event => event instanceof NavigationEnd),
map(() => this._activatedRoute.snapshot),
map((route) => {
const lang = window.navigator.language.includes('fr') ? 'fr' : 'en';
const lang = window.location.href.includes(environment.angularAppHost.en) ? 'en' : 'fr';
let r = route;
const titles = [AppRoutes.root.title[lang]];
while (r.firstChild) {
......@@ -46,7 +47,7 @@ export class AppComponent implements OnInit {
return titles;
}),
).subscribe((titles) => {
const title = titles.join(' ');
const title = titles.join(' - ');
this._titleService.setTitle(title);
});
}
......
......@@ -3,8 +3,8 @@ export const AppRoutes = {
root: {
url: '',
title: {
fr: 'Données métropolitaines du Grand Lyon',
en: 'tropolitan data of the Grand Lyon',
fr: 'Données de la Métropole de Lyon',
en: 'Lyon Metropolitan Area\'s Data',
},
},
signin: {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment