mirror of https://github.com/LemmyNet/lemmy-ui.git
Fix language bug on mobile browsers
This commit is contained in:
parent
3a593addfd
commit
48a6118173
|
@ -111,6 +111,11 @@ server.get("/*", async (req, res) => {
|
||||||
<script>window.isoData = ${serialize(isoData)}</script>
|
<script>window.isoData = ${serialize(isoData)}</script>
|
||||||
<script>window.lemmyConfig = ${serialize(config)}</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.title.toString()}
|
||||||
${helmet.meta.toString()}
|
${helmet.meta.toString()}
|
||||||
|
|
||||||
|
|
|
@ -394,9 +394,11 @@ export function getLanguage(override?: string): string {
|
||||||
export function getBrowserLanguage(): string {
|
export function getBrowserLanguage(): string {
|
||||||
// Intersect lemmy's langs, with the browser langs
|
// Intersect lemmy's langs, with the browser langs
|
||||||
let langs = languages ? languages.map(l => l.code) : ["en"];
|
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];
|
return allowedLangs[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue