浏览代码

Fix local source not working if english was disabled. Closes #848

len 7 年之前
父节点
当前提交
74a7e2a17e

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt

@@ -57,7 +57,7 @@ class LocalSource(private val context: Context) : CatalogueSource {
 
     override val id = ID
     override val name = "LocalSource"
-    override val lang = "en"
+    override val lang = ""
     override val supportsLatest = true
 
     override fun toString() = context.getString(R.string.local_source)

+ 3 - 6
app/src/main/java/eu/kanade/tachiyomi/ui/catalogue/CataloguePresenter.kt

@@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.data.database.models.MangaCategory
 import eu.kanade.tachiyomi.data.preference.PreferencesHelper
 import eu.kanade.tachiyomi.data.preference.getOrDefault
 import eu.kanade.tachiyomi.source.CatalogueSource
+import eu.kanade.tachiyomi.source.LocalSource
 import eu.kanade.tachiyomi.source.Source
 import eu.kanade.tachiyomi.source.SourceManager
 import eu.kanade.tachiyomi.source.model.Filter
@@ -303,15 +304,11 @@ open class CataloguePresenter(
         val languages = prefs.enabledLanguages().getOrDefault()
         val hiddenCatalogues = prefs.hiddenCatalogues().getOrDefault()
 
-        // Ensure at least one language
-        if (languages.isEmpty()) {
-            languages.add("en")
-        }
-
         return sourceManager.getCatalogueSources()
                 .filter { it.lang in languages }
                 .filterNot { it.id.toString() in hiddenCatalogues }
-                .sortedBy { "(${it.lang}) ${it.name}" }
+                .sortedBy { "(${it.lang}) ${it.name}" } +
+                sourceManager.get(LocalSource.ID) as LocalSource
     }
 
     /**