Simplified and Traditional Chinese vs Regions

前端 未结 3 987
梦如初夏
梦如初夏 2020-12-02 05:50

In the process of implementing traditional and simplified chinese support in my Android application and I confused on how this is supposed to work.

So from reading t

3条回答
  •  庸人自扰
    2020-12-02 06:53

    https://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources

    Android 7.0 (API level 24) introduced support for BCP 47 language tags, which you can use to qualify language- and region-specific resources. A language tag is composed from a sequence of one or more subtags, each of which refines or narrows the range of language identified by the overall tag.

    you can now define traditional or simplified using the BCP 47 tags. (To use a BCP 47 language tag, concatenate b+ and a two-letter ISO 639-1 language code, optionally followed by additional subtags separated by +.)

    more specifically: -

    Simplified:

    values-b+zh (defaults to simplified) 
    values-b+zh+Hans or
    values-b+zh+Hans+CN (if you want to include regions)
    

    Traditional:

    values-b+zh+Hant or
    values-b+zh+TW (defaults to traditional)
    values-b+zh+Hant+TW (if you want to include regions)
    

    you can look at https://tools.ietf.org/html/bcp47 for other interesting combinations. including: -

      zh-cmn-Hans-CN (Chinese, Mandarin, Simplified script, as used in
      China)
    
      cmn-Hans-CN (Mandarin Chinese, Simplified script, as used in
      China)
    
      zh-yue-HK (Chinese, Cantonese, as used in Hong Kong SAR)
    
      yue-HK (Cantonese Chinese, as used in Hong Kong SAR)
    
      zh-nan-TW (min nan Chinese, as used in Taiwan)
    
      zh-hak-CN (Chinese, Hakka, China).
    

    remember to add -b and replace the - in each tag with +

提交回复
热议问题