Save This Page
Home » apache-harmony-6.0-src-r917296-snapshot » java » util » [javadoc | source]
java.util
public final class: Locale [javadoc | source]
java.lang.Object
   java.util.Locale

All Implemented Interfaces:
    Cloneable, Serializable

{@code Locale} represents a language/country/variant combination. It is an identifier which dictates particular conventions for the presentation of information. The language codes are two letter lowercase codes as defined by ISO-639. The country codes are three letter uppercase codes as defined by ISO-3166. The variant codes are unspecified.
Field Summary
public static final  Locale CANADA    Locale constant for en_CA. 
public static final  Locale CANADA_FRENCH    Locale constant for fr_CA. 
public static final  Locale CHINA    Locale constant for zh_CN. 
public static final  Locale CHINESE    Locale constant for zh. 
public static final  Locale ENGLISH    Locale constant for en. 
public static final  Locale FRANCE    Locale constant for fr_FR. 
public static final  Locale FRENCH    Locale constant for fr. 
public static final  Locale GERMAN    Locale constant for de. 
public static final  Locale GERMANY    Locale constant for de_DE. 
public static final  Locale ITALIAN    Locale constant for it. 
public static final  Locale ITALY    Locale constant for it_IT. 
public static final  Locale JAPAN    Locale constant for ja_JP. 
public static final  Locale JAPANESE    Locale constant for ja. 
public static final  Locale KOREA    Locale constant for ko_KR. 
public static final  Locale KOREAN    Locale constant for ko. 
public static final  Locale PRC    Locale constant for zh_CN. 
public static final  Locale SIMPLIFIED_CHINESE    Locale constant for zh_CN. 
public static final  Locale TAIWAN    Locale constant for zh_TW. 
public static final  Locale TRADITIONAL_CHINESE    Locale constant for zh_TW. 
public static final  Locale UK    Locale constant for en_GB. 
public static final  Locale US    Locale constant for en_US. 
public static final  Locale ROOT    the locale whose language, country, and variant are empty ("") strings.
    since: 1.6 -
 
Constructor:
 public Locale(String language) 
    Constructs a new {@code Locale} using the specified language.
    Parameters:
    language - the language this {@code Locale} represents.
 public Locale(String language,
    String country) 
    Constructs a new {@code Locale} using the specified language and country codes.
    Parameters:
    language - the language this {@code Locale} represents.
    country - the country this {@code Locale} represents.
 public Locale(String language,
    String country,
    String variant) 
    Constructs a new {@code Locale} using the specified language, country, and variant codes.
    Parameters:
    language - the language this {@code Locale} represents.
    country - the country this {@code Locale} represents.
    variant - the variant this {@code Locale} represents.
    Throws:
    NullPointerException - if {@code language}, {@code country}, or {@code variant} is {@code null}.
Method from java.util.Locale Summary:
clone,   equals,   getAvailableLocales,   getCountry,   getDefault,   getDisplayCountry,   getDisplayCountry,   getDisplayLanguage,   getDisplayLanguage,   getDisplayName,   getDisplayName,   getDisplayVariant,   getDisplayVariant,   getISO3Country,   getISO3Language,   getISOCountries,   getISOLanguages,   getLanguage,   getVariant,   hashCode,   setDefault,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.util.Locale Detail:
 public Object clone() 
    Returns a new {@code Locale} with the same language, country and variant codes as this {@code Locale}.
 public boolean equals(Object object) 
    Compares the specified object to this {@code Locale} and returns whether they are equal. The object must be an instance of {@code Locale} and have the same language, country and variant.
 public static Locale[] getAvailableLocales() 
    Gets the list of installed {@code Locale}. At least a {@code Locale} that is equal to {@code Locale.US} must be contained in this array.
 public String getCountry() 
    Gets the country code for this {@code Locale} or an empty string of no country was set.
 public static Locale getDefault() 
    Gets the default {@code Locale}.
 public final String getDisplayCountry() 
    Gets the full country name in the default {@code Locale} for the country code of this {@code Locale}. If there is no matching country name, the country code is returned.
 public String getDisplayCountry(Locale locale) 
    Gets the full country name in the specified {@code Locale} for the country code of this {@code Locale}. If there is no matching country name, the country code is returned.
 public final String getDisplayLanguage() 
    Gets the full language name in the default {@code Locale} for the language code of this {@code Locale}. If there is no matching language name, the language code is returned.
 public String getDisplayLanguage(Locale locale) 
    Gets the full language name in the specified {@code Locale} for the language code of this {@code Locale}. If there is no matching language name, the language code is returned.
 public final String getDisplayName() 
    Gets the full language, country, and variant names in the default {@code Locale} for the codes of this {@code Locale}.
 public String getDisplayName(Locale locale) 
    Gets the full language, country, and variant names in the specified Locale for the codes of this {@code Locale}.
 public final String getDisplayVariant() 
    Gets the full variant name in the default {@code Locale} for the variant code of this {@code Locale}. If there is no matching variant name, the variant code is returned.
 public String getDisplayVariant(Locale locale) 
    Gets the full variant name in the specified {@code Locale} for the variant code of this {@code Locale}. If there is no matching variant name, the variant code is returned.
 public String getISO3Country() throws MissingResourceException 
    Gets the three letter ISO country code which corresponds to the country code for this {@code Locale}.
 public String getISO3Language() throws MissingResourceException 
    Gets the three letter ISO language code which corresponds to the language code for this {@code Locale}.
 public static String[] getISOCountries() 
    Gets the list of two letter ISO country codes which can be used as the country code for a {@code Locale}.
 public static String[] getISOLanguages() 
    Gets the list of two letter ISO language codes which can be used as the language code for a {@code Locale}.
 public String getLanguage() 
    Gets the language code for this {@code Locale} or the empty string of no language was set.
 public String getVariant() 
    Gets the variant code for this {@code Locale} or an empty {@code String} of no variant was set.
 public synchronized int hashCode() 
    Returns an integer hash code for the receiver. Objects which are equal return the same value for this method.
 public static synchronized  void setDefault(Locale locale) 
    Sets the default {@code Locale} to the specified {@code Locale}.
 public final String toString() 
    Returns the string representation of this {@code Locale}. It consists of the language followed by the country and at the end the variant. They are separated by underscores. If the language is missing the string begins with an underscore. If the country is missing there are 2 underscores between the language and the variant. the variant alone canot be defined without a language and/or a country (in this case this method would return the empty string). Examples: "en", "en_US", "_US", "en__POSIX", "en_US_POSIX"