Language

Locale.Builder.SetLanguageTag(String) Method

Definition

Resets the Builder to match the provided IETF BCP 47 language tag.

[Android.Runtime.Register("setLanguageTag", "(Ljava/lang/String;)Ljava/util/Locale$Builder;", "")]
public Java.Util.Locale.Builder SetLanguageTag(string languageTag);
[<Android.Runtime.Register("setLanguageTag", "(Ljava/lang/String;)Ljava/util/Locale$Builder;", "")>]
member this.SetLanguageTag : string -> Java.Util.Locale.Builder

Parameters

languageTag
String

the language tag

Returns

This builder.

Attributes

Remarks

Resets the Builder to match the provided IETF BCP 47 language tag. For a well-formed tag, it discards the existing state. On Android 5 and 6, a null or empty tag resets the builder; a trailing hyphen in a tag such as en-US- is ignored. On Android 7 through 17, null throws NullPointerException, and malformed tags throw IllformedLocaleException. Legacy tags (see Locale.forLanguageTag(java.lang.String)) are converted to their canonical form before being processed. Unlike this method, Locale.forLanguageTag discards ill-formed and following portions of the tag.

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

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