By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

Dual language interface

P: n/a
OM
Hi,

I have a simple Access application, for recording fuel use, and generating a
few reports. It is necessary that the forms (such as the menu, and data
entry forms) be in Thai as well as English.

There are 4 ways that I have imagined how to do this, but I'm not sure which
are practical, or easiest etc.

1. I was considering just adding the Tai to the existing labels and
controls, so each had both languages, but Thai is a difficult language
(actually needs up to 4 lines per letter), and some of the entries got
pretty unwieldy.

2. I then considered having all the labels etc duplicated, one set in Thai,
one set in English, and a button on the Main Menu, that allowed the other
language to be used. My thoughts on this were that I could have 2 labels,
one on top of the other. Only one would be enabled at a time, and clicking
on that one would enable the second, make it visible, disable the clicked
one, and make it invisible. The whole form would be somewhat the same, with
duplicated controls, one set in each language, that are enabled and made
visible, depending on which button is pressed on the Main Menu (actually,
could have a button on each form, but I would need to make the change
permanent until the language change button is pressed a second time,
otherwise the user would have to click on every form opened).

3. The next thing I considered was having 2 complete sets of forms, one set
in English, one in Thai. When the user clicked (say) the Thai button on the
main menu, the program branched (not sure if thats the right term) to the
Thai set. The user would have to go back to the main menu to change to the
other language.

4. Last I have all the text for controls, labels etc, in a table. One field
is the English text, the other is the Thai. A button on every form would
switch between the two languages, by changing the labels and controls
source, from field 1 to field 2, or vice versa.(This would have the
advantage of being able to use more languages - just enter the
menu/label/control equivalents in each languuage).

Question.
Which way is "best" ? Note that I am something of a beginner in coding, but
can struggle by. If anyone knows of any code examples available, it would be
a help.

Thanks,

Robert Lepper
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hello,

I would prefer the 4. Method.
As you mentioned it will give you more fexibility (Adding new languages
correct spelling errors etc) but there will be a lot of work.

One suggestion of implementing this feature

store the appropriate language value in a global variable
For each label place a unique string (id) in the "tag" property
create a table named labels
uniqueid text(64)
language long integer
labeltext text(255) 'to enter the text

create a query "GetCaption" with sql
"Parameters enterid text, enterlanguage long; Select labeltext from labels
where uniqueid=enterid and language=enterlanguage"

place a public sub in a moudule.
Public Sub GetLabel(myForm as object)

'Data objectdefinitions -depending on ado,dao or rdo
'assuming dao

dim dbdatabase as database
dim rsdata as recordset
dim qrylanguage as querydef

set dbdatabase=currentdb()
set qrylanguage=dbdatabase.querydefs("GetCaption")

'Declaring other objects and variables
ctControl as control

for each ctcontrol in myform.controls
if control is typeof label then
qrylanguage("enterid")=control.tag
qrylanguage("enterlanguage")=choosenlanguage 'the global variable
set rsdata=qrylanguage.openrecordset
if rsdata.eof then
'No entry for language/tag combination here leave caption unaltered
else
control.caption=rsdata("labeltext")
endif
endif
next

end sub

In each forms/reports Load-event call this sub with
call getlabel(me)

Never tried this for myself, but with some fine tuning it should work

HTH
Karpi
<fluctuat nec mergitur>

Am Sat, 03 Apr 2004 10:19:17 +0700 schrieb OM:
Hi,

4. Last I have all the text for controls, labels etc, in a table. One field
is the English text, the other is the Thai. A button on every form would
switch between the two languages, by changing the labels and controls
source, from field 1 to field 2, or vice versa.(This would have the
advantage of being able to use more languages - just enter the
menu/label/control equivalents in each languuage).

Question.
Which way is "best" ? Note that I am something of a beginner in coding, but
can struggle by. If anyone knows of any code examples available, it would be
a help.

Thanks,

Robert Lepper


Nov 12 '05 #2

P: n/a
"Hans-Joerg Karpenstein" <hj***********@web.de> wrote in message
news:pa****************************@web.de...
Hello,

I would prefer the 4. Method.
As you mentioned it will give you more fexibility (Adding new languages
correct spelling errors etc) but there will be a lot of work.

One suggestion of implementing this feature

store the appropriate language value in a global variable
For each label place a unique string (id) in the "tag" property
create a table named labels
uniqueid text(64)
language long integer
labeltext text(255) 'to enter the text

create a query "GetCaption" with sql
"Parameters enterid text, enterlanguage long; Select labeltext from labels
where uniqueid=enterid and language=enterlanguage"

place a public sub in a moudule.
Public Sub GetLabel(myForm as object)

'Data objectdefinitions -depending on ado,dao or rdo
'assuming dao

dim dbdatabase as database
dim rsdata as recordset
dim qrylanguage as querydef

set dbdatabase=currentdb()
set qrylanguage=dbdatabase.querydefs("GetCaption")

'Declaring other objects and variables
ctControl as control

for each ctcontrol in myform.controls
if control is typeof label then
qrylanguage("enterid")=control.tag
qrylanguage("enterlanguage")=choosenlanguage 'the global variable
set rsdata=qrylanguage.openrecordset
if rsdata.eof then
'No entry for language/tag combination here leave caption unaltered
else
control.caption=rsdata("labeltext")
endif
endif
next

end sub

In each forms/reports Load-event call this sub with
call getlabel(me)

For reasons of performance, opening a separate recordset for each label is
probably not a good idea. I suggest using another column in your
translations table to hold the form name. When you open the form, create a
fast-forward recordset of language-specific translation data for that form
and run through the recordset once. This example uses ADO and a sql server
translations table but it should give you the general idea: Note that the
translations table also has a column "properties" so you can translate
different control properties such as ControlTipText, StatusBarText, Caption
etc.
Sub SetLanguage(frm As Form, lang As String)

Dim cmd As ADODB.Command
Dim rst As ADODB.Recordset
Dim sql As String

sql = "SELECT controlname, propname, " & lang & " AS language FROM
dbo.translations WHERE objname = '" & frm.Name & "'"
Set rst = New ADODB.Recordset
rst.Open sql, CurrentProject.Connection, adOpenForwardOnly,
adLockReadOnly, adCmdText
Do Not While rst.EOF
If rst("language") <> "" Then
If rst("controlname") = frm.Name Then
' form property
frm.Properties(rst("propname")).Value = rst("language")
Else

frm.Controls(rst("controlname")).Properties(rst("p ropname")).Value =
rst("language")
End If
End If
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set frm = Nothing

End Sub







Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.