|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Locale
Untamed:
Field Summary | |
static Locale |
CANADA
Enabled: Useful constant for country. |
static Locale |
CANADA_FRENCH
Enabled: Useful constant for country. |
static Locale |
CHINA
Enabled: Useful constant for country. |
static Locale |
CHINESE
Enabled: Useful constant for language. |
private static String |
compressedIsoCountries
|
private static String |
compressedIsoLanguages
|
private String |
country
|
private static Locale |
defaultLocale
|
static Locale |
ENGLISH
Enabled: Useful constant for language. |
static Locale |
FRANCE
Enabled: Useful constant for country. |
static Locale |
FRENCH
Enabled: Useful constant for language. |
static Locale |
GERMAN
Enabled: Useful constant for language. |
static Locale |
GERMANY
Enabled: Useful constant for country. |
private int |
hashcode
Placeholder for the object's hash code. |
private static String[] |
isoCountries
List of all 2-letter country codes currently defined in ISO 3166. |
private static String[] |
isoLanguages
List of all 2-letter language codes currently defined in ISO 639. |
static Locale |
ITALIAN
Enabled: Useful constant for language. |
static Locale |
ITALY
Enabled: Useful constant for country. |
static Locale |
JAPAN
Enabled: Useful constant for country. |
static Locale |
JAPANESE
Enabled: Useful constant for language. |
static Locale |
KOREA
Enabled: Useful constant for country. |
static Locale |
KOREAN
Enabled: Useful constant for language. |
private String |
language
|
static Locale |
PRC
Enabled: Useful constant for country. |
(package private) static long |
serialVersionUID
serialization ID |
static Locale |
SIMPLIFIED_CHINESE
Enabled: Useful constant for language. |
static Locale |
TAIWAN
Enabled: Useful constant for country. |
static Locale |
TRADITIONAL_CHINESE
Enabled: Useful constant for language. |
static Locale |
UK
Enabled: Useful constant for country. |
static Locale |
US
Enabled: Useful constant for country. |
private String |
variant
|
Constructor Summary | |
Locale(String language)
Enabled: Construct a locale from a language code. |
|
Locale(String language,
String country)
Enabled: Construct a locale from language, country. |
|
Locale(String language,
String country,
String variant)
Enabled: Construct a locale from language, country, variant. |
Method Summary | |
Object |
clone()
Suppressed: Overrides Cloneable |
private static String[] |
composeList(java.text.MessageFormat format,
String[] list)
Given a list of strings, return a list shortened to three elements. |
private String |
convertOldISOCodes(String language)
|
boolean |
equals(Object obj)
Suppressed: Returns true if this Locale is equal to another object. |
private String |
findStringMatch(String[][] languages,
String desiredLanguage,
String fallbackLanguage)
|
private static String |
formatList(String[] patterns,
String[] stringList)
Format a list with an array of patterns. |
static Locale[] |
getAvailableLocales()
Enabled: Returns a list of all installed locales. |
String |
getCountry()
Enabled: Returns the country/region code for this locale, which will either be the empty string or an upercase ISO 3166 2-letter code. |
static Locale |
getDefault()
Enabled: Gets the current value of the default locale for this instance of the Java Virtual Machine. |
String |
getDisplayCountry()
Enabled: Returns a name for the locale's country that is appropriate for display to the user. |
String |
getDisplayCountry(Locale inLocale)
Enabled: Returns a name for the locale's country that is appropriate for display to the user. |
String |
getDisplayLanguage()
Enabled: Returns a name for the locale's language that is appropriate for display to the user. |
String |
getDisplayLanguage(Locale inLocale)
Enabled: Returns a name for the locale's language that is appropriate for display to the user. |
String |
getDisplayName()
Enabled: Returns a name for the locale that is appropriate for display to the user. |
String |
getDisplayName(Locale inLocale)
Enabled: Returns a name for the locale that is appropriate for display to the user. |
String |
getDisplayVariant()
Enabled: Returns a name for the locale's variant code that is appropriate for display to the user. |
String |
getDisplayVariant(Locale inLocale)
Enabled: Returns a name for the locale's variant code that is appropriate for display to the user. |
private String[] |
getDisplayVariantArray(ResourceBundle bundle)
Return an array of the display names of the variant. |
String |
getISO3Country()
Enabled: Returns a three-letter abbreviation for this locale's country. |
String |
getISO3Language()
Enabled: Returns a three-letter abbreviation for this locale's language. |
static String[] |
getISOCountries()
Enabled: Returns a list of all 2-letter country codes defined in ISO 3166. |
static String[] |
getISOLanguages()
Enabled: Returns a list of all 2-letter language codes defined in ISO 639. |
String |
getLanguage()
Enabled: Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code. |
String |
getVariant()
Enabled: Returns the variant code for this locale. |
int |
hashCode()
Suppressed: Override hashCode. |
private void |
readObject(ObjectInputStream in)
|
static void |
setDefault(Locale newLocale)
Enabled: Sets the default locale for this instance of the Java Virtual Machine. |
private String |
toLowerCase(String str)
|
String |
toString()
Suppressed: Getter for the programmatic name of the entire locale, with the language, country and variant separated by underbars. |
private String |
toUpperCase(String str)
|
private void |
writeObject(ObjectOutputStream out)
|
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Locale ENGLISH
public static final Locale FRENCH
public static final Locale GERMAN
public static final Locale ITALIAN
public static final Locale JAPANESE
public static final Locale KOREAN
public static final Locale CHINESE
public static final Locale SIMPLIFIED_CHINESE
public static final Locale TRADITIONAL_CHINESE
public static final Locale FRANCE
public static final Locale GERMANY
public static final Locale ITALY
public static final Locale JAPAN
public static final Locale KOREA
public static final Locale CHINA
public static final Locale PRC
public static final Locale TAIWAN
public static final Locale UK
public static final Locale US
public static final Locale CANADA
public static final Locale CANADA_FRENCH
static final long serialVersionUID
private String language
getLanguage()
private String country
getCountry()
private String variant
getVariant()
private int hashcode
private static Locale defaultLocale
private static String[] isoLanguages
private static final String compressedIsoLanguages
private static String[] isoCountries
private static final String compressedIsoCountries
Constructor Detail |
public Locale(String language, String country, String variant)
language
- lowercase two-letter ISO-639 code.country
- uppercase two-letter ISO-3166 code.variant
- vendor and browser specific code. See class description.public Locale(String language, String country)
language
- lowercase two-letter ISO-639 code.country
- uppercase two-letter ISO-3166 code.public Locale(String language)
language
- lowercase two-letter ISO-639 code.Method Detail |
public static Locale getDefault()
The Java Virtual Machine sets the default locale during startup
based on the host environment. It is used by many locale-sensitive
methods if no locale is explicitly specified.
It can be changed using the
setDefault
method.
public static void setDefault(Locale newLocale)
If there is a security manager, its checkPermission
method is called with a PropertyPermission("user.language", "write")
permission before the default locale is changed.
The Java Virtual Machine sets the default locale during startup based on the host environment. It is used by many locale-sensitive methods if no locale is explicitly specified.
Since changing the default locale may affect many different areas of functionality, this method should only be used if the caller is prepared to reinitialize locale-sensitive code running within the same Java Virtual Machine, such as the user interface.
newLocale
- the new default locale
SecurityException
- if a security manager exists and its
checkPermission
method doesn't allow the operation.
NullPointerException
- if newLocale
is nullSecurityManager.checkPermission(java.security.Permission)
,
java.util.PropertyPermission
public static Locale[] getAvailableLocales()
public static String[] getISOCountries()
public static String[] getISOLanguages()
public String getLanguage()
NOTE: ISO 639 is not a stable standard-- some languages' codes have changed. Locale's constructor recognizes both the new and the old codes for the languages whose codes have changed, but this function always returns the old code. If you want to check for a specific language whose code has changed, don't do
if (locale.getLanguage().equals("he") ...Instead, do
if (locale.getLanguage().equals(new Locale("he", "", "").getLanguage()) ...
getDisplayLanguage()
public String getCountry()
getDisplayCountry()
public String getVariant()
getDisplayVariant()
public final String toString()
toString
in class Object
getDisplayName()
public String getISO3Language() throws MissingResourceException
ftp://dkuug.dk/i18n/iso-639-2.txt
MissingResourceException
public String getISO3Country() throws MissingResourceException
MissingResourceException
public final String getDisplayLanguage()
public String getDisplayLanguage(Locale inLocale)
public final String getDisplayCountry()
public String getDisplayCountry(Locale inLocale)
public final String getDisplayVariant()
public String getDisplayVariant(Locale inLocale)
public final String getDisplayName()
language (country, variant)depending on which fields are specified in the locale. If the language, country, and variant fields are all empty, this function returns the empty string.language (country)
language (variant)
country (variant)
language
country
variant
public String getDisplayName(Locale inLocale)
language (country, variant)depending on which fields are specified in the locale. If the language, country, and variant fields are all empty, this function returns the empty string.language (country)
language (variant)
country (variant)
language
country
variant
public Object clone()
clone
in class Object
java.lang.Cloneable
public int hashCode()
hashCode
in class Object
java.lang.Object#equals(java.lang.Object)
,
java.util.Hashtable
public boolean equals(Object obj)
equals
in class Object
obj
- the reference object with which to compare.
Object.hashCode()
,
java.util.Hashtable
private String[] getDisplayVariantArray(ResourceBundle bundle)
bundle
- the ResourceBundle to use to get the display names
private static String formatList(String[] patterns, String[] stringList)
patterns
- an array of three patterns. The first pattern is not
used. The second pattern should create a MessageFormat taking 0-3 arguments
and formatting them into a list. The third pattern should take 2 arguments
and is used by composeList. If patterns is null, then a the list is
formatted by concatenation with the delimiter ','.stringList
- the list of strings to be formatted.
private static String[] composeList(java.text.MessageFormat format, String[] list)
format
- a format which takes two argumentslist
- a list of strings
private void writeObject(ObjectOutputStream out) throws IOException
IOException
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
private String toLowerCase(String str)
private String toUpperCase(String str)
private String findStringMatch(String[][] languages, String desiredLanguage, String fallbackLanguage)
private String convertOldISOCodes(String language)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |