From 2eecf3ccfa292db46b546eee2bfabd7036ccd95e Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 20 May 2024 18:50:56 +0200 Subject: [PATCH] Fix unknown locales --- CHANGELOG.md | 1 + assets/js/app.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e0c91ef..ba038b7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Fix responsive layout on dashboard - Fix presenter layout with embeds when messages are hidden - Fix missing stream for form submits +- Fix unknown locales ## v2.0.0 diff --git a/assets/js/app.js b/assets/js/app.js index 1bea8509..a011769a 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -21,9 +21,16 @@ import Split from "split-grid"; import { TourGuideClient } from "@sjmc11/tourguidejs/src/Tour"; window.moment = moment; -const locale = +const supportedLocales = ["en", "fr", "de", "es"]; + +var locale = document.querySelector("html").getAttribute("lang") || navigator.language.split("-")[0]; + +if (!supportedLocales.includes(locale)) { + locale = "en"; +} + window.moment.locale("en"); window.moment.locale(locale); window.Alpine = Alpine;