PenProfile 2.x

com.livescribe.i18n
Class Locale

java.lang.Object
  extended by com.livescribe.i18n.Locale

public class Locale
extends Object

A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user.

The language argument is a valid ISO Language Code. These codes are the lower-case, two-letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, such as: http://www.loc.gov/standards/iso639-2/englangn.html

The country argument is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as: http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html

Locale.toString() returns the programmatic name of the entire locale with language, country and variant seperated by underscores (_).If the language is missing, the string will begin with an underbar. If both the language and country fields are missing, this function will return the empty string, even if the variant field is filled in (you can't have a locale with just a variant-- the variant must accompany a valid language or country code). Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr__MAC"


Field Summary
static String COUNTRY_CHINA
          ISO 3166 code for China
static String COUNTRY_FRANCE
          ISO 3166 code for FRANCE
static String COUNTRY_GB
          ISO 3166 code for United Kingdom
static String COUNTRY_GERMANY
          ISO 3166 code for Germany
static String COUNTRY_ITALY
          ISO 3166 code for ITALY
static String COUNTRY_JAPAN
          ISO 3166 code for Japan
static String COUNTRY_KOREA
          ISO 3166 code for South Korea
static String COUNTRY_MALAYSIA
          ISO 3166 code for MALAYSIA
static String COUNTRY_SPAIN
          ISO 3166 code for SPAIN
static String COUNTRY_US
          ISO 3166 code for United States of America
static Locale DE_DE
           
static Locale EN
          Locale with language set to LANG_ENGLISH
static Locale EN_GB
          Locale with language set to LANG_ENGLISH and country set to COUNTRY_GB
static Locale EN_US
          Locale with language set to LANG_ENGLISH and country set to COUNTRY_US
static Locale ES_ES
           
static Locale FR_FR
           
static Locale IT_IT
           
static Locale JA_JP
          Locale with language set to LANG_JAPANESE and country set to COUNTRY_JAPAN
static Locale KO
           
static Locale KO_KR
           
static String LANG_CHINESE
          ISO 639-2 code for Chinese Language
static String LANG_ENGLISH
          ISO 639-2 code for English Language
static String LANG_FRENCH
          ISO 639-2 code for French Language
static String LANG_GERMAN
          ISO 639-2 code for German Language
static String LANG_ITALIAN
          ISO 639-2 code for Italian Language
static String LANG_JAPANESE
          ISO 639-2 code for Japanese Language
static String LANG_KOREAN
          ISO 639-2 code for Korean Language
static String LANG_MALAY
          ISO 639-2 code for MALAY Language
static String LANG_SPANISH
          ISO 639-2 code for Spanish Language
static Locale MS_MY
           
static Locale ZH
          Locale with language set to LANG_CHINESE
static Locale ZH_CN
          Locale with language set to LANG_CHINESE and country set to COUNTRY_CHINA
 
Method Summary
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 String getCountry()
          Gets the country/region code for this locale which will be the empty string or an uppercase ISO 3166 2-letter code.
static Locale getDefault()
          Gets the default locale of the platform.
 String getDisplayName()
          Calls getDisplayName with the current system locale
 String getDisplayName(Locale locale)
          Gets the display name of this locale in the native language of the locale passed in.
 String getLanguage()
          Gets the language code for this locale which will be the empty string or a lower case ISO 639 code.
static Locale getLocale(String lang, String country, String variant)
           
 String getVariant()
          Gets the variant code for this locale.
 int hashCode()
          Returns a hash code value for the object.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LANG_ENGLISH

public static final String LANG_ENGLISH
ISO 639-2 code for English Language

See Also:
Constant Field Values

LANG_CHINESE

public static final String LANG_CHINESE
ISO 639-2 code for Chinese Language

See Also:
Constant Field Values

LANG_JAPANESE

public static final String LANG_JAPANESE
ISO 639-2 code for Japanese Language

See Also:
Constant Field Values

LANG_KOREAN

public static final String LANG_KOREAN
ISO 639-2 code for Korean Language

See Also:
Constant Field Values

LANG_GERMAN

public static final String LANG_GERMAN
ISO 639-2 code for German Language

See Also:
Constant Field Values

LANG_FRENCH

public static final String LANG_FRENCH
ISO 639-2 code for French Language

See Also:
Constant Field Values

LANG_ITALIAN

public static final String LANG_ITALIAN
ISO 639-2 code for Italian Language

See Also:
Constant Field Values

LANG_SPANISH

public static final String LANG_SPANISH
ISO 639-2 code for Spanish Language

See Also:
Constant Field Values

LANG_MALAY

public static final String LANG_MALAY
ISO 639-2 code for MALAY Language

See Also:
Constant Field Values

COUNTRY_US

public static final String COUNTRY_US
ISO 3166 code for United States of America

See Also:
Constant Field Values

COUNTRY_GB

public static final String COUNTRY_GB
ISO 3166 code for United Kingdom

See Also:
Constant Field Values

COUNTRY_CHINA

public static final String COUNTRY_CHINA
ISO 3166 code for China

See Also:
Constant Field Values

COUNTRY_JAPAN

public static final String COUNTRY_JAPAN
ISO 3166 code for Japan

See Also:
Constant Field Values

COUNTRY_KOREA

public static final String COUNTRY_KOREA
ISO 3166 code for South Korea

See Also:
Constant Field Values

COUNTRY_GERMANY

public static final String COUNTRY_GERMANY
ISO 3166 code for Germany

See Also:
Constant Field Values

COUNTRY_FRANCE

public static final String COUNTRY_FRANCE
ISO 3166 code for FRANCE

See Also:
Constant Field Values

COUNTRY_ITALY

public static final String COUNTRY_ITALY
ISO 3166 code for ITALY

See Also:
Constant Field Values

COUNTRY_SPAIN

public static final String COUNTRY_SPAIN
ISO 3166 code for SPAIN

See Also:
Constant Field Values

COUNTRY_MALAYSIA

public static final String COUNTRY_MALAYSIA
ISO 3166 code for MALAYSIA

See Also:
Constant Field Values

EN

public static final Locale EN
Locale with language set to LANG_ENGLISH


EN_US

public static final Locale EN_US
Locale with language set to LANG_ENGLISH and country set to COUNTRY_US


EN_GB

public static final Locale EN_GB
Locale with language set to LANG_ENGLISH and country set to COUNTRY_GB


ZH

public static final Locale ZH
Locale with language set to LANG_CHINESE


ZH_CN

public static final Locale ZH_CN
Locale with language set to LANG_CHINESE and country set to COUNTRY_CHINA


JA_JP

public static final Locale JA_JP
Locale with language set to LANG_JAPANESE and country set to COUNTRY_JAPAN


KO_KR

public static final Locale KO_KR

KO

public static final Locale KO

DE_DE

public static final Locale DE_DE

FR_FR

public static final Locale FR_FR

IT_IT

public static final Locale IT_IT

ES_ES

public static final Locale ES_ES

MS_MY

public static final Locale MS_MY
Method Detail

getLocale

public static Locale getLocale(String lang,
                               String country,
                               String variant)

getDefault

public static Locale getDefault()
Gets the default locale of the platform.

Returns:
default locale.

getLanguage

public String getLanguage()
Gets the language code for this locale which will be the empty string or a lower case ISO 639 code.

Returns:
language code.

getCountry

public String getCountry()
Gets the country/region code for this locale which will be the empty string or an uppercase ISO 3166 2-letter code.

Returns:
country code.

getVariant

public String getVariant()
Gets the variant code for this locale.

Returns:
variant code.

getDisplayName

public String getDisplayName(Locale locale)
Gets the display name of this locale in the native language of the locale passed in. For example if this local is zh_CN and the locale passed in was en_US the result would be Chinese

Parameters:
locale -
Returns:
the display name for the specified locale.

getDisplayName

public String getDisplayName()
Calls getDisplayName with the current system locale

Returns:
the display name for the current system locale.

toString

public String toString()
Description copied from class: Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

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

equals

public boolean equals(Object obj)
Description copied from class: Object
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Boolean.hashCode(), Hashtable

hashCode

public int hashCode()
Description copied from class: Object
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

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

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.