Questions tagged [currentculture]

a Thread property in the .NET System.Threading namespace or a CultureInfo property in the .NET System.Globalization namespace

CurrentCulture refers to either the Thread.CurrentCulture property in the .NET System.Threading namespace or the CultureInfo.CurrentCulture property in the .NET System.Globalization namespace.

In both cases, this property is used to get or set the System.Globalization.CultureInfo object that represents the culture of the current thread.

Resources

Related Tags

139 questions
6
votes
5 answers

Wrong CurrentCulture when running an nUnit test in TeamCity

I have a unit-test that relies on a specific culture. In FixtureSetup, I set both Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture to the desired value (en-US). When I run the test from Resharper, it passes. When I run…
Miroslav Bajtoš
  • 10,667
  • 1
  • 41
  • 99
6
votes
1 answer

How to correctly inherit thread culture in a parallel block?

I'm using automatic globalization on an ASP MVC website. It works fine until it reached a parallel block: public ActionResult Index() { // Thread.CurrentThread.CurrentCulture is automatically set to "fr-FR" // according to the requested…
Pablo Honey
  • 1,074
  • 1
  • 10
  • 23
6
votes
1 answer

Difference between Application.CurrentCulture and Thread.CurrentCulture

Can someone tell me the difference between Application.CurrentCulture and Thread.CurrentCulture. Thread has CurrentCulture and CurrentUICulture. But Application has only CurrentCulture. Why? I am refering this link mentioned below…
Rajes
  • 1,036
  • 10
  • 15
5
votes
1 answer

How to dynamically initialize Culture in ASP.NET WebService Call?

Can anyone tell me how can i dynamically initialize thread culture in a asp.net webservice call? In my aspx pages i have a base page where i override the InitializeCulture() Method. Note that the value of selected language is saved in Session State.
rtcardoso
  • 111
  • 2
  • 8
5
votes
2 answers

How to control the CurrentCulture for recurring jobs in HangFire

I'm using HangFire 1.6 in an asp.net WebApi2 solution with Owin. The server is setup for one culture (da-DK) - I cannot change this. My application must use another culture (en-US) to correctly parse text data it receives. Basically I just want…
Zrethreal
  • 317
  • 4
  • 15
5
votes
1 answer

How to detect if CurrentCulture has been customised by the user?

I would like to know how I can determine whether the CultureInfo instance returned by CultureInfo.CurrentCulture has all it's default values or whether it has been customised by the user. I have done some testing using the following LINQPad snippet…
Steve Crane
  • 4,340
  • 5
  • 40
  • 63
5
votes
3 answers

WinRT equivalent of these .Net culture methods?

What is the WinRT equivalent of these items from the .NET framework? CultureInfo.CurrentCulture.LCID Encoding.GetEncoding(int codePage) Encoding.CodePage
Brannon
  • 5,324
  • 4
  • 35
  • 83
4
votes
2 answers

C# getCultures in local/currentCulture

The following code returns English names despite I localized the currentculture. List languageList = new List(); CultureInfo[] cultureList = CultureInfo.GetCultures(CultureTypes.AllCultures); foreach (CultureInfo culture in…
Shaokan
  • 7,438
  • 15
  • 56
  • 80
4
votes
1 answer

Instance is read-only Exception while changing culture in asp.net

I try to implement multicultural application where users able to change language, date format and etc. I wrote core but it returns Exception: System.InvalidOperationException: Instance is read-only. switch (culture) { case…
Uladz Kha
  • 2,154
  • 4
  • 40
  • 61
4
votes
0 answers

C# Mvc CurrentCulture async issue, wrong language loaded

I've currently an issue with switching languages in MVC while using async This works fine : public ActionResult Index() { Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr"); Thread.CurrentThread.CurrentUICulture =…
4
votes
0 answers

how to override Windows current culture in order to start an application?

I had a .NET application with resources in French, Deutsche and Spanish. Native resources of the application are in English. My computer's UI culture is set at "en-US" therefore when I run the application, the UI is in English. I want to execute…
XtianGIS
  • 967
  • 16
  • 39
4
votes
2 answers

Thread.CurrentCulture refers to client or server

Where does Thread.CurrentCulture gets it's data from? Client (browser) or server. And another question, is this the right way to find out the culture of the user? Thanks
iBiryukov
  • 1,730
  • 4
  • 19
  • 30
4
votes
1 answer

get locale code from current thread culture

I am working with a c# application. If I access the Thread.CurrentThread.CurrentCulture object, and from inspection I find its culture is set to en-GB, how can I access the GB value? I looked at the object and it was not apparent where such was…
amateur
  • 43,371
  • 65
  • 192
  • 320
4
votes
2 answers

MonoTouch: CurrentCulture when "Language" set

On an iPhone, when the user sets their Language to French and their Region Format to United States, the CurrentCulture represents en-US. Only when the user sets their Region Format to France do I get fr-FR; How can I determine the language if the…
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
3
votes
1 answer

C# Tasks, System.Threading.Thread.CurrentThread.CurrentCulture and Microsoft.Office.Interop.Excel

I execute code in Tasks in order to generate excel files. But cells format are still in en-US format. Do Tasks get the CurrentCulture parameter of the Current Thread ? Here some code : Parallel.ForEach(_blablalist, blabla => { …
andoke
  • 184
  • 13
1
2
3
9 10