com.wm.g11n.util
Class iContext

java.lang.Object
  extended by com.wm.g11n.util.iContext
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class iContext
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

iContext encapsulates international context sensitivity for the webMethods platform. This includes locale, language preference, collation (sorting), currency, region, time zone, and calendar preferences.

This class relies heavily on utility classes that encapsulate the related standards. When you construct and set a field in this class, it will always contain the nearest match to the related standard for that particular field. You can set a field to any value (similar to a Java locale object), but webMethods does not guarantee interoperability or any functionality related to these non-standard values.

The standards encapsulated by this class are:

For specific information, see the following sites:

The non-standard items in the iContext are based on the IBM International Classes for Unicode for Java (ICU4J) library and the related internationalization and Unicode standards. For specific information, see the following sites:

iContext supports the Microsoft .NET CultureInfo identifier, which Microsoft calls an 'rfc1766 ID'. RFC1766 was the precursor to RFC3066. In addition, Microsoft has a few proprietary add-on codes that extend these standards. iContext parses these additional values and populates the correct field for the given value (for example, the "Region" code "CB" for Caribbean is mapped correctly and not to a variant). Note that other platforms may not fully support these values.

iContext is constructed from an RFC3066bis identifier. RFC3066bis is an Internet-draft. This draft is a replacement for RFC3066 and provides a number of extensions to the older form. Although iContext uses RFC3066bis extension mechanism to store some proprietary values (such as, collation parameters), it should be regarded as the source for valid behavior of an iContext.

Serialization of an iContext has changed in this version to be an RFC3066bis string. The older URN string syntax remains and is extended to be compatible with v1.0 of this class (used in the webMethods 6.1 product). The URN format provides support for all of the fields in an iContext, and thus is lossless. An RFC3066 string stores only the four most important values (language, region, script, and variant). RFC3066bis stores everything, so it should be regarded as the "native" serialization format.

The URN is the format used by the toUrnString() method of the class and for serialization within the webMethods platform.

Validation and matching methods look only at a subset of fields in an iContext. webMethods looks only at RFC3066bis identifying fields plus some extensions. The expected pattern is:

The fallback pattern is similar to Java. webMethods remove elements from right-to-left. Empty fields are allowed. Script is mostly unpopulated except for a few minor languages (Uzbek, Serbian, Azeri) and one major one(Chinese).

The wmResourceBundleLoader understands iContext in ResourceBundle lookups, which enables you to create non-Java resources. Regular ResourceBundle can also be used to access these resources, but you must use the JavaLocale class in a non-strict mode.

The iContext class also supports four specialized or 'abstract' iContext values. The abstract values are used to set execution policy in the Integration Server.

The four values are:

See Also:
Serialized Form

Field Summary
static java.lang.String KEY_CONCRETE
          (Convenience) Constant used to specify the iContext is not abstract.
static java.lang.String KEY_DEFAULT
          (Convenience) Constant used to specify the server-default iContext.
static java.lang.String KEY_NEUTRAL_DEFAULT
          (Convenience) Constant used to specify the neutral iContext.
static java.lang.String KEY_USER_DEFAULT
          (Convenience) Constant used to specify the user-default iContext.
 
Constructor Summary
iContext()
          Creates a new, empty instance of iContext.
iContext(iContext p_iContext)
          Creates a new instance of iContext from another iContext.
iContext(java.util.Locale p_Locale)
          Creates a new instance of iContext using the language, country and variant of the provided Java locale object.
iContext(java.lang.String p_LocaleString)
          Creates a new iContext based on the RFC3066 string provided.
iContext(java.lang.String p_lang, java.lang.String p_script, java.lang.String p_variant, java.lang.String p_region)
          Creates a new instance of iContext with the provided language, script, region and variant values.
 
Method Summary
 void addExtension(java.lang.String key, java.lang.String value)
          Inserts the given extension value with the given key.
 void addSubLang(java.lang.String extlang)
          Adds the specific sublanguage to the end of the list of sublanguages.
 void addVariant(java.lang.String p_sVariant)
          Adds a variant to the list of variants.
 void clearExtensions()
          Removes all the extensions.
 void clearSubLangs()
          Removes all of the sublanguages from the list and deletes the references to sublanguages from the internal store.
 void clearVariants()
          Clears all the variants associated with this iContext.
 java.lang.Object clone()
          Duplicates this iContext object.
 boolean equals(iContext p_IContext)
          Determines whether the iContexts are equal.
 boolean equals(java.lang.String p_sLocale)
          Determines whether the locale in this iContext matches the provided locale.
 java.lang.String getAbstractKey()
          Returns the key string for the iContext(KEY_DEFAULT, KEY_NEUTRAL_DEFAULT, or KEY_USER_DEFAULT), if this is an abstract iContext (it is being used as a policy).
 java.lang.String getCultureInfo()
          Converts to a Microsoft .NET String format.
 java.lang.String getCurrency()
          Returns the currency in the form of an ISO 4217 code.
 java.lang.String getCurrency(boolean p_bAllowGuessing)
          Returns the currency in the form of an ISO 4217 code.
static iContext getDefault()
          Returns the iContext described by the JVM default Locale object.
 java.lang.String getEncoding()
          Returns the encoding
 java.lang.String getExtension(java.lang.String key)
          Returns the specified extension.
 java.util.Iterator getExtensions()
          Returns an iterator over the set of extension values.
 java.lang.String getISOCountry()
          Returns the country code as an ISO 3166 2-letter code.
 java.lang.String getISOCountry3()
          Returns the country code as an ISO 3166 3-letter code.
 java.lang.String getISOCurrency()
          Returns the currency in the form of an ISO 4217 code.
 java.lang.String getISOLanguage()
          Returns the language for this iContext as an ISO 639 Code 2-letter code.
 java.lang.String getISOLanguage3()
          Returns the language for this iContext as an ISO 639 Code 3-letter code.
 java.lang.String getISOScript()
          Returns the script as an ISO 15924 Code.
 java.util.Locale getJavaLocale(boolean p_bBestMatch)
          Returns the Java locale that most closely matches this iContext or a Java locale that holds the iContext information.
 java.lang.String getLanguage()
          Returns the language for this iContext.
static iContext getNeutral()
          Returns the neutral (abstract) iContext described by KEY_NEUTRAL_DEFAULT.
 java.lang.String getPosix()
          Converts the iContext into a POSIX locale using UTF8 encoding.
 java.lang.String getPosix(java.lang.String encoding)
          Converts to a POSIX locale string using the provided encoding.
 java.lang.String getRegion()
          Returns the region of this iContext, if any.
 java.lang.String getRfc3066()
          Converts the IContext into a RFC3066 language tag.
 java.lang.String getScript()
          Returns the script.
 java.util.Iterator getSubLangs()
          Returns an iterator over the list of sublanguages.
 java.util.TimeZone getTimeZone()
          Returns the timezone as a Java TimeZone.
 java.lang.String getTimeZoneID()
          Returns the current timeZone ID.
 java.util.Iterator getVariants()
          Returns the list of variants
 boolean hasExtensions()
          Determines if this iContext has any extension values.
 boolean hasSubLangs()
          Determines if this iContext has a sublanguage (also referred to as extended language code).
 boolean hasVariants()
          Determines if the iContext has any variants.
 boolean isAbstract()
          Determines if this iContext is abstract.
 boolean isCountryNeutral()
          Determines if the country or region is not set.
 boolean isCurrencyEuro()
          Determines if the currency corresponds to the EURO.
 boolean isCurrencySet()
          Determines if the currency is set.
 boolean isEncodingSet()
          Determines if the encoding is set.
 boolean isLanguageSet()
          Determines if the language parameter is set.
 boolean isNeutral()
          Determines if this iContext corresponds to the "neutral" locale.
 boolean isRegionSet()
          Determines if the country or region is set.
 boolean isRoot()
          (Convenience) Determines if this iContext is the root iContext.
 boolean isScriptSet()
          Determines if the script value is not empty.
 boolean isServerDefault()
          Determines if this iContext corresponds to the "server default" locale.
 boolean isTimeZoneSet()
          Determines if the timezone is set.
 boolean isUserDefault()
          Determines if this iContext corresponds to the "user default" locale.
 boolean matches(iContext p_IContext)
          Determines whether the fields in this iContext are compatible with those in the other iContext.
 boolean matches(java.lang.String p_sLocale)
          Matches the locale of this iContext against a provided locale.
 iContext parent()
          Returns the most logical parent iContext.
 boolean removeSubLang(java.lang.String extlang)
          Removes the specific sublanguage from the list of sublanguages, if it exists.
 void setCalendarID(java.lang.String p_sCalendarID)
          Sets the current calendar to one identified by p_sCalendarID.
 void setCurrency(java.lang.String p_sCurrency)
          webMethods strongly encourages you to use ISO 4217 currency codes for this property.
 void setEncoding(java.lang.String p_sEncoding)
          Sets the encoding associated with this locale.
 void setLanguage(java.lang.String p_sLanguage)
          Sets the language field in the iContext to the specified value.
 void setRegion(java.lang.String p_sRegion)
          For this property, webMethods strongly encourages that you use only ISO 3166 country codes.
 void setScript(java.lang.String p_sScript)
          webMethods strongly encourages you to use ISO-15924 script codes for this property.
 void setTimeZone(java.lang.String p_sTimeZone)
          Sets the timezone ID to p_sTimeZone, which must be a valid Olsen ID, empty string, or null.
 java.lang.String toString()
          Converts this iContext to a string.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_USER_DEFAULT

