getLanguage (JavaScript)

Returns a list of all 2-letter country codes defined in ISO 3166. Can be used to create Locales

Note: ISO 639 is not a stable standard-- some language codes have changed. The list this function returns includes both the new and the old codes for the languages whose codes have changed.

Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code. ISO 639 is not a stable standard-- 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, do not use

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

Instead, use

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

Defined in

Locale (Runtime - JavaScript)

Syntax

getLanguage() : string