Step-by-step iOS localization tutorial

Localization Q&A by Babble-on

More questions:

Let us localize your app!

Once you've completed this tutorial to internationalize your app, please let us translate your strings!
Bookmark this page and come back for a free price quote.

Translate my app

Categories

Preparing your iOS app for localization in Xcode

Prepare iOS apps for localization

iOS and Mac apps rely on something called base internationalization. Here's how it works.

Introduction to Base Internationalization

The idea behind base internationalization is to extract the text a user sees in your app from Interface Builder and other resources. All of those buttons names and text labels need to be translated, after all. Each piece of text is placed in a simple text format called a .strings file. Base internationalization helps collect those texts from .storyboard and .xib files automatically. You can also include images and other resources that you may want to localize. Xcode moves or duplicates all of these resources into a Base.lproj folder in your project. It also creates separate folders for each language you want to translate into in order to store the localized version of these resources.

Enabling Base Internationalization in Xcode 12

  1. Turn on Base Internationalization.

    Recent versions of Xcode turn on base internationalization by default, but let's just make sure your project is using it.

    Select your project in Xcode's file navigator. (Make sure you're looking at the Project, not the target, and that the Info panel is highlighted.) This is the screen to verify or enable base internationalization, there at the bottom.

    Localizing Xcode

  2. Add your resources

    Add any resource files you plan to localize into your Base.lproj folder.

    When you check the Base Internationalization checkbox the first time, Xcode will ask which resources to use as well as your default language (usually English).

    Xcode will create a Base.lproj folder if it isn't already there, and add any resource files you select. It also creates a language folder for the development language (for English, it's called en.lproj).

    Internationalization of resources in Xcode for iOS and Mac

  3. Add languages

    Add languages using the menu command Editor > Add Localization.

    Or right from the Info panel, press the button and choose the language you want to add. Xcode will again ask which resources you plan to localize, and create a [language code].lproj folder for each.

    Add localization language in Xcode for iOS and Mac

  4. Enable Auto Layout

    Lastly, enable Auto Layout in your views. Eliminate all fixed origins, widths, and heights in your views so that the localized text can reflow automatically when the language or locale changes.

    Auto Layout is enabled by default in Xcode for new projects, but for existing projects you can enable it for any view.

    See also: Apple's Auto Layout Guide.

    Why Auto Layout?

    Other languages are going to take up either less or (more likely) much more space than your current language.

    German words take up about 30% more room than English.

    Chinese takes about 15% less.


  5. Add comments

    Don't forget to add comments.

    Remember translators work without visual context. Be sure to add written comments for the translators directly in Interface Builder.

    If something is a button, a headline, or anything else, tell them.

    Context is the most important thing you can do to improve translation quality. We'll do the same thing with hard-coded strings next.


Hint: Add more resources at any time using the File inspector. Just press the button or check the boxes for the languages you'd like. This is useful if you want to include a localized image for a PNG file that has some text in it, for example, or perhaps you want to show a particular country's flag based on the user's language.

Note: Xcode will actually create a .strings file for each and every .xib resource. Xcode includes many placeholders that say "Label" and "Button" that you probably never intended to pay a translator to translate! Consider deleting these from the final files you send your translators.

Extract your hard-coded app strings for iOS localization

iOS app localization service

Xcode's Base Internationalization will export your storyboards and xib texts automatically. That leaves your hard-coded strings and labels, which you can also prepare for export using the NSLocalizedString macro.

Change hard-coded strings to NSLocalizedString.

Not every text a user sees comes from your .storyboard or .xib files, of course. What about those error messages and user prompts that are buried inside your code? Xcode can help you externalize your coded texts for iOS app localization too.

  1. Wrap text in NSLocalizedString

    Any string your user will see needs to be wrapped in the NSLocalizedString macro. If you're still programming in Objective-C, note that the correct macro is NSLocalizedStringWithDefaultValue.

    Let's begin by making sure your coded strings are ready for iOS localization. That means you'll want to change all user-facing strings to:


  2. Include a comment

    Always include a unique key and a helpful comment for the translators.

    Since you will need to add the NSLocalizedString call to every string a user sees, take an extra moment to tell the translators what this string is for. Remember, they'll be seeing it totally out of context and your helpful hint here is all they have! Knowing that a text is a title or a button, a noun or a verb, can be very helpful.

    Also make sure your key is absolutely unique. That will ensure that you can translate a string like "Clear" as both a button to remove text, AND as an adjective describing the color of something. In other languages, these two words are certain to be different!

