1 import { Component, OnInit, OnDestroy } from '@angular/core';
2 import { TranslateService } from '@ngx-translate/core';
3 import { ConfigService, IConfig } from './services/config.service';
7 templateUrl: 'app.component.html'
10 export class AppComponent implements OnInit, OnDestroy {
11 private defaultLanguage = 'en';
12 public isCollapsed = true;
14 constructor(private translate: TranslateService, private configSvr: ConfigService) {
18 this.translate.addLangs(['en', 'fr']);
19 this.translate.setDefaultLang(this.defaultLanguage);
21 const browserLang = this.translate.getBrowserLang();
22 this.translate.use(browserLang.match(/en|fr/) ? browserLang : this.defaultLanguage);
24 this.configSvr.Conf$.subscribe((cfg: IConfig) => {
26 switch (cfg.language) {
34 lang = this.defaultLanguage;
36 this.translate.use(lang);
41 // this.aglIdentityService.loginResponse.unsubscribe();
42 // this.aglIdentityService.logoutResponse.unsubscribe();