Thursday, May 29, 2008

GUI Internationalization in NetBeans

Internationalization is one of the popular project which is moving at faster pace now-a-dayz. Netbeans has its own internationalization module. Internationalization permits applications to be adapted to various languages and regions without requiring engineering changes or recompilation. Internationalized programs enable textual elements, such as status messages and GUI component labels, to be stored outside the source code and retrieved dynamically rather than hard-coded in the program.

Here is a use case of simple GUI being Internationalized.

Open a new project with JFrame form added. (you can do this by right clicking on the project node then New and selecting JFrame Form).
I created a simple GUI to demonstrate the steps.

Now right click on project node and go to New->Other->Other->Properties.
Name it Bundle. Add the following contents to that file.

Now you need to set the name of the respective component by right clicking and editing. Note that the name must be similar to what you have written in Bundles file.
Open the UI class in the design mode. Right click on Form node->Properties.
You should see a window like this.

Check Automatic Internationalization. Click on ellipsis(..) to select the desired locale. I have chosen French(fr_FR). Right click on and open it. You should see something similar to this,

Save it.Go to Design mode window(Editor Window). Now in the navigator window right click on the Form option and Reload.
Right click on the project name node, Goto properties->Run then enter this
"-Duser.language=fr" (Without Quotes)
in the Virtual Machine Argument TextField and run the project.You must see your GUI Internationalized.

Howz That now......

1 comment:

Bessie said...

NICE Blog :)

Take a peek into the future of High Definition Technology at