Translate a properties file

This guide explains how to generate and translate property files used in Jenkins localization. Property files provide the strings that are displayed to users.

Property files can be associated with Java files or with Jelly views.

Generate property files

Java messages are stored in Messages.properties files. The maintainers of the plugin usually provide those files for the default locale. Translators create property files for their specific locale by appending the local to the file name. For example, Messages.properties for Portuguese as spoken in Brazil is named Messages_pt_BR.properties. Messages.properties for Japanese is named Messages_ja.properties.

The other messages that need to be translated are in Jelly view files, which are in src/main/resources/**.jelly. To localize them, first generate the skeleton property file for your locale with:

mvn stapler:i18n -Dlocale=fr

This generates *_fr.properties throughout src/main/resources with empty values. If the file already exists, missing entries are appended.

It is not necessary to translate the entire file. Entries that are empty will use the default locale.

Translate property files

Translate the property files by assigning values to the properties in the file. Strings in the property file should be encoded in UTF-8.

Test the translation

Test the translation by running Jenkins in the target locale with the plugin enabled.

LANG=pt_BR.utf-8 mvn hpi:run

Commit the changes

Commit the changes and submit a pull request with the changes.