?
Solved

Multi Language Applications.

Posted on 2011-04-29
7
Medium Priority
?
1,228 Views
Last Modified: 2012-05-11
Hi, I'm using VB.NET 2010 (VS.NET 2010), WinForms. Has anyone found an easy way to create multi-language applications, whereby you don't have to change the Text property of each of your labels one-by-one? In other words, I'd like to create a label for 3 languages. Perhaps English, Spanish and French. I'd like to be able to allow the user to select his/her language of preference. So, if they select Spanish from a global options screen, then all the labels on each Form would switch to Spanish (not the data, just the labels). I'm sure there is some sort of database in  the background that will contains all the translations for each label, but I'd like to see how others have handled this matter (short of writing 3 different applications).

Thanks,
Fulano
0
Comment
Question by:Mr_Fulano
  • 4
  • 2
7 Comments
 
LVL 16

Assisted Solution

by:Kalpesh Chhatrala
Kalpesh Chhatrala earned 800 total points
ID: 35496560
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1200 total points
ID: 35496818
0
 

Author Comment

by:Mr_Fulano
ID: 35498287
Hi Emereau, your solution is what I was looking for, but it doesn't seem to work with VB2010. Once I get to step (Adding a new supported language), the process changes. Your approach does not work.

Any thoughts?

Thanks,
Fulano
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Mr_Fulano
ID: 35498299
Hi kalpesh2804, the same that I mentioned to Emereau goes for your suggestion. I think VB2010 is different than what we had in earlier editions of VB.NET. The approach here did not work for me. Any thoughts?

Thanks,
Fulano
0
 

Author Comment

by:Mr_Fulano
ID: 35498472
OK...I think I figured it out. There are some differences in the way it behaves from earlier versions and in 2010. I realized that you have to actually change the values of the text properties for the resource file to be created, otherwise it never gets created. Below is the code that goes in the code behind.

Thanks for both your help,
Fulano
Imports System.Globalization
Imports System.Threading
Imports System.Resources

Public Class Form1
    Public Sub New()
        MyBase.New()
        System.Threading.Thread.CurrentThread.CurrentUICulture = New CultureInfo("es") 'Spanish
        'System.Threading.Thread.CurrentThread.CurrentUICulture = New CultureInfo("en") 'English (which was my Form's default language).

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub


End Class

Open in new window

0
 

Author Closing Comment

by:Mr_Fulano
ID: 35498478
Both solutions helped me find an ultimate solution. Thanks for your help.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 35498480
it changed a bit.

-create your interface and set the values for your default language
-set your form's Localizable property to true
-set the form's Language property to the language you want to support.
-set the text values of any controls (labels, buttons, ...) to the new language
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question