Search code examples
androidlocale

Android How to get system's installed locales


Is there any way to get System installed locales from the Android device. I tried with getAvailableLocales () from android Get Available locales, but it is not working for devices like Asus, Carbon, Lava, Intex.

For example, if I call getAvailableLocales() in Nexus device I am able to get locales which is there in Settings-> Language&Input -> Language

But if I do same on any Carbon device, instead of getting languages from Settings-> Language&Input -> Language, I get a different list.

I want only the installed list of languages in the device, not every language supported by OS.


Solution

  • If you want system supported locales, use

    Locale.getAvailableLocales() 
    

    If you want system supported and device enabled locales

    Resources.getSystem().getAssets().getLocales()
    

    By using the first one, you cannot be sure about if all locales are supported by that device. Cause they all came in with that Android ROM.

    But the latter one is always a sure shot. Cause it gives only what all the locales(fonts) installed for that particular device. These locales(fonts) are placed by that device manufacturer.

    I explained more it in here