'Content Description in Multi Language
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 ?
Solution 1:[1]
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/I '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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Cheticamp |