I wrote these guidelines originally for Wayfair internal frontend documentation. Here’s an adapted and improved version. All examples below are using React and React Intl library but these recommendations are generic for web apps and can be applied with any framework and internationalization library.
Incomplete phrases are hard or even impossible to translate, because the translators don’t see the whole phrase. Also, the order of parts may be different in other languages.
Merge all related parts of a phrase into a single localization string, and use interpolation for dynamic content, instead of splitting a single sentence into multiple localization strings.
Bad:
Good:
Example: “red pencil” in English would be “crayon rouge” in French (note the reversed order of words).
Similar to the previous tip, nested strings are hard to translate because the translators see only part of the phrase.
Keep a complete phrase as a single localization string, and use tag interpolation to add formatting or dynamic elements like links or buttons. This may be different or impossible in your internationalization library.
Different languages may use punctuation differently: for example, different spacing around characters or even different characters.
Put punctuation inside localization strings, instead of adding it in the code.
Bad:
Good:
Example: “Username:” in English would be “Nom d’utilisateur :” in French (note the space before the colon).
#4. Don’t reuse translations in different contexts
The same English strings may be translated differently in different contexts, or a translation can be tweaked for a specific page without realizing it would affect other pages.
Create unique localization strings for your features, instaed of reusing phrases that look the same in English in many places.
Bad:
Good:
Example: “Bookmark” heading and “Bookmark” button label in English would be “Закладка” and “Добавить в закладки” in Russian.
The goal of these best practices is to give translators more context, so they can produce better translations, so your non-English speaking users will have a much better experience. Sometimes a single incorrect or inappropriate translation can prevent a user from understanding the interface and how to use it.
Here are some good resources on internationalization and web typography: