fix: filter alt langs when selecting by navigator

This commit is contained in:
goat 2021-09-07 01:31:16 +02:00
parent 4787a2166f
commit ef1a6a4454
No known key found for this signature in database
GPG key ID: 7773BB5B43BA52E5

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;