-1

So I was developing a simple app where it support multiple language but I need to know what kind of locale that were installed in user keyboard so I can recommend some IME to user to download. The app is about learning language like duolingo so I need to know whether the installed keyboard support the language they want to learn or not.

Frandall
  • 378
  • 1
  • 13

2 Answers2

0

In argument pass where you need to use the locale to get the device default locale in your android application use this: `Locale.getDefault()'

And to get whole list locale listing

Anchit Gupta
  • 16
  • 1
  • 5
  • by doing this they only get the current active language of the device they can't give all languages to them and they are looking for the all supported locale language by device. – Shubham Sejpal Sep 14 '17 at 12:49
  • Try this. Hopefully this will help: https://stackoverflow.com/questions/15759507/android-get-list-of-supported-locales – Anchit Gupta Sep 14 '17 at 12:53
  • What I want to get is the keyboard's locale, not the device. For example, your device default locale is en_US, but you can type using arabic or other non latin keyboard. I can get the current active language of the keyboard but not all supported language of the keyboard/IME – Frandall Sep 14 '17 at 15:57
  • @AnchitGupta it's only get the current keyboard locale, not all installed language/locale of the keyboard – Frandall Sep 15 '17 at 04:37
0

Try this it may helps you:

Locale[] loc = Locale.getAvailableLocales();
        ArrayList<String> locallanguage = new ArrayList<String>();
        for (Locale l : loc) {
            locallanguage.add(l.getDisplayLanguage().toString());
            Log.i("TAG1", l.getDisplayLanguage().toString());
        }
        String[] languageslist = (String[]) locallanguage.toArray(new String[locallanguage.size()]);
Shubham Sejpal
  • 3,556
  • 2
  • 14
  • 31