Since I create iOS Apps I use the following code to translate / localize my apps:
NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
if ([language isEqualToString:@"de"]) {
// localized language
}
else { //base language
}
But since the update to iOS 9 this code does not work anymore. All my apps are now in English.
Neither the apps I already have in the app store, nor the apps I run in the Simulator are localized anymore.
It would be great if you could tell me how I have to translate my code programmatically in iOS 9.
I could solve the problem.
If I use the following code the localization works under iOS 9.
[[NSBundle mainBundle] preferredLocalizations];
NSString *language = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0];
if ([language isEqualToString:@"de"]){
// localization
}
else {
//base language
}
I hope that will help some of you, too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With