Tuesday, 26 July 2011

Problems with switching languages on iPhone Simulator?

There are some pitfalls when you start localising your iPhone app. Let's say you followed the guidebook by the letter:
  • you create a Localizable.strings file - and add one for each language.
  • you replace all your "hardwired" strings in the program with NSLocalizableString(keyString, commentString).
  • you then create localised XIB files.
  • you've done all the adjustments.
  • you then clean the project build
  • and rebuild from scratch.
And then you run it on the iPhone Simulator (or your testing device). When changing the language of the device from English to - say German - what happens?
Nothing.
Still only one language is shown - the one you started with.

Well - there is one obvious way to enforce it:
  • delete the app from the iPhone Simulator or your iOS testing device
  • clean, build and reinstall
Voila - the language switching now works.
Unfortunately, all previously saved data are now lost. My app e.g. uses SQLite - and un/re-installing the app means we start from scratch. Sucks, doesn't it? You definitely don't want the user to let this happen to them - or there will be a lot of VERY unhappy bunnies out there.

Apparently, this is a known issue in XCode. Read the following entry:
The upshot of this blog seems to be that the AppStore installation does the right thing. Meaning, users can continue using their app and the language switching works out of the box.
The only way of testing this - prior to submission to iTunes - would be to install your app as ad-hoc application and see what happens.

No comments:

Post a Comment