Solved

Localization in VB.net

Posted on 2004-10-13
6
6,409 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

24 Experts available now in Live!

Get 1:1 Help Now