The Java Developer's Guide to EclipseThe Java Developer's Guide to Eclipse

Chapter 31, Internationalization and Accessibility, demonstrated that the Eclipse internationalization enablement process is relatively straightforward. This is fortunate, since providing a software product solely in English is no longer acceptable from a usability, quality, marketing, and in some cases, legal standpoint. Enabling your product for the global market simply makes economic sense.

Running the Example

To begin, import the plug-in project com.ibm.jdg2e.nls.example.helloworld and its fragment project com.ibm.jdg2e.nls.example.helloworld.nl1 from the CD-ROM (see the readme for details).

  1. Launch the runtime Workbench (Run > Run As > Eclipse Application). Assuming that your locale is US English (en_US), you will see the menu choice below.

    Hello, World

    The menu items and dialog were displayed in English despite the presence of the German-language com.ibm.jdg2e.nls.example.helloworld.nl1 fragment because the default locale for the launch configuration specifies "-nl en_US." Close the runtime Workbench.

  2. Create a new launch configuration (Run > Run... > New) and explicitly set the locale in the Program Arguments field as shown below.

    Locale setting

    This will set the JRE locale for the runtime Workbench to German / Germany (de_DE). Apply the settings and then select Run. The message text contributed by the national language (NL) fragment are now recognized.

    Hallo, Welt

Roadmap of the Example

This example demonstrates how to internationalize your plug-in using fragments, so the code itself is of secondary importance. The property files of this example are shown below, where blue are those in English and the yellow highlighted files ending in _de are German.

Example English and German properties files

Notice how the corresponding .properties files appear in the same relative location for each language. The fragment's library, nl1.jar, is "merged" with those found on the classpath of the parent plug-in, com.ibm.jdg2e.nls.example.helloworld. The additional language-specific .properties files are also found by the classloader using the same mechanism.

References

© Copyright International Business Machines Corporation, 2003, 2004, 2006. All Rights Reserved.
Code or samples provided herein are provided without warranty of any kind.