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

前端 未结 14 1262
我在风中等你
我在风中等你 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:47

    First we need to plan how the application will render differently in different locals. Here it shows example, where the text string and images have to go.

    de-rDE German / Germany res/values-de/ res/drawable-de-rDE/ 
    fr-rFR French / France res/values-fr/ res/drawable-fr-rFR/ 
    fr-rCA French / Canada res/values-fr/ res/drawable-fr-rCA/ 
    en-rCA English / Canada (res/values/) res/drawable-en-rCA/ 
    ja-rJP Japanese / Japan res/values-ja/ res/drawable-ja-rJP/ 
    en-rUS English / United States (res/values/) res/drawable-en-rUS/ 
    

    For more info you can see the page Localization

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-11-22 02:50

    If you're using Android Studio you can:

    1. Right click a directory on your project > New > Android Resource File
    2. In the Available qualifiers section select Locale and click >>

    You will see a list of all Languages and if you choose them you will see Specific Regions for each. You can also type in the list to filter languages.

    0 讨论(0)
  • 2020-11-22 02:52

    Here:

    public static final Locale  CANADA  Locale constant for en_CA.
    public static final Locale  CANADA_FRENCH   Locale constant for fr_CA.
    public static final Locale  CHINA   Locale constant for zh_CN.
    public static final Locale  CHINESE Locale constant for zh.
    public static final Locale  ENGLISH Locale constant for en.
    public static final Locale  FRANCE  Locale constant for fr_FR.
    public static final Locale  FRENCH  Locale constant for fr.
    public static final Locale  GERMAN  Locale constant for de.
    public static final Locale  GERMANY Locale constant for de_DE.
    public static final Locale  ITALIAN Locale constant for it.
    public static final Locale  ITALY   Locale constant for it_IT.
    public static final Locale  JAPAN   Locale constant for ja_JP.
    public static final Locale  JAPANESE    Locale constant for ja.
    public static final Locale  KOREA   Locale constant for ko_KR.
    public static final Locale  KOREAN  Locale constant for ko.
    public static final Locale  PRC Locale constant for zh_CN.
    public static final Locale  ROOT    Locale constant for the root locale.
    public static final Locale  SIMPLIFIED_CHINESE  Locale constant for zh_CN.
    public static final Locale  TAIWAN  Locale constant for zh_TW.
    public static final Locale  TRADITIONAL_CHINESE Locale constant for zh_TW.
    public static final Locale  UK  Locale constant for en_GB.
    public static final Locale  US  Locale constant for en_US.
    
    0 讨论(0)
  • 2020-11-22 02:52

    Just FYI, if you are unable to set any locale, the problem might be below attribute in your app level gradle file:

    resConfigs "en", "hi" //to specify allowed locales for your app
    

    So, if you want to support any locale other than English and Hindi, specify your locale here or just remove above line. By default your app will support all the locales.

    Thanks :)

    0 讨论(0)
  • 2020-11-22 02:53

    Update for 4.0

    Android 4.0.3 Platform

    Arabic, Egypt (ar_EG)
    Arabic, Israel (ar_IL)
    Bulgarian, Bulgaria (bg_BG)
    Catalan, Spain (ca_ES)
    Chinese, PRC (zh_CN)
    Chinese, Taiwan (zh_TW)
    Croatian, Croatia (hr_HR)
    Czech, Czech Republic (cs_CZ)
    Danish, Denmark(da_DK)
    Dutch, Belgium (nl_BE)
    Dutch, Netherlands (nl_NL)
    English, Australia (en_AU)
    English, Britain (en_GB)
    English, Canada (en_CA)
    English, India (en_IN)
    English, Ireland (en_IE)
    English, New Zealand (en_NZ)
    English, Singapore(en_SG)
    English, South Africa (en_ZA)
    English, US (en_US)
    Finnish, Finland (fi_FI)
    French, Belgium (fr_BE)
    French, Canada (fr_CA)
    French, France (fr_FR)
    French, Switzerland (fr_CH)
    German, Austria (de_AT)
    German, Germany (de_DE)
    German, Liechtenstein (de_LI)
    German, Switzerland (de_CH)
    Greek, Greece (el_GR)
    Hebrew, Israel (he_IL)
    Hindi, India (hi_IN)
    Hungarian, Hungary (hu_HU)
    Indonesian, Indonesia (id_ID)
    Italian, Italy (it_IT)
    Italian, Switzerland (it_CH)
    Japanese (ja_JP)
    Korean (ko_KR)
    Latvian, Latvia (lv_LV)
    Lithuanian, Lithuania (lt_LT)
    Norwegian bokmål, Norway (nb_NO)
    Polish (pl_PL)
    Portuguese, Brazil (pt_BR)
    Portuguese, Portugal (pt_PT)
    Romanian, Romania (ro_RO)
    Russian (ru_RU)
    Serbian (sr_RS)
    Slovak, Slovakia (sk_SK)
    Slovenian, Slovenia (sl_SI)
    Spanish (es_ES)
    Spanish, US (es_US)
    Swedish, Sweden (sv_SE)
    Tagalog, Philippines (tl_PH)
    Thai, Thailand (th_TH)
    Turkish, Turkey (tr_TR)
    Ukrainian, Ukraine (uk_UA)
    Vietnamese, Vietnam (vi_VN)
    

    SOURCE: http://us.dinodirect.com/Forum/Latest-Posts-5/Android-Versions-and-their-Locales-1-86587/

    0 讨论(0)
提交回复
热议问题