Get the current language in device

0 votes
asked Nov 18, 2010 by pinki

How can we get the current language selected in the Android device?

15 Answers

0 votes
answered Nov 18, 2010 by deragan

If you want to get the selected language of your device, this might help you:

Locale.getDefault().getDisplayLanguage();
0 votes
answered Nov 18, 2010 by johan-pelgrim

You can 'extract' the language from the current locale. You can extract the locale via the standard Java API, or by using the Android Context. For instance, the two lines below are equivalent:

String locale = context.getResources().getConfiguration().locale.getDisplayName();
String locale = java.util.Locale.getDefault().getDisplayName();
0 votes
answered Nov 19, 2011 by airewyre

To save others time and/or confusion I wanted to share that I have tried the two alternatives proposed by Johan Pelgrim above and on my device they are equivalent - whether or not the default location is changed.

So my device's default setting is English(United Kindom) and in this state as expected both Strings in Johan's answer give the same result. If I then change the locale in the phone settings (say to italiano(Italia)) and re-run then both Strings in Johan's answer give the locale as italiano(Italia).

Therefore I believe Johan's original post to be correct and gregm's comment to be incorrect.

0 votes
answered Nov 7, 2012 by armandino

To add to Johan Pelgrim's answer

context.getResources().getConfiguration().locale
Locale.getDefault()

are equivalent because android.text.format.DateFormat class uses both interchangeably, e.g.

private static String zeroPad(int inValue, int inMinDigits) {
    return String.format(Locale.getDefault(), "%0" + inMinDigits + "d", inValue);
}

and

public static boolean is24HourFormat(Context context) {
    String value = Settings.System.getString(context.getContentResolver(),
            Settings.System.TIME_12_24);

    if (value == null) {
        Locale locale = context.getResources().getConfiguration().locale;

    // ... snip the rest ...
}
0 votes
answered Nov 11, 2013 by ramkailash

You can use this code to find out keyboard current

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();
String locale = ims.getLocale();
0 votes
answered Nov 12, 2013 by opsenas

As described in Locale reference the best way to get language is:

Locale.getDefault().getLanguage()

this method returns string with language id according to ISO 639-1 standart

0 votes
answered Nov 15, 2013 by simon-karmy

You can use this

boolean isLang = Locale.getDefault().getLanguage().equals("xx");

when "xx" is any language code like "en", "fr", "sp", "ar" .... and so on

0 votes
answered Nov 18, 2014 by ayed-abboushi

There are two languages.

Default language of OS:

Locale.getDefault().getDisplayLanguage();

Current language of Application:

getResources().getConfiguration().locale.getDisplayLanguage();//return string
0 votes
answered Nov 19, 2014 by trante

I've checked the Locale methods on my Android 4.1.2 device, and the results:

Locale.getDefault().getLanguage()       ---> en      
Locale.getDefault().getISO3Language()   ---> eng 
Locale.getDefault().getCountry()        ---> US 
Locale.getDefault().getISO3Country()    ---> USA 
Locale.getDefault().getDisplayCountry() ---> United States 
Locale.getDefault().getDisplayName()    ---> English (United States) 
Locale.getDefault().toString()          ---> en_US
Locale.getDefault().getDisplayLanguage()---> English
0 votes
answered Nov 20, 2014 by stefan-nsk

You can try to get locale from system resources:

PackageManager packageManager = context.getPackageManager();
Resources resources = packageManager.getResourcesForApplication("android");
String language = resources.getConfiguration().locale.getLanguage();
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...