简体   繁体   中英

Why does CultureInfo.GetCultures(CultureTypes.SpecificCultures) return different sets of cultures on different computers

If I run this line of code below on different computers then I get different results:

int cultureCount = CultureInfo.GetCultures(CultureTypes.SpecificCultures).Count();

On Windows 10 with .NET 4.0 cultureCount = 535

On a different Windows 10 with .NET 4.0 cultureCount = 554

On Windows 7 with .NET 4.0 cultureCount = 210.

Is there a reason that I get different results on different computers?

Is there a standard minimal set of cultures that is guaranteed to be present on all computers?

According to this link from MSDN: https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo(v=vs.110).aspx

Remember that the culture names and identifiers represent only a subset of cultures that can be found on a particular computer. Windows versions or service packs can change the available cultures.

The reason for different cultures is the differences in Windows or service packs.

However, I did not find any Microsoft link that suggests there exists a minimal set of cultures. From my observation, later version of Windows includes older cultures.

My solution is to check on older versions of Windows and make sure that the culture exists there. If not, I will build a custom culture for backward support.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM