How to Translate Locale Files Using Machine Translation

by Denis Augsburger

In general, but especially when planning international and multilingual software projects, the developers on the team have to decide early on, how to handle different languages and formats - in other words implementation of internationalization (i18n) and localization (l10n).

To start, developers choose a suitable i18n library that works with their programming language and library/framework (some frameworks already include i18n). At this point we are still in an early stage of the project and besides the fact that requirements can change, oftentimes it will not be until much later in the project that we start dealing with the process of translation. From my experience, it is at this later stage that we encounter unexpected bugs and design issues related to translations which can then be time consuming to be fixed.

Improve multilingual software projects

My advice is to implement different languages as early as possible and experiment with them. A lot of the components need to adapt to their content. A button with a fixed width will likely result in an overflow or line breaks. You see how the text flows in different languages and devices. This gives you insights and adds new requirements to your components, layouts or even messages early on. So even if the translated results don't represent the final version: To develop and use the product in multiple languages from the start can be a good experience with even better results. It helps everyone involved to find certain bugs - from developers to product managers and translators.

Benefit from machine translation

To be able to shift translation processes ahead without straining your budget you can use machine translation. Preferably in an accessible way, without having to adapt the format of your code which saves time and reduces cost. This is one of the reasons why we developed Simpleen Translation (Beta). It gives you the opportunity to tackle the translation process early on. It provides a customizable Web Translator for different locales commonly used for different programming languages and frameworks.

// your locale file, i.e. in json format with { variables }
{
  "welcome": "Hi there",
  "back": "Back",
  "author": {
    "bio": "i18n specialist for { language }",
    "required_skills": [
      "Writing tech blogs",
      "Like to code",
      "Automate translation processes"
    ]
  }
}

// copy paste to simpleen translator OR use API directly
// => result in spanish
{
  "welcome": "Hola.",
  "back": "Volver",
  "author": {
    "bio": "Especialista en i18n para { language }",
    "required_skills": [
      "Escribir blogs de tecnología",
      "Me gusta codificar",
      "Automatizar los procesos de traducción"
    ]
  }
}

Use it with any project and when you need it

Simpleen can be used in different projects and translates your locales directly without overhead. It is a good fit for

  • prototyping, where you want to showcase multilingual features of your application
  • testing, to check your design and layouts or for usability tests
  • open source contributions
  • expanding your software (or test it)
  • reducing costs

If you would like to give it a try, just register and set up a translator. You can use it with different formats. Please let us know if your locale format is not supported yet.

Let's check the options for configuring your translator for your specific use case:

  • Set your source and target language, i. e. from English to Japanese
  • Select the formality, i. e. less formal for a familiar form
  • Interpolation - select how variables are inserted in your messages, i. e. {{ variable/code }} for the library i18next
  • Choose your format - i. e. JSON
  • Selections (decide if you only want to have certain parts translated)

Afterwards switch to Translate and select your translator. Then copy-paste your locale file into the input field. The translated text is embedded in the same structure you provided and can be directly used in your i18n library.