Pentaho Report Designer can be internationalized and localized. To accomplish that, translation files used by the report need to have a specific format and their names need to obey certain rules.
How to configure translation files?
By default, each report that you create contains an empty fall-back/default translation file: translations.properties, editable. You can access it by clicking on File Tab, then Resources option and finally selecting translations.properties and selecting Edit option.
The other translation files can be created or imported by accessing File Tab/Resources option. These files need to contain key-value pairs, separated by an equal symbol (=):
- dashboardTitle = Internationalization dashboard
Additionally, translation files need to have the following format name:
- translations<language>.properties - language corresponds to the language code, List of ISO 639-1 codes - Wikipedia (use 639-1 column). File name examples:
- translations_<language>_<COUNTRY>.properties - COUNTRY corresponds to the country code, uppercase code ISO ALPHA-2, (Country Codes List - ISO ALPHA-2, ISO ALPHA-3 and Numerical Country Codes - Nations Online Project). File name example:
Note: Special characters such as Japanese characters or "Ç" for instance or even accents need to be Ascii encoded (Native2ascii Online), otherwise the characters are not displayed correctly in the report.
Resource-labels are the only elements that perform translations in PRD. You need to set its value property with a key, defined in the translations files. For instance:
- value property = dashboardTitle
value property is under resource-label Atributes Panel.
How is the hierarchical structure in the translations.properties ?
Translations or messages can be created in multiple translation files. Whenever that happens, keep in mind the following hierarchy:
In conclusion, translations_<language>_<COUNTRY>.properties overrides translations_<language>.properties file, which overrides translations.properties file.
Pentaho Report Designer Example
Imagine that you want to create a PRD for English and Japanese languages. You need to configure/create
translations.properties, translations_en.properties and translations_ja.properties with the keys and values that you want to translate and add resource-labels with the keys that you just defined as values properties. Then, to test the translation functionality, you need to go to File Tab, click on Configuration option and click and set ~.environment.designtime.Locale with the language code that you want to see: ja or en to see a Japanese or English translation, respectively.
In case you want to publish this PRD in the repository, PUC, and test the translation functionality, you need to click on View Tab, choose Languages option and then select English or Japanese language. Afterwards, open the PRD report or reload it if it was already opened and see that the report shows the translation for the language chosen in PUC.
Note: In the event of having to translate two reports that share some translation, you only want to maintain one file for each language instead of several. So, you should import the translation file from your file system in File Tab/Resources option. You can edit the imported translation file by clicking on edit option from File Tab/Resources option, or by editing the translation file in your file system. In these situations there are some considerations your should take into consideration. Whenever you edit the translation file inside the File Tab/Resources option you will need to export it. Otherwise, the translation file in your file system won't have the changes that you have performed. The same way, if you change the translation file in your file system, you will need to remove the file that you have imported to File Tab/Resources option and imported it again.
This example was tested in Pentaho 8.0.