mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 20:31:13 +00:00
Fix language bug on mobile browsers
This commit is contained in:
parent
3a593addfd
commit
48a6118173
2 changed files with 10 additions and 3 deletions
|
@ -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()}
|
||||
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue