ULocale Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
<strong>[icu enhancement]</strong> ICU's replacement for java.util.Locale
.
[Android.Runtime.Register("android/icu/util/ULocale", ApiSince=24, DoNotGenerateAcw=true)]
public sealed class ULocale : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable, Java.Lang.IComparable
[<Android.Runtime.Register("android/icu/util/ULocale", ApiSince=24, DoNotGenerateAcw=true)>]
type ULocale = class
inherit Object
interface ISerializable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
interface IComparable
- Inheritance
- Attributes
- Implements
Remarks
<strong>[icu enhancement]</strong> ICU's replacement for java.util.Locale
. Methods, fields, and other functionality specific to ICU are labeled '<strong>[icu]</strong>'.
A class analogous to java.util.Locale
that provides additional support for ICU protocol. In ICU 3.0 this class is enhanced to support RFC 3066 language identifiers.
Many classes and services in ICU follow a factory idiom, in which a factory method or object responds to a client request with an object. The request includes a locale (the requested locale), and the returned object is constructed using data for that locale. The system may lack data for the requested locale, in which case the locale fallback mechanism will be invoked until a populated locale is found (the valid locale). Furthermore, even when a populated locale is found (the valid locale), further fallback may be required to reach a locale containing the specific data required by the service (the actual locale).
ULocale performs <b>'normalization'</b> and <b>'canonicalization'</b> of locale ids. Normalization 'cleans up' ICU locale ids as follows: <ul> <li>language, script, country, variant, and keywords are properly cased<br> (lower, title, upper, upper, and lower case respectively)</li> <li>hyphens used as separators are converted to underscores</li> <li>three-letter language and country ids are converted to two-letter equivalents where available</li> <li>surrounding spaces are removed from keywords and values</li> <li>if there are multiple keywords, they are put in sorted order</li> </ul> Canonicalization additionally performs the following: <ul> <li>POSIX ids are converted to ICU format IDs</li> <li>Legacy language tags (marked as “Type: grandfathered” in BCP 47) are converted to ICU standard form</li> </ul> All ULocale constructors automatically normalize the locale id. To handle POSIX ids, canonicalize
can be called to convert the id to canonical form, or the canonicalInstance
factory method can be called.
Note: The actual locale is returned correctly, but the valid locale is not, in most cases.
Java documentation for android.icu.util.ULocale
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
ULocale(String, String, String) |
Constructs a ULocale from a localeID constructed from the three 'fields' a, b, and c. |
ULocale(String, String) |
Convenience overload of ULocale(String, String, String) for compatibility with java. |
ULocale(String) |
<strong>[icu]</strong> Constructs a ULocale from a RFC 3066 locale ID. |
Fields
PrivateUseExtension |
The key for the private use locale extension ('x'). |
UnicodeLocaleExtension |
The key for Unicode locale extension ('u'). |
Properties
BaseName |
<strong>[icu]</strong> Returns the (normalized) base name for this locale,
like |
Canada |
Useful constant for country/region. |
CanadaFrench |
Useful constant for country/region. |
CharacterOrientation |
<strong>[icu]</strong> Returns this locale's layout orientation for characters. |
China |
Useful constant for country/region. |
Chinese |
Useful constant for language. |
Class |
Returns the runtime class of this |
Country |
Returns the country/region code for this locale, which will either be the empty string or an uppercase ISO 3166 2-letter code. |
Default |
Returns the current default ULocale. |
DisplayCountry |
Returns this locale's country localized for display in the default |
DisplayLanguage |
Returns this locale's language localized for display in the default |
DisplayLanguageWithDialect |
<strong>[icu]</strong> Returns this locale's language localized for display in the default |
DisplayName |
Returns this locale name localized for display in the default |
DisplayNameWithDialect |
<strong>[icu]</strong> Returns this locale name localized for display in the default |
DisplayScript |
Returns this locale's script localized for display in the default |
DisplayVariant |
Returns this locale's variant localized for display in the default |
English |
Useful constant for language. |
ExtensionKeys |
Returns the set of extension keys associated with this locale, or the empty set if it has no extensions. |
Fallback |
<strong>[icu]</strong> Returns the fallback locale for this locale. |
France |
Useful constant for country/region. |
French |
Useful constant for language. |
German |
Useful constant for language. |
Germany |
Useful constant for country/region. |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
ISO3Country |
Returns a three-letter abbreviation for this locale's country/region. |
ISO3Language |
Returns a three-letter abbreviation for this locale's language. |
IsRightToLeft |
<strong>[icu]</strong> Returns whether this locale's script is written right-to-left. |
Italian |
Useful constant for language. |
Italy |
Useful constant for country/region. |
Japan |
Useful constant for country/region. |
Japanese |
Useful constant for language. |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
Keywords |
<strong>[icu]</strong> Returns an iterator over keywords for this locale. |
Korea |
Useful constant for country/region. |
Korean |
Useful constant for language. |
Language |
Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code. |
LineOrientation |
<strong>[icu]</strong> Returns this locale's layout orientation for lines. |
Name |
<strong>[icu]</strong> Returns the (normalized) full name for this locale. |
PeerReference | (Inherited from Object) |
Prc |
Useful constant for country/region. |
Root |
The root ULocale. |
Script |
Returns the script code for this locale, which might be the empty string. |
SimplifiedChinese |
Useful constant for language. |
Taiwan |
Useful constant for country/region. |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
TraditionalChinese |
Useful constant for language. |
Uk |
Useful constant for country/region. |
UnicodeLocaleAttributes |
Returns the set of unicode locale attributes associated with this locale, or the empty set if it has no attributes. |
UnicodeLocaleKeys |
Returns the set of Unicode locale keys defined by this locale, or the empty set if this locale has none. |
Us |
Useful constant for country/region. |
Variant |
Returns the variant code for this locale, which might be the empty string. |
Methods
AcceptLanguage(String, Boolean[]) |
<strong>[icu]</strong> Based on a HTTP formatted list of acceptable locales, determine an available locale for the user. |
AcceptLanguage(String, ULocale[], Boolean[]) |
<strong>[icu]</strong> Based on a HTTP formatted list of acceptable locales, determine an available locale for the user. |
AcceptLanguage(ULocale[], Boolean[]) |
<strong>[icu]</strong> Based on an ordered array of acceptable locales, determine an available locale for the user. |
AcceptLanguage(ULocale[], ULocale[], Boolean[]) |
<strong>[icu]</strong> Based on a list of acceptable locales, determine an available locale for the user. |
AddLikelySubtags(ULocale) |
<strong>[icu]</strong> Adds the likely subtags for a provided locale ID, per the algorithm described in the following CLDR technical report:
|
Canonicalize(String) |
<strong>[icu]</strong> Returns the canonical name according to CLDR for the specified locale ID. |
Clone() |
This is for compatibility with Locale-- in actuality, since ULocale is immutable, there is no reason to clone it, so this API returns 'this'. |
CompareTo(ULocale) |
Compares two ULocale for ordering. |
CreateCanonical(String) |
<strong>[icu]</strong> Creates a ULocale from the id by first canonicalizing the id according to CLDR. |
CreateCanonical(ULocale) |
Creates a ULocale from the locale by first canonicalizing the locale according to CLDR. |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
ForLanguageTag(String) |
Returns a locale for the specified IETF BCP 47 language tag string. |
ForLocale(Locale) |
<strong>[icu]</strong> Returns a ULocale object for a |
GetAvailableLocales() |
<strong>[icu] Note:</strong> Unlike the Locale API, this returns an array of |
GetAvailableLocalesByType(ULocale+AvailableType) | |
GetBaseName(String) |
<strong>[icu]</strong> Returns the (normalized) base name for the specified locale,
like |
GetCountry(String) |
<strong>[icu]</strong> Returns the country/region code for this locale, which will either be the empty string or an uppercase ISO 3166 2-letter code. |
GetDefault(ULocale+Category) | |
GetDisplayCountry(String, String) |
<strong>[icu]</strong> Returns a locale's country localized for display in the provided locale. |
GetDisplayCountry(String, ULocale) |
<strong>[icu]</strong> Returns a locale's country localized for display in the provided locale. |
GetDisplayCountry(ULocale) |
Returns this locale's country localized for display in the provided locale. |
GetDisplayKeyword(String, String) |
<strong>[icu]</strong> Returns a keyword localized for display in the specified locale. |
GetDisplayKeyword(String, ULocale) |
<strong>[icu]</strong> Returns a keyword localized for display in the specified locale. |
GetDisplayKeyword(String) |
<strong>[icu]</strong> Returns a keyword localized for display in the default |
GetDisplayKeywordValue(String, String, String) |
<strong>[icu]</strong> Returns a keyword value localized for display in the specified locale. |
GetDisplayKeywordValue(String, String, ULocale) |
<strong>[icu]</strong> Returns a keyword value localized for display in the specified locale. |
GetDisplayKeywordValue(String, ULocale) |
<strong>[icu]</strong> Returns a keyword value localized for display in the specified locale. |
GetDisplayKeywordValue(String) |
<strong>[icu]</strong> Returns a keyword value localized for display in the default |
GetDisplayLanguage(String, String) |
<strong>[icu]</strong> Returns a locale's language localized for display in the provided locale. |
GetDisplayLanguage(String, ULocale) |
<strong>[icu]</strong> Returns a locale's language localized for display in the provided locale. |
GetDisplayLanguage(ULocale) |
Returns this locale's language localized for display in the provided locale. |
GetDisplayLanguageWithDialect(String, String) |
<strong>[icu]</strong> Returns a locale's language localized for display in the provided locale. |
GetDisplayLanguageWithDialect(String, ULocale) |
<strong>[icu]</strong> Returns a locale's language localized for display in the provided locale. |
GetDisplayLanguageWithDialect(ULocale) |
<strong>[icu]</strong> Returns this locale's language localized for display in the provided locale. |
GetDisplayName(String, String) |
<strong>[icu]</strong> Returns the locale ID localized for display in the provided locale. |
GetDisplayName(String, ULocale) |
<strong>[icu]</strong> Returns the locale ID localized for display in the provided locale. |
GetDisplayName(ULocale) |
Returns this locale name localized for display in the provided locale. |
GetDisplayNameWithDialect(String, String) |
<strong>[icu]</strong> Returns the locale ID localized for display in the provided locale. |
GetDisplayNameWithDialect(String, ULocale) |
<strong>[icu]</strong> Returns the locale ID localized for display in the provided locale. |
GetDisplayNameWithDialect(ULocale) |
<strong>[icu]</strong> Returns this locale name localized for display in the provided locale. |
GetDisplayScript(String, String) |
<strong>[icu]</strong> Returns a locale's script localized for display in the provided locale. |
GetDisplayScript(String, ULocale) |
<strong>[icu]</strong> Returns a locale's script localized for display in the provided locale. |
GetDisplayScript(ULocale) |
Returns this locale's script localized for display in the provided locale. |
GetDisplayVariant(String, String) |
<strong>[icu]</strong> Returns a locale's variant localized for display in the provided locale. |
GetDisplayVariant(String, ULocale) |
<strong>[icu]</strong> Returns a locale's variant localized for display in the provided locale. |
GetDisplayVariant(ULocale) |
Returns this locale's variant localized for display in the provided locale. |
GetExtension(Char) |
Returns the extension (or private use) value associated with the specified key, or null if there is no extension associated with the key. |
GetFallback(String) |
<strong>[icu]</strong> Returns the fallback locale for the specified locale, which might be the empty string. |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
GetISO3Country(String) |
<strong>[icu]</strong> Returns a three-letter abbreviation for this locale's country/region. |
GetISO3Language(String) |
<strong>[icu]</strong> Returns a three-letter abbreviation for this locale's language. |
GetISOCountries() |
Returns a list of all 2-letter country codes defined in ISO 3166. |
GetISOLanguages() |
Returns a list of all unique language codes defined in ISO 639. |
GetKeywords(String) |
<strong>[icu]</strong> Returns an iterator over keywords for the specified locale. |
GetKeywordValue(String, String) |
<strong>[icu]</strong> Returns the value for a keyword in the specified locale. |
GetKeywordValue(String) |
<strong>[icu]</strong> Returns the value for a keyword in this locale. |
GetLanguage(String) |
Returns the language code for the locale ID, which will either be the empty string or a lowercase ISO 639 code. |
GetName(String) |
<strong>[icu]</strong> Returns the (normalized) full name for the specified locale. |
GetScript(String) |
<strong>[icu]</strong> Returns the script code for the specified locale, which might be the empty string. |
GetUnicodeLocaleType(String) |
Returns the Unicode locale type associated with the specified Unicode locale key for this locale. |
GetVariant(String) |
<strong>[icu]</strong> Returns the variant code for the specified locale, which might be the empty string. |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
MinimizeSubtags(ULocale) |
<strong>[icu]</strong> Minimizes the subtags for a provided locale ID, per the algorithm described in the following CLDR technical report:<blockquote>
|
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
SetKeywordValue(String, String, String) |
Given a locale id, a keyword, and a value, return a new locale id with an updated keyword and value. |
SetKeywordValue(String, String) |
<strong>[icu]</strong> Given a keyword and a value, return a new locale with an updated keyword and value. |
ToArray<T>() | (Inherited from Object) |
ToLanguageTag() |
Returns a well-formed IETF BCP 47 language tag representing this locale. |
ToLegacyKey(String) |
<strong>[icu]</strong> Converts the specified keyword (BCP 47 Unicode locale extension key, or legacy key) to the legacy key. |
ToLegacyType(String, String) |
<strong>[icu]</strong> Converts the specified keyword value (BCP 47 Unicode locale extension type, or legacy type or type alias) to the canonical legacy type. |
ToLocale() |
<strong>[icu]</strong> Converts this ULocale object to a |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
ToUnicodeLocaleKey(String) |
<strong>[icu]</strong> Converts the specified keyword (legacy key, or BCP 47 Unicode locale extension key) to the equivalent BCP 47 Unicode locale extension key. |
ToUnicodeLocaleType(String, String) |
<strong>[icu]</strong> Converts the specified keyword value (legacy type, or BCP 47 Unicode locale extension type) to the well-formed BCP 47 Unicode locale extension type for the specified keyword (category). |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IComparable.CompareTo(Object) | |
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |