|
我做了个软件,现在我想把它翻译成英文版,请问各位有什么好的方法
我现在做的思路是:把所有的标签等全部放在一个文本文档里面然后写一个函数,在每个页面都调用该函数,很笨的方法,且速度慢,下面是该函数:
Public Sub queryword(frm)
On Error GoTo query_err:
Dim filename As String
Dim str As String
Dim position As Integer
Dim positionx As Integer
Dim positiony As Integer
Dim ctr As Control
Dim stry As String
Dim s As String
Dim myobject As Object
Dim tex As Object
Dim serachline As String
Dim replaced As String
Dim positions As Integer
Dim stry1 As String
Dim strx1 As String
filename = "word1.txt"
'Set myobject = GetObject("d:\报价系统\word.txt")
'myobject.Close
'Close CurrentProject.Path & "\" & filename
'If s <> "" Then
'Close
'MsgBox (0)
'End If
Open CurrentProject.Path & "\" & filename For Input As #1
Line Input #1, s
str = s
For Each ctr In frm.Controls
str = s
Select Case ctr.ControlType
Case acLabel, acCommandButton, acPage
'serachline = Left(ctr.Caption, Len(ctr.Caption) - 1)
serachline = Trim(ctr.Caption)
While Len(str) > 0
'If InStr(str, vbLf) > 0 Then
'If InStr(str, vbLf) > InStr(str, Space(1)) Then
'position = InStr(str, Space(1))
'Else
'position = InStr(str, vbLf)
'End If
'Else
position = InStr(str, Space(1))
'End If
If position > 0 Then
stry = Trim(Left(str, position - 1))
str = Trim(Mid(str, position + 1))
'MsgBox (0)
Else
stry = str
str = ""
End If
positionx = InStr(stry, "(")
If positionx > 0 Then
If InStr(stry, serachline) > 0 And (serachline = Left(stry, positionx - 1)) Then
'If Left(stry, positionx - 1) = serachline Then
positionx = InStr(stry, "(")
positiony = InStr(stry, ")")
replaced = Mid(stry, positionx + 1, positiony - 1)
replaced = Left(replaced, Len(replaced) - 1)
replaced = replace(replaced, "!", " ", 1, , vbTextCompare)
Select Case ctr.ControlType
Case acLabel, acCommandButton, acPage
ctr.Caption = replaced
End Select
End If
End If
Wend
End Select
Next
Close
err_exit:
Exit Sub
query_err:
MsgBox err.Description
Close
Resume err_exit
End Sub
|
|