From ea2d017275f36f6b74e9d15f1da49412b9ea9d62 Mon Sep 17 00:00:00 2001 From: Secozzi <49240133+Secozzi@users.noreply.github.com> Date: Mon, 4 Nov 2024 19:55:32 +0100 Subject: [PATCH] fix: Subtitle selection not matching two letter language codes (#1805) --- .../main/java/eu/kanade/tachiyomi/util/SubtitleSelect.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/SubtitleSelect.kt b/app/src/main/java/eu/kanade/tachiyomi/util/SubtitleSelect.kt index 67ed06dd8..177033228 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/SubtitleSelect.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/SubtitleSelect.kt @@ -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