Java properties

Last modified: May 11, 2021Author: Jakub Pomykała

One of the most common formats used in all Java and JVM apps for localization are property files as shown below. Every file contains translations for a different language translations. It's a common case where those files have naming convention like messages_{language}.properties. For example: messages_pl-PL.properties.

java i18n properties file structure

Such files are often used together with Thymeleaf template engine and for e-mail translations.

File format example

# common
email.user.hello=Hello, {0}
email.team=SimpleLocalize.com Team
email.broken.button.instruction=In case the button link doesn't work for you, please copy and paste the link in your browser
# user created
email.user.created.subject=Setup password for SimpleLocalize account
email.user.created.instruction.button=In order to set up a new password, click on the button below:
email.user.created.button.text=Setup password

Upload with CLI

simplelocalize upload --apiKey <PROJECT_KEY> \
  --uploadFormat java-properties \
  --uploadPath ./messages_{lang}.properties

Learn more about SimpleLocalize CLI and translations upload feature.

Download with CLI

simplelocalize download --apiKey <PROJECT_KEY> \
  --downloadFormat java-properties \
  --downloadPath ./messages_{lang}.properties

Learn more about SimpleLocalize CLI and translations download feature.

Import with API

curl
    --request POST \
    --url 'https://api.simplelocalize.io/api/v2/import?uploadFormat=java-properties' \
    --header 'x-simplelocalize-token: <API_KEY>' \
    --form file=@/path/to/your/messages.properties

Learn more about importing translations with API

Export with API

curl
    --request GET \
    --url https://api.simplelocalize.io/api/v3/export?downloadFormat=java-properties \
    --header 'x-simplelocalize-token: <API_KEY>'

Learn more about exporting translations with API