Variables or placeholders are yet another important features in website translation. Depending on the website structure and subject matter the text may be brimmed with different variable types or contain just a few of them. Let’s have a look at variables in more depth and see how to deal with them while localising a website.
What are variables?
In programming and web development variables are used to store known or unknown values and to separate the content and name of a particular item. Variables may represent a textual or numerical value that may change when a website is used. You can usually find them in the form of a percentage sign followed by a letter or number, for example ’%d’ in the string ‘You have %d items in your basket’.
Where can you find variables?
Strings with variables are very common in application source code, but website code may contain them as well. Typical examples would be online shops, gaming sites, social networks or booking platforms where variables can represent numbers, names, locations or products. When you translate and localise such website types, you’ll need to give special attention to these often ambiguous characters.
Online shops are typical examples of website codes with variables. Here a screenshot from The Book Depository.
Know how to s% the %1
So how to deal with the variables in your text? To translate the strings correctly you’ll first need to know what the variable represents. In some situations it might be clear from the context, e.g. when you translate an online shop a variable in the sentence “There are no %s in your basket” can be easily identified as “items” or “products”. However, in many cases you might need a further explanation from your customer. Once you know what the variable stands for, it’s time to take care of the proper word order and grammar. In highly inflected languages (e.g. Polish, Russian, Greek), the sentence will have to be modified to ensure that the translation reads well. One strategy is to add a colon before a variable that represents a word that would have to be inflected in the target language (e.g. ‘The number of items in your basket: %s’ instead of ‘You have %s items in your basket’). In this way your translation, although rephrased, will have a correct grammar form and convey the source text message. Another solution is to provide translation for all possible combinations, e.g. for all genders that the word replaced by the variable may take on. Before you attempt to translate a text with variables, make sure that you can view the source content in a browser. This will not only help you to get a better idea of the context, but also to check if you have enough room for any rephrased and extended texts. Finally, try not to change the order in which the same variable types appear, as it’s usually predefined and has to be equivalent in all languages.
Strings from booking platforms contain many variables as well. Here a screenshot from Booking.com.
Translating a website with variables is not as challenging as it may seem. The key to success is to find out about the context and ensure that the string will read well and have a correct grammar form when the variable will be replaced by a specific number or word.
Do you want to learn more how to translate and localise websites? Check out my online course How to translate and localise websites!