Dynamic strings and placeholders are commonly used in video games as a way of randomizing scenarios or even full quests. This allows for a more personalized experience that feels unique to each player: no one else has explored that land, crossed that bridge, or opened that door. However, when it comes to localizing these strings, translators feel a little less special, as they have to tackle entire sentences made up of brackets and numbers instead of words.

Inherent Complexities and How to Crack Them

Because languages can differ so much from one another, developing one sentence structure that would fit them all is impossible. As of April 2021, 39% of the games developers worldwide reside in the United States, resulting in the fact that many games start out in English. English is known for its simple, standardized syntax and its lack of consistent number and gender agreement. However, most languages do not work like that. They require an extra effort to manipulate strings into fitting a multitude of possibilities.

Let’s start on the right foot here by stating that anything can be achieved. It may sound overconfident, I know, but let’s assume it’s true. So let’s walk through this process.

The first issue that comes up when working with placeholders is the lack of contextual information. For example, it’s common for variables to display just a number: [1], [2], etc. This works nicely in game development, but when it comes to localizing, if not provided with the right set of instructions, neither the LSP project managers nor the linguists know for sure what will replace these placeholders. Meanwhile, context is the key to quality localizations. One solution is for developers to name variables in a way that indicates what content might replace them or, another solution is to develop a list that includes their meaning. Still, it’s good to have a backup plan. Establishing an open communication channel between the narrative team, producers, project managers, and linguists will be of utmost importance to tackle any further questions or issues that may come up. As we continue down this path, agreement among sentence components can’t be ignored. In many languages, most notably in romance languages such as Spanish, French, or Italian, gender affects animate and inanimate nouns alike, as every noun has a gender assigned to it, masculine or feminine. Throw German or Russian into the mix and you’ll have neuter gender as well, not to be confused with inclusive or neutral localization currently being developed. And so the

elements surrounding those words will need to match grammatically to be correct. The solution? There is no such a thing as one-size-fits-all, but we can give this one a try. Let’s imagine we are working on a home décor game and we have a simple string that goes as follows:

Place the [color] [item] to complete the room.

where both the color and item can represent anything from a black sofa to a white lamp, or vice versa. Either way, it works well in English. In Spanish, however, “sofa” and “lamp” have different genders and so the gender of the color must agree with the item. “Blanco” (the masculine version of white) works for the masculine “sofa” but not for “the black lamp”; instead we would need to use the feminine “negra” (black) for “lamp”, as it is also feminine. On top of these, the articles would also need to match. Our recommendation is to include all these elements into the variable itself:

Place [the-color&item] to complete the room.

One variable, one unit of meaning. This allows us to adapt the structure to fit the needs of each language.

Numbers are another common item usually found in variables, and although they may seem simple enough, the following considerations need to be taken into account. First, singular and plural strings will require different wordings. As a result, when numeric variables can be replaced by both “1” and “>1”, two versions of the same string will be required:

[number-singular+GEM]

[number-plural+GEMS]

As you can see from the example above, this also happens in English, so game developers are aware and singular/plural strings tend to be created already.

Another aspect to consider is the fact that languages like Traditional Chinese and Simplified Chinese require quantifiers between numbers and items.

Spend [number+GEMS] to get a new task.

花费 [number +quantifier+ GEMS] 来获取一个新任务。

花费 3 宝石来获取一个新任务。

This is not a problem in itself, however, strings must be flexible enough to support the addition of the appropriate quantifier. The simplest way of doing this is by having dedicated strings for variables that are also submitted for localization. Following with the example above:

[number] Gems

[number] 宝石

This enables linguists to accommodate structures without creating issues elsewhere in the game.

A Magical Case Study

The project we want to address now is from our beloved Jam City’s Harry Potter: Hogwarts Mystery. Our team has been working on the globalization of this game since before its release back in 2018, and we couldn’t have been more excited when our guidance was requested for their new, completely randomized feature. Let’s take a closer look.

Solving the Mystery of Variables: How to Make Dynamic Strings and Placeholders Both Developer and Localizer Friendly

In this particular event, we find a person (Expedition Giver) who, on behalf of their place of work (Expedition Location), requires the help of a given Magical Creature. It includes exactly 50 creatures of 15 different types, to be summoned at 44 different locations, all of which were randomized.

Let’s go over just some examples from the game and how we addressed each one of the variables during the localization process:

::ExpeditionGiverFullName:: greeted ::ExpeditionCreatureName:: upon its arrival at ::ExpeditionLocationName::.

The image below is from our testing so there are still some minor issues to fix, but it is interesting to see how these strings are displayed in the game:

::ExpeditionGiverFirstName:: reports being relieved to have ::ExpeditionCreatureName::’s help at ::ExpeditionLocationName::.

::ExpeditionGiverFullName:: is struggling to get ::ExpeditionCreatureName:: to behave around the customers at ::ExpeditionLocationName::.

