Success Criterion 3.1.1 - Level A
Language of Page
Ensure the language is set for all content. A screen reader reads all 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 a wrong language is set, the pronunciation is unclear. A correctly set language also helps to display letters and to display subtitles.
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)