Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the current language in device

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

like image 444
Pinki Avatar asked Nov 18 '10 06:11

Pinki


People also ask

How do I find the current language of my device?

You can use Locale. getDefault(). getLanguage(); to get the usual language code (e.g. "de", "en").

How do I change the whole language on Android?

Go to app > res > values > right-click > New > Value Resource File and name it as strings. Now, we have to select the qualifier as a locale from the available list and select the language as Gujarati from the drop-down list.

What is device locale?

A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user.


2 Answers

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 Locale.getDefault().toLanguageTag()     ---> en-US 
like image 84
trante Avatar answered Oct 16 '22 23:10

trante


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

Locale.getDefault().getDisplayLanguage(); 

You can use Locale.getDefault().getLanguage(); to get the usual language code (e.g. "de", "en")

like image 25
DeRagan Avatar answered Oct 17 '22 00:10

DeRagan