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',
8 styleUrls: ['app.component.css']
11 export class AppComponent implements OnInit, OnDestroy {
12 private defaultLanguage = 'en';
13 public isCollapsed = true;
15 constructor(private translate: TranslateService, private configSvr: ConfigService) {
19 this.translate.addLangs(['en', 'fr']);
20 this.translate.setDefaultLang(this.defaultLanguage);
22 const browserLang = this.translate.getBrowserLang();
23 this.translate.use(browserLang.match(/en|fr/) ? browserLang : this.defaultLanguage);
25 this.configSvr.Conf$.subscribe((cfg: IConfig) => {
27 switch (cfg.language) {
35 lang = this.defaultLanguage;
37 this.translate.use(lang);
42 // this.aglIdentityService.loginResponse.unsubscribe();
43 // this.aglIdentityService.logoutResponse.unsubscribe();