Fix language in source filter list jumping to top incorrectly

Fixes #9068
This commit is contained in:
arkon
2023-05-03 15:07:41 -04:00
parent 14c465d36f
commit f5ad95d78a
4 changed files with 28 additions and 20 deletions

View File

@@ -11,10 +11,14 @@ import java.util.Locale
*/
object LocaleHelper {
val comparator = compareBy<String>(
{ getDisplayName(it) },
{ it == "all" },
)
/**
* Sorts by display name, except keeps the "all" (displayed as "Multi") locale at the top.
*/
val comparator = { a: String, b: String ->
if (a == "all") -1
else if (b == "all") 1
else getDisplayName(a).compareTo(getDisplayName(b))
}
/**
* Returns display name of a string language code.