Monday, July 4, 2011

Tutorial : Localization of iPhone App

If you are confused with long posts describing localization you came across so far, you are in right place.
All the tutorials on this blog are straight to the point , No bullshit.
Let's cut to the chase.

In this post we will be dealing with localization of strings displayed in .m files.
How to localize the .nib or .xib file ? , we will deal with it in the next post. LINK

Ok, We are going to have support for 2 languages in our app: English and German.

We will have 2 directories: en.lproj and de.lproj. We will keep localized file in respective directories.
We will have a text file called Localizable.strings file in "each" directory saved as UTF-16 encoding on TextEdit.

(Note if you can't get over the .rtf format in TextEdit, then just take Localizable.strings file from the Sample Code provided at the end of this post and use it with your own strings.)

See the directory structure

Whats in the Localizable.strings ?

In de.lproj > Localizable.strings, I will have keys and values of german strings
"German" = "Duetsch";

German is the key and  Duetsch is the value.

In en.lproj > Localizable.strings,I will have keys and values of english strings
"German" = "German";
German on left is the key and  German on  right is the value.

Note: They both share same "key".

How to access these strings in your code ?

Here, NSString *sString= NSLocalizedString(@"German", @"");

German is the key for which you are getting the string value. In here the value for key German is German or Duetsch depending on language in our Setting of our device.

How to change Language in Setting on iPhone/iPad. LINK

In Sample Code, you will see the output localized string printed on console.
Download the code HERE


  1. Hello,
    If you’re involved in software and/or website localization, I would warmly recommend a new translation tool that my team developed and will probably make your work easier:
    POEditor is intuitive and collaborative. You can import from multiple localization file formats (like pot, po, xls, xlsx, strings, xml, resx) and, most importantly, we’re constantly trying to enhance it based on our users’ feedback.
    Feel free to try it out and recommend it to developers and everyone who might find it useful.

  2. Hi Reetu, useful tutorial, thanks for sharing it! I also thought that it might be helpful to mention a resource for reading; a blog which covers some interesting topics about the world of translation and localization. See here more articles: Thanks!

  3. Thanks for sharing information.
    online recharge
    Existing customers can avail the tariff benefit of ALL LOCAL CALLS at 25P/min for 3 months on Special Tariff voucher (STV)priced at Rs 38 only in Haryana.