Use more than one language in project

Doggo120

Newcomer
Joined
Oct 7, 2011
Messages
23
Location
Colombia
Hey guys!

I'm wondering what would be the best and most efficient way to write my program with two languages (english and spanish); so depending on your selection the *entire* thing would display text, information and such in the corresponding language (something like the picture).

Thanks!
 

Attachments

One possible technique is the use of resource files, these can either be created directly (just add them as a file) when you need to store things like images, strings etc on a locale by locale basis.

A form can also have these auto generated - if you create the basic form and then select it in the designer there is a property called Localizable, if you set this to true then Visual Studio does some work that Visual Basic chooses to hide :(

If you are using VB then you will need to get it to display all files; At the top of the solution explorer there is a button to "show all files" if you select this there should be a little triangle symbol next to the <form name>.vb file, expand this and you should see two files a <form name>.designer.vb and a <form name>.resx - if you open the resx you will see it contains all the strings and positions for the UI elements. This is now effectively the default language for the form. If you are using C# then these should be visible by default.

To support additional languages you can then select the form again and in the property grid look for a property called Language which should be set to 'Default' - if you wish to support say Spanish then simply select this from the list. If you now make changes to the UI you should notice an additional file called <form name>.es.resx is created - this will contain all the Spanish text etc for the form.

This should then set the correct culture based on the user's locale settings, or if you wish to handle it manually then in the application start up you can deliberately force the culture...

I have attached a simple app that should show you the principle working, if you look in the program.cs file you should see me forcing the UI culture and the code culture to spanish...
 

Attachments

Thank u soooooooooo much for your time! I couldn't open the file though, I have Vb.net :P But with the localization thing I have a better idea on how to tackle this issue. Thanks again! :D
 
Back
Top