public static final java.lang.String KEY_USER_DEFAULT
(Convenience) Constant used to specify the user-default iContext.

See Also:
Constant Field Values

KEY_DEFAULT

public static final java.lang.String KEY_DEFAULT
(Convenience) Constant used to specify the server-default iContext.

See Also:
Constant Field Values

KEY_NEUTRAL_DEFAULT

public static final java.lang.String KEY_NEUTRAL_DEFAULT
(Convenience) Constant used to specify the neutral iContext.

See Also:
Constant Field Values

KEY_CONCRETE

public static final java.lang.String KEY_CONCRETE
(Convenience) Constant used to specify the iContext is not abstract.

See Also:
Constant Field Values
Constructor Detail

iContext

public iContext()
Creates a new, empty instance of iContext.


iContext

public iContext(java.util.Locale p_Locale)
Creates a new instance of iContext using the language, country and variant of the provided Java locale object.

Parameters:
p_Locale - If null, a neutral iContext is constructed.

iContext

public iContext(iContext p_iContext)
Creates a new instance of iContext from another iContext.

Parameters:
p_iContext - If null, a neutral iContext is constructed.

iContext

public iContext(java.lang.String p_lang,
                java.lang.String p_script,
                java.lang.String p_variant,
                java.lang.String p_region)
Creates a new instance of iContext with the provided language, script, region and variant values. The values are not checked.

Parameters:
p_lang - the language (usually an ISO 639 code)
p_script - the script (usually an ISO 15924 code)
p_variant - the variant (usually an IANA registered variant value)
p_region - the region (usually an ISO 3166 code)

iContext

public iContext(java.lang.String p_LocaleString)
Creates a new iContext based on the RFC3066 string provided. In addition to valid language and country strings, webMethods also handles all of the IANA registered values, mapping them as closely to the webMethods structure as possible. webMethods also handles Microsoft .NET specials.

All other fields are left null and determined at run time from the language and country (if supplied).

If the RFC3066 string cannot be parsed or contains illegal values, this constructor ignores all of the unrecognized fields, sets what it can, and returns with no error. This may lead to an empty iContext.

Parameters:
p_LocaleString - The string to parse. If null, the "neutral" locale is created.
Method Detail

clone

public java.lang.Object clone()
Duplicates this iContext object.

Overrides:
clone in class java.lang.Object
Returns:
duplicate iContext object

getDefault

public static iContext getDefault()
Returns the iContext described by the JVM default Locale object.

Returns:
default iContext for this JVM

getNeutral

public static iContext getNeutral()
Returns the neutral (abstract) iContext described by KEY_NEUTRAL_DEFAULT.

Note that this is not the same as an iContext with all empty fields. To construct this iContext, use the String constructor with the empty string or the Locale constructor with the locale new Locale("","");.

Returns:
the "neutral" locale

setRegion

public void setRegion(java.lang.String p_sRegion)
For this property, webMethods strongly encourages that you use only ISO 3166 country codes. Invalid codes may prevent valid locales later. 3166 codes will be normalized. If a 2- and 3-letter code exists for a region, It is transformed into its shortest form.

Parameters:
p_sRegion - An ISO 3166 2- or 3-letter code or if no other option, an alphanumerical string. This parameter is not case sensitive.

getRegion

public java.lang.String getRegion()
Returns the region of this iContext, if any.

Returns:
The region string (usually an ISO 3166 code). If the region has not been set, it returns an empty string.

getISOCountry

public java.lang.String getISOCountry()
Returns the country code as an ISO 3166 2-letter code.

Returns:
The ISO code. Returns null, if the region did not correspond to a valid ISO 3166 value. (UN M49 codes will return null values)

getISOCountry3

public java.lang.String getISOCountry3()
Returns the country code as an ISO 3166 3-letter code.

