Change iOS app's language on the fly
Solution 1:
This should do the trick, assuming that de
is the new language selected by the user. Also assure that you are reinitiating the current view.
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"de", nil]
forKey:@"AppleLanguages"];
Solution 2:
Personally, I don't like the idea of giving NIB files to translators. Instead, I design the NIBs so there is enough space for non-English languages (typically they will require 50% more room for text), and then I store all text resources in Localizable.strings files.
Then, in my code I set the text for each UI control.
[_myButton setTitle:NSLocalizedString(@"My button title",
@"My description for translation file, e.g. including chars limit")
forState:UIControlStateNormal];
I find this makes the translation process easier to manage.
To answer your original question, you would put this code in the viewWillAppear
function of your UIView
to ensure it is reloaded each time the UI reappears.