Today I wanted to try the localization feature of iOS.
I added a Localizable.strings file to my project with the following content:
"TP_Start_Button" = "Workout Plan";
"TL_Start_Button" = "Training Log";
"Calc_Start_Button" = "Calculator";
I set the titles of three UIButtons like this:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tp_start_button setTitle:NSLocalizedString(@"TP_Start_Button", nil) forState:UIControlStateNormal];
[self.tl_start_button setTitle:NSLocalizedString(@"TL_Start_Button", nil) forState:UIControlStateNormal];
[self.calc_start_button setTitle:NSLocalizedString(@"Calc_Start_Button", nil) forState:UIControlStateNormal];
}
After that I added another language by selecting my project and pressing the "+" button under localization. O chose German and another Localizable.strings was created. I replaced the content with the German translation. Then I had the following:
Localizable.strings
Localizable.strings (English)
Localizable.strings (German)
And in my project folder the folders de.lproj and en.lproj
were created with the Localizable.strings inside.
However, after starting the iPhone Simulator, English was loaded as the default language. After setting the language to German the language of my app didn't change. Even after deleting and reinstalling the app from my device it didn't work.
What do I have to do for automatically switching the language when the language in the settings is changed?