[Previous] [Main] [Next]

Internationalization (I18N) - All Prompts and Messages

Access this table with JGuiGen --> Create --> I18n. All of the prompts, messages, warnings and other text that the users see (and most of the comments in the generated code) are internationalized. This means that the values are not hard coded in the program. Since many values are shared by all JGuiGen applications a new application is automatically partially internationalized. Here is a class that was just generated:





Java uses a system called resource bundles These are text files with key=value pairs. Java automatically looks in a text file appropriate to the locale of your user for a key. If it exists the corresponding value is used. If the file doesn't exist or and key doesn't exist, java looks in the master file and uses that value. (It actually goes through several levels - for example Spanish-Mexico-Macitosh, then Spanish-Mexico, then Spanish, then the master file.) These files have an extension of ".properties" and use a set of letters to indicate the language and the country codes. For example TesterRb_es_Mx.properties, TesterRb_es.properties, TesterRb.properties, where "es" is spanish and "MX" is Mexico.

There are practical problems with this system.
Frist - Java aborts if the key=value pair isn't found at all.
Second - keeping these up-to-date can be a nightmare.

JGuiGen handles this by placing the key=value pair into a database table - JGuiGen_I18N. The edit screen automatically writes all of the information out into appropriate properties files. When you make a change it is reflected everywhere.

In addition, if java can't find a key in any of the properties file, JGuiGen adds the key to the I18N table. It returns the key surrounded by brackets or brackets and pound signs. When you see a message like [Hello] or [#Hello#], JGuiGen is telling you that a key=value pair has been added to the I18N table and you need to write the properites files out. You may also want to edit the value part of the key=value pair to give a better message on the screen.

Here is the screen you see when you click on the Internationalization menu option: Note that four language are filled in (using Bablefish translation).

I18n Table

You can limit the rows using the combobox at the top of the screen or using the Find button.

1. ClassName combobox- key-value pairs showns as Prompt-(Default Value/CurrentValue) above are specific to one clsss generated by JGuiGen. By selecting that classname you can scroll up and down the values for one class without data from all of the other classes getting in the way.

JGuiGen_Std checkbox - the one exception to key=value pairs being specific to one class are those that are marked as "JGuiGen Standard." These are included in all of the properties files that JGuiGen writes out. This allow us to have one translation for all of the standard prompts, messages and error messages inside JGuiGen. When they are translated once, they are available for all applications generated by JGuiGen.

2. Prompt - This is what the application looks for. It is the "Key" in the key=values pairs in the properties files. It is automatically set to lower case the first time you edit a column. You will need to press the Save button to register the change.

3. Default Value - this is the original "Value" for the key=values pairs in the properties file. If it is empty, it is replaced with the value from the prompt field.

4. Current Value - If this is not empty it is used instead of the Default value. This allows you to change what appears in your application, but still know what the value was originally when the applicaiton was generated. For example JGuiGen will create three lines for editing firstName, middleName, and lastName. Each of these will have their own label and the label names will apear here. You may decide to modify the output so that all of these are on one line and modify the "Last Name" value to "Name-1st, mid. Last".

5. Comment - is just what it says.

6. Lang2 - (Spanish) - this is the value that will be written to the Spanish properties file.

Lang3 - etc.

The chgLang2, chgLang3 checkboxes are not used at this time.

You can write the propterites out by clicking on the "Write" button. This is the "Extra" button created by JGuiGen for all application. This screen will also ask you if you want to write out the properties files when you click on the "Exit" button.