Posted by: bearc0025 | May 26, 2009

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:
    ibtool --generate-strings-file Example.strings en.lpoj/Example.xib
  2. Extract strings from your code:
    genstrings -o en.lproj *.m
  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:
    ibtool --strings-file fr.lproj/Example.strings -write fr.lproj/Example.xib en.lproj/Example.xib
  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

Advertisements

Responses

  1. You should try this tool also for localizing your strings: https://poeditor.com/. I stuck to it as it works better than anything else I tried before.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: