Question:
Change hard-coded strings to
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.
![Xliff Editor 2 1 – Xcode Localization Made Easy Learning Xliff Editor 2 1 – Xcode Localization Made Easy Learning](https://screenshots.macupdate.com/JPG/56798/56798_1597258543_scr_uc2.jpg)
Let's localize your iPhone app!
1) Should Symfony translation files use Yaml or XLIFF? We currently have XLIFF. XLIFF is the standard for translations. Yaml does not give any technical benefits. Sure Yaml might be easier to read, but who reads the Symfony translation files anyways? I vote for keeping XLIFF but Im fine either way. 2) Should we recommend using Yaml or XLIFF? 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.
Localize an iPhone app. Preparing your iOS app for localization in Xcode 9 and Xcode 10
Now your iPhone app can speak that
Preparing your iOS app for localization in Xcode
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 9 and Xcode 10
- 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 blue.) This is the screen to verify or enable base internationalization, there at the bottom.
- 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). - 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.
- Finally, enable Auto Layout in your views. Why? 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, and Chinese takes about 15% less. 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. - Don't forget to add comments. Starting from Xcode 7 came the ability to add comments for the translators directly in Interface Builder. Make sure to mention if something is a button, a headline, or anything else that might help give context.
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
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.
- 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 isNSLocalizedStringWithDefaultValue
. Let's begin by making sure your coded strings are ready for iPhone localization. That means you'll want to change all user-facing strings to: - 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! - Advanced users: Since version 6, Xcode has decided to hide the Localizable.strings file for your English strings by default. While you see the Localizable.strings file for, say, your French translation in the
fr.lproj
folder (only AFTER you import the French XLIFF file), the English one is not in theen.lproj
folder.You can, however, change this behavior by creating your own Localizable.strings file, or using the helpfulgenstrings
command. OpenTerminaland navigate to your project's home directory. Then run this command:find ./ -name '*.m' -print0 | xargs -0 genstrings -o en.lproj
This creates a strings file called Localizable.strings that extracts all NSLocalizedString calls into a single file in theen.lproj
localization directory. You can then modify the .strings file directly, and it will be exported along with the XLIFF file. This is useful if you want to use keys instead of the full English string. Do NOT rename Localizable.strings files. Otherwise Xcode won't find them.
Use Xcode's handy import/export localization features
Since Xcode 6, Apple has embraced the XLIFF format for handing off to your translation team
Importing and exporting localizations with XLIFF
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 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.)
- Select your project from the File navigator. Then choose the menu item Editor > Export For Localization….
- 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 iPhone localization team!New in 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. - 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 likezh-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.
Create a free account in our developer portal to help test out your localization, get free price estimates, and expert advice
See also:
Translate your App Store metadata too
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.
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.
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.
It contains common translations for iOS terms, including things like Settings, Tap, etc. in a dozen languages.
What to send to the translator
Don't forget iPhone App Store descriptions and keywords.
Hire a professional translator for each language, or do every language simultaneously with Babble-on iPhone app localization!
You've generated your .strings files, both from Interface Builder and coded strings from Xcode, and those go to the iPhone 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 iTunes 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.
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.
![Xliff Editor 2 1 – Xcode Localization Made Easy Learning Xliff Editor 2 1 – Xcode Localization Made Easy Learning](https://screenshots.macupdate.com/JPG/56798/56798_1597258543_scr_uc2.jpg)
Check it out: How to write an iTunes App Store description »
Now your app can speak that
Hiring a team for iOS localization.
1. Send your iPhone localization strings.
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.
We'll produce localized Unicode text files to insert back into your iOS app in Apple's Xcode.
3. Users rejoice.
iPhones and iPads are multilingual out of the box, so your app's interface will appear localized for the user automatically.
Budget localizations using a free 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.
See Press Release: San Francisco iOS App Localization Service Says No to the Factory Model, Introduces Cost Estimator
Multilingual iOS application iPhone localization examples
Talk to a real translator.
Interested in professional iPhone 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.
Developers, send us your strings!
Localize iOS apps into the right languages
Using iTunes 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 iPhone 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.
XLIFF Editor - POEditor Localization Tool
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 iPhone app localized into Spanish, Japanese, Russian or any other language, Babble-on is ready to help.
When it comes to localizing applications for iOS or Mac OS, things get pretty quickly messed up and cumbersome. The tool support by Apple is – friendly spoking – lacking consistency. Especially if you are updating your code and want to update the localization, things get hairy. I do not want to go into detail here because otherwise this post would never end. I would rather like to provide a (simple) solution.
Read on, if you want to know more about the background and the pre-conditions of my approach. You can however also jump directly to the solution.
Fortunately, Apple has decided to include localizations based on XLIFF in the development process of iOS and Mac applications. XLIFF is a well defined localization interchange format that bundles all localization strings in one file. Using XLIFF tools, the localization of Mac and iOS applications is straightforward. In this post, I want to present a (fairly) simple localization approach based on XLIFF.
In order to be able to localize your application, you have to encapsulate all strings in your code that appear in the user interface into
NSLocalizedString
pragmas. So, for instance, out of @'No Internet connection'
gets NSLocalizedString(@'noInternetConnection', @'No Internet connection')
. IOS With Phrase Setup
The usage of
NSLocalizedString
is a topic of its own. Usually, the first parameter is the actual string that should appear in the application and the second parameter contains a comment for the translator. However, I would claim that currently in the majority of cases the first parameter is used as the key and the second parameter as the default value in the base language (throughout this article, the base language will be English). The background of this approach is that the default value might change and if you used it in the first parameter and have other translations, this change would break the other translations as the first parameter is used as the key to which the translation of a string is assigned. The downside to this approach is that you have to provide a translation for your base language as well (in our case English). The second kind of files that are translated are storyboard and NIB files. Basically, you do not have to do anything to enable their localization. Strings in these files will be recognized automatically.
So, let’s assume you encapsulated all your strings in
NSLocalizedString
pragmas and want to localize your application. This means that we now want to create the XLIFF files and translate them in the aftermath. Actually, Xcode allows to create (and update!) XLIFF files based on the underlying Stroyboards, NSLocalizedString
s in your code and on already existing localization resources. However, Xcode does not allow to export an XLIFF of the base language. It allows to export an empty XLIFF file based on the base language but as soon as you created and translated an English XLIFF, you cannot export an English XLIFF file including the existing translations. So, I will not cover exporting XLIFF files with Xcode (you will find a good tutorial about that here, if you like), I will rather employ the following command line command found here for each language that needs to be created OR updated:xcodebuild -exportLocalizations -localizationPath -project [[-exportLanguage ]]
An example for the creation of the English XLIFF file would be
xcodebuild -exportLocalizations -localizationPath . -project 'North Kiteboarding.xcodeproj' -exportLanguage en
. In that example, the command is executed in the directory where the file North Kiteboarding.xcodeproj is located. After executing this command, a file called en.xliff will be created containing as well the localization strings of the NSLocalizedString
s and of the storyboard and NIB files. If you have not provided a previous English localization, it contains only the keys and comments, not the actual translation. (BTW, for the English translation, you can just copy the comments into the target field.) However (and this is the big difference to previous approaches), if you had already provided a translation, the existing translations will be included in the XLIFF file. So now you (or a translation agency) can start adding the missing information. Although you could as well use a text editor, there is a range of tools available for XLIFF translation. I used a tool called iXLIFF that i found on the App Store which cost 0.99€. Using this tool, the translation looks like the following:
In this example, I translated an app from English to German. As you can see on the left side, the XLIFF file contains as well the strings from the storyboard as from the code (Localizable.strings).
The usage of the application is simple, just type the translations into the ‘Translated’ column.
After you finished the translation, you save the file and import it into Xcode. For the Import, select the project name in Xcode and choose Editor > Import Localizations…. (Note that Xcode will create the translation for the target language in the project file for you. You do not have to do this in advance.) Now, the app is localized in the imported language ?
Whenever you add or change strings in your code or in the storyboard, you repeat the generation of the XLIFF file for each language using the command above, add the missing information using your favorite editor (or translation agency) and import the file to Xcode.
To comprehend:
Using the introduced command line argument, you create and update a XLIFF file for each language. Existig translations in the target language will be incorporated in the XLIFF files. You translate these XLIFF files and import them back to Xcode.
Using the introduced command line argument, you create and update a XLIFF file for each language. Existig translations in the target language will be incorporated in the XLIFF files. You translate these XLIFF files and import them back to Xcode.
That’s it. If you got comments or questions, do not hesitate to post them in the comments.