With the full .NET framework, you can get/set the current thread's culture and UI culture using:
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
I'm porting a library to netstandard1.n
(n
is to be determined) and discovered the Thread
class does not define CurrentCulture
nor CurrentUICulture
.
Is there an alternative API for this?
CurrentCulture – Tells you the user's current locale, as set in the Region applet. I.e.: Where is the user located? CurrentUICulture – Tells you the native language of the version of Windows that is installed.
The CultureInfo. CurrentCulture property is a per-thread setting; that is, each thread can have its own culture. You get the culture of the current thread by retrieving the value of the CultureInfo. CurrentCulture property, as the following example illustrates. C# Copy.
How to CultureInfo in VB.NET. The CultureInfo class specifies a unique name for each culture, based on RFC 4646. The name is a combination of an ISO 639 two-letter lowercase culture code associated with a language and an ISO 3166 two-letter uppercase subculture code associated with a country or region.
To change the current UI culture, you assign the CultureInfo object that represents the new UI culture to the Thread. CurrentThread. CurrentUICulture property.
Use CultureInfo
's static members instead:
CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With