Accessibility language on Android
When content is written in multiple languages, foreign words should ideally be indicated in their respective language. For example, you can indicate a French quote in a Dutch piece of content. This enables assistive technologies to use the right pronunciation.
On Android, you can use
LocaleSpan to speak content in a specific language. Multiple
LocaleSpan's can be embedded inside a
SpannableString to speak content in multiple languages.
val locale = Locale.forLanguageTag("nl-NL") val localeSpan = LocaleSpan(locale) val string = SpannableString("Appt") string.setSpan(localeSpan, 0, string.length, Spanned.SPAN_INCLUSIVE_INCLUSIVE) element.setText(string)