| C H A P T E R 14 |
|
Localizing With The Development Kit |
This chapter describes the support for localization that the development kit provides. This chapter is useful only if you have a source release of the development kit.
Items that can be localized in the development kit include the Java language-based tools, cref, and the Java language-based Java Card RMI sample applications and client framework. The Java language-based programs and the C language-based programs use different localization mechanisms.
This section describes the mechanisms used to localize the following programs and tools:
These Java utilities and programs can be localized in a similar fashion. Each uses the Java language resource bundle mechanism. This mechanism allows the user to customize locale-sensitive data for a new locale without rebuilding the application. Refer to the Java SE platform java.util.ResourceBundle class for more information regarding resource bundles.
The development kit also provides localization support for Java Card RMI sample applications and client framework. Localizing the client framework and the sample applications can be done in the same way as the Java Card technology-based utilities.
Since none of the Java Card platform reference implementation utilities or programs require a graphical user interface (GUI) and are not dependent on user input, the majority of the locale-specific data consists of static strings. Localization consists of customizing these strings for the intended locale. Locale-sensitive strings are grouped into .properties files (for example, MessagesBundle.properties). Localizing an application entails creating a new version of the properties file that contains the translated strings.
The following steps are required to localize a Java program to a new locale:
1. Create a new version of the appropriate property file which contains the correct set of strings customized for the intended locale.
2. Rename the property file with the appropriate locale identifier appended to the file name (for example, the French version of the MessagesBundle.properties file would be MessagesBundle_fr.properties).
3. Include the location of the property file in the CLASSPATH for the cref utility.
When the Java utility is executed in an environment with the same locale as the properties file, the strings contained in that properties file will be used for output.
For additional information regarding internationalization and localization in the Java language, please refer to the Java SE online documentation at
http://java.sun.com/j2se/1.5.0/docs/guide/intl/index.html.
Similar to the Java utilities described above, localizing cref consists of providing the set of static output strings used by cref correctly customized for the intended locale. Unlike the Java language utilities described above, cref must be rebuilt to localize it to a new locale. Therefore, you must use a source bundle of this development kit to localize cref.
All of the locale-sensitive strings used by cref are stored in a single C header file, src/share/c/common/cref_locale.h. To localize cref, customize the strings in this file for the new locale and then rebuild cref.
Copyright © 2009 Sun Microsystems, Inc. All rights reserved.