I have a question about creating a multi-language application and the use of resource files. I will explain what I have done and what I would like the final product to be like.
I am doing this in VB.Net and using Visual Studio 2008
After creating a new project, I added a resource file to the project (Add -> New Item, Selected Resource File, named it Resource1.resx).
I then double clicked the resource file and was able to add some names and values. For example,
Name – lblFirstName, value – John Name – lblLastName, value – Smith
On my form, I have 2 labels: FirstName, and LastName
In Code, I added
FirstName.Text = My.Resources.Resource1.lblFirstName
LastName.Text = My.Resources.Resource1.lblLastName
If I run this code, it works fine. John and Smith are displayed on the labels.
Now for my question. Say instead of first and last name the labels (buttons, menu items, etc.) were actually words that would be different in different languages. What I would like is to have something like
EnglishText.resx SpanishText.resx GermanText.resx
Each resource file would contain the same names, just different values. Depending on what language was selected, decided by the user (from a menu), how can I get the matching resource file to be used.
Basically what I want would be
FirstName.Text = My.Resources.<Language Specific Resource File>.lblFirstName
Is something like this possible? Is this an acceptable approach? Is there a better way of doing this?
Any tips or advice would be greatly appreciated. I try to check often to see if there are follow up questions or if more information needs to be provided.