Internationalization

 

AdventNet MibBrowser supports Internationalization. This allows using the MibBrowser application and applet in various languages without changing the source code. Localized content can be added easily and the same executable can be run worldwide. All the textual elements such as GUI component labels and messages can be made suitable to the locale (combination of specific language and country) of the user.

 

The following are the steps involved in enabling the Internationalization support to AdventNet MibBrowser.

  1. The MibBrowser.properties file available in the <MibBrowser> directory is to be used as the template file. This file contains the English strings of all the GUI labels and the messages.

  2. The MibBrowser.properties file has to be copied to the specified locale file. For example, to display the MibBrowser in French language, the MibBrowser.properties file is to be copied as MibBrowser_fr_FR.properties file. The language and the country are to be represented by the standard two-letter codes (fr - French and FR - France). If the specified locale file is not present in the specified directory, the default properties file MibBrowser.properties is searched and loaded.

  3. The developer has to write the equivalent strings of the chosen language and country in this file. This will enable the MibBrowser to print the user-written strings instead of English strings. For all the strings for which corresponding locale-specific strings are not given, English strings are used.

The format given in the MibBrowser.properties file should not be altered. The English strings are provided with the "escape" sequence characters. For example, the string "Save MibBrowser Results As...." is provided as "Save\ MibBrowser\ Results\ As... ". However, the equivalent strings (of the chosen language) need not have the "escape" sequence included. For example, the equivalent string for "Save\ MibBrowser\ Results\ As... ". can be given as "my own language equivalent of the same text".

  1. After the above steps, the following code changes have to be done in the MibBrowserApplication.java. Before instantiating MibBrowser, the locale has to be set and the font which was supported for the specified locale should be set. For example, to set the internationalization for the French language, you need to include the following (provided that the font 'Helvetica' supports French).

MibBrowser.internationalize(new Locale("fr","FR"), new Font("Helvetica",Font.PLAIN,12));

 

The properties file should also be edited with proper French words and copied as MibBrowser_fr_FR.properties. The properties file should be present in the directory in which the application is executed. If the properties file is present in some other directory, it can be specified by using the static method setSearchPath() in the SnmpUtils class.

 

SnmpUtils.setSearchPath(<path of the properties file>);

MibBrowser.internationalize(new Locale("fr","FR")), new Font("Helvetica",Font.PLAIN,12));

MibBrowser mibbrowser = new MibBrowser();

 

For applets, similar changes have to be done in the MibBrowserApplet.java file. In case of applets, if the properties file is present in any other directory, it can be specified by giving the path related to the document base in the setSearchPath() method.

 

For example, if the document base is /home/test/mibbrowser, the server base is /home/test/ and the properties file is present in the directory /home/test/properties/, the search path should be set as follows:

 

SnmpUtils.setSearchPath("../properties");

MibBrowser.internationalize(new Locale("fr","FR")), new Font("Helvetica",Font.PLAIN,12));

MibBrowser mibbrowser = new MibBrowser(applet);

  1. The Java files have to be compiled and regenerated to reflect these changes.

To implement internationalization in MibBrowser using the default properties file MibBrowser.properties, you need to include the following:

 

MibBrowser.internationalize(new Locale("",""), new Font("Helvetica",Font.PLAIN,12));

 



Copyright © 1996-2006, AdventNet Inc. All Rights Reserved.