bestbarcoder.com

The Locale Class in Java Develop Code 128 Code Set C in Java The Locale Class

The Locale Class generate, create barcode 128a none with java projects Microsoft Office Official Website A locale is a representa applet barcode code 128 tion of a set of cultural and language preferences. It is represented in two, or perhaps three, parts. The first is the language code, and this is considered to be the most significant part.

The second part is the country code. The country code adds a fine tuning to the localization provided by selection of the correct language. For example, British and American locales both share the language code en for English; however, because there are a number of other variations, such as spellings, currency symbol, and the presentation format used for dates, these variations are represented in a suffix to the main language code.

The locale name for American is en_US, while the locale name for British is en_GB. In the Java APIs, Locale is a class. Objects of the Locale class represent these regional variations, and are used to trigger the most appropriate behavior in a number of other classes.

For example, the Calendar class uses the instance of Locale that describes the user"s preferences to decide what default behavior is required when presenting dates.. The ResourceBundle Class The ResourceBundle class code 128 barcode for Java is a collection of objects, keyed on a textual (String) field. A variety of subclasses of ResourceBundle are provided, including one that is easy to set up, but that represents only text in the data part of the lookup table, and one subclass that allows any type of data, but is somewhat more complex to set up. Normally, you would use a ResourceBundle class to store all the aspects of a program that might need to vary with locale.

Then you would code the program in such a way that it does a lookup, using the key string, to obtain an object that provides the necessary functionality for a given purpose. The significant feature of ResourceBundle is that it provides a mechanism to 117. load a particular instan ce of a ResourceBundle subclass (one that you have created for your program) based on a "root" name that you provide combined with the locale in which the program is running. So, for example, if you provide the root name MyLocalizableElements and the locale of the host OS is en_GB, the program first tries to load the ResourceBundle using a class called MyLocalizable-Elements_en_GB. If that fails, then it tries to load MyLocalizableElements_en, and finally as the fallback, it attempts to load a class called MyLocalizableElements.

. The Unicode Text Encoding Standard The Java platform uses U nicode to represent text. This means that almost any modern language, and a great many ancient ones, can be encoded accurately in a program. Of course, this is not generally enough by itself.

The host operating system must be able to display the characters that the program represents. So, for example, if the program refers to a character that represents a Cyrillic character, this displays correctly only if the host OS has been configured with a suitable font. In most cases, however, this means that any Java technology program will correctly read and present the user"s native language presumably the user"s computer is set up for the user"s language.

However, there is the possibility that you could receive a data file from a user in an office that is located in a different country, and while the program might read and interpret it correctly, you might still be unable to view or edit the data. This is not really a problem with the Java technology, or with any particular program. Rather, it is an issue with the host OS configuration.

. The java.text Package Different cultures repre sent information in special ways. Every day information, such as the presentation of dates and the currency symbol, are good examples of these issues. Many of the problems with representing these items have been addressed and have solutions that are built into the classes in the java.

text package. Specifically, these classes include MessageFormat and NumberFormat, which provide text layout functionality, and can present many textual items in locally correct form. These items include, but are not limited to, numbers, currency values, and dates.

The classes in the java.text package are controlled by an instance of the Locale class. Usually, the java.

text classes will use the default locale object to determine their behavior. However, you can overrule the default locale and instruct the java.text classes to use a specific locale if you desire.

.
Copyright © bestbarcoder.com . All rights reserved.