Android Samsung text-to-speech bug for amount of money reading

Hello! We are improving accessibility for Talkback in our android app.

Faced with the problem of voice acting through Samsung TTS and simple android TextView with the formatted text for example “1 000 ₽”, what must reading as “one thousand russian roubles”. Samsung TTS engine reads his incorrect as “one zero zero zero” and ignores the currency.

Code snippet to reproduce the problem:

  <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="1 000 ₽"
        android:importantForAccessibility="yes"
        />

But Google Text-To-Speech reads it correctly as “one thousand rubles”.

Also we tried solution with TtsSpan and this did not help for Samsung TTS engine:

val amountText = "1 000 Р"
val ttsspan = TtsSpan.MoneyBuilder().setCurrency("RUB").setIntegerPart(1000L).build()
val spannable = SpannableString(amountText)
spannable.setSpan(ttsspan, 0, amountText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
findViewById<TextView>(R.id.text).text = spannable

How is it possible to bypass the problem of reading amount of money on Samsung devices where Samsung TTS turned by default?
Or is engine bug ?

Hello. I’m not sure about the currency issue, But reading “1 000” as “One zero zero zero” seems to be working as intended by the speech engine. If you want to have this be read as “One thousand” you could try trimming the spaces programmatically from between the digits when reading using TTS.

1 Like