Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the current culture of the entire windows forms application .NET Compact Edition

I need to change the current culture of the application to th-TH I have tried to do this to create an object of the following type and I intend to assign it to the current thread's CurrentCulture Property

System.Threading.Thread.CurrentThread.CurrentCulture = 
    new System.Globalization.CultureInfo("en-US");

But the .NET Compact edition that I am using does not have the CurrentCulture property available in the System.Threading.Thread.CurrentThread property.

Is there a way in which we can do this?

Edit : I can change the Regional setting of the Mobile device and then when I run the application I am able to get the Correct text from the correct resource files.

But I am not able to get the correct resource when Install the application using a setup project

This is what I have done.

  1. I Created the Setup project and I included the Localized resources, Primary output and also the Content file to the Application folder in the file system directory of the setup project.
  2. I then built it under Debug Mode and the Required Cab files were generated.
  3. I transfered the file to my device and then ran the cab file and it says installation successfull.
  4. When I run the application it displays the strings only in English language irrespective of the regional settings on the device (But the correct strings from the language resource are displayed in the app when I run the same application in the Debug mode by directly selecting the device in visual studio and deploying the application on it)

I have also verified that the reqired folders such as fr-CA,th-TH etc are being created in the same directory where the .exe of my application is present

like image 270
Vishweshwar Kapse Avatar asked Apr 15 '15 08:04

Vishweshwar Kapse


1 Answers

According to MSDN, this is impossible.

You cannot set current culture programmatically on a device. They are set by the device manufacturer or manually configurable by the device user, such as with Regional Settings on a Pocket PC running Windows CE or Windows CE .NET, current culture settings are on a per-device basis.

However, I did find an article on Code Project that proposed a solution to this problem.
Basically, the author created his own ResourceManager and base form, meaning this solution will probably not be very easy to apply to existing compact framework applications.

Depending on your application's complexity you might want to consider implementing some kind of ResourceManager yourself, or use the one from the Code Project article.

like image 91
Zohar Peled Avatar answered Oct 22 '22 03:10

Zohar Peled