Skip to content

Commit

Permalink
Use system language for subs, if available
Browse files Browse the repository at this point in the history
  • Loading branch information
Secozzi committed Oct 16, 2023
1 parent 3cbb195 commit 2259885
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit 2259885

Please sign in to comment.