Solved

Localization in VB.net

Posted on 2004-10-13
6
6,406 Views
Last Modified: 2010-04-21
I need to write a winforms app that is going to be distributed in 3 languages,
so ALL the text in my app should be in those 3 languages. What is the best way to approach this.

Somehow I would like one solution that I want to build in either of the 3 languages
0
Comment
Question by:RonaldBiemans
6 Comments
 
LVL 7

Expert Comment

by:J_Mak
ID: 12295647
It would all begin with Inheritnace.... each form that you create with one language must have similar charateristics with those in another language. So the best way to start off is to create forms that have common properties with all 3 languages. The customised forms for a certain language then inherit from the parent form and change it as it sees fit. Have constants for all 3 so that when you build (like for labels, text boxes, etc), it can choose from either. It is much more complicated than this, but this would be a start.
0
 
LVL 6

Accepted Solution

by:
etmendz earned 200 total points
ID: 12295802
I have two ways in mind:

1) You can use resources which is inherent to .Net since v1.0. Easiest to maintain and deploy. Read more from the following articles:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpqstart/html/cpsmpnetsamples-howtoresources.asp
http://samples.gotdotnet.com/quickstart/aspplus/default.aspx?url=%2fquickstart%2fhowto%2fdoc%2fuseresources.aspx
http://www.c-sharpcorner.com/Code/2004/Jan/GloblizationInDotNEt.asp

2) You can also use a database that supports unicode data. Then use the database to store a list of keys and translated values. On application startup or when the language setting is changed, you can (re)load the labels/messages to a global collection/dictionary. Note that there are some memory overhead here...

Choose the approach you are comfortable with.

Have fun...
0
 
LVL 18

Assisted Solution

by:armoghan
armoghan earned 200 total points
ID: 12295845
I dont get it exectly. It seems simple.

why dont you just make the Localizable property of the Forms true and Language = XYZ for different forms and make different Resx file, they will be kept in different DLLs so that they can be loaded when the language is changed.
If you want to chnage the language at runtime,
Instead of insitalizing all the components in initilizeComponents make a custom method which takes language as an argument, So when you, lets say, chnage the language from the menu, a listener will be attached to all the forms and that it called and they initialzie the components again in different languages,

0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 14

Assisted Solution

by:ptakja
ptakja earned 100 total points
ID: 12296655
armoghan is right, (and that is the best way to go) but that only covers the form UI elements. There are still error messages, text displayed in message boxes, status bar messages, etc...for that you would need to add a resource file (one for each language) that has key/value pairs in it.

In your code you create an instance of a ResourceManager object which gives you access to the resource file.

By default, your app will attempt to run under the language Windows is running in. If you don't have resources for that language (and you haven't set up your forms to run in that language (as armoghan suggests)) you need to provide a fallback to some default language.

The book "Programming Microsoft Visual Basic .NET" by Franceso Balena has an excellent chapter on localization and the new things that came with .NET to make this much simpler than it used to be with VB6.

Good luck!
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12319161
Thanx.
Glad to help the person on number 1 :)
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 31365748
what about lookup tables? or should i also use resources?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now