Lauro2 on Thu, 29 Jun 2017 17:29:20


I developed an Office (2007-16) solution based on an Access db and a Word template.

All my interface's objects are in Italian (dialog windows, forms, error messages, ribbons, etc.). But now, to late, I'm thinking that maybe my sowftare could be of some utility also outside my country, so I want to prepare it for a multilanguage version.

I know that I would have been in a much better situation if I had forseen that since the beginning, but...

Do you ave any hints to help me to recover from my lack of foresight?

Thanks in advaance, Lauro


Chenchen Li on Fri, 30 Jun 2017 03:06:45


Do you develop with VBA? You could add reference "Microsoft Visual Basics for Applications Extensibility 5.3" and use its methods to read your code. Then you could automate IE and navigate Google Translate to translate Italian to English.


In module1:

Sub test()
Dim s As String
s = "this is a test: questo"
End Sub

In module2:

Sub D()
Dim text As String
Dim VBP As VBProject
Dim VBM As VBComponent
Dim VBModule As CodeModule
Dim VBProc As VBComponent
Set VBP = ActiveDocument.VBProject
Set VBModule = VBP.VBComponents.Item("Module1").CodeModule
With VBModule
For i = 1 To .CountOfLines
text = text + vbNewLine + transalte_using_vba(.Lines(i, 1))
.DeleteLines 1, .CountOfLines
.AddFromString text
End With
End Sub

Function transalte_using_vba(str As String) As String
    Dim IE As Object, i As Long
    Dim result_data As String
    Set IE = CreateObject("InternetExplorer.application")
    IE.Visible = False
    IE.navigate "" & str
    Do Until IE.ReadyState = 4
    CLEAN_DATA = Split(Replace(IE.Document.getElementById("result_box").innerHTML, "</SPAN>", ""), "<")
    For j = LBound(CLEAN_DATA) To UBound(CLEAN_DATA)
        result_data = result_data & Right(CLEAN_DATA(j), Len(CLEAN_DATA(j)) - InStr(CLEAN_DATA(j), ">"))
    transalte_using_vba = result_data
End Function

Run subroutine D, the subroutine test is replaced:

Sub test ()
Dim s As String
S = "this is a test: this"
End Sub




Lauro2 on Tue, 04 Jul 2017 04:49:26

Thanks Celeste for your suggestion.