We want to have application specific locale regardless of device locale in iOS app. We want to let the user select their desired locale for the app in app login/settings screen. Once user selects any locale the app data will be updated automatically with the locale regardless of device locale.
We found by setting the AppleLanguages
in NSUserDefaults
can update the current locale for the app:
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:selectedLanguage, nil] forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize];
However, This becomes effective once we kill & restart the app.
Another way I found is changing the resource folder as per the locale. I found two issues with this approach:
- In the whole app we have to replace the code related to
NSLocalizedString
with the code to fetch strings using[NSBundle localizedStringForKey]
- Keyboard will be shown as per the device locale.
Is there any approach by using it we can allow the app specific locale selection?