Returns:
The ISO code or null, if the region did not correspond to a valid ISO 3166 value (UN M49 codes will return null values)

isCountryNeutral

public boolean isCountryNeutral()
Determines if the country or region is not set. Note that this is the reverse of the isRegionSet method.

Returns:
true if region is null or has an empty string; falseotherwise.

isRegionSet

public boolean isRegionSet()
Determines if the country or region is set.

Returns:
true if region is set; falseotherwise.

setLanguage

public void setLanguage(java.lang.String p_sLanguage)
Sets the language field in the iContext to the specified value. Generally this will be either an ISO639 alpha-2 or alpha-3 code or an IANA registered "special" value (such as i-klingon, i-hakka, etc.)

You can set the iContext to an abstract value by passing one of the abstract keys (KEY_DEFAULT, KEY_NEUTRAL_DEFAULT or KEY_USER_DEFAULT). Setting an abstract key loses any existing information stored in this iContext. This is a convenient way to set up an abstract iContext other than via the constructor.

Note that there is a difference between the policy (abstract) iContext "$null" and the empty (neutral) iContext.

Parameters:
p_sLanguage - an ISO 639 2- or 3-letter code, or if no other option, an alphanumerical string

getLanguage

public java.lang.String getLanguage()
Returns the language for this iContext.

Returns:
Language string (usually an ISO 639 code). Returns an empty string, if this locale is abstract or the language has not been set.

getISOLanguage

public java.lang.String getISOLanguage()
Returns the language for this iContext as an ISO 639 Code 2-letter code.

Returns:
An ISO code. Returns an empty string, if the language does not correspond to a valid ISO.

getISOLanguage3

public java.lang.String getISOLanguage3()
Returns the language for this iContext as an ISO 639 Code 3-letter code.

Returns:
An ISO 639 3-letter code. Returns an empty string, if the language does not correspond to any valid 3-letter ISO code.

isLanguageSet

public boolean isLanguageSet()
Determines if the language parameter is set.

Returns:
true if the language is set; falseotherwise.

hasSubLangs

public boolean hasSubLangs()
Determines if this iContext has a sublanguage (also referred to as extended language code).

Returns:
true if there is at least one sublanguage set; falseotherwise.

getSubLangs

public java.util.Iterator getSubLangs()
Returns an iterator over the list of sublanguages.

Returns:
an iterator over the list of sublanguages

addSubLang

public void addSubLang(java.lang.String extlang)
Adds the specific sublanguage to the end of the list of sublanguages.

Parameters:
extlang - a 3-letter code

removeSubLang

public boolean removeSubLang(java.lang.String extlang)
Removes the specific sublanguage from the list of sublanguages, if it exists.

Parameters:
extlang - the sublanguage you want to remove
Returns:
trueif the sublanguage was removed; falseotherwise.

clearSubLangs

public void clearSubLangs()
Removes all of the sublanguages from the list and deletes the references to sublanguages from the internal store.


setScript

public void setScript(java.lang.String p_sScript)
webMethods strongly encourages you to use ISO-15924 script codes for this property. An invalid code may prevent valid locales later.

Parameters:
p_sScript - an ISO 15924 4-letter code or if no other option, an alphanumerical string

getScript

public java.lang.String getScript()
Returns the script. Usually an ISO 15924 Code.

Returns:
The script(usually an ISO 15924 Code) returns an empty string, if no script is set.

isScriptSet

public boolean isScriptSet()
Determines if the script value is not empty.

Returns:
trueif the script is set; falseotherwise.

getISOScript

public java.lang.String getISOScript()
Returns the script as an ISO 15924 Code.

Returns:
an ISO code or the empty string, if the stored value is not a valid ISO code

clearVariants

public void clearVariants()
Clears all the variants associated with this iContext.


addVariant

public void addVariant(java.lang.String p_sVariant)
Adds a variant to the list of variants. This method exists to provide compatibility with Java, which allows multiple variants. If there is a variant that matches the added variant (case insensitive), the new item is ignored. If the item is not in the current list of variants, it is added to the end of the list.

Parameters:
p_sVariant - the variant string (usually a IANA register variant value)

getVariants

public java.util.Iterator getVariants()
Returns the list of variants

Returns:
an Iterator to check the list

hasVariants

public boolean hasVariants()
Determines if the iContext has any variants.

Returns:
trueif the iContext has variants; falseotherwise.

setEncoding

public void setEncoding(java.lang.String p_sEncoding)
Sets the encoding associated with this locale. An encoding should only be used to provide safe round trip of POSIX locales.

Parameters:
p_sEncoding - encoding name to associate with the locale

getEncoding

public java.lang.String getEncoding()
Returns the encoding

Returns:
The encoding name. Returns an empty string, if none is set.

isEncodingSet

public boolean isEncodingSet()
Determines if the encoding is set.

Returns:
trueif the encoding setting for this iContext is not empty; falseotherwise.

setCurrency

public void setCurrency(java.lang.String p_sCurrency)
webMethods strongly encourages you to use ISO 4217 currency codes for this property. Invalid codes may prevent valid locales later.

Parameters:
p_sCurrency - an ISO 4217 3-letter code or if no other option, an alphanumerical string

isCurrencySet

public boolean isCurrencySet()
Determines if the currency is set.

Returns:
trueif the currency has a non-empty value; falseotherwise.

getCurrency

public java.lang.String getCurrency()
Returns the currency in the form of an ISO 4217 code. If no currency is set, a guess is made using the locale's region. For example, if the region is US, USD is returned.

Returns:
the ISO 4217 code for the currency. Returns null, if a code cannot be found.

getISOCurrency

public java.lang.String getISOCurrency()
Returns the currency in the form of an ISO 4217 code. Returns an empty string if the currency is not set, is not a valid ISO 4217 code, or is invalid.

Returns:
the currency code or an empty string, if none is found or its invalid

isCurrencyEuro

public boolean isCurrencyEuro()
Determines if the currency corresponds to the EURO. Convenience methods added to simplify Java locale conversion.

Returns:
true if the currency corresponds to the EURO; falseotherwise.

getCurrency

public java.lang.String getCurrency(boolean p_bAllowGuessing)
Returns the currency in the form of an ISO 4217 code. If no currency is set, a guess is made using the locale's region. For example, if the region is US, USD is returned.

Parameters:
p_bAllowGuessing - true To allow guessing; falseotherwise.
Returns:
the language string (usually an ISO 639 code that is formatted in uppercase)

clearExtensions

public void clearExtensions()
Removes all the extensions.


addExtension

public void addExtension(java.lang.String key,
                         java.lang.String value)
Inserts the given extension value with the given key.

Parameters:
key - the extension key you want to insert (usually a single letter)
value - the key value for the provided extension key. This is usually an alphanumerical string of 2 or more characters.

getExtension

public java.lang.String getExtension(java.lang.String key)
Returns the specified extension.

Parameters:
key - the key for the extension you want to return
Returns:
The extension value for the specified key. Returns null if an extension does not exist for the specified key.

getExtensions

public java.util.Iterator getExtensions()
Returns an iterator over the set of extension values. Extensions include all of webMethods specific extensions to RFC3066bis (Java variants and the extended fields, such as currency, calendar, and collation).

Returns:
an iterator over the extension values

hasExtensions

public boolean hasExtensions()
Determines if this iContext has any extension values.

Returns:
trueif this iContext has extensions; falseotherwise.

isTimeZoneSet

public boolean isTimeZoneSet()
Determines if the timezone is set.

Returns:
true if the timezone is set; falseotherwise.

setTimeZone

public void setTimeZone(java.lang.String p_sTimeZone)
Sets the timezone ID to p_sTimeZone, which must be a valid Olsen ID, empty string, or null. Specifying an empty string or null unsets this field. Specifying an invalid value results in no change.

Parameters:
p_sTimeZone - The timezone you want to use to form a valid Olsen ID. Specify an empty string or null to unset the timezone.

getTimeZoneID

public java.lang.String getTimeZoneID()
Returns the current timeZone ID. Returns an empty string if the iContext is not set and the default timezone for this machine cannot be determined. Note that this method differs from others in this class in that it returns a value even when the iContext itself is not set.

Returns:
A timezone ID string. Returns an empty string if the iContext is not set.

getTimeZone

public java.util.TimeZone getTimeZone()
Returns the timezone as a Java TimeZone.

Returns:
The Java TimeZone object that is the nearest match to the current timezone ID of the iContext. Returns a GMT TimeZone object if the timezone is null or the ID is not recognized or supported on this JVM.

setCalendarID

public void setCalendarID(java.lang.String p_sCalendarID)
Sets the current calendar to one identified by p_sCalendarID. This must be CalendarID strings identified by CalendarFactory.

Parameters:
p_sCalendarID - string for the calendar ID.

parent

