Delite Studio
Five-star iPhone, iPad, Android, and OS X apps
  • Home
  • WordPress
    • Push Notifications for WordPress
      • Documentation
      • FAQs
      • Library for iOS
      • Library for Android
  • Apps
    • Picture Transfer
    • Local Cloud
      • For iOS
      • For Android
    • File Storage
    • File Transfer
      • For iOS
      • For Mac
      • For Android
      • For Windows
    • File Extractor
    • Localizable Strings Merge
    • Delite Blocks
  • About
  • Contact
  • Account
    • Cart
  • English
    • Italiano
Select Page ...

Blog

How To Internationalize an OS X/iOS App

September 11, 2012 OS X

To increase the user base, and thereby boost profits, all developers must localize their applications for iOS or OS X into multiple languages: users don’t buy and don’t use an application written in a language they don’t understand.

Making the app able to be localized to a specific market is called internationalization, and that's the topic of this article.

Step 1: Embed every literal string within the macro NSLocalizedString

We need to pull all of the hardcoded strings into a separate file so we can localize them. To do that, simply change all literal strings like this:

NSString *string = @"This is a sample string";

to this:

NSString *string = NSLocalizedString(
@"This is a sample string",
@"A comment for the translator");

NSLocalizedString is a macro part of the Foundation Framework. It takes two parameters: the first one is the string which must be translated, written in the neutral language (typically English). The second parameter is a comment, i.e. an aid for the translator indicating the context where the string is used. That argument can actually be set to nil (as it is optional), but it is always a good idea to write short texts that help the translators.

You should do this with every string a user sees.

Step 2: Create an empty Localizable.strings for each language

Localizable.strings is the default name for the resource files that contain the localizable strings.

To create the Localizable.strings file in Xcode:

  1. Click File > New > File...
  2. Select “Resource” on the left
  3. Select “Strings File” on the right
  4. Name the file “Localizable.strings”
  5. Select the file in the Xcode Project Navigator
  6. In the Utilities panel change the text encoding to “Unicode (UTF-16)”
  7. In the Utilities panel click on “Make localized...”
  8. Select “English” in the new window
  9. Click the “+” button under Localization, and select the languages you want to support
Please note that starting with Xcode 4.4 the “+” button has been moved in Project > Info > Localizations (more info here).

You should now see as many files as there are languages under the “Localizable.strings” file:

Step 3: Extract the strings to translate

Now you can use the command line tool genstrings, but we created a great app that simplifies the whole string extraction process. It's called Localizable Strings Merge and is available in the Mac App Store.

To fill the Localizable.strings files:

  1. Drag and drop all the source files (or directly the folder containing the project) on the left side of Localizable Strings Merge:
  2. Drag and drop all the Localizable.strings files (or directly the folder containing the project) on the right side of Localizable Strings Merge:
  3. Now click on the button “Merge Strings”.

You've generated your Localizable.string files!

Step 4: Translate the strings

Now, you have to translate every Localizable.string file in the language to which it refers.

If you open a Localizable.strings file you can find many lines like:

/* A comment for the translator */
"This is a sample string" = "This is a sample string";

As you can see the file consists of one or more key-value pairs along with optional comments. The key and the value is in double quotes followed by a semi-colon. The keys should be left unchanged, while values need to be translated:

/* A comment for the translator */
"This is a sample string" = "Questa è una stringa di esempio";

That's all! Now you have a multilingual application.

← Start dockless apps at login with App Sandbox enabled

One Response to How To Internationalize an OS X/iOS App

  • How To Internationalize an OS X/iOS App | Delite Studio | VishalDharmawat - iPhone and iPad Development
    11 / 2 / 2013

    […] See on http://www.delitestudio.com […]

    How To Internationalize an OS X/iOS App | Delite Studio | VishalDharmawat - iPhone and iPad Development 11 / 2 / 2013
  • Local Cloud for iOS

    Local Cloud for iOS
    iPad / iPhone / Mac / Windows
    Picture Transfer for iOS

    Picture Transfer for iOS
    iPad / iPhone / Mac / Windows
    File Transfer for Mac

    File Transfer for Mac
    Mac
Delite Studio S.r.l. © 2011 - 2019. All Rights Reserved. — P. IVA e Cod. Fisc. IT03402240042 — Privacy Policy
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkMore info