diff --git a/packages/app-shell/src/app-shell.js b/packages/app-shell/src/app-shell.js index bf2bab5e86cee6158b619e9105c0aa600d3100cc..5e582b4f847b61f9603f196a9ce8a877b21b9413 100644 --- a/packages/app-shell/src/app-shell.js +++ b/packages/app-shell/src/app-shell.js @@ -44,6 +44,7 @@ export class AppShell extends ScopedElementsMixin(DBPLitElement) { constructor() { super(); this.lang = i18n.language; + this.languages = []; this.activeView = ''; this.entryPointUrl = ''; this.subtitle = ''; @@ -270,8 +271,12 @@ export class AppShell extends ScopedElementsMixin(DBPLitElement) { * @param {string} lang */ updateLangIfChanged(lang) { + // if the language is switched to English then i18n.languages is ['en'], instead of ['en', 'de'] + // so we are now only adding new ones to this.languages + this.languages = Array.from(new Set(this.languages.concat(i18n.languages))); + // in case the language is unknown, fall back to the default - if (!i18n.languages.includes(lang)) { + if (!this.languages.includes(lang)) { lang = this.lang; } if (this.lang !== lang) {