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.
 

InvariantCulturegit

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

 
     

 

當咱們看到 en-US,es-ES等表示culture的名稱時,能夠這樣進行識別
橫線前面的部分稱爲Neutral Culture,它是「與某種語言關聯但不與國家/地區關聯的區域性」的含義
橫線後面的部分稱爲Specific Culture ,它就是和某個地區國家有關的了app

只有一種特殊狀況,就是中文,它的關係是這樣的
zh-CHS Chinese (Simplified) , Neutral
zh-CN Chinese - Chinaless

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

 

zh-Hans is not a region namethis

 

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/regioncode2spa

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 tagcode

 
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 ("").orm

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

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

名稱 culture structure
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 -> zhIf create the culture zh-Hant-TW, its parent chain will be zh-Hant -> zh
相關文章
相關標籤/搜索