Accessibility language - iOS
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"