Fix secondary languages. Fixes #265

This commit is contained in:
Dessalines 2021-07-16 14:28:10 -04:00
parent 7b6b47c7c8
commit 4ad0879aa2

View file

@ -392,7 +392,12 @@ export function getLanguage(override?: string): string {
} }
export function getBrowserLanguage(): string { export function getBrowserLanguage(): string {
return navigator.language; // 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",
];
return allowedLangs[0];
} }
export function getMomentLanguage(): string { export function getMomentLanguage(): string {