diff --git a/musikr/src/main/java/org/oxycblt/musikr/tag/interpret/Naming.kt b/musikr/src/main/java/org/oxycblt/musikr/tag/interpret/Naming.kt
index 8f42ec171..b3ddcb343 100644
--- a/musikr/src/main/java/org/oxycblt/musikr/tag/interpret/Naming.kt
+++ b/musikr/src/main/java/org/oxycblt/musikr/tag/interpret/Naming.kt
@@ -15,9 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-
+
package org.oxycblt.musikr.tag.interpret
+import android.icu.text.Transliterator
+import android.os.Build
import java.text.CollationKey
import java.text.Collator
import org.oxycblt.musikr.tag.Name
@@ -84,7 +86,7 @@ private data class IntelligentKnownName(override val raw: String, override val s
private fun parseTokens(name: String): List {
// TODO: This routine is consuming much of the song building runtime, find a way to
// optimize it
- val stripped =
+ var stripped =
name
// Replace punctuation with spaces to create token boundaries, improving
// sorting of names like "15-9" vs "15-10".
@@ -101,6 +103,13 @@ private data class IntelligentKnownName(override val raw: String, override val s
}
}
+ // Transliterate to latin if available
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && Transliterator.getAvailableIDs()
+ .toList().contains("Any-Latin")
+ ) {
+ stripped = Transliterator.getInstance("Any-Latin;").transliterate(stripped)
+ }
+
// To properly compare numeric components in names, we have to split them up into
// individual lexicographic and numeric tokens and then individually compare them
// with special logic.