mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 22:01:13 +00:00
Fix secondary languages. Fixes #265
This commit is contained in:
parent
7b6b47c7c8
commit
4ad0879aa2
1 changed files with 6 additions and 1 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue