feat: prefer en language as top (#2042)

This commit is contained in:
Shinigami 2023-05-01 19:30:57 +02:00 committed by GitHub
parent 98777f078c
commit 076c47b7b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,10 @@ const languages = $computed(() =>
? fuse.search(languageKeyword).map(r => r.item)
: [...languagesNameList].filter(entry => !userSettings.value.disabledTranslationLanguages.includes(entry.code))
.sort(({ code: a }, { code: b }) => {
// Put English on the top
if (a === 'en')
return -1
return a === modelValue ? -1 : b === modelValue ? 1 : a.localeCompare(b)
}),
)