]> Untitled Git - lemmy-ui.git/commitdiff
Fix language bug on mobile browsers
authorDessalines <tyhou13@gmx.com>
Sun, 18 Jul 2021 15:08:24 +0000 (11:08 -0400)
committerDessalines <tyhou13@gmx.com>
Sun, 18 Jul 2021 15:08:24 +0000 (11:08 -0400)
src/server/index.tsx
src/shared/utils.ts

index 163ab538ac299dae24bb080ed1d6b91deb559df0..c95e44af29c8ea2aabddea3ef2ffd4cbeb894419 100644 (file)
@@ -111,6 +111,11 @@ server.get("/*", async (req, res) => {
            <script>window.isoData = ${serialize(isoData)}</script>
            <script>window.lemmyConfig = ${serialize(config)}</script>
 
+           <!-- A remote debugging utility for mobile
+           <script src="//cdn.jsdelivr.net/npm/eruda"></script>
+           <script>eruda.init();</script>
+           -->
+
            ${helmet.title.toString()}
            ${helmet.meta.toString()}
 
index 931f2f1fb5bab60bb00d89e34a3ec2ac5801f718..49801d438cfe0754d7a5bf8aeabbe0838b60a9f5 100644 (file)
@@ -394,9 +394,11 @@ export function getLanguage(override?: string): string {
 export function getBrowserLanguage(): string {
   // Intersect lemmy's langs, with the browser langs
   let langs = languages ? languages.map(l => l.code) : ["en"];
-  let allowedLangs = navigator.languages.filter(v => langs.includes(v)) || [
-    "en",
-  ];
+
+  // NOTE, mobile browsers seem to be missing this list, so append en
+  let allowedLangs = navigator.languages
+    .concat("en")
+    .filter(v => langs.includes(v));
   return allowedLangs[0];
 }