Skip to Content

Translate a Java App

Translate a Java App

December 7, 2020
Created by
February 27, 2017
Use SAP Translation Hub to translate the UI texts for a Java app that you develop in Eclipse.

You will learn

  • How to translate the properties file of a Java app using the file upload scenario in SAP Translation Hub
QR code


Step 1: Locate properties file

In your Eclipse window, locate the file that contains your app texts.

Locate file
Log on to answer question
Step 2: View texts in properties file

Before you get started with the translation process, open the file to look at the texts that you’re going to translate.

Open file
Log on to answer question
Step 3: Choose tile for trial account in Neo

In the SAP Cloud Platform cockpit, choose the tile for a trial account in the Neo environment.

access menu to open service catalog
Log on to answer question
Step 4: Open the service catalog

Choose Services in the navigation area on the left.

open service catalog
Log on to answer question
Step 5: Locate the SAP Translation Hub service

Search for the SAP Translation Hub service by entering transl and then choose the SAP Translation Hub tile.

Find Translation Hub service
Log on to answer question
Step 6: Open SAP Translation Hub UI

To access the SAP Translation Hub, UI, choose Go to UI for Translation Workflow.

Go to SAP Translation Hub service
Log on to answer question
Step 7: Create a translation project

Create a translation project for the .properties file that you’re going to upload.

Create translation project
Log on to answer question
Step 8: Enter translation project details

Enter the following details about your translation project:

Field Name Value
Project Name espmcloud
File Type Java Properties File
Domain Sales
Source Language English
Target Languages Enter the languages of your choice, such as French and Italian

Choose Save.

Create project
Log on to answer question
Step 9: Upload properties file

You can upload the properties file in two ways: there’s the drag & drop option, which automatically starts the translation process, and there’s the more traditional file selection option, which requires you to select the file and start the translation process. The end result is the same, it’s just a matter of how you prefer to work.

Drag & Drop Option

Simply drag the file from your Eclipse project to the translation project screen. SAP Translation Hub uploads your properties file to the translation project and translates the texts in one go.

File Selection Option

  1. On the translation project screen, choose Upload File:
    Upload properties file

  2. Navigate to the folder on your local PC that contains the file and open it:
    Select properties file

  3. Choose Upload and Translate:
    Select properties file

Regardless of the option you choose, when SAP Translation Hub has translated the texts, you see the following status:

Success status
Log on to answer question
Step 10: Review translations

To review the translated texts, choose Translations.

Choose translations tab

On this screen, you can switch between target languages and view information about the translation provider and quality rating:

Review translations, translation provider, and quality index
Log on to answer question
Step 11: Filter by quality index (optional)

To better plan the language review process, you can filter translations by the quality rating. For example, this enables you to see only those translations that have a quality rating below a certain threshold, such as 50.
Choose the filter icon above the Quality Index column:

Choose filter button

Choose Quality Index:

Choose quality index button

Enter 50 as the upper limit or move the right slider bubble to the center of the scale:

Adjust quality index slider

The following success message confirms your filter setting:

Confirm quality index filter
Log on to answer question
Step 12: Update translations (optional)

If you want to update any translations, make the changes in the Translated Text column and choose Save Project:

Save translation project
Log on to answer question
Step 13: Download translations

Now it’s time to download your translations so that you see your Java app in other languages. Choose Download Translations:

Download translations

SAP Translation Hub prepares a zip file that contains properties files for each of the target languages in your translation project; save the zip file on your local PC and make a note of its location. You’ll need to navigate to this file later in the tutorial.

Confirm zip download
Log on to answer question
Step 14: Import translations in Eclipse

Now it’s time to head back to your Eclipse window and import the translations into the project for your Java app.

Ensure that you’re looking at the Java perspective:

Choose Java perspective

In the Package Explorer, navigate to your i18n folder, by choosing espm-cloud-web > src > main > webapp > webshop.
Right-click the i18n folder and choose Import….

Choose import in Eclipse

Choose Archive File:

Choose archive file for import

At the top of the Import window, browse to the zip file that you downloaded from the SAP Translation Hub UI and choose Finish:

Select zip file to import

The properties files per target language appear in the i18n folder:

Show target language properties files
Log on to answer question
Step 15: Restart Java server (optional)

To see the translations in your Java app, you need to restart the Java server. In Eclipse, switch to the Git perspective:

Choose Git perspective

Choose the Servers tab:

Choose Servers tab

Right-click Java Web Server and choose Clean…:

Choose Servers tab

Confirm the clean process by choosing OK:

Confirm clean process

Depending on system performance, it can take several minutes for the Java server to be cleaned and restarted. When the process is complete, the status of the Java Web server changes to Started, Synchronized:

Server started
Log on to answer question
Step 16: Display app in browser

To see your app in the translated languages, enter the following address in a browser; the last two letters denote the language of your app: http://localhost:8080/espm-cloud-web/webshop/?sap-language=fr

Enter local host address in browser

The French version of the app appears:

Display French version of app
Which project types are available to create a translation project in SAP Translation Hub?

Next Steps

Back to top