com.plumtree.openfoundation.internationalization
Class XPLocale

java.lang.Object
  extended bycom.plumtree.openfoundation.internationalization.XPLocale

public class XPLocale
extends java.lang.Object

Represents information about a specific geographical, political, or cultural region. The information that this class represents include name of the country and language.


Constructor Summary
XPLocale(java.util.Locale locale)
          Creates an XPLocale from the platform-local equivalent.
XPLocale(java.lang.String shortLocaleName)
          Creates an XPLocale, initialized using the given locale string in the form language-country, based on the underlying platform library's ability to look up a named locale.
XPLocale(java.lang.String language, java.lang.String country)
          Creates an XPLocale, initialized using the given language and country strings based on the underlying platform library's ability to look up a named locale.
 
Method Summary
static java.lang.String[] GetAvailableLocaleNames()
          Returns an array of the display names of all locales installed in the runtime library.
static XPLocale[] GetAvailableLocales()
          Returns an array of all locales installed in the runtime library, in cross-platform (XPLocale) form.
 java.lang.String GetCountry()
          Returns the country/region code for this locale, which will either be the empty string or an ISO 3166 2-letter code.
static XPLocale GetDefault()
          Returns an instance of XPLocale wrapping the platform default locale, determined by runtime or operating system localization settings.
 java.lang.String GetDisplayCountry()
          Returns a name for the locale's country that is appropriate for display to the user.
 java.lang.String GetDisplayLanguage()
          Returns a name for the locale's language that is appropriate for display to the user.
 java.lang.String GetDisplayName()
          Returns a name for the locale that is appropriate for display to the user.
 java.lang.String GetLanguage()
          Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code.
 java.lang.String GetShortName()
          Returns a short name for the locale that has the form language-country, which can be used to construct an XPLocale object; or return just the language component if the Locale doesn't have an country component.
 java.util.Locale GetUnderlyingObject()
          Returns the platform specific object that this class wraps.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPLocale

public XPLocale(java.util.Locale locale)
Creates an XPLocale from the platform-local equivalent.

Parameters:
locale - the underlying Locale object.

XPLocale

public XPLocale(java.lang.String shortLocaleName)
Creates an XPLocale, initialized using the given locale string in the form language-country, based on the underlying platform library's ability to look up a named locale. Return default locale if not found in list of supported locales. The case of the input string is flattened to lowercase before looking up the locale.

Parameters:
shortLocaleName - a String in the form language or language-country (for example "en" or "zh-cn")

XPLocale

public XPLocale(java.lang.String language,
                java.lang.String country)
Creates an XPLocale, initialized using the given language and country strings based on the underlying platform library's ability to look up a named locale. Return default locale if not found in list of supported locales.

Parameters:
language - supported language to define Locale object.
country - country name to define Locale object.
Method Detail

GetAvailableLocales

public static XPLocale[] GetAvailableLocales()
Returns an array of all locales installed in the runtime library, in cross-platform (XPLocale) form.

Returns:
an array of supported XPLocale objects.

GetAvailableLocaleNames

public static java.lang.String[] GetAvailableLocaleNames()
Returns an array of the display names of all locales installed in the runtime library.

Returns:
an array of supported XPLocale objects' display names.

GetCountry

public java.lang.String GetCountry()
Returns the country/region code for this locale, which will either be the empty string or an ISO 3166 2-letter code.

Returns:
country name of current XPLocale instance.

GetDefault

public static XPLocale GetDefault()
Returns an instance of XPLocale wrapping the platform default locale, determined by runtime or operating system localization settings.

Returns:
default XPLocale object.

GetDisplayCountry

public java.lang.String GetDisplayCountry()
Returns a name for the locale's country that is appropriate for display to the user.

Returns:
a String country's display name.

GetLanguage

public java.lang.String GetLanguage()
Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code.

Returns:
a String of language code.

GetDisplayLanguage

public java.lang.String GetDisplayLanguage()
Returns a name for the locale's language that is appropriate for display to the user.

Returns:
a String of language's display name.

GetDisplayName

public java.lang.String GetDisplayName()
Returns a name for the locale that is appropriate for display to the user.

Returns:
a String of Locale object's display name.

GetShortName

public java.lang.String GetShortName()
Returns a short name for the locale that has the form language-country, which can be used to construct an XPLocale object; or return just the language component if the Locale doesn't have an country component. Note that the returned language-country string is all lowercase. Some examples locale's short name:
-With a country component: "en-us", "ja-jp"
-With no country component: "en", "ja"

Returns:
a short string ID for the locale

GetUnderlyingObject

public java.util.Locale GetUnderlyingObject()
Returns the platform specific object that this class wraps.

Returns:
An instance of Timezone class.


Copyright 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.