Skip to content

Internationalization

dschadow edited this page Dec 23, 2014 · 9 revisions

JCrypTool is available in two languages: English (the primary language) and German. Therefore you should internationalize your plug-in, even if you plan to only support one language (in this case this must be English, but offering a German translation is strongly recommended). Eclipse offers great support here, so a lot is done automatically.

You have to make sure the following things:

  1. All plugin.xml and MANIFEST.MF strings are externalized to bundle.properties (English, default) and bundle_de.properties. Right click on plugin.xml and choose PDE Tools --> Externalize Strings. Follow the dialogs. This creates the English version. Just copy the bundle.properties file and rename it for the German version to bundle_de.properties. Translate its content afterwards. Make sure that both files are added to build.properties, otherwise they won't be shipped (only the automatically generated file bundle.properties is added by Eclipse, the German translation in the bundle_de.properties file therefore is missing in the binary build).
  2. Externalize strings (like messages and titles) from all your classes. Select the src folder of your plug-in and choose Source --> Externalize Strings in the menu. Follow the dialogs. Important: use the Eclipse mechanism (select the checkbox). The wizard creates a messages.properties file for every package, which contains the English text strings. Copy this file and rename it to messages_de.properties for a German version. Translate the content. The Messages class takes care of the mapping between properties and classes.
  3. The nl directory contains two languages de and en for your help files. Each directory contains the same files (this is important!). toc.xml is the help index file, contexts.xml (optional) the context sensitive help. toc.xml is referenced in plugin.xml via $nl$/toc.xml. context.xml is referenced via $nl$/contexts.xml. This is resolved automatically by Eclipse at runtime. Those two files should be located in the root directory of every language (in the en or de directory). Add subdirectories for the html files and graphics that make up your help.

See org.jcryptool.crypto.classic.vigenere for a complete example. It is important to use this mechanism and to use the default file names that Eclipse offers. This is the Eclipse default, and Eclipse takes care of the mapping for each language during runtime. And using the same file names in each plug-in makes it easy for developers to follow along across different plug-ins.

The following table shows some common characters and their Unicode representation:

Character Unicode
ä \u00e4
Ä \u00c4
ö \u00f6
Ö \u00d6
ü \u00fc
Ü \u00dc
ß \u00df

Testing

Please test all available language versions of your plug-in. It is relatively easy to forget a translated file or an html page in one language, which is an annoying bug...

Testing different languages is easy:

  1. Open your Run Configurations dialog and select the JCrypTool entry
  2. Switch to the Arguments tab
  3. In the Program Arguments text field replace the -nl value (the text in {}) with en (so you end up with -nl en)
  4. Name this run entry e.g. JCrypTool English press the Apply button
  5. Copy (duplicate) your run menu entry and rename the run menu entry to JCrypTool German
  6. On the Arguments tab, replace the en with de (so you end up with -nl de)

It is wise to clear the workspace at each start, which can be done automatically by selecting the clear checkbox on the first tab in the run dialog. Otherwise you may end up with a mixture of German and English.

Restrictions

Following the above procedure does not translate the default Eclipse dialogs (like preferences). These dialogs must be provided in an internationalized version via the JCrypTool Core. A plug-in developer cannot provide translations for these generic parts.