From 2259885133fb9ccb7f36c543d3b986a830f4edc2 Mon Sep 17 00:00:00 2001 From: folke Date: Mon, 16 Oct 2023 12:22:51 +0200 Subject: [PATCH] Use system language for subs, if available --- .../java/eu/kanade/tachiyomi/ui/player/ExternalIntents.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/ExternalIntents.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/ExternalIntents.kt index 58b48e044a..6bc5954d79 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/ExternalIntents.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/ExternalIntents.kt @@ -24,6 +24,7 @@ import eu.kanade.tachiyomi.data.track.AnimeTrackService import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.ui.player.loader.EpisodeLoader import eu.kanade.tachiyomi.ui.player.settings.PlayerPreferences +import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.isOnline import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.DelicateCoroutinesApi @@ -180,7 +181,12 @@ class ExternalIntents { headers.putString(it.first, it.second) } - video.subtitleTracks.firstOrNull()?.let { + val localLangName = LocaleHelper.getSimpleLocaleDisplayName() + video.subtitleTracks.firstOrNull { + it.lang.contains(localLangName) + }?.let { + putExtra("subtitle", it.url) + } ?: video.subtitleTracks.firstOrNull()?.let { putExtra("subtitle", it.url) }