From: Dessalines Date: Sun, 18 Jul 2021 15:08:24 +0000 (-0400) Subject: Fix language bug on mobile browsers X-Git-Url: http://these/git/%22https:/www.exeterceilidhs.net/%22%7B%7D/%7Bthis.captchaPngSrc%28%29%7D?a=commitdiff_plain;h=48a6118173086e538ad21827aa1d6c1339769f65;p=lemmy-ui.git Fix language bug on mobile browsers --- diff --git a/src/server/index.tsx b/src/server/index.tsx index 163ab53..c95e44a 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -111,6 +111,11 @@ server.get("/*", async (req, res) => { + + ${helmet.title.toString()} ${helmet.meta.toString()} diff --git a/src/shared/utils.ts b/src/shared/utils.ts index 931f2f1..49801d4 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -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]; }