Solving the Mystery of Variables: How to Make Dynamic Strings and Placeholders Both Developer and Localizer Friendly

::ExpeditionGiverFullName::

This was replaced by pulling from a long list of names created by the game’s narrative team. Here we faced two issues:

  1. The order of the first and last name in Asian languages
  2. The gender of the Expedition Giver

The ::ExpeditionGiverFullName:: variable was developed in such a way that it followed the English order FirstName+LastName. Asian languages reverse this order. Fortunately, we were able to work with the developers to create the following two options, which when combined, triggered the same result: ::ExpeditionGiverFirstName:: and::ExpeditionGiverLastName::. This allowed our teams to swap the order so localizations were correct in the target market.

The gender of the Expedition Giver was a bit more complicated. Most of the lines could be twisted or transcreated into a neutral version, rendering gender irrelevant; however, in other cases, this was not an option. So, we requested the strings be duplicated, creating one male and one female version of each. The developers were able to create a code to import based on the tags.

::ExpeditionCreatureName::

The Creature’s name was chosen by the players themselves. As a result, we lacked information as to the intended gender, which is key to forming grammatical sentences in most languages. Let’s take a closer look at the following example:::ExpeditionCreatureName:: isn’t a perfect fit for this task at the Ministry, but it’s getting the job done.

In Spanish, for instance, a common localization could require a specific gender for the creature so that it’s translated in one of two ways:

  1. ::ExpeditionCreatureName-male:: no es perfecto para la misión…
  2. ::ExpeditionCreatureName-female:: no es perfecta para la misión…

Our first recommendation to the developers was that players were allowed to choose the creature’s gender together with the name; however, this was not an option, and so duplicating each string with this variable to account for both male and female creatures (same as with the Expedition Giver) would not work, thus forcing our linguists to resort to language-specific methods to resolve this. For instance, some added the word creature before the name, or alternated active and passive voice structures. Others completely rephrased the original English sentence. Just to continue with the example above, the gender-neutral option:

::ExpeditionCreatureName:: no está haciendo un trabajo perfecto…
(Back translation: ::ExpeditionCreatureName:: is not doing a perfect job…)

::ExpeditionLocationName::

We already mentioned there were 44 possible locations. The issues here were two-fold:

  1. The translation of the article depends on the location.
  2. Some languages combine the article with the preposition.

As with most nouns, once localized, locations will have a gender assigned to them, and they can also be singular or plural. “The Three Broomsticks”, for instance, is plural and feminine in Spanish, so the correct article is “las”; while “The Ministry of Magic” is masculine and singular, therefore the correct article is “el”.

If this isn’t complicated enough, languages like Italian, Portuguese, German, French, and, to some extent, Spanish, combine these articles with the preposition. Just to give you a visual example, because of these combinations, the English preposition AT has the following options in Italian:

A

AL – ALLA – ALL’ – AGLI – ALLE

A UNO – A UN – A UNA – A UN’ – A DEI – A DELLE

DA

DAL – DALLA – DALL’ – DAGLI – DALLE

DA UNO – DA UN – DA UNA – DA UN’ – DA DEI – DA DELLE

To tackle all these issues in one go, we requested the creation of five different in-sentence options for each location, as follows:

  • in-ExpeditionLocationName: in the Department of Magical Education
  • of-ExpeditionLocationName: of the Department of Magical Education
  • at-ExpeditionLocationName: at the Department of Magical Education
  • for-ExpeditionLocationName: for the Department of Magical Education
  • from-ExpeditionLocationName: from the Department of Magical Education

This provided our linguists with enough options to accurately localize the content. This solution once again involved working with the developers to pull the correct variable that would best fit the context.

Before Going Live

With these types of randomized quests, testing becomes a MUST. However, in this case, we had far more potential versions of the strings than time to test each one in-game.

Consequently, our solution was a review pass. This was not meant to replace testing, but to complement it by including every single possible option in just one clean file. And to better organize it, content was split by location. There were over 350 strings per each of the 44 locations, all of which were reviewed one at a time.

Conclusions

The potential issues that can result from the use of variables might be hard to foresee for nonlanguage experts, so solutions will have to be designed and tailored to fit the needs of each game. Thus, continued collaboration between language experts and developers is the key to quality results. In this case study, as in all our projects, this very strategy was used to ensure players from around the world found this event as exciting and specialized as we had when we first set our eyes on it.

About the Author
Natalio Acerbo Glyph
Natalio Acerbo
Senior Project Manager at Glyph Language Services

Natalio Acerbo has been in the localization industry for 8 years. He graduated from the Universidad Nacional de La Plata with a degree in English & Spanish Translations. He joined Glyph in 2019 as a Project Manager bringing his great experience to their games team. Natalio’s amazing determination and eagerness to learn propelled him forward in his career as he is currently the Senior Project Manager for the Games Localization Division. In this role, Natalio manages continuous localization workflows, researching the latest in gaming trends and ensuring localization quality for all his clients.