diff --git a/app/src/main/java/eu/kanade/domain/extension/interactor/GetExtensionLanguages.kt b/app/src/main/java/eu/kanade/domain/extension/interactor/GetExtensionLanguages.kt index a4917f43f..968cfbabe 100644 --- a/app/src/main/java/eu/kanade/domain/extension/interactor/GetExtensionLanguages.kt +++ b/app/src/main/java/eu/kanade/domain/extension/interactor/GetExtensionLanguages.kt @@ -25,10 +25,7 @@ class GetExtensionLanguages( } .distinct() .sortedWith( - compareBy( - { it !in enabledLanguage }, - { LocaleHelper.getDisplayName(it) }, - ), + compareBy { it !in enabledLanguage }.then(LocaleHelper.comparator), ) } } diff --git a/app/src/main/java/eu/kanade/domain/source/interactor/GetLanguagesWithSources.kt b/app/src/main/java/eu/kanade/domain/source/interactor/GetLanguagesWithSources.kt index 8fa640f53..ce6a4288d 100644 --- a/app/src/main/java/eu/kanade/domain/source/interactor/GetLanguagesWithSources.kt +++ b/app/src/main/java/eu/kanade/domain/source/interactor/GetLanguagesWithSources.kt @@ -25,10 +25,7 @@ class GetLanguagesWithSources( sortedSources.groupBy { it.lang } .toSortedMap( - compareBy( - { it !in enabledLanguage }, - { LocaleHelper.getDisplayName(it) }, - ), + compareBy { it !in enabledLanguage }.then(LocaleHelper.comparator), ) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsScreenModel.kt index 7d31bd92a..184e47951 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsScreenModel.kt @@ -82,11 +82,11 @@ class ExtensionsScreenModel( val languagesWithExtensions = _available .filter(queryFilter(searchQuery)) - .groupBy { LocaleHelper.getSourceDisplayName(it.lang, context) } - .toSortedMap() + .groupBy { it.lang } + .toSortedMap(LocaleHelper.comparator) .flatMap { (lang, exts) -> listOf( - ExtensionUiModel.Header.Text(lang), + ExtensionUiModel.Header.Text(LocaleHelper.getSourceDisplayName(lang, context)), *exts.map(extensionMapper(downloads)).toTypedArray(), ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt index 21a2e7d7c..ac7966021 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/LocaleHelper.kt @@ -11,6 +11,11 @@ import java.util.Locale */ object LocaleHelper { + val comparator = compareBy( + { getDisplayName(it) }, + { it == "all" }, + ) + /** * Returns display name of a string language code. */