Is there a way to change the application language during runtime?
So, after the change NSLocalizedString immediately returns the string for the new language.
What I’m doing now is changing the language using the code below:
- (void)onChangeLanguage: (id)sender
{
NSArray *lang = [NSArray arrayWithObjects:((InfoWhatever *)sender).language, nil];
[[NSUserDefaults standardUserDefaults] setObject:lang forKey:@"AppleLanguages"];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
NSString *currentLanguage = [languages objectAtIndex:0];
NSLog(@"Current language: %@", currentLanguage);
}
The language will change but only after restarting the app.
I doubt you can do this, even the Settings app cannot do it.
(When you change the language in the Settings app, the screen goes black, and displays “setting language…” and a progress wheel. After a long wait, you are back in Springboard. It almost looks like the phone reboots.)