What is the list of supported languages/locales on Android?

前端 未结 14 1260
我在风中等你
我在风中等你 2020-11-22 02:06

I\'d like to know what to name my folder for different languages. Where can I find the supported list of languages on Android?

14条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 02:50

    I think the best way is to run a sample code to find the supported locales. I've made a code snippet that does it:

    final Locale[] availableLocales=Locale.getAvailableLocales();
    for(final Locale locale : availableLocales)
      Log.d("Applog",":"+locale.getDisplayName()+":"+locale.getLanguage()+":"
        +locale.getCountry()+":values-"+locale.toString().replace("_","-r"));
    

    the columns are : displayName (how it looks to the user), the locale, the variant, and the folder that the developer is supposed to put the strings into.

    Here's a table I've made out of the 5.0.1 emulator: https://docs.google.com/spreadsheets/d/1Hx1CTPT82qFSbzuWiU1nyGROCNM6HKssKCPhxinvdww/

    Weird thing is that for some cases, I got "#" which is something I've never seen before. It's probably quite new, and the rule I've chosen is probably incorrect for those cases (though it still compiles fine when I put such folders and files), but for the rest it should be fine.

    If anyone knows about what the "#" is, and how to handle it, please let me know.

提交回复
热议问题