public iContext parent()
Returns the most logical parent iContext. Looks at language, script, region, and variant fields. The fields are listed from the most important to the least important. The least important field is dropped to get the parent. If all fields are null, null is returned.

Returns:
the parent iContext or null if no more fields can be ignored.

getAbstractKey

public java.lang.String getAbstractKey()
Returns the key string for the iContext(KEY_DEFAULT, KEY_NEUTRAL_DEFAULT, or KEY_USER_DEFAULT), if this is an abstract iContext (it is being used as a policy). If the iContext is concrete (not abstract), returns KEY_CONCRETE.

Returns:
one of the abstract strings (KEY_DEFAULT, KEY_NEUTRAL_DEFAULT, or KEY_USER_DEFAULT)

equals

public boolean equals(iContext p_IContext)
Determines whether the iContexts are equal. This is an equality test that uses an equal method to look at all the fields.

Parameters:
p_IContext - iContext to use for comparison
Returns:
trueif all fields are equal; falseotherwise.

equals

public boolean equals(java.lang.String p_sLocale)
Determines whether the locale in this iContext matches the provided locale. The provided locale is converted to an iContext, then matched against the Culture Info ID, POSIX ID, or RFC 3066 language tag.

Parameters:
p_sLocale - locale to use for the comparison
Returns:
trueif all the information carried by the locale is identical to the one in the iContext; falseotherwise.

matches

public boolean matches(iContext p_IContext)
Determines whether the fields in this iContext are compatible with those in the other iContext.

This method only compares the language, region, variant and script fields. Note: The matches test is not the same as the equals test. It determines if this iContext is a logical parent or equal to the provided iContext with regard to resource default.

The following matching order is used:

Matching rules are not case sensitive. For example:

Parameters:
p_IContext - the iContext with which to compare to the current iContext
Returns:
trueif the rules set above are satisfied; falseotherwise.

matches

public boolean matches(java.lang.String p_sLocale)
Matches the locale of this iContext against a provided locale. The method matches against the Culture Info ID, POSIX ID, or RFC 3066 language tag.

Parameters:
p_sLocale - locale to use for the matching test
Returns:
trueif various fields match; falseotherwise.
See Also:
matches(iContext)

isNeutral

public boolean isNeutral()
Determines if this iContext corresponds to the "neutral" locale.

Returns:
trueif this iContext corresponds to "neutral"; falseotherwise.

isUserDefault

public boolean isUserDefault()
Determines if this iContext corresponds to the "user default" locale.

Returns:
trueif this iContext corresponds to "user default"; falseotherwise.

isServerDefault

public boolean isServerDefault()
Determines if this iContext corresponds to the "server default" locale.

Returns:
true if this iContext corresponds to "server default"; falseotherwise.

isAbstract

public boolean isAbstract()
Determines if this iContext is abstract.

Returns:
true if this iContext is abstract; falseotherwise.

isRoot

public boolean isRoot()
(Convenience) Determines if this iContext is the root iContext.

Returns:
true if this iContext is not abstract and the language, region, script, and variant fields are empty; falseotherwise.

toString

public java.lang.String toString()
Converts this iContext to a string.

Overrides:
toString in class java.lang.Object
Returns:
a string following the RFC3066bis pattern

getJavaLocale

public java.util.Locale getJavaLocale(boolean p_bBestMatch)
Returns the Java locale that most closely matches this iContext or a Java locale that holds the iContext information. The RFC3066 language tag is coupled with the ISO 3166 ID string if there is one.

Parameters:
p_bBestMatch - true To return the closest matching Java Locale; falseotherwise.
Returns:
the matching Java Locale

getRfc3066

public java.lang.String getRfc3066()
Converts the IContext into a RFC3066 language tag.

Returns:
a RFC3066 tag

getCultureInfo

public java.lang.String getCultureInfo()
Converts to a Microsoft .NET String format.

Returns:
Closest matching Microsoft .NET CultureInfo "rfc1766" identifier string. If no match is available, returns the Invariant string.

getPosix

public java.lang.String getPosix()
Converts the iContext into a POSIX locale using UTF8 encoding.

Returns:
a POSIX locale string

getPosix

public java.lang.String getPosix(java.lang.String encoding)
Converts to a POSIX locale string using the provided encoding.

Parameters:
encoding - encoding string to use for the resulting POSIX locale
Returns:
a POSIX locale string

valuematchesdoesn't match
enen-GB, en-GB-Latnfr
zh-hantzh-hant-TW, zh-CHTzh-TW