OVH Cloud OVH Cloud

Rendre une application multilingue

12 réponses
Avatar
codial
J'ai une application sous access 2000 qui a été validée mais je dois pouvoir
la rendre multilingue, les menus et les titres des formulaires et au moins
français/Anglais. Quelqu'un a t il déja fait celà et comment? D'avance merci
Codial

2 réponses

1 2
Avatar
codial
Merci pour cette réponse détaillée je vais tester celà.
Merci beaucoup

Codial

"Saintor" a écrit dans le message de news:
M1zgb.44281$
Pour compléter, j'utilise une solution un peu différente et moins
peaufinée

qui permet d'avoir une solution bilingue "On-The-Fly" français-anglais.

Elle comporte quatre éléments;
(1) Une variable sLang avec valeur "F" ou "E" que je garde dans un
contrôle

de formulaire caché frmDetectIdleTime.



(2) Une table tblLang avec les traductions par contrôle avec les champs
suivants;
FormName
CtlType
CtlName
CtlProp
CtlValue_EN
CtlValue_FR



(3) Une routine qui va populer cette table
Private Sub EnumAllFormProps()

On Error Resume Next

Dim doc As Document
Dim db1 As DAO.Database, rs1 As DAO.Recordset
Dim frm As Form
Dim ctl As Control
Dim prop As Property
Dim strx As String
Const gsdskip = vbCrLf & vbCrLf
Dim X As Integer

Set db1 = CurrentDb()
Set rs1 = db1.OpenRecordset("tblLang")

For Each doc In db1.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign
Set frm = forms(doc.Name)
For Each ctl In frm.Controls
For Each prop In ctl.Properties
Select Case ctl.ControlType
Case acCheckBox, acCommandButton, acLabel, acOptionGroup,
acTextBox,

acPage
If prop.Name = "Caption" Or prop.Name = "ValidationText" Then
GoSub

Add_record

Case acListBox, acComboBox
If prop.Name = "Caption" Or prop.Name = "ValidationText" Or
prop.Name = "ColumnWidths" _
Then GoSub Add_record

Case Else
End Select

Next prop
Next ctl
DoCmd.Close acForm, doc.Name
Next doc

GoTo exit_EnumAllFormProps

Add_record:
rs1.AddNew
rs1!FormName = frm.Name
rs1!CtlType = ctl.ControlType
rs1!CtlName = ctl.Name
rs1!CtlProp = prop.Name
rs1!CtlValue_EN = VBA.Left(prop.Value, 100)
rs1.Update
rs1.Bookmark = rs1.LastModified
Return

exit_EnumAllFormProps:
Set prop = Nothing
Set ctl = Nothing
Set frm = Nothing
Set doc = Nothing
Set db1 = Nothing

End Sub




