Multi Language Applications

Posted on 1997-08-01
Last Modified: 2009-04-17
We are a system integrator writing applications for industrial control systems using Visual Basic "Man Machine Interfaces" (MMI) and C++ for most control functions.  We have had numerous requests to provide multi-language MMI’s .  These are Client/server applications using Windows NT the standard TCP/IP network services.

Previously we supplied many non-windows based systems using an industrial 68000 based computer programmed in "Forth".  We supplied systems for English/Spanish, English/French, English/Polish, and English/Russian.  To accomplish this, we stripped out all the text in both the MMI and the reports, built a file with English statements and corresponding "Second Language" statements.  We then were able to, by means of a "Two Position" selector switch, switch from one language to the other.

I am looking for any products or ideas that will assist me in this type of system. Any ideas???
                                           Richard Jorgensen
Question by:rjorgy
  • 4
  • 3

Accepted Solution

dansari earned 100 total points
ID: 1429183

The best way the have a multi-language interface in VB, where the user can switch between languages from within the program, is this:

Make up a .res (resource) file using Visual C++ or another tool, and store all the English phrases (used for labels, message boxes, etc) beginning from ID 0, say, and all the French strings from 10000, say.  In the VB program, assign the Tag property of a label control to the ID from offset 0 that describes the label in English.  If the user has French selected, then add 10000 to the Tag value of that label to get the French description.

In the Form_Load event, loop through all the controls in the form with:

for each ctl in controls
  ctl.label = LoadResString(ctt.Tag + nLanguageBase)

You might want to put this in a separate routine that is called from Form_Load as well as from the place where the user switches to another language.

Since you can have only one .res file in a VB project, strings for all the languages must be in that one file - you can't have multiple .res files, each containing strings for one language.  That's why you must use the offset nLanguageBase (10000 for French, in this example).

If you need further clarification, don't hesitate to contact me -

Hope this helps.

Author Comment

ID: 1429184
I will let you know how it works out.

Author Comment

ID: 1429185
I will let you know how it works out.
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!


Author Comment

ID: 1429186
I will let you know how it works out.

Expert Comment

ID: 1429187

Here's some code I found somewhere, (better version of the above):

me.caption = loadresstring(cint(me.tag))

for each ctl in me.controls
  if isnumeric(ctl.tag) then
    if err = 0 then
      ctl.caption = loadresstring(cint(ctl.tag) + nLanguageBase)
    end if
  end if

So, for all controls on the form that *do* have a numeric Tag property value, this code will attempt to load the resource string into that control's caption.

Expert Comment

ID: 1429188
Damn, that should be

me.caption = loadresstring(cint(me.tag) + nLanguageBase)

Iterative programming.

Author Comment

ID: 1429189
Thanks again

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VBA to format 3 80
Problem to the message 13 63
Access 2016 VB code 9 86
message box in access 4 34
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 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

22 Experts available now in Live!

Get 1:1 Help Now