Changing the Culture of the System

Asked

Viewed 1,991 times

5

Developing a system for a Bolivian company, in a windows with Culture pt-BR, some objects like datetimepicker has its internal components according to the language in which the system was installed.

And in my case, when this system was installed in Bolivia, no windows will have as Culture es-BO, soon would need a way via code that the Culture exchange is made so that these objects have their components with Spanish text and not with Culture and that the system was installed.

According to the documentation http://msdn.microsoft.com/en-us/library/b28bx3bh(v=vs.110). aspx this Culture exchange must occur before the components are initialized (InitializeComponent()) with the following lines of code:

Thread.CurrentThread.CurrentCulture = new CultureInfo("es-BO");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-BO");

But even using this solution, my result remained the texts of the object all in Portuguese.
The exchange happens, but the system "automatically" returns Ulture to the initial? or am I making this change in the wrong way?

  • Do you want the . Net specific texts to be in Spanish? Do they appear in your application? Are the texts you created for your application ok? You used Resources or wrote the raw text in the application? The . Net installed on the machines is located in Spanish?

  • are the texts that depend on the language of the system, for example, the datetimepicker when clicked, its texts in en-br would be, example: "September", "Today", "Tuesday".

  • I want to exchange these texts that depend on the language of the system

  • Right away I can only imagine there’s a problem in deploy of the . Net on these machines, possibly missing the Resources from the . Net to es-BO. Do you know which languages are installed on the machine? Tried others, English for example?

  • even using en-US he does not exchange.

  • Look inside the C:\Windows\Microsoft.NET\Framework\vX.Y.ZZZZZ. See if you have some folders with 4 digit names. See the numbers there. 1033 for example is the en-US. It needs to exist for other languages. This is a possible problem. But if 1033 exists and it didn’t work with en-US, the problem is another and I still can’t imagine what it could be.

  • has the 1033, and also the 1046, which is probably the en.

  • That. In es-BO will not show even, there are no files with the texts. But still intrigues me not to have shown in English. My only experience with this was a quick test a long time ago and it had worked.

  • for now, in my testing machine I put the language manually to Spanish(Bolivia), there yes everything is the way it should

  • @Enzotiezzi Just so I can locate myself: what is the technology of your application?

  • desktop application, doing in windows form same.

Show 6 more comments

2 answers

4


The fact is that the technique of changing the Thread.CurrentThread.CurrentCulture and the Thread.CurrentThread.CurrentUICulture does not work for the control DateTimePicker and for control MonthCalendar, as explained by Microsoft itself:

The Datetimepicker and Monthcalendar control do not reflect the Currentuiculture Property

According to the article, these controls take into account only the system settings in the control panel. Thus, to change them, it is necessary to effectively change the entire system settings.

Proof of this, is that if you change the Thread.CurrentThread.CurrentCulture and the Thread.CurrentThread.CurrentUICulture, for "en-US", for example, the control NumericUpDown will effectively respect your choice by changing the thousand and decimal separator, according to.

Thus, one can say that the technique works for "almost" everything... except for the controls DateTimePicker and MonthCalendar (and possibly others that are tied to the system configurations).

0

My application presented the same problem. The problem was solved when I did so:

Thread.CurrentThread.CurrentCulture = new CultureInfo("es-BO", true); Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-BO", true);

  • Tomorrow arriving on my work PC I already test and give you the answer

  • 1

    @Will Enzotiezzi be able to sleep? : P

  • Okay, check if it helps you. Anything, comment here!

  • I slept quiet @Tiagocésaroliveira hehehe, and it still hasn’t, I even tested with en-USand yet

Browser other questions tagged

You are not signed in. Login or sign up in order to post.