It seems that I came across a very special case when the application locale just goes crazy.
I am changing the standard application locale using something like this:
[[NSUserDefaults standardUserDefaults] setObject:@[@"ar"] forKey:@"AppleLanguages"];
Then I tried to get the preferred language and create a local object from it using:
NSString* langPrefix = [NSLocale preferredLanguages][0];
Finally, create a new NSLocale object from the returned object. When testing the code, I would change the language from the application, and then close the application through Xcode. I assume that NSUserDefaults will not synchronize, but even if I called the synchronize method, it would still get messed up.
Bottom line: localization testing should be performed by deploying the application, and after the device has been disconnected from Xcode, so the application will work properly at all stages of the life cycle.
Mazyod
source share