The Jedi Tutorial

previous
by Andreas Raquet
back to start


Multiple languages

Support for multiple languages is part of the JDK and Jedi provides special support for it. The 'Resources' tab is used to localize an application. We can use this feature to localize the HelloWorld class and add german language support.

Creating language resources

The first step of localization is to create language resources. Select the HelloWorld class, then click on the 'Resources' tab. Jedi will display the name of the language resource bundle, a language selector and a text editor. Go to the text editor and type.

HelloWorld=Hello, World!

This creates a resource-string for the english version. Now change the language selection to 'German [de]'. The editor will be empty again. Create the german resource string by typing

HelloWorld=Hallo, Welt!

Your resources are in place. Now all you need to do is to call them.

Accessing language resources

Accessing the resources is made extremely easy by Jedi. Select the HelloWorld class and activate the 'Resources' tab again. Then click the 'add resource loader' icon in the toolbar. It is the rightmost one in the resource panel. Jedi will create two static methods in your HelloWorld class. These are the resource loaders. Now go to the main method and replace it with the following code:

System.out.println(HelloWorld.GRS("HelloWorld"));

HelloWorld is localized and will adapt to the language your system is configured for.

Testing the languages

If your system is configured for english, you will not notice any difference when running HelloWorld. But you can change the runtime preferences and enforce a different language. Open the 'Runtime environment' dialog from the 'Preferences' menu and select 'German [de]'.
then restart HelloWorld and voila:
Hallo, Welt!

The end

This is the end of the tutorial. More pages will be added when more features are present in Jedi :)
For now, just open all those dialogs again and explore :)

Regards,
Andreas Raquet - Jedi knight


previous
30.08.1999
back to start