Hi,
I am writing an application in VB6.0 that will have the option to
select the language. For instance when Spanish is selected all the
text on the program interface will display in Spanish.
This is easy to do for the majority of the text on a form. I just put
the following code in Form_Load:
If language = “English” then
CmdOK.Caption = “OK”
etc
Elseif language = “Spanish” then
CmdOK.Caption = “Aceptar”
etc
End if
However I have a problem with the main drop down menu (i.e.
File/Edit/View etc). I did something similar to the above to change
the text however there are two other problems that I cannot see any
solution to:
1. I want underscores under letters in the various options so I can
activate the option with Alt+Letter. This is normally done in the menu
editor by placing a & in front of the letter. This does not seem to
work when I change the caption at run time. The & seems to be ignored.
2. For a given option in the menu the standard shortcut for English
and Spanish are different. For example Open (Ctrl+O) in English and
Abrir (Ctrl+A) in Spanish. How can I change the shortcut at run time ?
I not the first person to write a multilingual program … how is
this normally done – am I going about this in the right way ?
Thanks,
Stephen 3 6506
Inline :-
On 21 Oct 2003 14:32:03 -0700, sm*********@yahoo.com (smjmitchell)
wrote: Hi,
I am writing an application in VB6.0 that will have the option to select the language. For instance when Spanish is selected all the text on the program interface will display in Spanish.
This is easy to do for the majority of the text on a form. I just put the following code in Form_Load:
This looks very odd - are you using VB.NET ?
Or is your Newsreader playing up ?
If language = “English” then CmdOK.Caption = “OK” etc Elseif language = “Spanish” then CmdOK.Caption = “Aceptar” etc End if
I really would not write the code like that, it is asking for problems
- the stuff becomes plain unreadable
The way I wrote a multi-lingual system was by using a Lexicon
Command1.Caption = Lex( "Click Ok" )
Lex() nips of to a string holding something like an INI file, and
either returns the Spanish, or - if not found - returns the English,
and adds the word/phrase to the file
- that way one just translates the data in the file However I have a problem with the main drop down menu (i.e. File/Edit/View etc). I did something similar to the above to change the text however there are two other problems that I cannot see any solution to:
1. I want underscores under letters in the various options so I can activate the option with Alt+Letter. This is normally done in the menu editor by placing a & in front of the letter. This does not seem to work when I change the caption at run time. The & seems to be ignored.
I've just tested it and the & is not ignored in VB5
2. For a given option in the menu the standard shortcut for English and Spanish are different. For example Open (Ctrl+O) in English and Abrir (Ctrl+A) in Spanish. How can I change the shortcut at run time ?
In VB5 only bottom level menu items can have 'design time' Shortcuts
- and these cannot be altered at run time
However you can make a menu items Enabled property False
- also you can set their Visible property to False
Personally I would design one menu with each line repeated twice
- both in English
- each having a different design Shortcut
- each being a member of a Control Array
eg: mnuFile(0)
mnuFile(1)
mnuClose(0)
mnuClose(1)
In one routine, I would run through all the Menu controls, setting the
Visible property to True or False depending on the language
- and using Lex() to get the Caption (for consistency)
Because each Menu Item is a member of a Control Array, the Click event
will run the same code
Actually you only really need to bother with using Control Arrays for
the bottom level menus
An alternative method would be to use the Tag property
- hmm - that would probably be much simpler
Private Sub Command2_Click()
Dim C As Control
Dim English As Boolean
For Each C In Me.Controls
If TypeOf C Is Menu Then
Select Case C.Tag
Case "E": C.Enabled = English
C.Visible = English
Case "F": C.Enabled = Not English
C.Visible = Not English
End Select
End If
Next
End Sub I not the first person to write a multilingual program … how is this normally done – am I going about this in the right way ?
Basically I strongly recommend that you write the system in your
native language, and just have one point where you pick up the
translation
To solve the Menu design time shortcut problem simply have two menu
entries and hide the irrelevant one.
Thanks for the detailed reply ... I will give this a go.
Yeap .. the Google newsreader facility is plying up hence the weird
characters in the code .. they should have been quotation marks.
Steve er*****@nowhere.com (J French) wrote in message news:<3f***************@news.btclick.com>... Inline :-
On 21 Oct 2003 14:32:03 -0700, sm*********@yahoo.com (smjmitchell) wrote:
Hi,
I am writing an application in VB6.0 that will have the option to select the language. For instance when Spanish is selected all the text on the program interface will display in Spanish.
This is easy to do for the majority of the text on a form. I just put the following code in Form_Load:
This looks very odd - are you using VB.NET ? Or is your Newsreader playing up ?
If language = “English” then CmdOK.Caption = “OK” etc Elseif language = “Spanish” then CmdOK.Caption = “Aceptar” etc End if I really would not write the code like that, it is asking for problems - the stuff becomes plain unreadable
The way I wrote a multi-lingual system was by using a Lexicon
Command1.Caption = Lex( "Click Ok" )
Lex() nips of to a string holding something like an INI file, and either returns the Spanish, or - if not found - returns the English, and adds the word/phrase to the file - that way one just translates the data in the file
However I have a problem with the main drop down menu (i.e. File/Edit/View etc). I did something similar to the above to change the text however there are two other problems that I cannot see any solution to:
1. I want underscores under letters in the various options so I can activate the option with Alt+Letter. This is normally done in the menu editor by placing a & in front of the letter. This does not seem to work when I change the caption at run time. The & seems to be ignored.
I've just tested it and the & is not ignored in VB5
2. For a given option in the menu the standard shortcut for English and Spanish are different. For example Open (Ctrl+O) in English and Abrir (Ctrl+A) in Spanish. How can I change the shortcut at run time ?
In VB5 only bottom level menu items can have 'design time' Shortcuts - and these cannot be altered at run time
However you can make a menu items Enabled property False - also you can set their Visible property to False
Personally I would design one menu with each line repeated twice - both in English - each having a different design Shortcut - each being a member of a Control Array eg: mnuFile(0) mnuFile(1) mnuClose(0) mnuClose(1)
In one routine, I would run through all the Menu controls, setting the Visible property to True or False depending on the language - and using Lex() to get the Caption (for consistency)
Because each Menu Item is a member of a Control Array, the Click event will run the same code
Actually you only really need to bother with using Control Arrays for the bottom level menus
An alternative method would be to use the Tag property - hmm - that would probably be much simpler
Private Sub Command2_Click() Dim C As Control Dim English As Boolean
For Each C In Me.Controls If TypeOf C Is Menu Then Select Case C.Tag Case "E": C.Enabled = English C.Visible = English Case "F": C.Enabled = Not English C.Visible = Not English End Select End If Next End Sub I not the first person to write a multilingual program … how is this normally done – am I going about this in the right way ?
Basically I strongly recommend that you write the system in your native language, and just have one point where you pick up the translation
To solve the Menu design time shortcut problem simply have two menu entries and hide the irrelevant one.
On Wed, 22 Oct 2003 08:21:35 +0000 (UTC), J French <[email deleted]>
wrote: This looks very odd - are you using VB.NET ? Or is your Newsreader playing up ?
If language = “English” then CmdOK.Caption = “OK” etc Elseif language = “Spanish” then CmdOK.Caption = “Aceptar” etc End if
OP probably wrote this in Word, with its "smart quotes" (oxymoron if
I've ever heard one) turned on, and then pasted into Google.
--
auric "underscore" "underscore" "at" hotmail "dot" com
*****
Bigamy: one wife too many. Monogamy: same idea. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: J?rg Keller |
last post by:
Hi all
I have to localize an Access 2002 application: The application using
several form, tables etc. is currently only in English. Now the
frontend has to be bilingual, so the user can choose...
|
by: kuldeep |
last post by:
Hi all,
I am devloping a multilingual application in which I am storing string
(these strings are used as text for UI controls) in various languages like
hindi,english etc in resource files. The...
|
by: Jim Adams |
last post by:
Anyone have any insights into this?
I'm planning an upgrade to an existing ASP.Net project to support
multiple display languages (e.g. English, Spanish, ...).
I'd like to use a solution that...
|
by: Manfred Kooistra |
last post by:
I am building a website with identical content in four different
languages. On a first visit, the search engine determines the language
of the content by the IP address of the visitor. What the...
|
by: balaki |
last post by:
Hi All,
I have a Multilingual VB6 application, which rightnow supports French language. When I debug the code, it works in French, by changing the regional settings - locale to French(France)....
|
by: Luc The Perverse |
last post by:
Hello! I am looking for a good way to make an application multilingual.
Danish/English for now (but I don't want to preclude more than two languages
eventually) Every dialog will have an option...
|
by: raju |
last post by:
Hai all,
I am working on the multilingual application, in asp.net. In
that we are displaying contents in some other language (user selected
language). In that page, we are having some textbox...
|
by: PrateekArora |
last post by:
Hi Guys,
I need to develop a MultiLingual Application (Arabic & English) in VB.NET, as far as Labels and captions are concerned in User Interface I am done with that using Resource Manager Class &...
|
by: Abhijit D. Babar |
last post by:
I have to create a multilingual application in Visual c++ .net 2008.
I have a Windows form application and i want to run this on
multilingual support. So how can i do this. Which change i have...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |