This article is a mirror article of machine translation, please click here to jump to the original article.

View: 3684|Reply: 4

[Source] .NET/C# sets the default CultureInfo information for the program

[Copy link]
Posted on 11/23/2023 9:29:26 PM | | | |
Requirements: .NET/C# sets the default locality (CultureInfo) information of the program, which does not depend on the default locale of the Windows system.

The code is as follows:


Get all the regions, the code is as follows:



CultureInfo.CurrentCultureProperties are settings for each thread and can be determinedDefault format for date, time, currency, and numbers, text sort order, string comparison, and case conversion.
CultureInfo.CurrentUICultureProperties are per-thread settings that return the current user interface locality. This property is used by the ResourceManager class to find locally specific resources at runtime.

Summary: When the program is running, the CurrentUICulture property is used to determine what kind of resources to load, while the CurrentCulture property is used to determine how things such as currency, numbers, and dates are formatted.

Reference:

The hyperlink login is visible.
The hyperlink login is visible.
The hyperlink login is visible.




Previous:.NET/C# Read/Write Lock ReaderWriterLockSlim test
Next:Use NVM to install and manage node.js releases
 Landlord| Posted on 11/23/2023 9:34:28 PM |
zh-CN and zh-TW are two cultures that are primarily used on Windows, and the Linux ICU library only supports them as alias cultures. An alias means that these regionalities are not enumerated in the list of regions, but are only valid if you create a region with that alias.

The correct names for these cultures are zh-Hans-CN and zh-Hant-TW.

When you create a zh-CN or zh-TW regionality, the parent regionality on Linux will be zh instead of zh-hans or zh-hant. If you run it on Windows, you will get different behavior.

If you create a culture zh-hans-CN, its parent chain is zh-hans -> zh
If you create a culture zh-hant-tw, its parent chain is zh-hant -> zh


language-script-region-variant-extension-privateuse

1. language: This part is the code specified in ISO 639, for example, Chinese is zh.

2. script: Indicates variations, such as zh-hans in simplified Chinese characters and zh-hant in traditional Chinese characters.

3. region: indicates the geographical region where the language is used, such as zh-Hans-CN is the Chinese Simplified used in Chinese mainland.

4. variant: Indicates dialect.

5. extension-privateus: Indicates the extension purpose and private identity.

The general convention is that the language tag is all lowercase, the region tag is all uppercase, and the script tag is only capitalized. Use hyphens-links between different labels.

Posted on 12/15/2023 5:33:57 PM |
Prompt:Authors are banned or removed content is automatically blocked
Posted on 12/20/2023 12:23:33 PM |
Prompt:Authors are banned or removed content is automatically blocked
 Landlord| Posted on 7/22/2024 8:46:44 AM |

AllCultures7
All locales that .NET recognizes, including user-created neutral and specific regionals, as well as custom regionalities.
On .NET Framework 4 and later, as well as .NET Core running on Windows, regional data that can be obtained from the Windows operating system will be included. On .NET Core running on Linux and macOS, regional data defined in the ICU library will be included.
AllCultures is a compound field that includes the values of NeutralCultures, SpecificCultures, and InstalledWin32Cultures.
FrameworkCultures64
This member is deprecated; Using this value in conjunction with GetCultures(CultureTypes) returns the non-specific and region-specific nature that comes with the .NET Framework 2.0.
InstalledWin32Cultures4
This member is deprecated. All regionalities installed in the Windows operating system.
NeutralCultures1
Regionality that is associated with a language but not specific to a country.
ReplacementCultures16
This member is deprecated. Custom locales created by the user that can replace the regionalities that come with the .NET Framework.
SpecificCultures2
Regionality specific to a country.
UserCustomCulture8
This member is deprecated. Custom locales created by users.
WindowsOnlyCultures32
This member is deprecated and will be ignored.


The hyperlink login is visible.
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com