Ashish Sharma
Ashish Sharma

Reputation: 387

Localizing of C# Win Forms

I am developing a WinForm application which require localization. If I try to set the Localizable property of the form to True and set the text for all the languages then every thing works fine.

What I want is to maintain all languages resource files in a separate folder (one file for each form).

-Project
   -Resources
      -Language
          frmFirstForm.en-US.resx
          frmFirstForm.en-GB.resx
          frmSecondForm.en-US.resx
          frmSecondForm.en-GB.resx
   frmFirst.cs
   frmSecond.cs

In my resource file I have defined all strings as follows:

**Key              Value**
lblName          Name
lblAddress       Address
.....

The key is my control names, I will also keep form specific strings in the resource files. Now the issue is when I compile the solution, it do generate the language files but while running the application it just displays the default values. I don't even know whether the localized resource file is loaded or not. Also, though I have specified two separate form files but while compiling the system is generating only one single resource file per language for a project (means no separate resource file for FirstForm and SecondForm).

Is there any way where the form controls are changed as per the specified localized thread?

I have already added the following line in my main application Program.cs file:

Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;

Please suggest me how to proceed with this..

Upvotes: 2

Views: 2901

Answers (1)

csLijo
csLijo

Reputation: 501

@Ashish : this is what you want exactly!!!!

Upvotes: 1

Related Questions