Code Review
/
src
/
xds
/
xds-agent.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fixed webapp build and error message.
[src/xds/xds-agent.git]
/
webapp
/
src
/
app
/
app.component.ts
diff --git
a/webapp/src/app/app.component.ts
b/webapp/src/app/app.component.ts
index
40cfb24
..
b644ecd
100644
(file)
--- a/
webapp/src/app/app.component.ts
+++ b/
webapp/src/app/app.component.ts
@@
-1,37
+1,44
@@
-import { Component, OnInit, OnDestroy } from
"@angular/core"
;
-import {
Router } from '@angular/router
';
-
//TODO import {TranslateService} from "ng2-translate"
;
+import { Component, OnInit, OnDestroy } from
'@angular/core'
;
+import {
TranslateService } from '@ngx-translate/core
';
+
import { ConfigService, IConfig } from './services/config.service'
;
@Component({
@Component({
- selector: 'app',
- templateUrl: './app/app.component.html',
- styleUrls: ['./app/app.component.css']
+ selector: 'app-root',
+ templateUrl: 'app.component.html'
})
export class AppComponent implements OnInit, OnDestroy {
})
export class AppComponent implements OnInit, OnDestroy {
+ private defaultLanguage = 'en';
+ public isCollapsed = true;
- isCollapsed: boolean = true;
-
- private defaultLanguage: string = 'en';
-
- // I initialize the app component.
- //TODO constructor(private translate: TranslateService) {
- constructor(public router: Router) {
+ constructor(private translate: TranslateService, private configSvr: ConfigService) {
}
ngOnInit() {
}
ngOnInit() {
-
- /* TODO
- this.translate.addLangs(["en", "fr"]);
+ this.translate.addLangs(['en', 'fr']);
this.translate.setDefaultLang(this.defaultLanguage);
this.translate.setDefaultLang(this.defaultLanguage);
-
le
t browserLang = this.translate.getBrowserLang();
+
cons
t browserLang = this.translate.getBrowserLang();
this.translate.use(browserLang.match(/en|fr/) ? browserLang : this.defaultLanguage);
this.translate.use(browserLang.match(/en|fr/) ? browserLang : this.defaultLanguage);
- */
+
+ this.configSvr.Conf$.subscribe((cfg: IConfig) => {
+ let lang: string;
+ switch (cfg.language) {
+ case 'ENG':
+ lang = 'en';
+ break;
+ case 'FRA':
+ lang = 'fr';
+ break;
+ default:
+ lang = this.defaultLanguage;
+ }
+ this.translate.use(lang);
+ });
}
ngOnDestroy(): void {
}
ngOnDestroy(): void {
+ // this.aglIdentityService.loginResponse.unsubscribe();
+ // this.aglIdentityService.logoutResponse.unsubscribe();
}
}
-
-
}
}