Locale Constructors

Definition

Overloads

Locale(String)

Construct a locale from a language code.

Locale(String, String)

Construct a locale from language and country.

Locale(String, String, String)

Construct a locale from language, country and variant.

Locale(String)

Construct a locale from a language code.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")]
public Locale (string language);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")>]
new Java.Util.Locale : string -> Java.Util.Locale

Parameters

language
String

An ISO 639 alpha-2 or alpha-3 language code, or a language subtag up to 8 characters in length. See the Locale class description about valid language values.

Attributes

Remarks

Construct a locale from a language code. This constructor normalizes the language value to lowercase.

<b>Note:</b> <ul> <li>ISO 639 is not a stable standard; some of the language codes it defines (specifically "iw", "ji", and "in") have changed. This constructor accepts both the old codes ("iw", "ji", and "in") and the new codes ("he", "yi", and "id"), but all other API on Locale will return only the OLD codes. <li>For backward compatibility reasons, this constructor does not make any syntactic checks on the input. </ul>

Added in 1.4.

Java documentation for java.util.Locale.Locale(java.lang.String).

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

Locale(String, String)

Construct a locale from language and country.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;)V", "")]
public Locale (string language, string country);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;)V", "")>]
new Java.Util.Locale : string * string -> Java.Util.Locale

Parameters

language
String

An ISO 639 alpha-2 or alpha-3 language code, or a language subtag up to 8 characters in length. See the Locale class description about valid language values.

country
String

An ISO 3166 alpha-2 country code or a UN M.49 numeric-3 area code. See the Locale class description about valid country values.

Attributes

Remarks

Construct a locale from language and country. This constructor normalizes the language value to lowercase and the country value to uppercase.

<b>Note:</b> <ul> <li>ISO 639 is not a stable standard; some of the language codes it defines (specifically "iw", "ji", and "in") have changed. This constructor accepts both the old codes ("iw", "ji", and "in") and the new codes ("he", "yi", and "id"), but all other API on Locale will return only the OLD codes. <li>For backward compatibility reasons, this constructor does not make any syntactic checks on the input. </ul>

Java documentation for java.util.Locale.Locale(java.lang.String, java.lang.String).

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

Locale(String, String, String)

Construct a locale from language, country and variant.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", "")]
public Locale (string language, string country, string variant);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", "")>]
new Java.Util.Locale : string * string * string -> Java.Util.Locale

Parameters

language
String

An ISO 639 alpha-2 or alpha-3 language code, or a language subtag up to 8 characters in length. See the Locale class description about valid language values.

country
String

An ISO 3166 alpha-2 country code or a UN M.49 numeric-3 area code. See the Locale class description about valid country values.

variant
String

Any arbitrary value used to indicate a variation of a Locale. See the Locale class description for the details.

Attributes

Remarks

Construct a locale from language, country and variant. This constructor normalizes the language value to lowercase and the country value to uppercase.

<b>Note:</b> <ul> <li>ISO 639 is not a stable standard; some of the language codes it defines (specifically "iw", "ji", and "in") have changed. This constructor accepts both the old codes ("iw", "ji", and "in") and the new codes ("he", "yi", and "id"), but all other API on Locale will return only the OLD codes. <li>For backward compatibility reasons, this constructor does not make any syntactic checks on the input. <li>The two cases ("ja", "JP", "JP") and ("th", "TH", "TH") are handled specially, see Special Cases for more information. </ul>

Java documentation for java.util.Locale.Locale(java.lang.String, java.lang.String, java.lang.String).

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