The internet is often called a "global village", and there is a lot of truth in that. Setting aside politics and censorship, anyone in the world can reach material from other corners of the planet and talk to foreigners as "closely" as to their own countrymen. But that doesn't mean everyone online speaks one language (unless you count the language of memes). It is fair to say that English dominates (although people in China or Russia would probably show different numbers), but most of us prefer content in our native language. That brings us to the same conclusion people who work with cultural products reached long ago: content can and should be translated.

However, what we are writing about today, internationalization, is a broader concept. Most of us equate it with translation, but it is a bit like in film: translation is one thing and adaptation is another, and Shrek is a good example. Internationalization is a fascinating topic that is not always well understood, including by clients, and as a result misunderstandings sometimes come up while an app is being built. Today I will try to clear up most of the doubts.

What is internationalization?

Let's start with the fact that "internationalization" is a long word, so it is often shortened to "i18n", which is just another way of writing the term internationalization. The number 18 makes sense once you count the letters in the middle. But back to the point: what is it, exactly?

Internationalization is the process of designing or adapting software to support different language versions. It covers not only entering text in another language, but also, among other things:

  • handling language selection (manual and automatic) for a given user,
  • adapting the interface to words of different lengths in each version,
  • using the right character encoding,
  • adjusting how text is displayed, for example for Arabic, which is written from right to left (RTL),
  • (in games) making it possible to match lip movement and animation to the language version.

Gamers may recognize similar topics from interviews with Polish studios that localize popular titles, where the trivia includes things like enlarging text boxes so the text fits or handling gendered forms. I used the term "localization" here on purpose, because it means adapting to a specific language. In other words, internationalization should be done by the software developers, who design the "tools" that allow or simplify the later work of the people doing the localizations (plural, since there can be many languages).

Because localization is also a fairly long word, there is a common abbreviation for it too, this time "l10n". There are many more such terms, including accessibility (for people with disabilities), written "a11y". You can find more of these short forms in this presentation.

One more fairly obvious point: internationalization is standard practice when you open up to other markets and get the most value out of your software. That doesn't mean translating an app into, say, English will bring success right away, but it is better to be prepared and not use it than to need it and not have it. We will get to that later today.

What does internationalization look like for a developer?

As mentioned above, it is usually the team building the software that prepares it to support multiple languages. It makes no difference how many there will be: internationalization for two language versions works the same way as for a dozen. There is some difference when designing for versions that use another alphabet (for example Cyrillic) or another writing culture (for example Arabic), where there is a bit more work because of encoding and interface adjustments. It is worth adding, though, that the various frameworks used to build software provide tools that help with this kind of work, and many of them solve the problems for developers.

Detecting or choosing the language is a slightly different matter. Of course, various engines support multilingual setups at this level too, but how the version is chosen is up to the team, and not only the developers but also the UX designers. Apps show many ways to present multilingualism in the interface: clicking one of the buttons, flags, a dropdown, a control in the header, in the footer, and so on. Detecting the language from the browser can matter more or less, and so can addressing. Some sites store the chosen language in the user's browser, while others put a language code in the URL, which means adjusting the routing. Frameworks help a lot, but they won't do everything for the developer. It is also worth mentioning that using flags to choose a language is discouraged, if only because the user is choosing a language, not a country. In many cases the two are the same, but a Brit may hesitate to pick the American flag, and an Austrian may object to seeing only the German one.

Another issue is designing the interface (again together with graphic designers and UX designers) so that longer option texts still fit in the space provided. A classic example is a menu, which usually consists of a few buttons or links placed evenly next to each other and "calculated" for a certain distance between them. After localizing into another language (Spanish, say), it often starts to look unnaturally cramped or the items even overlap. Unfortunately, no matter how much time you spend on it, you can never foresee every case until you have the actual texts in that language. That is why the interface adjustment stage usually happens once the actual translations are in, and consists of preparing fixes specific to that version.

And what does entering the translations into the software look like? As I said, thanks to frameworks it is usually fairly simple. I touched on this when writing about the comment system, and below I will show how it works in the engine that we use most often at Wilda Software as of this writing, Yii 2.0.

