Internationalization of my iPhone app
How does the user change the language of the application?
It looks like he can only change the language of the entire iPhone (Settings -> General -> International -> Language).
After the change, an app internationalized for that language will respond in it.
How does the user change the language of the application? – take two -
It turns out that an application can give the user a choice among languages that it supports,
say “en”, “fr”, “de”, “jp”.
When the user selects one of these codes (in the app’s own Select Language menu), the app should do
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:languageCode2LetterString, nil] forKey:@"AppleLanguages"];
and instruct the user to stop and to restart the application.
The application will now come up with the newly selected language.
How do I set up an Xcode project for internationalization ?
- replace strings in the program like
label.text = @"Hello world.";
by
label.text = NSLocalizedString(@"Hello world.", @"This is a comment about my greeting.");
- add directories en.lproj, fr.lproj, de.lproj e.t.c.
- run : genstrings -o en.lproj Classes/*.m
- add the generated en.lproj/Localizable.strings to Xcode project resources (save as UTF-16!)
- copy en.lproj/Localizable.strings to fr.lproj/Localizable.strings and edit it to provide translations
- add fr.lproj/Localizable.strings to project Resources
- build
- test
OK, there is more to it but this is a start.
[...] Internationalization of iPhone application April 23, 2010 | Posted by admin http://rudifa.wordpress.com/2009/12/12/i18n-of-my-iphone-app/ [...]