Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set default accessibility language on iOS to Spanish

I'm maintaining an app that was made for english speaking users. I was asked to make a spanish version (they wanted separate apps because of resource size issues). They also want it to be accessible. Now all the labels are set in the app but they are pronounced with an English accent! (sounds horrible :) ) Anyway, I figured out that you can set the accessibilityLanguage to @"es" and that will take care of that. The question then is:

How can I set the default accessibilityLanguage to @"es"? This would override the user's preference. I know Apple doesn't like this but in this case it really does not make sense to have it set to English when all the buttons/labels are spanish.

like image 309
Joris Weimar Avatar asked Jan 31 '26 20:01

Joris Weimar


1 Answers

This did the trick for me, without having to set accessibilityLanguage on each view separately:

#import "NSObject+AccessibilityLanguage.h"

@implementation NSObject (AccessibilityLanguage)

- (NSString *)accessibilityLanguage {
    return @"nl";
}

@end
like image 81
Johan Kool Avatar answered Feb 02 '26 09:02

Johan Kool