-
Notifications
You must be signed in to change notification settings - Fork 43
Internationalization
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:
- 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).
- 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.
-
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 |
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:
- Open your Run Configurations dialog and select the JCrypTool entry
- Switch to the Arguments tab
- In the Program Arguments text field replace the
-nl
value (the text in{}
) withen
(so you end up with-nl en
) - Name this run entry e.g. JCrypTool English press the Apply button
- Copy (duplicate) your run menu entry and rename the run menu entry to JCrypTool German
- On the Arguments tab, replace the
en
withde
(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.
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.
Need help? Please visit the public JCT Chatroom or open a new Issue and ask your question. We'll be happy to assist you!