views:

106

answers:

3

I need to make a form that have to suport two languages (for now). the two languages dont have the same look and also half of the form is not a like but it still have some similiarity beetwen them. what is the best way to deal with this problem in a case of two different languages and above? by the way, the program language that I use is C#.

10x

+3  A: 

First, configure your project default language, you do this in the Project Properties, in the Assembly Information dialog, there's a "Neutral Language" setting at the bottom.

Set this to be your "default" language, the "main" language if you wish.

Then, make sure the form as it is now, is in that language.

To start translating and changing the form to comply with a different language, first set the "Localizable" property of the form to true, and then change the Language property to your second (or third, fourth, etc.) language.

Once you have changed that, you can start making changes. Make sure you don't delete items on the form, instead just set them invisible. Deletion is done for all languages, but invisible will thus only be set for the current language.

Keep switching back and forth between the languages to make adjustments.

To test your program in a specific language, execute this at the start of your Main method:

Thread.CurrentThread.CurrentCulture = new CultureInfo("code of that other language");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("code of that other language");

For instance, to test it with "Norwegian, Bokmål" language, which is my main language, the code you would use would be "nb-NO". To find the code you need to use, once you've changed the language of your form to the language you want to localize for, and saved, a new file will be added to the solution explorer with the right name.

For instance, for Form1, the following files will be present:

Form1.cs
    Form1.designer.cs
    Form1.nb-NO.resx     <-- here's the localized content
    Form1.resx

Now, having done this, there's plenty of other things you need to be aware of when making a localized application, I suggest you go read other questions on SO and on the web with more information, like these:

Lasse V. Karlsen
A: 

See the step by step for winforms localization:
http://urenjoy.blogspot.com/2008/11/windows-form-localization-in-net.html

Brij