NSLocalizedStringWithDefaultValue(@"window.greeting" // Unique key of your choice
	, @"Localizable", // .strings file name 
	, [NSBundle mainBundle] // Default bundle
	, @"Hello, world" // Default (English) text
	, @"Window title" // comment for translator
	);
myText = NSLocalizedString("window.greeting", // Unique key
	value:"Hello, world!", // Default (English) text
	comment:"Window title")
	
// Example with format (variables) let format = NSLocalizedString("format.example", // Unique key value:"I need %d volunteers", // Default (English) text comment:"Number of volunteers")
myText = String.localizedStringWithFormat(format, // formatted string volunteers.count) // %d number variable
// Swift UI will export "literal" Text() labels automatically,
// But for other hard-coded texts…
Button(NSLocalizedString("submit.form.button", value:"Submit", comment:"Sends the form"))

Use Xcode's handy import/export localization features

In Xcode, Apple has embraced the XLIFF format for handing off to your translation team

At runtime, your iPhone or iPad app is going to use the text inside those strings files you created to swap out English text for the translations. But instead of sending dozens of .strings and storyboards files to your translation team, Xcode has a quick export function that creates a single XLIFF file for each language.

(XLIFF is a standard XML-format supported by most translation software, including ours.)

Using Xliff with Xcode for iOS localization tutorial

Importing and exporting localizations with XLIFF

  1. Export For Localization

    Select your project from the File navigator. Then choose the menu item Editor > Export For Localization….


  2. Save the Development Language

    In the Save window that appears, select where to save the export. Generally speaking, as translators, we only need the Development language, which is usually English. But if you have existing translations to share, you will also want to send those. You can export any language from the list of available ones for your project.

    And, voilà. Your app will soon speak enough French to understand the word "voilà!" You have all the files you need to send to your iOS/Mac localization team!

  3. Export localizations development language xcode apple ios

    New since Xcode 10: Xcode will now export even more stuff in a folder it called an Xcode catalog, or .xcloc. In addition to the xliff file, it also exports some Source context (storyboards) and creates a Notes folder where you can put some screenshots for your translators or other instructions.


    This is when your translators work…


  4. Import the translations

    Your translators should return to you one file for each language using the language code as its name. That is, for French you'll receive an fr.xliff file, for Chinese, you'll get back something like zh-Hans.xliff.

    Import the files back into Xcode using the menu command Editor > Import Localizations…. Xcode will display a window with the differences between your existing files and the ones your translators have sent you. Press the Import button to finish.

  5. Import localizations translations xcode apple ios

  6. Tip for Advanced Users

    Now that you've set up localization, you'll notice that Xcode shows Localizable.strings files for your translations. But where is your English (or whatever your development language is)? Base localization will take care of getting your "default" English texts straight from the code. While you see the Localizable.strings file for, say, your French translation, the English one is not there by default.

    Note: How iOS determines which language to show — TL;DR It looks for a localization of your user's preferred dialect. If that's not there, a generic of your user's preferred language. And finally, ultimately, your development language, likely English.

    So if your user's preferred language is French Canadian, iOS checks for: fr-CA.lproj. Not there? Then fr.lproj. Not there? It will just use the Base development language en.proj.


    Sign in to our developer portal

    Create a free account in our developer portal to help test out your localization, get free price estimates, and expert advice

  7. iOS Localization in Xcode

    Note: You can modify the .strings file directly, and it will be exported along with everything else in the XLIFF file. Do NOT rename Localizable.strings files or .lproj folders. Otherwise Xcode won't find them.

See also:

Language Codes
Complete list of ISO-639 language codes to use for your iOS app. Use these to name your xx.lproj folders.
iOS Glossary
This page contains many common translations for iOS terms, including things like Settings, Tap, etc.
Developer Guide
Apple's guide for preparing your nibs.

Pseudolocalization —  testing you've found every string

Once you've finished preparing your .strings file you're probably having doubts that you actually managed to find every hard-coded string in your app. What about those error messages or that plug-in you use? Well, there is a quick way to check. It's called pseudolocalization!

Pseudolocalize my files

Plus get free cost estimate

Essentially, you use a program to substitute all the English (source) phrases with a fake language. Load up this gibberish Localizable.strings file into Xcode and then run your app. Check every screen and make sure all the text appears as the pseudo-localized text rather than your original. If you can't spot any missing strings, you're good to go.

Tip: Pseudolocalization is also a great way to make sure you've left enough room in your GUI for other languages. A common rule of thumb is that non-English languages are 30% longer, so tiny buttons and titles may not fit when you localize. Pseudolocalization can help you spot those cramped spaces too!

Start translating your app right away using this free Multilingual iOS Term Glossary. It contains common translations for iOS terms, including things like Settings, Tap, etc. in a dozen languages.

Translate your App Store metadata too

You've generated your .strings files, both from Interface Builder and coded strings from Xcode, and those go to the iOS localization team you hire. That's not everything, though. You'll definitely want to have your app description for the App Store localized as well. Since App Connect will also ask you for keywords, make sure you come up with a list of keywords> for your translation team to localize. This ensures that users in other languages will find your app when searching their localized version of the App Store.

Even before you publish your localized app, translating your app description and keywords is a great way to see which languages are most likely to succeed in your internationalization efforts.

How much does it cost to translate an app description?

Estimate the cost of localizing your existing app description from the iTunes, Google Play, or Windows Store URL.



This might also be a good time to read through your App Store description and make sure it is the best it can be—before you have it translated into 30 languages.

Check it out: How to write an iTunes App Store description »

Multilingual iOS application iPhone localization examples

Pivotal Tracker Tinder Sky Guide for iPhone and iPad Living Earth Weather App Rock On - A SongPop Advent Shades puzzle gamet

Talk to a real translator.

Interested in professional iOS localization from a team that cares about making apps awesome? Unlike automated or cloud translation services which will translate your "bold" text as brave and "Archive" as a noun without considering it might be a verb, Babble-on is a dedicated team of translators that put as much care into localization as you do into app development.

You can talk to us about your project the whole way through, not just upload your strings and cross your fingers.

Tips for how to localize your iOS app

Localize iOS apps into the right languages

Developers, send us your strings! We localize iOS apps »

Using App Connect, you've probably already noticed users from all over the world downloading your app. How many more users can you get by translating and localizing your iOS app into another language? Into two, or more? Once you've created the .strings file using the tutorial above, it's very simple to localize your iPhone or iPad app for the iOS App Store.

From our FAQ: Which languages are worth localizing into? »

Is your App Store description going to sell?

Writing a description of your app for the App Store description is often difficult for even the best developers. How do you make your app sound great without sounding like a door-to-door salesman? How will the description translate when you localize your iOS app, and are there any issues to consider for new markets? Babble-on helps developers with both the copywriting and translation, so we know this subject very well. Ask us for help.

Check it out: Tips for writing your iTunes App Store description »

Tell your users in their language.

A user can set their preferred language by going to Settings -> General -> International -> Language. Once the language is set, the iPhone/iPad will display all text, including the app's name on the home screen, in the user's local language.

Professional iOS localization

We love iPhone and iPad apps and are excited to help you localize your projects and test them in multiple languages. Whether you need your iOS app localized into Spanish, Japanese, Russian or any other language, Babble-on is ready to help.

Need more help?

App Localization FAQ

Hiring a team for iOS localization

1. Send your iOS localization strings.
Prepare iOS apps for localization

Calculate the word count and cost of your XLIFF file for iOS localization.
Don't forget your keywords and App Store description.

2. We'll translate.
iOS app localization service

We'll produce localized Unicode text files.
Insert back into your iOS app in Apple's Xcode.

3. Users rejoice.
Integrate strings for iOS apps for localization

iPhones and iPads are multilingual out of the box.
Your app's interface will appear localized for the user automatically.

Budget localizations using a free App Localization Cost Calculator

iOS App Localization Cost Calculator

Now that you have all your text ready for translation, you're probably wondering how many words you have and how much that will cost to translate. Use Babble-on's free iPhone app localization cost calculator to find out.

Try the cost calculator »

See Press Release: San Francisco iOS App Localization Service Says No to the Factory Model, Introduces Cost Estimator

We'd love to help get your app ready for localization.

Contact us

For real.