The Locale Java Help

The Locale

The Locale class is instantiated to produce objects that each describe a geographical or cultural region. It is one of several classes that provide you with the ability to write programs that can execute in several different international environments. For example, the formats used to display dates, times, and numbers are different in various regions. Internationalization is a large topic that is beyond the scope of this book. However, most programs will only need to deal with its basics, wJ1ich include setting the current locale. The Locale class defines the following constants that are useful for dealing with the most common locales For example; the expression Locai~.CAN ADA represents the Locale object for.Canada.' The constructors for Locale are Locale(String lang/age, String colorant) Locale(String Gelling,String country, String data) .These constructors build a Locale object to represent a specific language and country. These values must contain ISO-standard language and country codes. Auxiliary browser and vendor-specific information can be provided in data. Locale-defines several methods. One of the'most important is segfault( ), shown here: static void set Default(Locale locale Obj) This sets the default locale to that specified by oilcloth. Some other interesting methods ar~ the following:

final String get Display Country( )
final String get Display Language() ,
final String get Display Name( )
These return human-readable strings that can be used to display the name of the country, the name'of the language, and the complete .description of the locale. The default locale can be obtained us~g get Default( ), shown here: static Locale get Default( ) Calendar and Gregorian Calendar are examples of classes that operate in a locale sensitive manner. Date,Format and Simple Date Format, also depend on the locale.

Posted on September 17, 2014 in java.util More Utility Classes

Share the Story

About the Author

Back to Top
Share This