Reputation: 547
I'm trying to get user language with two-letters
but no success until here.
Use Locale.getDefault().getISO3Language();
returns code with three digits (eng, por, jap).
Use substring
method to cut does not work for all codes, so what's the solution?
Upvotes: 6
Views: 2333
Reputation: 21766
Instead of getISO3Language()
, use getLanguage()
and you will get user language like en
, ja
, pt
etc.
Locale.getDefault().getLanguage();
Checkout official documentation for more information about getLanguage()
Upvotes: 8