Reputation: 1393
how I can add support of multi-language for content description. I am developing a kiosk app where I want to take confirmation from users for the language they want to have for accessibility. I had tried the below code but it only speaks content in one language.
fun wrapTextInLocaleSpan(
originalText: CharSequence, loc: LocaleList): SpannableStringBuilder {
val myLocaleBuilder = SpannableStringBuilder(originalText)
myLocaleBuilder.setSpan(LocaleSpan(loc), 0,
originalText.length - 1, 0)
return myLocaleBuilder
}
What could be best solution for supporting content description in multiple language ?
Upvotes: 3
Views: 234
Reputation: 62831
If I understand you questions, I think that you misunderstand the purpose of LocaleSpan. This span will not do the translation for you, but just permits the developer to identify a part of a string the may be in another language from the rest of the string. There is a video from Google I/O '18 that explains this starting at time mark 5:16.
You should take a look at Localize your app on how to present different translations for strings. You should also take a look at App resources overview.
Upvotes: 3