Popular Tags

Who's online

There are currently 0 users and 72 guests online.

User login

Developers will frequently want to localize their application, or in other words, translate it to work for various languages.

This is by no means a comprehensive guide, but rather what I have learned about localization.

    Localizing your application

  1. In your Xcode project, choose File New File...
  2. From the "Other" category, add a new "Strings File" called "Localizable.strings" to your project.
  3. Populate Localizable.strings with Key-Value pairs in the following format:
    "Key" = "Value";
  4. Right click on "Localizable.strings" in your project tree and choose "Get Info"
  5. In the "General" tab, click the button at the bottom, called "Make File Localizable". This will jump you to the "Targets" tab.
  6. Go back to the "General" tab, and click the "Add Localization" button at the bottom.
  7. Name the new localization after the two letter language abbreviation that corresponds to the desired language. (Ex: Spanish = es, Portuguese = pt, French = fr, etc)
  8. You'll see that Localizable.strings is now a group in your project tree. Expanding it reveals the added localizations. Choose one.
  9. The localization has been populated with the values that you added in Localizable.strings. Simply translate the Value to the localized version. For example, in your English version, you might have:
    "Greeting" = "Hello";
    In your "es" (EspaƱol) file, you would have:
    "Greeting" = "Hola";
  10. Now, in your code, whenever you want to have a localized greeting, simply used the NSLocalizedString macro, like so:
    [greetingTitle setTitle:NSLocalizedString(@"Greeting", "greeting to use")];
  11. Now greetingTitle will display the appropriate string ("Hello" versus "Hola") depending on what language the user has set as their default!

This same procedure also allows you to localize more than just string values. You can also localize your Info.plist file, .xib/.nib files, and more. One caveat is that in order to localize your application's name (generally contained in Info.plist), you should first create a strings file entitled "InfoPlist.strings" and put in the line:
CFBundleDisplayName = "Your App Name";
Then localize the "InfoPlist.strings" file as explained above.

For further information, check out the Internationalization Programming Guide on the Apple Developer Connection.

Your rating: None Average: 4.3 (4 votes)



The site has recently been updated. You may notice some of the following issues:

  • Some URLs no longer work. Please use the search box.
  • File uploads should now be working. If you experience problems, please contact us.