Skip to content

Localize an iPhone App

In doing localization work, I found several useful links, but this is the most concise:

Localization Guide for iPhone Applications, built with Apple Xcode

The main points are:

  1. Extract strings from your xib files: [sourcecode lang=”cpp”]ibtool –generate-strings-file Example.strings en.lpoj/Example.xib[/sourcecode]
  2. Extract strings from your code: [sourcecode lang=”cpp”]genstrings -o en.lproj *.m[/sourcecode]
  3. Get those translated (or translate them yourself)
  4. For the files from step 2, put them in an appropriately named dir (e.g., French -> fr.lproj – see lang codes).
  5. Add the new language dirs to your project. (see note below)
  6. For the files from step 1, create localized xib files: [sourcecode lang=”cpp”]ibtool –strings-file fr.lproj/Example.strings -write fr.lproj/Example.xib en.lproj/Example.xib[/sourcecode]
  7. Put the new xib files in your project

NOTE: One thing that stumped me was that the en.lproj and fr.lproj seemed to be able to be anywhere. Xcode/the app pick up on the language letters (e.g., en) and use the right dir and the file type “.strings” and the ‘magic’ happens.

Localization group in XCode
Localization group in XCode

So I added a ‘Localized’ group in my ‘Resources’ group. Then I added the en.lproj and fr.lproj dirs to ‘Localized.’ Each time under the <lang code>.lproj item was a .swp file that caused build problems. I removed those files – problem gone.

As a test, I just used the same Localizable.strings file in each lang dir but made a change to some text so when I ran the app, I’d know if it was using the right version (e.g., “Done” -> “FRENCH!”).

I changed my language setting in the Settings app and ran the app. The first time I didn’t see a change, but when I ran it again, viola!

Other links:

http://adeem.me/blog/2009/05/09/tutorial-iphone-localization-in-xib-nib-files/

http://www.bdunagan.com/2009/04/15/ibtool-localization-made-easier/

http://www.digitalwaters.net/koan/ing/2007/11/27/from-nibtool-to-ibtool.html

http://developer.apple.com/iphone/prerelease/library/documentation/MacOSX/Conceptual/BPInternational/Articles/StringsFiles.html#//apple_ref/doc/uid/20000005

1 thought on “Localize an iPhone App”

Comments are closed.