Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i18n in windows forms

Status
Not open for further replies.

DevinWhalen

Programmer
Jan 22, 2008
4
0
0
CA
Hello,

I am trying to find some tutorials/examples on internationalizing a C# app in visual studio 2010. Can anyone point me in the right direction? I have been searching but the stuff I find is for vs 2002, anything current?

What I gather, is that I am going to have to create a .resx file for each language I want but I am not sure how to set up with windows form to reference this. This seems similar to creating properties files in Java, but it is the hooking it into the form that I am having a problem with.

If you can't tell, I am new to c#. I have built some command line programs but haven't done much with windows forms. I have a couple books on c# but they don't have much on windows forms.

Thanks for any help.
 
I haven't done any localization work myself, but the concept behind resource files and multilingual works like this.
1. a resource (resx) file per language
2. each resource contains the same keys, only the values change

you create a resource manager which will reference any of the given resource files in the system. typically this would be set when the application 1st starts, or the system is configured. then you can reference the keys to use that language. for example

Code:
var local = GetLocalLanguage();
ResourceManager.SetLanguageOfChoice(local);
Code:
ALabel.Text = ResourceManager.TextForLabelA;
An example of this is found in the Castle Validator project.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Thanks for your response.

It seems easier than I thought. I just have to choose a language for the form item and visual studio handles created the resources file and linking them for me. But for any non-form related text I will have to load the resource manager like you said.

Thanks.
 
even better :)

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top