Coding for the world, part 4: Everyone talks about recycling; we are not, or are we?
As inhabitants of this earth, we produce a lot of stuff—too much, in fact. Recycling is not curing the root issue, but may help on a different level: we can reuse cars and clothes and make new bottles out of plastic scrap. When it comes to code, recycling can be very problematic for localization, but there are areas where recycling makes total sense. But first things first.
Writing honest and clean code that is easily understood among peers is the goal of every developer. Why shouldn’t the developer take a string that has been already written and use it somewhere else; does it do any harm? Here is what the linguist in me says: “It depends.”
Let’s assume you have already written a string, “Add user”, which is the title of the page. Later in the process you will also have a button labeled “Add user”. Now you just take the code for the title and reuse it for the button. This is where the trouble begins for localization. Depending on the language, the manner in which button labels are translated compared to titles can be different.
“Add Users” as a title in German:
"AddUsersModuleHeader": "Fügen Sie Benutzer hinzu",
“Add Users” as a button in German:
"AddUsersBTN": "Benutzer hinzufügen",
As you can see, it won’t work to use one translation for the other.
There is content that can be recycled and used over and over again, however, such as translations for a country list. The provided context is always the key! Take, for example, the country Georgia. If there is no context and the linguists only see the word “Georgia”, it can be interpreted as a country, a US state, or a font! Or, for example, the word “Back”, can refer to navigating back or the back of a passport—two totally different words in other languages. Another nice example is the word “Custom”, which can be used in many scenarios in the English language; but in other languages, the translators need to know which noun “Custom” refers to in order to get the translation correct. The translation can depend on the noun’s gender and if the noun is plural or singular.
You can happily reuse standard buttons across your code. Standard buttons are, for instance, Cancel, Close, OK, or Continue. However, I must pull the linguist again and say, “be cautious.” And here is why.
Imagine you are now the one that localizes a product from German to English. The German developer used one string for two different instances in the product. See the drama unfold:
The German word “Bank” is used as a list item for two different lists for the following contexts:
- a long seat for several people called a bench in English
- a financial institution called a bank in English
The only possibility that is left for you as a linguist is to do the following for your English translation—very confusing for your end user:
For better results, the German developer needs to create two separate strings:
Which gives you the possibility to add both translations in English:
Let’s review some English word examples. “Close” is a standard button if used for closing a UI module, such as a dialog box. If “Close” refers to a different context, it is not a standard button any longer—for instance, if there is a button to close an account, which would be a totally different scenario from closing a UI module. Here are some examples to illustrate that we need two different strings when we use the same word in different contexts.
The solution to this problem is to use, for different scenarios, unique strings with enough context. If you would like to know more about best practices for providing context, read Part 3: It is all about those clues.
A single word in one language can have multiple translations in another. The shorter the UI string text, the more ambiguous it can be. Use a string only for a specific scenario but not for other instances, as the style or meaning of the translation may vary by context.
See you in the next part when we talk about “What’s in a name?”. Until then, sunny greetings from the linguist that you can trust!
- Coding for the world
- Part 1: Why should I care about localization?
- Part 2: Keeping it together—or is separation a thing?
- Part 3: It is all about those clues
- Part 4: Everyone talks about recycling; we are not, or are we?
- Part 5: What’s in a name?
- Part 6: Time, money and arrangements
- Part 7: A form is a form. Wait. What?
- Part 8: Politics and your involvement
- Part 9: Casing, space and commotion behind the scenes
- Part 10: The one with the genders and pluralization
Note: Thanks to Carlos Barbero-Cortés of DocuSign for consultation and feedback.