Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get language in android?

Tags:

android

In my android app I need to know which is the language of the phone in this format :fr (for francais), en (for english),etc.. How can I do this? I know that I can display language with this :

Locale.getDefault().getDisplayLanguage()

but the result is francais,english,...

Can I obtain somehow the initials of languages?

like image 790
Gabrielle Avatar asked Aug 23 '11 11:08

Gabrielle


2 Answers

Locale.getDefault().getLanguage()

Returns the language code for this Locale or the empty string if no language was set.

http://developer.android.com/reference/java/util/Locale.html#getLanguage()

like image 93
Sander Versluys Avatar answered Sep 17 '22 18:09

Sander Versluys


How about using

Locale.getDefault().getLanguage();
like image 20
nahwarang Avatar answered Sep 18 '22 18:09

nahwarang