Fix/multilang (#326)

* Adding a few missing langs.

* Remove unused extra language issue.

* Fix secondary languages. Fixes #265
This commit is contained in:
Dessalines 2021-07-16 14:29:48 -04:00 committed by GitHub
parent 8cf1efbcb7
commit 98f88b8a26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -392,7 +392,12 @@ export function getLanguage(override?: string): 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 {