Consider the following example:

<h1>Twoje dane</h1>
<div>Trofea: <?= $trophyCount ?></div>
<div>Twój język: PL</div>

This HTML (or rather PHP, since there is an insert in that language) is valid but not prepared for internationalization. All the texts are written in directly (hardcoded, as people say), so they will be displayed the same way to someone expecting the Polish version and to someone choosing the English option. The example texts are Polish: "Twoje dane" means "Your data", "Trofea" means "Trophies" and "Twój język" means "Your language". So let's prepare this code for i18n:

<h1><?= Yii::t('app', 'yourData') ?>:</h1>
<div><?= Yii::t('app', 'yourTrophies {n}', ['n => $trophyCount]) ?></div>
<div><?= Yii::t('app', 'yourLanguage {lang}', ['lang' => strtoupper(Yii::$app->language)]) ?></div>

Well, it is plain to see that the code has become more complicated and there are more PHP inserts. The Yii::t method inserts, in the given place, the text found in the translation file (we will show it in a moment). So where "normal" texts used to be, the framework is now responsible for finding the right version and loading it. The mechanism itself is much more extensive, though. For example, it allows splitting translations into categories, which matters in very large apps with many texts. In the example above we use only one, default category, "app", which means the messages are stored in the file app.php. They are identified by keys, and the actual translations sit under those keys. The example also shows parameterized translations, where you can substitute the appropriate variables. Yii 2.0 itself also offers mechanisms for plural forms and for formatting basic data types.

Let's see what the files with the actual texts look like, which live in a specific folder in the application:

// zawartość pliku messages/pl/app.php

return [
	'yourData' => 'Twoje dane',
	'yourTrophies {n}' => 'Trofea: {n}',
	'yourLanguage {lang}' => 'Twój język: {lang}',
];

// zawartość pliku messages/en/app.php

return [
	'yourData' => 'Your data',
	'yourTrophies {n}' => 'Trophies: {n}',
	'yourLanguage {lang}' => 'Your language: {lang}',
];

As you can see, the texts are collected in one place (at least in theory), so they are easy to modify and later translate. It is worth mentioning that in theory you can use actual texts in the default language instead of keys, but that isn't recommended, because when something changes you have to edit not only the file above but also every place where the given entry was used.

You can also see that Yii 2.0 lets you get the currently active language (Yii::$app->language) and has mechanisms for setting it manually and automatically. Of course, this isn't the only framework that can do it. Angular, for instance, which is most often used in frontends, has its own module, in which translated entries use JSON files and are inserted like this: {{ 'app.yourData' | translate }}. Laravel has an even shorter notation: __('yourData').

How does translation work?

I mentioned above that the texts are collected in one place that contains as little code as possible and focuses mainly on the content of the messages. This set is usually sent to translators, who render it into a specific language and then send back the changed file, ready to be put into the application. It sounds simple, but a few things need to be said here too.

The first and basic point: unless agreed otherwise, the software house is not responsible for the translation itself. I said above that the IT team prepares internationalization, meaning, among other things, the ability to enter texts in another language. That doesn't mean the developers will sit down and translate into the client's desired language themselves, even if they know it. This applies to English too, although English is common in IT, and a developer entering the default texts in their native language could naturally enter them in English as well. But let's not kid ourselves: that person is responsible for other things without which the software won't work properly, and if forced to translate alone, they will simply use Google Translate. That is why the client usually brings in their own translation company, while the IT company's job is to make the process easier for the experts.

The next thing is to check the phrase "one place". It isn't always possible for all the texts used in the system to live in one designated file or folder. Texts may be split between the frontend and backend or the admin panel, and they may also be stored in the database in so-called dictionary tables. That is why translators usually receive not one file but several in different formats. Which raises a basic problem.

Namely, any technical format (JSON, a PHP array and so on), even a fairly simple one, is not always easy for localizers to "read". Of course, developers provide instructions, but keep in mind that the texts may contain HTML tags, parameters and special characters, and the structure of the files themselves sometimes causes trouble. From experience we know that post-translation fixes are always needed, and they lengthen the work. The safest format is a spreadsheet, but then the software house has to provide converters that load those texts into the application.

Every translator knows that context is extremely important. There are words or phrases that mean different things in a given language (for example "zamek" in Polish, which can mean a castle, a zipper or a lock), but in another language each of those meanings has its own translation. For this reason translators should know the software they are translating, or at least discuss it with the software house or the client. But of course, first, there isn't always time for that, and second, sometimes you don't know whether a given item is actually problematic (so-called tacit knowledge). This problem usually shows up in works of fiction, but it also happens in apps.

The last point is about... the end. Because software can develop dynamically, so can the set of texts. As a result there may be several translation sessions, and by the time the previous batch is returned, new messages have already been created, and not always at the end of the file (where they would be easy to pick out) but also in the middle, in place of the original texts. In addition, translating at the end also makes sense because of the interface and the overall check of whether all the messages fit on the screen and look good.

Can AI help with translation?

In many areas of life and software development, artificial intelligence already helps a lot, and many of you know well that translation is one of the obvious areas where Google Translate or DeepL support even a professional translator's work. But can you rely entirely on these tools and give up the service of a live expert?

As you probably guess, the answer is "rather not". On one hand, there will always be situations where human understanding of context and human knowledge are indispensable. On the other, the development of AI and automatic translators means they are already quite decent at this kind of task. They are certainly a lifeline when you have texts in a foreign language to translate and lack the time and budget for professionals. But for translating an entire portal, say a fintech one, I would have serious doubts about relying on such tools.

That doesn't change the fact that they are excellent systems that serve as APIs and are used to suggest translations of texts entered by users, for example when they fill in product descriptions in an app. Not only do they save a lot of time, they are also a strong point from a marketing perspective. What matters, though, is to use them as support, not as a complete replacement for a live specialist.

Is it always worth internationalizing?

That is a very good question. From experience we know that many apps are built with a local audience in mind or have a more internal character. So you could assume there are cases where internationalization would be useless and a waste of time. But that same experience tells us that even then, in 90% of cases it is worth planning for i18n, and there are strong reasons for it.

The most important argument is that while at first the software may indeed be used only in the local language, in just as many cases the client will want to bring it to another market in the future, which requires translation. But it isn't only about another market. Apps built for specific companies must also assume that not all of that company's employees (and so potential users) come from the given region. A great example is Poland, where in many workplaces between 2010 and 2022 the employment of people from across the eastern border rose significantly, which made Ukrainian or Belarusian localization useful for helping foreign workers. Had nobody thought about internationalization from the start, such a need would mean an enormous amount of work in the application.

And that is absurd, because in most cases internationalization is simply easy. Of course, it still involves some work and requires some compromises, but once introduced, most of the time it needs no "care" while other features of the application are being built. That is why it should be included from the very beginning, when the software is only taking shape, so that everyone gets used to working with i18n. It is much easier to do it then than to internationalize a finished program. Of course, be sensible about it: if we know we won't support, say, Asian languages, it isn't worth spending long hours preparing an RTL version (read from right to left).

Introducing internationalization in the middle of advanced work has one more big drawback. Finding the places in the code where texts were hardcoded and replacing them with translated versions is extremely tedious and time-consuming work that can discourage anyone. Such messages are not always visible right away, which means carefully going through every file and moving the texts to the right place.

Of course, there are cases where you know the application will stay in one language. Examples are internal apps for a specific, very narrow group of users, or even temporary programs, for instance ones supporting short-term scientific experiments. Then you can be tempted to skip internationalization, but these are special situations and should be treated as exceptions.

Summary

Internationalization is, on one hand, a very simple topic and, on the other, a fairly deep one, especially in large apps aimed at the global market. The main takeaway from this article should be that with a suitable framework, localizing software is relatively simple (which doesn't mean it takes no time), and that it is worth planning for multiple language versions from the start.

Best regards and thank you, Jakub Rojek.