From 3ecacadcac131921c0d5262a441f835e6deff7db Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Tue, 18 May 2021 16:32:54 +0200
Subject: [PATCH] app-shell: in case routing to an unknown language, fall back
 to the default

This happens for example if we access "/dbp-signature.html" in which case the
router interprets the file name as a language.
---
 packages/app-shell/src/app-shell.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/packages/app-shell/src/app-shell.js b/packages/app-shell/src/app-shell.js
index 7487f205..04372c54 100644
--- a/packages/app-shell/src/app-shell.js
+++ b/packages/app-shell/src/app-shell.js
@@ -271,6 +271,10 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
      * @param {string} lang
      */
     updateLangIfChanged(lang) {
+        // in case the language is unknown, fall back to the default
+        if (!i18n.languages.includes(lang)) {
+            lang = this.lang;
+        }
         if (this.lang !== lang) {
             this.lang = lang;
             this.router.update();
-- 
GitLab