Merge pull request #192 from goaaats/fix/filter_alt_lang

Filter "alt" languages when selecting based on navigator
This commit is contained in:
Paul Makles 2021-09-09 21:07:50 +01:00 committed by GitHub
commit d7e245ba58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
import { Language } from "../../context/Locale";
import { Language, Languages } from "../../context/Locale";
import type { SyncUpdateAction } from "./sync";
@ -25,6 +25,10 @@ export function findLanguage(lang?: string): Language {
const values = [];
for (const key in Language) {
const value = Language[key as keyof typeof Language];
// Skip alternative/joke languages
if (Languages[value].cat === "alt") continue;
values.push(value);
if (value.startsWith(code)) {
return value as Language;