i18n made easy with the (new) Pentaho Translator

Introduction

At the time of writing,the Pentaho Data Integration source code contains over 6300 keys in 137 different packages. We have to admire the translators that managed to do a great job so far by hand.   I felt it was high time to help out our translators.

See also: Language specific pages

For PDI there is already a directory that contains translation rules and proposals for the messages
for each language, see Kettle/trunk/docsdev/translations

Pentaho Translator

In it's first incarnation, Pentaho Translator was a read-only key viewer based on all the properties files it could find in the source code.  It had many drawbacks:

  • It is read-only
  • It doesn't know about the source code
  • it doesn't detect untranslated keys

 As such, it was time to write a new version.

Pentaho Translator 2

This new program can be found in source tree src-ui and is called org.pentaho.di.ui.i18n.editor.Translator2

Screen shot



 
As youcan see, the whole program is in fact a single dialog.

How it works

  1. You select the locale to translate in the upper-left corner (nl_NL in our example)
  2. You select the package (step/job/spoon) to translate (the undo messages in our example)

At that time you will be shown a list of all the keys that need translation (for the selected locale and messages package).

From that list you can select the key to translate and the right side of the dialog will be filled in:

  • The key at the top (read-only) so you can copy-paste it
  • The main (en_US) translation for use as a reference point (read-only)
  • The translation text box where you can enter the actual translation
  • The line of source code in which the key was found, again for reference (read-only)

All you need to do then is type in the translation and click on the Apply button or hit CTRL-A.  At that time the translated key will be removed from the TODO list and you will be presented the next key in the list.

When you're done, you can hit the "Save" button and the changed messages files will be written do disk.

Searching

If you hit the "Search" button next the Main translation text box, you can search for strings in the translations for the keys in the TODO list. (the search is case insensitive)
If an occurrence is found, the key in which it is found will be selected in the list.  You can then select the "Next" button right below to search for the next occurrence.

The "Search" button next to the Translation text box does exactly the same thing but for the already translated keys.  Obviously this is only useful if you check the "Show all keys, not just the TODO list" option.

How to run

 If you want to run Translator2, then you obviously need the source code.  The best way to get the latest source code is to extract it from Subversion.  That way you can also create merge in updates from other i18n maintainers. (please see the FAQ on how to obtain the latest source code or go here: http://community.pentaho.org/getthecode/ )

When the code is extracted in a folder somewhere, you should get a hold of files:

  • lib/kettle-ui-swt-3.0.jar
  • lib/kettle-engine-3.0.jar

 Normally you would just run an "ant" build to create them, but I guess from version 3.0.0-RC2 (to be released) you can copy them from the binary distribution.
When you have those in the right place, all you need to do is launch "Translator.bat" (for Windows boxes) or "sh translator.sh" for the rest.

Alternatively, you can simply run the Translator2 program directly from within your favorite IDE.  If you do this, don't forget to refresh the project before running Spoon to test. Typically these IDE don't pick up the changes from the file system automatically.