is there a way to change the iphone International language in an automated way so that when we launch the app it shows up localized for the target locale (ll-CC)?
Thanks a bunch for your help!
is there a way to change the iphone International language in an automated way so that when we launch the app it shows up localized for the target locale (ll-CC)?
Thanks a bunch for your help!
Not sure what you mean by automated in this sense. You'll need to internationalize your app and then provide localized translations. If you have localized your app for a particular language then it will work in locales that use that language.
Basics on internationalization (iOS and OS X) can be found here.
Yes there is! I actually wrote a small bash script to do just that for my UI Automation-powered app screenshot taker. Grab it from here:
https://github.com/jonathanpenn/ui-screen-shooter/blob/master/bin/choose_sim_language
Feel free to explore it to see how it works. To use it you just need to run it with the locale code you choose.
./choose_sim_language en
All the simulator versions will be set to the one you gave it. Run the script without any parameters to have it print out the current language.
If you're targeting the actual device, you need to overwrite AppleLanguages
preference:
[[NSUserDefaults standardUserDefaults] setObject: [NSArray arrayWithObjects:lang, nil] forKey:@"AppleLanguages"];
Check a complete working solution here: http://aggressive-mediocrity.blogspot.com.es/2010/03/custom-localization-system-for-your.html
You don't need custom localization macros as indicated on that article, just #undef
them and #define
them to use your class.
You'll need some mechanism to change the language in the app: something in the UI or just an environment variable (set it in the command line when you launch Instruments, if that what you're doing).