aboutsummaryrefslogtreecommitdiffstats
path: root/htdocs
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-10-28 15:08:24 +0200
committerArmand Philippot <git@armandphilippot.com>2021-10-28 15:08:24 +0200
commitf6b4748685dc000d1dd8d244ddf11def38410940 (patch)
tree8ea48b8760257525744b3d9733350c23b9491f71 /htdocs
parent011339bde7e2b482ff78fdb084fbe2af4482076e (diff)
fix(i18n): use english language if preferred language is not supported
If the language is not supported, the 'code' property does not exist. So I need to check its existence before using it. Now, the 'en' fallback is working.
Diffstat (limited to 'htdocs')
-rw-r--r--htdocs/src/js/app.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/htdocs/src/js/app.js b/htdocs/src/js/app.js
index e8ed928..13d63ef 100644
--- a/htdocs/src/js/app.js
+++ b/htdocs/src/js/app.js
@@ -345,7 +345,7 @@ function setAppLocale() {
(lang) => preferredLanguage.startsWith(lang.code)
// eslint-disable-next-line function-paren-newline -- Conflict with Prettier
);
- const locale = supportedLanguage.code || 'en';
+ const locale = supportedLanguage?.code || 'en';
setLocale(locale);
}