Skip to main content
Logo Appt Light

Accessibility language on iOS

When content is written in multiple languages, foreign words should ideally be indicated in their respective language. For example, you can indicate a French quote in a Dutch piece of content. This enables assistive technologies to use the right pronunciation.

On iOS, the accessibilitySpeechLanguage key of NSAttributedString can be used to speak content in a specific language. Multiple NSAttributedString's can be embedded inside a NSMutableAttributedString to speak content in multiple languages.

In addition, the accessibilityLanguage attribute of the UIAccessibility protocol can be used to set a single language for an element. Many objects implement this protocol, such as UIApplication and UIView.

element.attributedText = NSAttributedString(
    string: "Appt", 
    attributes: [.accessibilitySpeechLanguage: "nl_NL"]
)

application.accessibilityLanguage = "nl_NL"
view.accessibilityLanguage = "nl_NL"

Feedback?

Let us know!