Skip to main content
Logo Appt Light

Success Criterion 3.1.2 - Level AA

Language of Parts

Ensure the language of parts is set. Sometimes pieces of text are written in another language. Set the language so text is read out correctly.

Impact

  • Ensure the language of text written in other languages is set correctly.

  • People with screen readers can have parts of text read in another language.

Check

“Are foreign texts indicated in their respective language?“

This can be tested with the screen reader.

Note: this success criterion is exempt for apps in EN 301 549.

Solution

Set language of text

On Android, you can use LocaleSpan to speak content in a specific language. Multiple LocaleSpan's can be embedded inside a SpannableString to speak content in multiple languages.

val locale = Locale.forLanguageTag("nl-NL")
val localeSpan = LocaleSpan(locale)

val string = SpannableString("Appt")
string.setSpan(localeSpan, 0, string.length, Spanned.SPAN_INCLUSIVE_INCLUSIVE)

element.setText(string)

Resources

Feedback?

Let us know!