How to translate an iOS app and make it international

How to translate an iOS app and make it international
L. Giopp
L. Giopp
Tue 08 Feb, 2022


In front of every creation you can probably get faced with an uncomfortable choice: who am I making my app for? What language do I write the interfaces in? How do I translate an iOS app?

The choice is never easy. While it is true that English is the international language par excellence, the one that everyone knows a little, it is equally true that the user likes to be as comfortable as possible. So everyone prefers to have, where possible, an app written in their own language. This is why the most complex apps written in English take a back seat to the worst user experience and are automatically less downloaded (apart from the Anglo-Saxon countries, of course).

Obviously, writing an application only in your native language is too reductive. For example, in terms of market share, imagine how many potential users you are giving up with an app written in Italian that will be downloaded and used only by Italian users. So, having an app written in only one language is definitely unacceptable if you intend to earn money or reach as many people as possible.

How to translate an iOS app

Fortunately, to the simple question "how to translate an iOS app?" Apple has provided an equally simple tool: localization.

Localization is the process that allows you to translate your app into any language you like (at least all the Apple-supported languages, of which there are many) and conquers all the affluent markets where Apple paves the way by selling its wonders.

Translating an iOS app is divided into two parts: internationalization and localization. Once you have defined the element to be translated, you must associate the corresponding string in the target language to make your app multilingual.

Let's take a closer look at how to translate an iOS app using the Swift language.




Marketing is at the core of today's businesses. Read here to know what it is the so called Funnel Marketing.




Internationalization

The first step is to adapt the layout of your app to international content. The process consists of identifying which strings need to be translated and preparing them with a few tricks (remember: not only strings, but also images, numbers, etc.).

To see how to translate an iOS app, we will create a quick and very simple app. I will take the basics of Swift for granted.

Open a new project in XCode; create an iOS app of type Single View for simplicity. I called my app HeroTranslate. Once created, go to the storyboard and insert a label and a button. Set the button centred both vertically and horizontally, and the label above the button aligned with the centre of the button. Change the Button text to "Press" and the label to "This is a test label". Now create a myString variable with the text "Hello World!". So that when you press the button, the label is aligned with the myString. The preparations are over, and we can finally see how to translate an iOS app with Xcode.

Go to the project window and at the bottom you'll find the Localizations item: if it's not already selected, tick the Use Base Internationalization option. Now you just need to add the list of supported languages. You will notice that the default language is English. This is why I suggest that you initially set all texts in English, as well as for English-language devices, of course. In this way, the default language will also be English for all languages that you do not directly support. It is not necessary, in fact, to support all existing languages.

To select new languages, simply add them by clicking on + (alternatively, there is an Add Localization entry in the Editor menu, which does the same thing: just click on the new language you want to add, and voila, you're done).

So, at this point, we are ready for the second phase... Easy, isn't it?

Localization The second part is where you actually start translating the application. First, from the Editor menu, select Export For Localization. Select a destination to save the file(s) you will need to obtain the translations from the window that opens. A file will be created for each language where the file name is equal to the language suffix, and the extension is xliff.

Now open this file, and you will notice that it is in XML format (you can open it simply by double-clicking it, the file will open inside Xcode).

The first useful information is in the third line:

<file original="HeroTranslate/Base.lproj/LaunchScreen.storyboard" source-language="en" datatype="plaintext" target-language="en">

which indicates the source language, English (source-language="en") and the translation language, the target language, in our case ="it".

From here on, you will find the tag indicating the text in the original language, and the tag in the line immediately following: in this line, you will have to replace the string in English with that in the translation language:

<source>Press</source>
<target>Premi</target>

So you have replaced the text of the "Press" button with "Premi", and:

<source>This is a test description</source>.
<target>Questa è una descrizione di prova</target>

the text of the label from "This is a test label" to "Questa è una descrizione di prova".

You are almost done. Save the file and then return to your project; from the usual Editor menu, click on Import Localization. After waiting few seconds, you'll see a new window appear; on the left you will find the storyboard, and if you click inside, you will find the list of changes made to the file. Confirm the changes, and you will have imported your translation ready and waiting.

At this point, the localization of your iOS application should be ready. Let's give it a try, shall we?

Launch your simulator in English by default, and see what happens. You will notice that everything is working as usual, the button in the middle reads "Press", the label above it reads "This is a test label" and, if you press the button, the words "Hello World" will appear, just as you created the program.

Now, if you try to change the language of the device from the settings of your simulator, by relaunching your test application, you will find, as if by magic, that the text of the label is in Italian and the same for the text of the button. There's just one small drawback: if you've been paying attention, you'll surely have noticed that the only text that hasn't been translated is the one introduced in the code string (myString): "Hello World".




Do you have a website for your app? Read here to know why you should translate it!




NSLocalizedString

All this is to introduce the next step. Suppose it is true that all graphic elements, with their properties, are automatically recognized as elements to be translated for localization. In that case, you need to indicate to the program which elements introduced by code are to be translated and which are not. All this must be done before exporting the file for translation.

So, go back to your project and, in the ViewController.swift, replace the line myString = "Hello World!" with a string that will tell your program that that variable is to be translated:

myString = NSLocalizedString("Hello World!", comment: "myString")

The comment, in this specific case, is not essential.

At this point, however, you have partly remade what you did with internationalization. That is, you are once again faced with the need to translate your application. Fortunately, Apple has thought of everything, and export allows us to select all the translations already done from the Include entry, setting the value to "Existing Translations".

This is extremely important, as it will allow you to carry out the translation at different times, for example, if you have to add elements at the last second or in a subsequent project update phase.

Conclusion

The project is complete. At this point, there is only one thing left to do: get good translators. If you want to translate your apps into other languages, you must use a good translation service. Don't even think for a moment about using Google Translate. You'll indeed save money, but if you remove individual words, and in some cases even for those, the risk of making a fool of yourself is just around the corner.

We at Hero Translate can be your winning partner for perfectly translating your iOs app in as many languages as you want.

Get an Instant Quote or Contact Us and take advantage of a 10% Discount on your first order and become part of the 10.000+ companies and professionals that used Hero Translate to exploit international markets successfully!

Need a perfect Translation? Get a free instant quote

Instant Quote

Calculate the cost in no time with our Price Calculator.

Add your requirements

Add all requirements and submit the order. You can pay later.

Receive Your Job

We will do a perfect job in the shortest possible time.

  info@herotranslate.com