views:

330

answers:

2

How can i make my app in a different language, so people can select another language,

I need to translate some buttons, textboxes and labels. Is there a easy way for this?

A: 

It's not easy as in "it's very little work", but it's relatively easy in the "Hey, that's not too hard to understand" way.

Basically, you have to use string resources for different cultures, rather than typing the text into the tags.

I found a fairly straightforward example for you here:

http://www.c-sharpcorner.com/uploadfile/ankithakur/globalization_localization_in_dotnet_csharp07032006023510am/globalization_localization_in_dotnet_csharp.aspx

Of course, if you're just looking for a quick and dirty means of translating stuff for your own use, or to translate text items to go into your resource files, you can always use Babel Fish:

http://babelfish.yahoo.com/

David Stratton
+3  A: 

You need to externalize your string resources. If you wish to localize only form elements, then you can do this directly in WinForms designer within Visual Studio.

First, in the property grid in form designer, set form's Localizable property to true. Then, after setting Language property to desired target languages, set Text values for your labels and textboxes.

VS will extract .languagecode.resx files storing the localized values for you. The localization then occurs automatically at runtime based on user's locale.

If you want to override the setting based on user's preference, set Thread.CurrentThread.CurrentUICulture and CurrentCulture to a CultureInfo instance describing target culture before first form initialization, based on desired language, e.g.

string targetCulture = "de";
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(targetCulture);

Store the target culture value in application Settings or anywhere where you see fit.

Learn more about localization in .NET here

Marek
+1. That's a nice, simple explanation.
David Stratton