com.motorola.iden.resourcebundle
Class Locale

java.lang.Object
  extended bycom.motorola.iden.resourcebundle.Locale

public final class Locale
extends Object

A Locale object represents a specific geographical, political, or cultural region.

Create a Locale object using the constructors in this class:

 Locale(String language)
 Locale(String language, String country)
 
The language argument is a valid ISO Language Code. These codes are the lower-case, two-letter codes as defined by ISO-639.

The country argument is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166.

Because a Locale object is just an identifier for a region, no validity check is performed when you construct a Locale.

Once you've created a Locale you can query it for information about itself. Use getCountry to get the ISO Country Code and getLanguage to get the ISO Language Code.


MOTOROLA and the Stylized M Logo are registered trademarks of Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
© Copyright 2003 Motorola, Inc. All Rights Reserved.

See Also:
ResourceBundle

Constructor Summary
Locale(String lang)
          Construct a locale from a language code.
Locale(String lang, String coun)
          Construct a locale from language, country.
 
Method Summary
 boolean equals(Object obj)
          Returns true if this Locale is equal to another object.
 String getCountry()
          Returns the country/region code for this locale.
static Locale getDefault()
          Gets the current value of the default locale for this instance of the Java Virtual Machine.
 String getLanguage()
          Returns the language code for this locale.
 int hashCode()
          Override hashCode.
 String toString()
          Getter for the programmatic name of the entire locale, with the language and country separated by underbars.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Locale

public Locale(String lang,
              String coun)
Construct a locale from language, country.

Throws:
NullPointerException - thrown if either argument is null.

Locale

public Locale(String lang)
Construct a locale from a language code.

Throws:
NullPointerException - thrown if argument is null.
Since:
1.4
Method Detail

getDefault

public static Locale getDefault()
Gets the current value of the default locale for this instance of the Java Virtual Machine. The Java Virtual Machine sets the default locale during startup based on the host environment.

Returns:
the default locale for this instance of the Java Virtual Machine

getLanguage

public String getLanguage()
Returns the language code for this locale.


getCountry

public String getCountry()
Returns the country/region code for this locale.


toString

public final String toString()
Getter for the programmatic name of the entire locale, with the language and country separated by underbars. Language is always lower case, and country is always upper case. If the language is missing, the string will begin with an underbar. Examples: "en", "de_DE", "_GB"

Overrides:
toString in class Object
Returns:
a string representation of the object.

hashCode

public int hashCode()
Override hashCode. Since Locales are often used in hashtables, caches the value for speed.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable

equals

public boolean equals(Object obj)
Returns true if this Locale is equal to another object. A Locale is deemed equal to another Locale with identical language, country, and unequal to all other objects.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this Locale is equal to the specified object.
See Also:
Boolean.hashCode(), Hashtable