CultureInfo中linux下AllCultures中无zh-CN的问题

CultureInfo类型含义 
NeutralCulture
Neutral cultures are cultures like "en", "de", "zh", etc, for enumeration this includes ALL neutrals regardless of other flags
 
SpecificCulture
Non-netural cultuers.  Examples are "en-us", "zh-tw", etc., for enumeration this includes ALL specifics regardless of other flags
 
InstalledWin32Culture
Win32 installed cultures in the system and exists in the framework too., this is effectively all cultures
 
AllCulture = NeutralCultures | SpecificCultures | InstalledWin32Cultures,
   
UserCustomCulture
User defined custom culture
 
ReplacementCultures
User defined replacement custom culture
 
WindowsOnlyCultures(deprecated)
this will always return empty list
 
FrameworkCultures(deprecated)
will return only the v2 cultures marked as Framework culture.
 

InvariantCulture

culture-independent (invariant).it is associated with the English language but not with any country/region

 
     

 

当我们看到 en-US,es-ES等表示culture的名称时,可以这样进行识别
横线前面的部分称为Neutral Culture,它是“与某种语言关联但不与国家/地区关联的区域性”的含义
横线后面的部分称为Specific Culture ,它就是和某个地区国家有关的了

只有一种特殊情况,就是中文,它的关系是这样的
zh-CHS Chinese (Simplified) , Neutral
zh-CN Chinese - China

zh-CHT Chinese (Traditional) , Neutral
zh-TW Chinese - Taiwan
zh-HK Chinese - Hong Kong SAR
zh-MO Chinese - Macao SAR
zh-SG Chinese - Singapore

 

zh-Hans is not a region name

 

name类型含义 
DisplayName Gets the full localized culture name. The full localized culture name in the format languagefull [country/regionfull]  
EnglishName Gets the culture name in the format languagefull [country/regionfull] in English.  
Name

Gets the culture name in the format languagecode2-country/regioncode2

languagecode2 is a lowercase two-letter code derived from ISO 639-1. country/regioncode2 is derived from ISO 3166 and usually consists of two uppercase letters, or a BCP-47 language tag

 
NativeName Gets the culture name, consisting of the language, the country/region, and the optional script, that the culture is set to display.  
ThreeLetterISOLanguageName Gets the ISO 639-2 three-letter code for the language of the current  
ThreeLetterWindowsLanguageName Gets the three-letter code for the language as defined in the Windows API.  
TwoLetterISOLanguageName Gets the ISO 639-1 two-letter code for the language of the current  
     

 

CreateSpecificCulture object that represents

The invariant culture, if name is an empty string ("").

The specific culture associated with name , if name is a neutral culture.

The culture specified by name , if name is already a specific culture.

 

language-script-region-variant-extension-privateuse

1. language:这部分就是ISO 639规定的代码,比如中文是zh。

2. script:表示变体,比如简体汉字是zh-Hans,繁体汉字是zh-Hant。

3. region:表示语言使用的地理区域,比如zh-Hans-CN就是中国大陆使用的简体中文。

4. variant:表示方言。

5. extension-privateus:表示扩展用途和私有标识。

一般约定,language标签全部小写,region标签全部大写,script标签只有首字母大写。不同标签之间用连字号-链接。

 

 

The example displays the older zh-CHS and zh-CHT culture names with the 0x0004 and 0x7C04 culture identifiers, respectively. However, your Windows Vista applications should use the zh-Hans name instead of zh-CHS and the zh-Hant name instead of zh-CHT. The zh-Hans and zh-Hant names represent the current standard, and should be used unless you have a reason for using the older names.

 

对比zh-CN zh-Hans zh-CHS

名称culturestructure
zh-CN SpecificCulture  language-county
zh-CHS NeutralCulture language
zh-Hans NeutralCulture, current standard  PRC language-script

 

Parent :

On Windows, that parent chain for zh-CN is 'zh-CN'->'zh-Hans'->'zh'->Invariant. On Linux, the zh-Hans element is omitted

 

官方声明:https://github.com/dotnet/docs/issues/11363

zh-CN and zh-TW are two cultures mainly used on Windows and Linux ICU library just support them as aliased cultures. aliased means these cultures are not get enumerated in the cultures list but only work if you create the culture with that aliased name.

The right names for such cultures are zh-Hans-CN and zh-Hant-TW.

When creating the zh-CN or zh-TW cultures, the parent culture on Linux will be zh and not zh-Hans nor zh-Hant. If running on Windows, will get a different behavior.

If create the culture zh-Hans-CN, its parent chain will be zh-Hans -> zh
If create the culture zh-Hant-TW, its parent chain will be zh-Hant -> zh
posted @ 2019-06-04 09:32  Sylvia小伊  阅读(995)  评论(0编辑  收藏  举报