Skip to content
Snippets Groups Projects
Commit d2839612 authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #130

parent 0ea6425b
No related branches found
No related tags found
No related merge requests found
...@@ -103,8 +103,15 @@ export class AppComponent implements OnInit, OnDestroy, Observer { ...@@ -103,8 +103,15 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
} }
ngOnInit() { ngOnInit() {
this.intlService.addObserver(this); // try to detect the browser's language
this.intlService.setLocale(this.appSetupService.language); const navLang = navigator.language;
try {
this.intlService.setLocale(navLang);
} catch (e) {
console.error(e.toString());
this.intlService.setLocale(this.appSetupService.language);
}
this.formulaireService.addObserver(this); this.formulaireService.addObserver(this);
this.subscribeErrorService(); this.subscribeErrorService();
this._innerWidth = window.innerWidth; this._innerWidth = window.innerWidth;
...@@ -206,14 +213,6 @@ export class AppComponent implements OnInit, OnDestroy, Observer { ...@@ -206,14 +213,6 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
this.errorService.removeObserver(this); this.errorService.removeObserver(this);
} }
private updateLocale() {
const tag = this.appSetupService.language;
document["locale"] = tag;
this.intlService.setLocale(tag);
this.appRef.tick();
}
// interface Observer // interface Observer
update(sender: any, data: any): void { update(sender: any, data: any): void {
...@@ -260,8 +259,6 @@ export class AppComponent implements OnInit, OnDestroy, Observer { ...@@ -260,8 +259,6 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
this.closeCalculator(form); this.closeCalculator(form);
break; break;
} }
} else if (sender instanceof I18nService) {
this.updateLocale();
} else if (sender instanceof FormulaireDefinition) { } else if (sender instanceof FormulaireDefinition) {
switch (data["action"]) { switch (data["action"]) {
case "nameChanged": case "nameChanged":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment