Skip to main content
Logo Appt Light

Localization on Android

Assistive technologies, such as the screen reader, use the locale for the pronunciation of utterances. It is important to explictly set a locale for your app. An incorrect locale leads to unclear pronunciation. Also, setting a locale can help with displaying characters correctly.

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)

Feedback?

Let us know!