Skip to content

Commit

Permalink
fixes #50
Browse files Browse the repository at this point in the history
  • Loading branch information
janschulte committed Nov 7, 2019
1 parent dabfcb6 commit dbffb87
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/apps/complete/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,22 @@ export class AppComponent {
translate: TranslateService,
settings: SettingsService<Settings>
) {
translate.setDefaultLang('en');
const browserLang = translate.getBrowserLang() || 'en';
translate.use(browserLang);
this.languageList = settings.getSettings().languages;

// necessary to load information on e.g. what 'medium' date format should look like in German etc.
registerLocaleData(localeDe);
if (this.languageList.length > 0) {
const defaultLang = translate.getBrowserLang() || 'en';
const foundLang = this.languageList.find(l => l.code === defaultLang);
if (foundLang) {
translate.use(foundLang.code);
} else {
translate.use(this.languageList[0].code);
}

// necessary to load information on e.g. what 'medium' date format should look like in German etc.
registerLocaleData(localeDe);
} else {
console.error('Please check the language configuration in the settings. You must at least configured one language.');
}

this.languageList = settings.getSettings().languages;
}
}

0 comments on commit dbffb87

Please sign in to comment.