6

I'm developing an iOs application with latest SDK and XCode 4.2.

I need to add a menu where user can changes only app language (I don't want to change device language).

I also want to use NSLocalizedString.

How can I do this?

VansFannel
  • 45,055
  • 107
  • 359
  • 626
  • A very similar question was answered here: http://stackoverflow.com/questions/6150576/change-ios-apps-language-on-the-fly – ThomasW Feb 09 '12 at 09:22
  • http://stackoverflow.com/questions/34130853/how-to-force-an-app-to-change-language-in-ios-objective-c/34131794#34131794 – user3182143 Dec 09 '15 at 04:25

1 Answers1

11

Try this:

// switching to polish locale
[[NSUserDefaults standardUserDefaults] setObject:@[@"pl"] forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize];
Cœur
  • 37,241
  • 25
  • 195
  • 267
Tomasz Wojtkowiak
  • 4,910
  • 1
  • 28
  • 35
  • 6
    The important thing is, that these statements are executed before the app is launched: do it in main.m in the main() function, before UIApplicationMain() is called. – jbandi Jan 02 '13 at 22:19
  • 8
    If this needs to be done in the main(), then how is this going to help with a menu where the user can change the interface language of the app..? – Erik van der Neut Sep 23 '14 at 09:46