Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I am trying set culture as Chinese Traditional language. but it's doesn't work it always set default culture

I have used CultureInfo for set Culture.
my code like below in C#:

 CultureInfo culture = new CultureInfo("zh-CHT");

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Can you please use the below code it’s work fine for you I think

var culture = new CultureInfo("zh-CHT");
Thread.CurrentThread.CurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture.Name);

If it does not work then you can use like below code

private void SetCulture(HttpRequestMessage request, string lang)
{
    request.Headers.AcceptLanguage.Clear();
    request.Headers.AcceptLanguage.Add(new StringWithQualityHeaderValue(lang));
    Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading