找回密码
 加入
搜索
查看: 4568|回复: 3

[效率算法] 请高手帮忙看看一个翻译宏,能不能调用到au3上

  [复制链接]
发表于 2012-1-8 17:20:27 | 显示全部楼层 |阅读模式
本帖最后由 Ycxw2008 于 2012-1-8 17:25 编辑

本人英语差,
经常需要翻译些东西,
论坛关于翻译的,google网络失败,
其他的又不合心意,
下面是SDL Passolo 2011一个翻译宏文件的一部分代码
,文字超过5000字,
觉得有兴趣的可以下载源码一起研究研究
更希望有高手指点一下翻译经验
''This macro is a online translations macro program for strings
''in Passolo translation list.
''It has the following features:
''- Use the online translation engine automatically translate strings
''  in the Passolo translation list
''- Integrated some of the well-known online translation engines, and
''  you can customize other online translation engines
''- You can choose the string type, skiping some of string, and processing
''  the strings before and after translation
''- Integrated shortcuts, terminators, Accelerator check macro, and you can
''  check and correct errors in translations after the strings has be translated
''Idea and implemented by wanfu 2010.05.12 (modified on 2011.07.16)

Public UIFileList() As String,UIDataList() As String,UILangList() As String,LangFile As String

Public SpaceTrn As String,acckeyTrn As String,ExpStringTrn As String,EndStringTrn As String
Public acckeySrc As String,EndStringSrc As String,ShortcutSrc As String,ShortcutTrn As String
Public PreStringTrn As String,EndSpaceSrc As String,EndSpaceTrn As String

Public DefaultCheckList() As String,CheckDataList() As String,AppRepStr As String,PreRepStr As String
Public iVo As Long,AllCont As Long,AccKey As Long,EndChar As Long,Acceler As Long

Public DefaultEngineList() As String,EngineList() As String,EngineDataList() As String
Public tSelected() As String,WaitTimes As Long

Private Const Version = "2011.07.16"
Private Const ToUpdateEngineVersion = "2011.05.29"
Private Const ToUpdateCheckVersion = "2011.07.16"
Private Const EngineRegKey = "HKCU\Software\VB and VBA Program Settings\WebTranslate"
Private Const EngineFilePath = MacroDir & "\Data\PSLWebTrans.dat"
Private Const CheckRegKey = "HKCU\Software\VB and VBA Program Settings\AccessKey"
Private Const CheckFilePath = MacroDir & "\Data\PSLCheckAccessKeys.dat"
Private Const JoinStr = vbBack
Private Const SubJoinStr = Chr$(1)
Private Const LngJoinStr = "|"
Private Const NullValue = "Null"
Private Const DefaultObject = "Microsoft.XMLHTTP"
Private Const updateAppName = "PSLWebTrans"
'翻译引擎默认设置
Function EngineSettings(DataName As String) As String
        Dim StesArray(19) As String
        If DataName = DefaultEngineList(0) Then
                StesArray(0) = DefaultObject
                StesArray(1) = "fefed727-bbc1-4421-828d-fc828b24d59b"
                StesArray(2) = "http://api.microsofttranslator.com/V2/Http.svc/Translate?"
                StesArray(3) = "{Url}&appId={appId}&text={text}&from={from}&to={to}"
                StesArray(4) = "GET"
                StesArray(5) = "False"
                StesArray(6) = ""
                StesArray(7) = ""
                StesArray(8) = ""
                StesArray(9) = "Content-Type,application/xml; charset=utf-8"
                StesArray(10) = "responseText"
                StesArray(11) = "Serialization/"">"
                StesArray(12) = "</string>"
                StesArray(13) = "Serialization/"">"
                StesArray(14) = "</string>"
                StesArray(15) = "Serialization/"">"
                StesArray(16) = "</string>"
                StesArray(17) = "string"
                StesArray(18) = "string"
                StesArray(19) = "1"
        ElseIf DataName = DefaultEngineList(1) Then
                StesArray(0) = DefaultObject
                StesArray(1) = ""
                StesArray(2) = "http://translate.google.com/translate_t?"
                StesArray(3) = "{Url}&text={text}&langpair={from}|{to}"
                StesArray(4) = "POST"
                StesArray(5) = "False"
                StesArray(6) = ""
                StesArray(7) = ""
                StesArray(8) = ""
                StesArray(9) = "Content-Type,text/html; charset=utf-8"
                StesArray(10) = "responseText"
                StesArray(11) = "onmouseout=""this.style.backgroundColor='#fff'"">"
                StesArray(12) = "</span>"
                StesArray(13) = "onmouseout=""this.style.backgroundColor='#fff'"">"
                StesArray(14) = "</span>"
                StesArray(15) = "onmouseout=""this.style.backgroundColor='#fff'"">"
                StesArray(16) = "</span>"
                StesArray(17) = ""
                StesArray(18) = ""
                StesArray(19) = "1"
        ElseIf DataName = DefaultEngineList(2) Then
                StesArray(0) = DefaultObject
                StesArray(1) = ""
                StesArray(2) = "http://fanyi.yahoo.com.cn/translate_txt?"
                StesArray(3) = "{Url}&ei=UTF-8&fr=&lp={from}_{to}&trtext={Text}"
                StesArray(4) = "POST"
                StesArray(5) = "False"
                StesArray(6) = ""
                StesArray(7) = ""
                StesArray(8) = ""
                StesArray(9) = "Content-Type,text/html; charset=utf-8"
                StesArray(10) = "responseText"
                StesArray(11) = "<div id=""pd"" class=""pd"">"
                StesArray(12) = "</div>"
                StesArray(13) = "<div id=""pd"" class=""pd"">"
                StesArray(14) = "</div>"
                StesArray(15) = "<div id=""pd"" class=""pd"">"
                StesArray(16) = "</div>"
                StesArray(17) = ""
                StesArray(18) = ""
                StesArray(19) = "0"
        End If
        EngineSettings = Join(StesArray,SubJoinStr)
End Function

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2012-1-8 23:03:08 | 显示全部楼层
这代码是VB的吧!
发表于 2012-1-9 00:45:41 | 显示全部楼层
 楼主| 发表于 2012-1-11 15:28:00 | 显示全部楼层
本帖最后由 Ycxw2008 于 2012-2-8 01:08 编辑

回复 3# afan


   谢谢


http://www.swfcabin.com/open/1328629992
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-26 00:28 , Processed in 0.082837 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表