I am working on localization of my app for the English and Arabic support. I have followed all localization steps and supported my app for English and Arabic languages.
But I am facing problem in setting application's default language as English when user downloads and opens the app first time.
For example, Arabic user's device language is Arabic but when he downloads and open the app, first time app should be in English only. Later on he will select whether to change language or not. (As I have given option to change the language)
I have tired following code in main.m file
int main(int argc, char * argv[]) {
@autoreleasepool {
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize]; // to make the change immediate
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
This UserDefault can change the app language but app needs to be restarted the app, then it will work fine. Issue is only for the first time launch.
I have searched so many links but nothing works.
Please help me to sort out my issue.