Success Criterion 3.1.1 - Level A
Language of Page
Ensure the language of the screen is set. Some assistive technologies read text that appears on the screen. The pronunciation of the words depends on the language that has been set. When the language is not set, or when a wrong language is set, the pronunciation is unclear.
Impact
Screen reader users can have text read in the correct language.
Letters can be displayed better when the language is known.
Check
“Has the language of the screen been set correctly?“
This can be tested with a screen reader.
Solution
Set a language
On Android, you can use the createConfigurationContext
method to load resources in the correct locale. This is especially important for users of screen readers.
val locales = LocaleList.forLanguageTags("nl-NL")
val configuration = baseContext.resources.configuration
configuration.setLocales(locales)
val context = createConfigurationContext(configuration)
element.text = context.resources.getString(R.string.appt)