Language

Locale.Builder.SetLocale(Locale) Method

Definition

Resets the Builder to match the provided locale.

[Android.Runtime.Register("setLocale", "(Ljava/util/Locale;)Ljava/util/Locale$Builder;", "")]
public Java.Util.Locale.Builder SetLocale(Java.Util.Locale locale);
[<Android.Runtime.Register("setLocale", "(Ljava/util/Locale;)Ljava/util/Locale$Builder;", "")>]
member this.SetLocale : Java.Util.Locale -> Java.Util.Locale.Builder

Parameters

locale
Locale

the locale

Returns

This builder.

Attributes

Remarks

Resets the Builder to match the provided locale. On success, existing state is discarded. The locale's language, region and variant are checked for valid syntax. If a value fails this check, an IllformedLocaleException is thrown. On Android 5 and 6, a variant with a trailing separator can pass this check; see SetVariant(String). On Android 7 through 17, the script is also validated and the following three cases are accepted for compatibility reasons: Locale("ja", "JP", "JP") is treated as "ja-JP-u-ca-japanese"; Locale("th", "TH", "TH") is treated as "th-TH-u-nu-thai"; Locale("no", "NO", "NY") is treated as "nn-NO". Android 5 and 6 reject these three cases because their variants are ill-formed.

Java reference for java.util.Locale.Builder.setLocale.

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.

Applies to