Java Reference
In-Depth Information
ISO 15924 (script identifiers): http://unicode.org/
iso15924/
United Nations M.49 (area identifiers): http://unstats.un.org/
unsd/methods/m49/m49.htm
12-3. Setting the Default Locale
Problem
You want to set the default locale for all locale-sensitive classes.
Solution
Use the Locale.setDefault() method to set a Locale instance that all locale-
sensitive classes will use by default. This method is overloaded with the following two
forms:
Locale.setDefault(Locale aLocale)
Locale.setDefault(Locale.Category c, Locale
aLocale)
This example code demonstrates how to set the default locale for all locale-sensit-
ive classes:
Locale.setDefault(Locale.FRANCE);
You can also set the default for two additional locale categories, DISPLAY and
FORMAT :
Locale.setDefault(Locale.Category.DISPLAY, Locale.US);
Locale.setDefault(Locale.Category.FORMAT, Locale.FR);
You can create code that uses these specific locale categories within your applica-
tion to mix locale choices for different purposes. For example, you may choose to use
the DISPLAY locale for ResourceBundle text while using the FORMAT locale for
Search WWH ::




Custom Search