I am developing an application that should support two languages: English and French. However, since the translation into English is not yet complete, we want to deploy it only in French, and later add the English translation later.
The problem is that I do not want to strip English from my code, because some parts have already been completed, there are different NIBs for this language, etc. Instead, I just want English to be temporarily disabled in my application.
What I did, I put this code as the first instruction
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[NSArray arrayWithObjects:@"fr", nil] forKey:@"AppleLanguages"];
[defaults synchronize];
It works fine, except for one. When you launch the application for the first time after installation, it is still in English. Probably because preference AppleLanguageshas not yet been established. After I left the application and started it again, it displays correctly in French.
Does anyone know a fix for the French language to be applied on first run?
source
share