4.5. Translations into other languages
Prev | Chapter 4. Contribute to Pauker |

## 4.5. Translations into other languages

### 4.5.1. Updating translations

The strings presented to the Pauker user are not hardcoded into the sourcecode but are provided by property files. This way programmers and translators can work more or less independently. Pauker has already been translated into (still a relatively small) number of languages. The next figure shows, where the respective files are located:

To edit the translations you have to right-click the file `Strings.properties` and choose the menu option “Open”. Double-clicking `Strings.properties` or right-click->Edit unfortunately does NOT work like expected!

After you have opened the file `Strings.properties`, a new frame appears, where all translations are displayed side by side (see next figure). This way you can edit translations.

Unfortunately this view is not very clearly laid out. By double-clicking the above tab “Strings.properties” you can maximize the translation's frame. If you only want to edit a certain translation you can collapse the columns of the other languages (see next figure).

And now we can work with this tool to some degree! :-)

One thing to notice here is that you should not translate strings that are the same in your language and in the default language, e.g. the English word “Status” is also “Status” in German and therefore is not translated (see figure above). The same rule exists with language variants, e.g. German in Germany and Switzerland is written almost exactly the same but in Switzerland the character “ß” is replaced by “ss”. Therefore the translation “de_CH - German (Switzerland)” is almost empty with just a few exceptions, e.g. “Größe” is translated to “Grösse”.

Besides the program strings you may want to update the translation of the credits information. This information is in the file `credits_<your language code>.html` (see next figure):

This file is presented when you use the Pauker menu item “Help → About Pauker...”.

Next to the credits information in the “About Pauker” dialog is the software license. This license is in the file `license_<your language code>.html` (see next figure):

There are already some unofficial translations of the software license into several languages available at the “Unofficial GNU License Translations Page”: http://www.gnu.org/licenses/translations.html

Another document for translation is this online help itself. This documentation is written in DocBook. For more information about DocBook please visit the following website: http://www.docbook.org

The source for this document is neither in the Source Packages nor in the Test Packages but in a dedicated project directory (see next figure):

You can edit the file `Pauker.docbook` from within NetBeans. It is highly recommended to tell NetBeans that files ending with “docbook” are XML files. This way NetBeans provides syntax highlighting and XML validation for the online help document. Just add the item “docbook” to “Tools → Options → Advanced Options → IDE Configuration → System → Object Types → XML Objects → Extensions and MIME Types”

Pauker uses JavaHelp for presenting the online help. See the following website for more information about JavaHelp: https://javahelp.dev.java.net

For transforming the file `Pauker.docbook` to JavaHelp we use XSLT. For more information about XSLT see the following website: http://www.w3.org/TR/xslt

Transforming the Pauker DocBooks to JavaHelp in every supported language is a fairly complex process. Therefore an Ant target “1_create-docs” has been written that does all the necessary things automatically (see next figure):

This Ant target should run on all current Linux distributions if you have the package “xsltproc” installed. For more information about writing Ant targets see the following website: http://ant.apache.org

To be able to see the result, you have to start Pauker with the updated translation. Just press the F6 button.

To see Pauker with the new translation, your operating system or desktop must be started in the language of your new translation. If you can not or do not want to switch the locale of your running system you have to reconfigure the Netbeans Pauker project: Right-click the project “Pauker” and choose the menu entry “Properties”.

In the Project Properties category “Run” you can either choose already existing language configurations from the combobox at the top of the window or if your language configurations does not exist so far you can add a new configuration and set the VM-Options `-Duser.language=<language code>` and `-Duser.country=<country code>`.

After this you can start Pauker by pressing the F6 key.

You can easily switch between different language configurations by using the configuration combobox at the NetBeans toolbar:

### 4.5.2. Adding translations

If you do not just want to extend or correct a translation but add a new one, you have to right click the file `Strings.properties` and select the menu item “Add Locale...”.

To be useful in preferably all countries where this language is spoken, you should not use further specializations like country codes or variants.

In addition to the new file `Strings_<language>.properties` you should also create a new translation for the Pauker credits with the following steps:

1. select `credits.html`

2. copy the file, e.g. by pressing Ctrl+C

3. select the package “pauker”

4. paste the file, e.g. by pressing Ctrl+V

5. rename the file `credits_1.html`, e.g. by clicking it with the right mouse button, selecting the menu entry “Rename...” and change the file name to `credits_<language>.html` (i.e. if you are adding an Italian translation use `credits_it.html`)

In your new file `Strings_<language>.properties` you have to adopt the value for the key “About_Message_File” so that it points to your new file `credits_<language>.html`.

The next file to add is a translation for the software license. Copy and rename the file `license.html` to your language with the same steps as for the credits (see above). Please note, that there are already some unofficial translations of the license into several languages available at the “Unofficial GNU License Translations Page”: http://www.gnu.org/licenses/translations.html

In your new file `Strings_<language>.properties` you have to adopt the value for the key “License_File” so that it points to your new file `license_<language>.html`.

The last thing to add is a translation for this online help. You should:

1. create a new directory for your language in the folder `doc/docbook/`

2. copy the file `Pauker.docbook` from another language into your directory

3. translate your copy of `Pauker.docbook`

4. add the transformation handling to JavaHelp to the Ant task “1_create-docs”

Prev | Up |
4.4. Sourcecode modification | Home |