Locale.Language Property

Definition

Returns the language code of this Locale.

public string Language { [Android.Runtime.Register("getLanguage", "()Ljava/lang/String;", "")] get; }
[<get: Android.Runtime.Register("getLanguage", "()Ljava/lang/String;", "")>]
member this.Language : string

Property Value

The language code, or the empty string if none is defined.

Attributes

Remarks

Returns the language code of this Locale.

<b>Note:</b> ISO 639 is not a stable standard&mdash; some languages' codes have changed. Locale's constructor recognizes both the new and the old codes for the languages whose codes have changed, but this function always returns the old code. If you want to check for a specific language whose code has changed, don't do

if (locale.getLanguage().equals("he")) // BAD!
               ...

Instead, do

if (locale.getLanguage().equals(new Locale("he").getLanguage()))
               ...

Java documentation for java.util.Locale.getLanguage().

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