Solved

Multi Language Applications

Posted on 1997-08-01
7
239 Views
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
0
Comment
Question by:rjorgy
  • 4
  • 3
7 Comments
 
LVL 3

Accepted Solution

by:
dansari earned 100 total points
ID: 1429183
Richard,

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)
next

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 - daniel@cherniak.on.ca

Hope this helps.
0
 

Author Comment

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

Author Comment

by:rjorgy
ID: 1429185
I will let you know how it works out.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:rjorgy
ID: 1429186
I will let you know how it works out.
0
 
LVL 3

Expert Comment

by:dansari
ID: 1429187
Correction:

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

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

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

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.
0
 
LVL 3

Expert Comment

by:dansari
ID: 1429188
Damn, that should be

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

Iterative programming.
0
 

Author Comment

by:rjorgy
ID: 1429189
Thanks again
                 Dick
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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