Locales

A locale is a geographic or political region or community that shares the same language, customs, or cultural convention. In software, a locale is a collection of files, data, and code, which contains the information necessary to adapt software to a specific geographical location.

Some operations are locale-sensitive and require a specified locale to tailor information for users, such as:

Messages displayed to the user

Cultural information such as, dates and currency formats

In the Default Emulator, the default locale is determined by the platform’s locale. To define a default locale, use the following definition:

microedition.locale: <default_locale>

A locale name is comprised of two parts separated by an dash (-), for example, en-USis the locale designation for english/United States while en-AUis the designation for english/Australia.

The first part is a valid ISO Language Code. These codes are the lower-case two- letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, such as:

http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt

The second part is a valid ISO Country Code. These codes are the upper-case two- letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as:

http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html

Character Encodings

The input/output APIs in CLDC use named character encodings to convert 8-bit characters into 16-bit Unicode characters, and vice-versa. A MIDP implementation might make only a small set of encodings available for MIDlets to use.

In the Default Emulator, the default encoding is default encoder of the platform you are running on. Your emulator might use other encodings, such as UTF-8 and UTF-16, providing they are available in the J2SE platform.

To define the default character encoding used by the emulator, use the following definition:

microedition.encoding: <default_encoding>

To define the set of all available encodings, use the following definition:

microedition.encoding.supported: <list of encodings>

For example:

42 Wireless Toolkit Basic Customization Guide • December 2003

Page 56
Image 56
Sun Microsystems Computer Accessories manual Locales, Character Encodings