Lake in front of a forest with foggy sky and green Spring Boot logo in the background.

How to Easily Machine Translate your Java Properties File

by Denis Augsburger

A common method to internationalize Java software projects is to use resource bundles that include several properties files for different languages. Most of the popular Java frameworks like Spring Boot take advantage of properties files to have the translation separated from the implementation. Java as well as Spring Boot even have built-in mechanisms for the i18n capability. For better and easier maintenance it is a good idea to separate the properties files into corresponding resource bundles and use an UTF-8 encoding for all properties files.

Format and Naming

Generally, a properties file contains key value pairs connected with an equality(=) sign. A short file could look like this:

! filename:

header=Let us translate your properties file automatically
hint=Use it with your {appName}

# Buttons

# ....

Properties files can also have empty rows and comments. The comments are either marked with an exclamation mark(!) or a hash(#) character at the beginning - enabling you to have more structure. Usually, the file is saved as in UTF-8 in your corresponding resource folder. The translated version is suffixed with an underscore followed by the corresponding language code. For example, the french translation is saved as

Easily translate your properties file

Simpleen focuses on the translation of locales and i18n format handling to make it accessible for any multilingual software projects at any stage. How? By automatically integrating the machine translation service DeepL and customizing your translation according to the configuration of your translator. Simpleen handles

  • the formatting, comments and values to keep your structure faultless (values can also include HTML-tags like links)
  • the interpolations (so it does not translate variable names which would break the application)
  • the context (available because it provides the whole translation file to the machine translation service instead of only singles sentences)
  • specific translations of words/phrases (which you can add to your glossary)
  • the words/phrases that you do not want translated like brand, product names or technical terms (which you can also add to your glossary)

Quickly set up your translators and translate your properties files

Let's take the English example from above and translate it to French with Simpleen.

Step 1: Create a translator to configure and reuse it:

  • Name: i.e. Translate from EN to FR
  • Source Language: English
  • Target Language: French
  • Formality: Default (choose more or less formal if you wish)
  • Interpolation: { variable/code }
  • Glossary: none (choose one if you’ve already set one up)
  • Format: Properties (key=value)

Step 2: Translate your properties file directly via Web Translator:

  • Go to “Translate” in the navigation sidebar to access the translation page
  • Choose the translator you want to use for the translation in the drop-down menu
  • Copy/paste your properties file into the left text area
  • Click "Translate Input"

After a few seconds you receive the results on the right hand side as shown below:

! filename:

header=Traduisons automatiquement votre dossier de propriété
hint=Utilisez-le avec votre {appName}.

# Buttons

# ....

Note: Simpleen currently provides machine translation with DeepL Pro, which provides quality results for a smaller number of languages (compared to other services). Let us know if you’d want to use other translation services.

Logo Simpleen - Home

Simpleen is a localization tool to translate i18n files from your App, Game or Software.

Entirely independent & self-funded.