mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 13:48:55 +03:00
fix: Subtitle selection not matching two letter language codes (#1805)
This commit is contained in:
parent
1b31fcad8e
commit
ea2d017275
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue