Skip to content

Commit

Permalink
fix: Subtitle selection not matching two letter language codes (#1805)
Browse files Browse the repository at this point in the history
  • Loading branch information
Secozzi authored Nov 4, 2024
1 parent 1b31fca commit ea2d017
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/eu/kanade/tachiyomi/util/SubtitleSelect.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ class SubtitleSelect(private val playerPreferences: PlayerPreferences) {
private fun containsLang(title: String, locale: Locale): Boolean {
val localName = locale.getDisplayName(locale)
val englishName = locale.getDisplayName(Locale.ENGLISH).substringBefore(" (")
val langRegex = Regex("""\b${locale.getISO3Language()}\b""", RegexOption.IGNORE_CASE)
val langRegex = Regex("""\b${locale.isO3Language}|${locale.language}\b""", RegexOption.IGNORE_CASE)

return title.contains(localName) || title.contains(englishName) || langRegex.find(title) != null
return title.contains(localName, true) ||
title.contains(englishName, true) ||
langRegex.find(title) != null
}

@Serializable
Expand Down

0 comments on commit ea2d017

Please sign in to comment.