Solved

Localization in VB.net

Posted on 2004-10-13
6
6,423 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: 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!

 
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

Technology Partners: 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!

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

729 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