fix(console): intercept navigator.language, set browser lang as default for user without explicit setting, user table outline, member create dialog import (#820)

* i18n interceptor, set language to browser lang

* nullcheck

* rm external idp log

* fix module imports, rm user displayname from i18n

* Update console/src/assets/i18n/de.json

Co-authored-by: Fabi <[email protected]>
This commit is contained in:
Max Peintner
2020-10-08 14:49:47 +02:00
committed by GitHub
co-authored by Fabi
parent 0bbc9c7c49
commit 286bba1c70
17 changed files with 54 additions and 13 deletions
+3 -1
View File
@@ -220,7 +220,9 @@ export class AppComponent implements OnDestroy {
this.authService.user.subscribe(userprofile => {
this.profile = userprofile;
const lang = userprofile.preferredLanguage.match(/en|de/) ? userprofile.preferredLanguage : 'en';
const cropped = navigator.language.split('-')[0] ?? 'en';
const fallbackLang = cropped.match(/en|de/) ? cropped : 'en';
const lang = userprofile.preferredLanguage.match(/en|de/) ? userprofile.preferredLanguage : fallbackLang;
this.translate.use(lang);
this.document.documentElement.lang = lang;
});