(4) Une fonction qui va changer le contenu selon la variable en (1(. Je
met

l'instruction suivante dans l'événement form_load de chaque formulaire:
If forms!frmDetectIdleTime!sLang = "F" Then UpdAllFormProps Me,
"CtlValue_FR"


Public Sub UpdAllFormProps(sForm As Access.Form, sLangField As String)

On Error Resume Next

Dim doc As Document
Dim frm As Form
Dim ctl As Control
Dim Prop As Property
Dim sA As String

For Each ctl In sForm.Controls

For Each Prop In ctl.Properties

Select Case ctl.ControlType
Case acCheckBox, acCommandButton, acLabel, acOptionGroup,
acTextBox,

acPage
If Prop.Name = "Caption" Or Prop.Name = "ValidationText" Then
Prop.Value = Nz(DLookup(sLangField, "tblLang", "FormName='" &
sForm.Name & _
"' AND ctlName='" & ctl.Name & "' AND ctlProp='" & Prop.Name &
"'"), "NIET")
End If

Case acListBox, acComboBox
If Prop.Name = "Caption" Or Prop.Name = "ValidationText" Or
Prop.Name = "ColumnWidths" Then
Prop.Value = Nz(DLookup(sLangField, "tblLang", "FormName='" &
sForm.Name & _
"' AND ctlName='" & ctl.Name & "' AND ctlProp='" & Prop.Name &
"'"), "NIET")
End If


Case Else
End Select
Next Prop
Next ctl

Set Prop = Nothing
Set ctl = Nothing
Set doc = Nothing

End Sub



J'utilise aussi la table tblLang pour avec des numéros séquentiels pour
utilisation dans du code. Par exemple,
sM1 = "You have not the authorization to perform this operation."
If Forms!frmDetectIdleTime!sLang = "F" Then sM1 DLookup("CtlValue_F",
"tblLang", "FormName='00056'")
MsgBox sM1, vbExclamation
Exit Function


"codial" wrote in message
news:
J'ai une application sous access 2000 qui a été validée mais je dois
pouvoir

la rendre multilingue, les menus et les titres des formulaires et au
moins


français/Anglais. Quelqu'un a t il déja fait celà et comment? D'avance
merci

Codial








Avatar
codial
Je reviens au sujet de ta réponse, tu n'aurais pas un exemple par hasard??

D'avance merci

Codial

"Saintor" a écrit dans le message de news:
M1zgb.44281$
Pour compléter, j'utilise une solution un peu différente et moins
peaufinée

qui permet d'avoir une solution bilingue "On-The-Fly" français-anglais.

Elle comporte quatre éléments;
(1) Une variable sLang avec valeur "F" ou "E" que je garde dans un
contrôle

de formulaire caché frmDetectIdleTime.



(2) Une table tblLang avec les traductions par contrôle avec les champs
suivants;
FormName
CtlType
CtlName
CtlProp
CtlValue_EN
CtlValue_FR



(3) Une routine qui va populer cette table
Private Sub EnumAllFormProps()

On Error Resume Next

Dim doc As Document
Dim db1 As DAO.Database, rs1 As DAO.Recordset
Dim frm As Form
Dim ctl As Control
Dim prop As Property
Dim strx As String
Const gsdskip = vbCrLf & vbCrLf
Dim X As Integer

Set db1 = CurrentDb()
Set rs1 = db1.OpenRecordset("tblLang")

For Each doc In db1.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign
Set frm = forms(doc.Name)
For Each ctl In frm.Controls
For Each prop In ctl.Properties
Select Case ctl.ControlType
Case acCheckBox, acCommandButton, acLabel, acOptionGroup,
acTextBox,

acPage
If prop.Name = "Caption" Or prop.Name = "ValidationText" Then
GoSub

Add_record

Case acListBox, acComboBox
If prop.Name = "Caption" Or prop.Name = "ValidationText" Or
prop.Name = "ColumnWidths" _
Then GoSub Add_record

Case Else
End Select

Next prop
Next ctl
DoCmd.Close acForm, doc.Name
Next doc

GoTo exit_EnumAllFormProps

Add_record:
rs1.AddNew
rs1!FormName = frm.Name
rs1!CtlType = ctl.ControlType
rs1!CtlName = ctl.Name
rs1!CtlProp = prop.Name
rs1!CtlValue_EN = VBA.Left(prop.Value, 100)
rs1.Update
rs1.Bookmark = rs1.LastModified
Return

exit_EnumAllFormProps:
Set prop = Nothing
Set ctl = Nothing
Set frm = Nothing
Set doc = Nothing
Set db1 = Nothing

End Sub




(4) Une fonction qui va changer le contenu selon la variable en (1(. Je
met

l'instruction suivante dans l'événement form_load de chaque formulaire:
If forms!frmDetectIdleTime!sLang = "F" Then UpdAllFormProps Me,
"CtlValue_FR"


Public Sub UpdAllFormProps(sForm As Access.Form, sLangField As String)

On Error Resume Next

Dim doc As Document
Dim frm As Form
Dim ctl As Control
Dim Prop As Property
Dim sA As String

For Each ctl In sForm.Controls

For Each Prop In ctl.Properties

Select Case ctl.ControlType
Case acCheckBox, acCommandButton, acLabel, acOptionGroup,
acTextBox,

acPage
If Prop.Name = "Caption" Or Prop.Name = "ValidationText" Then
Prop.Value = Nz(DLookup(sLangField, "tblLang", "FormName='" &
sForm.Name & _
"' AND ctlName='" & ctl.Name & "' AND ctlProp='" & Prop.Name &
"'"), "NIET")
End If

Case acListBox, acComboBox
If Prop.Name = "Caption" Or Prop.Name = "ValidationText" Or
Prop.Name = "ColumnWidths" Then
Prop.Value = Nz(DLookup(sLangField, "tblLang", "FormName='" &
sForm.Name & _
"' AND ctlName='" & ctl.Name & "' AND ctlProp='" & Prop.Name &
"'"), "NIET")
End If


Case Else
End Select
Next Prop
Next ctl

Set Prop = Nothing
Set ctl = Nothing
Set doc = Nothing

End Sub



J'utilise aussi la table tblLang pour avec des numéros séquentiels pour
utilisation dans du code. Par exemple,
sM1 = "You have not the authorization to perform this operation."
If Forms!frmDetectIdleTime!sLang = "F" Then sM1 DLookup("CtlValue_F",
"tblLang", "FormName='00056'")
MsgBox sM1, vbExclamation
Exit Function


"codial" wrote in message
news:
J'ai une application sous access 2000 qui a été validée mais je dois
pouvoir

la rendre multilingue, les menus et les titres des formulaires et au
moins


français/Anglais. Quelqu'un a t il déja fait celà et comment? D'avance
merci

Codial








1 2