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.

Example:

“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:

"ListItemBank": "Bank",

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:

"ListItemBank": "Bench/Bank",

For better results, the German developer needs to create two separate strings:

"ListItemLongSeatForSitting": "Bank",

"ListItemFinancialInstitution": "Bank",

Which gives you the possibility to add both translations in English:

"ListItemLongSeatForSitting": "Bench",

"ListItemFinancialInstitution": "Bank",

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.

"CloseModule:Button": "Close",

"CloseAccount:Button": "Close",

 

"CancelUpload:Button": "Cancel",

"CancelMeeting:Button": "Cancel",

 

"ContinueToNextView:Button": "Continue",

"ContinueMembership:Button": "Continue",

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.

Conclusion

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!

Note: Thanks to Carlos Barbero-Cortés of DocuSign for consultation and feedback.

Additional resources

Bettina Becker
Author
Bettina Becker
Sr. Language Manager
Published
Related Topics