0

I'm facing a problem for multi-language support in iOS. I need to supports many languages but i like to make something by which user not need to leave app for just changing language in settings. I am able to change language but i need to restart ios app for taking its effects.

i used following for changing language :

[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"fr", nil]
                                              forKey:@"AppleLanguages"];
    [[NSUserDefaults standardUserDefaults] synchronize];

and i read that restarting app or killing app is against the apple privacy. Please provide your suggestions.

Thanks in advance.

Mehul Solanki
  • 465
  • 7
  • 27
  • Did you check out this thread? http://stackoverflow.com/questions/5912018/language-change-only-after-restart-on-iphone There's also a nice tutorial [here](http://aggressive-mediocrity.blogspot.sg/2010/03/custom-localization-system-for-your.html) -a bit old- but might work for you. – Leijonien Nov 16 '13 at 07:31

2 Answers2

2

I've created my custom LanguageManger, which allows to change language in runtime. You can find code here: https://github.com/antrix1989/LanguageManager

Sergey Demchenko
  • 2,924
  • 1
  • 24
  • 26
  • Thank for your reply but i need to restart app for taking effect of changed lagauge. is it possible that without restarting app i got the effect as it changed successfully? – Mehul Solanki Nov 16 '13 at 09:22
  • @MehulS you do not need to restart application. Just add observer for kLanguageChangedNotification and when it is occurred, retrieve again the value from LocalizedManager. – Sergey Demchenko Nov 16 '13 at 09:28
0

Do not change language of an app at runtime, you will have an application with interface in the selected language, but all system services in the "settings" language. Imagine the you have Chinese in the settings, while using the app you change in English and (always inside the app) you visit a section with a map, the map will be shown in Chinese.

Andrea
  • 26,120
  • 10
  • 85
  • 131