Sort filters and add translations for servers (#5493)

* Translate and sort server filters

* Set team_members to unknown[]

* Additional fixes after merge

* Additional translations

* Replace "IP" with "server address"

* Prioritize English and user language
This commit is contained in:
Jerozgen
2026-03-17 22:56:01 +03:00
committed by GitHub
parent 900a4df1b7
commit 58c1e225c8
17 changed files with 666 additions and 244 deletions

View File

@@ -69,16 +69,14 @@ const SERVER_HEADER_ORDER = [
export const sortedCategories = (tags, formatCategoryName, locale) => {
return tags.categories.slice().sort((a, b) => {
const aServerIdx = SERVER_HEADER_ORDER.indexOf(a.header)
const bServerIdx = SERVER_HEADER_ORDER.indexOf(b.header)
if (aServerIdx !== -1 || bServerIdx !== -1) {
return (
(aServerIdx === -1 ? Infinity : aServerIdx) - (bServerIdx === -1 ? Infinity : bServerIdx)
)
}
const headerCompare = a.header.localeCompare(b.header)
if (headerCompare !== 0) {
const aServerIdx = SERVER_HEADER_ORDER.indexOf(a.header)
const bServerIdx = SERVER_HEADER_ORDER.indexOf(b.header)
if (aServerIdx !== -1 && bServerIdx !== -1) {
return aServerIdx - bServerIdx
}
return headerCompare
}
@@ -87,6 +85,9 @@ export const sortedCategories = (tags, formatCategoryName, locale) => {
return x.indexOf(a.name) - x.indexOf(b.name)
}
if (a.name === 'pokemon') return -1
if (b.name === 'pokemon') return 1
const aFormatted = formatCategoryName(a.name)
const bFormatted = formatCategoryName(b.name)
return aFormatted.localeCompare(bFormatted, locale, { numeric: true })