How to set language of accessibilityHint?
How to set language of accessibilityHint?
- Subject: How to set language of accessibilityHint?
- From: Matthias Schmitt <email@hidden>
- Date: Wed, 09 May 2012 07:27:29 +0200
I am writing an iOS app, which operates in a multi-language environment. As a consequence the program can operate in a language different than the system language. The language can even be changed inside the app without restarting it. So instead of using NSLocalizedString I am using a mechnismn like this to get the correct text for the current app language:
- (NSString *)stringForLanguage:(NSString*)key
{
NSString *path;
if(prefLanguage == 0) {
path = [[NSBundle mainBundle] pathForResource:@"de" ofType:@"lproj"];
} else {
path = [[NSBundle mainBundle] pathForResource:@"fr" ofType:@"lproj"];
}
NSString* str=[[NSBundle bundleWithPath:path] localizedStringForKey:key value:@"" table:nil];
return str;
}
As I want to make my program accessible I wrote this little method to switch between german and french language. This routine is responsible to speak the texts using the correct language voice.
- (void)setVoLanguage:(NSObject*)object
{
if (prefLanguage == 0){
[object setAccessibilityLanguage:@"de-DE"];
} else {
[object setAccessibilityLanguage:@"fr-FR"];
}
}
I am using methods like this to get the correct text to be read in the correct language:
- (NSString *)accessibilityLabel {
[appDelegate setVoLanguage:self];
return [NSString stringWithString:[appDelegate stringForLanguage:@"UI_SPLIT_SLIDER"]];
}
- (NSString *)accessibilityHint {
[appDelegate setVoLanguage:self];
return [NSString stringWithString:[appDelegate stringForLanguage:@"UI_SPLIT_SLIDER_H"]];
}
My phone is running in English. Lets say, the app is running in German. The method 'accessibilityLabel' works fine, which means the texts are German and they are read with the German voice. The method 'accessibilityHint' fetches the correct text in German, but reads it using the English voice, which makes it pretty useless.
So it works fine for accessibilityLabels and accessibilityValues, but not for accessibilityHints. Does anybody know how to set the language for accessibilityHints?
Thank you.
Best regards
Matthias Schmitt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden