Glen DC
8 min readMay 10, 2016

Improving localization in video games, one step at a time

Human languages are complex and differ vastly from one another. This makes the translation aspect of localization very difficult and impossible once you start making parts of your sentences flexible as we’ll see in our case studies later in this article. Writing about localization in English is funny enough, impossible, without making spelling mistakes in the eyes of part of my audience.

“What languages does your game target?” (Image courtesy of Stuart Miles at FreeDigitalPhotos.net)

In the three years I’ve worked in the game industry, I had the chance to work in different studios with different and fantastic people. All teams had problems in their development pipeline, but at least one problem was shared across all teams I worked with: localization.

I’m writing this article as I’m working on a series of products based on the L20n language by Mozilla. You can find a feature-complete and open source library implementation for C# (.NET2+) on GitHub. That library is gratis by the way so you know… You’re welcome.

On top of that there will be a commercial plugin for Unity and free plugin for Marmalade available later this month. As I do have to make a living, I’ve chosen to sell the plugins aimed the big commercial engines for a very reasonable price, rather than giving them away for free. The libraries that I develop for those plugins, and that actually contain 92.5% of the work, are however gratis and opensource. You can expect more articles related to my work on these technologies in the time to come.

To not digress too much, let’s start talking about some actual practical examples. This will give you perspective on why the current localization technology* chosen by many game developers is broken and how I fixed it with the help of L20n.

Case Studies

Before we get our hands dirty with the examples, please let me stress something. The examples given below highlight just a tiny fraction out of the many problematic scenarios one could give, showcasing the complexity of languages and why it makes localization so damn difficult.

They key lesson to take away is that you shouldn’t take any specific problem as an exception and instead provide your translators with the tools to handle anything.

All examples given might actually arise in the form of bugs, reported by Q&A people if you’re developing games using one of the current available localization solutions* out in the wild. I saw all kinds of reactions on such bug reports, including:

  • Add some logic in the game-code specifically to the sentences that are causing problems, making your code dirty with a one-time hardcoded solution for something that shouldn’t be in your game-logic in the first place;
  • Remove the problematic sentences entirely and limit yourself to sentences that you can translate without causing problems in other languages;

None of these reactions are correct and highlight the fact that your current localization approach is broken. Therefore problems will keep popping up unless you choose to limit yourself to the type of translations you’ll make, right from the beginning. Good luck with your social service games :)

L20n solves this by providing a Domain Specific Language (DSL) that gives the translators all the power they need to provide correct translations with the context provided by the game logic. This means that the only localization code that you’ll find in your games are the function calls, that retrieve the translations based on an identifier and optional context. This frees up al lot of development/debug time for your precious programmers, as a by-product.

In order to follow the case study you can use this language specification sheet as a reference. On top of that you can take a look at this complete example file written in the L20n Domain Specific Language mentioned above, showcasing all its features. While understanding the L20n DSL syntax is useful, it is not a requirement for this article.

An example you can handle, don’t worry!

With that being said, let’s move on. In the first example we’ll look at is the simplest translation case and it is also immediately the only situation that current technologies handle decently.

Here we see a simple question, that's identified by the string "intro_question". What this means is that we'll have that sentence in all target languages available and retrievable from game code via its identifier. To give you an idea how this would work in practice, using the L20n Unity Plugin:

Nothing special, and something that probably looks very familiar to you, in case you’re a programmer that is using a localization technology out in the wild, or developed in-house.

But can you handle achievements?

So far so good. Clearly this works, as can be witnessed in most of the games out in the wild. But at some some point in video game history, achievements came into existence and here is where things start to get interesting:

An example, written in the L20n DSL syntax, showcasing a sentence that relies on a context provided by the game code.

This is the first scenario where things go wrong, really wrong. The problem at hand is that the sentence changes depending on what item and how many of it we need. When using L20n, the programmer doesn’t have to worry about this and any other linguistic problem. Instead she can simply rely on the know-how of the translators as they will be the one doing the translation work, as it should be.

Don’t worry if you don’t understand how the L20n DSL works at this point. For the purpose of this article, it’s not very important that you do. Right now I’m simply trying to highlight the shortcomings with localization technologies that you’re probably using, if you’re a game developer. I’ll be publishing an article entirely dedicated to teaching you the L20n DSL later this month.

For English (en) an item’s entity and the `number_case` macro as seen in the example above could be expressed in the L20n DSL as follows:

All of this means that the programmer never has to worry about any potential linguistic issues, beyond knowing how the L20n API works, and how the entities are called. In the Unity Plugin the programmer can retrieve the example translations purely from code via the following call:

At this point you might interrupt me by saying:

“This looks quite complex for the problem it is solving. What’s wrong with simply providing a singular and plural version of that sentence for every item I need? Really, what stops me from using technology X that I’m currently using?”

Uh, well… First of all, your approach would consist out of a lot of error-prone copy-paste work that on top of that will make your localization resource files bigger. But more importantly, your little hack won’t work without a lot of linguistic knowledge and an hardcoded logic-branch in case you’re unlucky with your choice of target languages.

Let's take a look at the Slovene language, used in a country not too far away from you in case you're located in Europe. When targeting a Slovenian audience you would have to worry about the gender case, as is also the case with any Latin-based language that you may wish to target.

That wouldn’t be a problem in this scenario. The real problem here, is that Slovene also has a dual number-case on top of the singular/plural branch you’re used to. Slovene is however not the only language that has a dual case. Among other languages, Arabic has it as well, which might be a more potential target language for your game. In case you’re interested you can learn more about the dual number-case and what other languages have it in this article.

Because of the power of L20n, this will all be handled by the translator that deals with the Slovene translations for your game and no extra work is required for any of the other translators. Also, your programmers won’t lose any nights of sleep as they wouldn’t even have to do anything, let alone think about it. For Slovene (sl) an item’s entity and the `number_case` macro as seen in the example above could be expressed in the L20n DSL as follows:

On top of the snippet above, the Slovenian translator would also provide the “achievement_collect_items” sentence.

Let’s incorporate Social Networks in our Video Games!

Are you still with me? Good, let’s continue by making our video games more social, as developers seem to like a lot.

Social features have become so important in video games, that the Sony’s PS4 controller even has an actual share hardware button. So you know, better be ready to handle this madness in your localization ;)

We already talked about genders within an external context. Last time however we could ignore it all together. In our next and last example we are in a scenario where we would like to ask the opinion of a user, about the outfit of a friend’s avatar:

Ironically enough, this is one of the few cases where English is actually making it more difficult than a Latin-based language such as Português:

In português the possessive case of a noun depends on the gender of that noun, rather than the gender of the subject, as is the case in languages such as English and Dutch.

Once that work has been done by the translators, you can start using it in your games, in the same way as I’ve shown already in previous examples.

And just for your information: for every game you’re developing using L20n, you will also have to select the default language, which will be used as the fallback/default language in case a L20n entry (an entity or macro) can’t be found in the current target language. This is usually the language spoken within your studio and is the only locale written by non-translators.

What this practically means is that you don’t have to wait for any translations, as long as you provide the entity in your default language’s resource file.

So what does this all mean?

After seeing the example scenarios given above, I hope you understand why I think that Localization technology, currently used in most video games, is broken. The main benefits from using my L20n-based technology are:

  • You’ll have a free or affordable technology, maintained without any extra costs and with the option to contribute or request features;
  • If you use any of the supported Game Engines, you would barely have any work on integrating this technology, as it is already done for you;
  • All translations will be do-able and handled entirely by your translators, simple and complex alike;
  • If you buy an engine plugin you’ll have a complete Localization solution, with the extra ability to localize all your other resources, on top of translating your sentences;

Developing all this L20n technology is a big project and will take a lot more work to be fully realized. All help is therefore welcome:

  • Feedback on this article can be given below;
  • Feedback on the libraries and plugins I developed and maintain can be given via email or in case of issues in one of the opensource libraries, you can simply open a ticket on GitHub;
  • General feedback on the aims of this project can be given by mail as well;
  • In case you would like to help me with the actual development of the opensource parts of this technology, you can send me an email and we’ll figure something out together;
  • Good UI Designers are especially welcome to ensuring that the free and opensource editor for translators will actually be usable;

If you’ve managed to read all the way through this dense article, I invite you to ask any remaining questions you might have, in the form of a comment below.

Edit*

A reader made me aware of the existence of po files and i18n. These are much older and according to that reader the standard way of localization. I did imagine there were other ways of doing it out in the wild, which is why my article states most, rather than all. These served as inspiration however during the development of L20n, I would guess.

Either way, it’s an approach far better than the primitive tag-only approach I’ve been mentioning in this article. It’s a technology I might be tempted to use if it wasn’t for existence of Mozilla’s L20n. And it’s definitely not mainstream in the sense that you can simply download a plugin from the major game engine’s plugin store and start using it in your game. Feel free to comment about this technology in case you use it. I would love to learn more about it, as its pro’s and con’s might aid me with improving the technology build on top of L20n.

Glen DC

Freelance Programmer on the road, currently in South America. Writing about programming, projects, life, my travels and stories about my encounters.