dtooboss 发表于 2009-11-25 03:14

你想自己汉化mod吗?发布自助翻译程序,希望大家喜欢。

本程序能自动提取你选的mod目录中需要汉化的英文字符串,在您汉化后可以自动
写到文件中。
第一步 选取目录
第二部 读取字串
第三部 翻译并写入表单
第四步 点汉化写入


下载地址:
http://d.namipan.com/d/0020055909c7120941913e5d944c8969785fb3ea43a20c00

附上软件源代码:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <file.au3>
FileInstall("SkinCrafterDll.dll", @TempDir & "SkinCrafterDll.dll", 1)
FileInstall("Deka_ST.skf", @TempDir & "Deka_ST.skf", 1)
$Dll = DllOpen(@TempDir & "SkinCrafterDll.dll")
$Form1 = GUICreate("火炬之光自助汉化程序            By 菜鸟西门", 835, 498, 192, 114)
$ListView1 = GUICtrlCreateListView("待汉化内容|已汉化内容", 32, 96, 769, 265)
_SkinGUI(@TempDir & "SkinCrafterDll.dll", @TempDir & "Deka_ST.skf", $Form1)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
_GUICtrlListView_SetColumnWidth($ListView1, 0, 420)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 360)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$Button1 = GUICtrlCreateButton("写入列表", 296, 376, 193, 57)
$label = GUICtrlCreateLabel("                                                                                                ", 10, 5)
$Input1 = GUICtrlCreateInput("用鼠标点取表格中的未翻译字符,在这里写入翻译语句,然后点写入列表", 120, 448, 601, 26)
GUICtrlSetFont(-1, 12)
$Button3 = GUICtrlCreateButton("读取英文字符串", 502, 26, 129, 57)
$Input2 = GUICtrlCreateInput("请选择需要汉化的路径", 32, 38, 329, 21)
$Button4 = GUICtrlCreateButton("目录选择", 359, 36, 113, 25, 0)
$Button2 = GUICtrlCreateButton("汉化写入", 665, 26, 129, 57)
$Progress1 = GUICtrlCreateProgress(32, 70, 360, 15)
GUISetState(@SW_SHOW)
FileInstall("d:tldat.exe", @TempDir & "tldat.exe", 1)
Local $Index = 0
$ini = "翻译-" & @MON & "-" & @MDAY & "-" & @HOUR & @MIN & ".txt"
While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button4
                        $eng = FileSelectFolder('请选择需要汉化MOD内容的文件夹', '', 4)
                        GUICtrlSetData($Input2, $eng)
                        If $eng = "" Then
                              Exit
                        EndIf
                Case $Button3
                        GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
                        FileDelete($ini)
                        getstring()
                Case $Button1
                        writestring()
                Case $Button2
                        writedata()

      EndSwitch
WEnd

Func getstring()

      $aFile = myFileListToArray($eng, ".(?i)dat$", 1, "GLOBALS.DAT.adm,massfile.dat.adm,BackUp,images")

      If IsArray($aFile) Then
                For $i = 1 To $aFile Step 1
                        $ii = 100 / $i
                Next
                For $i = 1 To $aFile Step 1
                        GUICtrlSetData($Progress1, $i * $ii)
                        Run(@TempDir & "tldat.exe " & '"' & $aFile[$i] & '"', "", @SW_HIDE)
                        GUICtrlSetData($label, "读取dat文件 " & $aFile[$i] & " 请稍候")
                Next
      EndIf
      GUICtrlSetData($label, "")

      $aFile = myFileListToArray($eng, ".(?i)adm$", 1, "GLOBALS.DAT.adm,massfile.dat.adm,BackUp,images")

      If IsArray($aFile) Then
                For $i = 1 To $aFile Step 1
                        $ii = 100 / $i
                Next
                For $i = 1 To $aFile Step 1
                        GUICtrlSetData($Progress1, $i * $ii)
                        RunWait(@TempDir & "tldat.exe " & '"' & $aFile[$i] & '"', "", @SW_HIDE)
                        Sleep(10)
                        GUICtrlSetData($label, "正在转换" & $aFile[$i] & " 为dat请稍候")
                        FileDelete($aFile[$i])
                Next
      EndIf
      GUICtrlSetData($label, "")

      $aFile = myFileListToArray($eng, ".(?i)dat$", 1, "已汉化目录,_private,BackUp,images")
      $key = 0
      If IsArray($aFile) Then
                For $i = 1 To $aFile Step 1
                        $ii = 100 / $i
                Next
                For $i = 1 To $aFile Step 1
                        GUICtrlSetData($Progress1, $i * $ii)
                        GUICtrlSetData($label, "正在提取字串" & $aFile[$i] & "请稍候")
                        $line = _FileCountLines($aFile[$i])
                        For $x = 0 To $line
                              $fond = FileReadLine($aFile[$i], $x + 1)
                              $replace = StringInStr($fond, "<TRANSLATE>")
                              If $replace <> 0 Then
                                        $y = $x + 1
                                        $zc = StringSplit($fond, ":", 1)
                                        $hz = StringRegExp($zc, '[^x00-xff]+', 3);
                                        If @error <> 0 Then
                                                IniWrite($ini, "翻译这里", $key + 1, $zc)
                                                IniWrite($ini, "不要翻译", $key + 1, $zc & "##" & $aFile[$i] & "##" & $y)
                                                $a = GUICtrlCreateListViewItem($key + 1 & " :" & $zc, $ListView1)
                                                $key = $key + 1
                                        EndIf
                              EndIf
                        Next
                Next
      EndIf
      IniWrite($ini, "不要翻译", "总共行数", $key)
      GUICtrlSetData($label, "")
EndFunc   

Func writestring()

      $str = GUICtrlRead($Input1)
      _GUICtrlListView_AddSubItem($ListView1, $Index, $str, 1)
      _GUICtrlListView_AddSubItem($ListView1, $Index, $str, 0)
      IniWrite($ini, "翻译这里", $Index + 1, $str)

EndFunc

Func writedata()
      $ipt2 = GUICtrlRead($Input2)
      DirCopy($ipt2, $ipt2 & "备份")
      Sleep(1000)
      $line = IniRead($ini, "不要翻译", "总共行数", "")
      $ii = 100 / $line
      For $i = 1 To $line
                GUICtrlSetData($Progress1, $i * $ii)
                $a = IniRead($ini, "不要翻译", $i, "")
                $b = IniRead($ini, "翻译这里", $i, "")
                $wfile = StringSplit($a, "##", 1)
                $g = $wfile
                _FileWriteToLine($wfile, $wfile, $wfile & ":" & $b, 1)
                $ans = FileRead($wfile)
                $var = StringToBinary($ans, 4)
                $var = BinaryToString($var, 4)
                $f = FileOpen($wfile, 34)
                FileWrite($f, $var)
                FileClose($f)
                GUICtrlSetData($label, "正在写入文件" & $wfile & "请稍候")
      Next
      GUICtrlSetData($label, "汉化已经完成")
      MsgBox(0, 0, "汉化已经完成,原始文件已经备份为" & $ipt2 & "备份目录")
      Quit()
EndFunc

Func myFileListToArray($sPath, $rPath = 0, $iFlag = 0, $sPathExclude = 0)
      Local $asFileList
      $asFileList = myFileListToArrayTemp($asFileList, $sPath, $rPath, $iFlag, $sPathExclude)
      Return $asFileList
EndFunc

Func myFileListToArrayTemp(ByRef $asFileList, $sPath, $rPath = 0, $iFlag = 0, $sPathExclude = 0)
      Local $hSearch, $sFile
      If Not FileExists($sPath) Then Return SetError(1, 1, "")
      If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "")
      $hSearch = FileFindFirstFile($sPath & "*")
      If $hSearch = -1 Then Return SetError(4, 4, "")
      While 1
                $sFile = FileFindNextFile($hSearch)
                If @error Then
                        SetError(0)
                        ExitLoop
                EndIf
      
                If $sPathExclude And StringLen($sPathExclude) > 0 Then $sPathExclude = StringSplit($sPathExclude, ",")
                $bExclude = False
                If IsArray($sPathExclude) Then
                        For $ii = 1 To $sPathExclude Step 1
                              If StringInStr($sPath & "" & $sFile, $sPathExclude[$ii]) Then
                                        $bExclude = True
                                        ExitLoop
                              EndIf
                        Next
                EndIf
                If $bExclude Then ContinueLoop

                Select
                        Case StringInStr(FileGetAttrib($sPath & "" & $sFile), "D")
                              Select
                                        Case $iFlag = 1
                                                myFileListToArrayTemp($asFileList, $sPath & "" & $sFile, $rPath, $iFlag, $sPathExclude)
                                                ContinueLoop
                                        Case $iFlag = 2 Or $iFlag = 0
                                                If $rPath Then
                                                      If Not StringRegExp($sPath & "" & $sFile, $rPath, 0) Then
                                                                myFileListToArrayTemp($asFileList, $sPath & "" & $sFile, $rPath, $iFlag, $sPathExclude)
                                                                ContinueLoop
                                                      Else
                                                                myFileListToArrayTemp($asFileList, $sPath & "" & $sFile, $rPath, $iFlag, $sPathExclude)
                                                      EndIf
                                                Else
                                                      myFileListToArrayTemp($asFileList, $sPath & "" & $sFile, $rPath, $iFlag, $sPathExclude)
                                                EndIf
                              EndSelect

                        Case Not StringInStr(FileGetAttrib($sPath & "" & $sFile), "D")
                              If $iFlag = 2 Then ContinueLoop
                              If $rPath And Not StringRegExp($sPath & "" & $sFile, $rPath, 0) Then ContinueLoop
                EndSelect

                ReDim $asFileList
                $asFileList = $asFileList + 1
                $asFileList = $sPath & "" & $sFile

      WEnd
      FileClose($hSearch)
      Return $asFileList
EndFunc


Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE


Func WM_NOTIFY($hWndGUI, $MsgID, $WParam, $LParam)

      Local $tagNMHDR, $Event, $hWndFrom, $IDFrom
      Local $tagNMHDR = DllStructCreate("int;int;int", $LParam)
      If @error Then Return $GUI_RUNDEFMSG
      $IDFrom = DllStructGetData($tagNMHDR, 2)
      $Event = DllStructGetData($tagNMHDR, 3)
      $tagNMHDR = 0
      Switch $IDFrom

                Case $ListView1

                        Switch $Event

                              Case $NM_CLICK
                                        $Index = _GUICtrlListView_GetSelectedIndices($ListView1)
                                        If Not StringLen($Index) Then
                                                MsgBox(0, "", "未选定")
                                                Return
                                        EndIf
                                       
                                        $ipt = StringSplit(_GUICtrlListView_GetItemText($ListView1, Number($Index)), ":", 1)
                                        GUICtrlSetData($Input1, StringStripWS($ipt, 1))


                              Case $NM_DBLCLK

                              Case $NM_RCLICK
                     
                        EndSwitch

      EndSwitch

      Return $GUI_RUNDEFMSG
EndFunc


Func _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle)
      $Dll = DllOpen($SkincrafterDll)
      DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "[email protected]", "wstr", "1")
      DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
      DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", $SkincrafterSkin)
      DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Handle, "int", 25)
      DllCall($Dll, "int:cdecl", "ApplySkin")
EndFunc

Func Quit()
      GUISetState(@SW_HIDE)
      DllCall($Dll, "int:cdecl", "DeInitDecoration")
      DllCall($Dll, "int:cdecl", "RemoveSkin")
      DllClose($Dll)
      FileDelete(@TempDir & "SkinCrafterDll.dll")
      FileDelete(@TempDir & "LEDWidget.skf")
      Exit
EndFunc

aibazhaoyu 发表于 2009-11-25 03:23

好强!这个要严重支持

zealot1313 发表于 2009-11-25 03:43

强帖留名。。。。。。

xiziblog 发表于 2009-11-25 05:22

楼主的共享翻页箱子还没做出来啊。。

bushuang88 发表于 2009-11-25 06:38

很强大支持支持~

newboss 发表于 2009-11-25 07:00

强大啊..比上次发布的更方便..支持

newboss 发表于 2009-11-25 07:01

无法打开下载...换个下载方式吧..郁闷

newboss 发表于 2009-11-25 07:11

LZ能说明一下与上次发布的 MOD自动汉化正式版1.01.exe 有什么重大的区别吗?
改良版?还是另一种效果的版本?

还有,怎么也打不开下载啊,能不能换个QQ中转站下载呢

dtooboss 发表于 2009-11-25 08:15

下载不了的qq中转地址http://31.dc.ftn.qq.com/ftn_handler/d72bfbaacf233c38df50cfed6cf53d06f137a664c4e8acfa6932849e3f141ed1adf49154a50e4ecacd99559b90b7d37b39c320cb932adbddf298094d37126e51/火炬mod自助汉化.rar?k=23393938d96ecacfd1880b0642330b1f520f085a5d05095249000b5e561e0d04560c145900525f1d5c0f5c0150005a555d5f000f6420398b9487df550b57eee4b2c38382df9c1742054b39提取码   (提取码 d998d390)

这个是补遗程序,向手动汉化mod的或者是用了我那个自动汉化程序以后
未汉化的的新文件可以用这个汉化。

teirc 发表于 2009-11-25 08:24

好东西,支持一下。

新年礼物 发表于 2009-11-25 08:24

好啊。可以自己弄来 。谢谢分享

seiaphim 发表于 2009-11-25 08:45

强大啊....首页支持............

sandmouse1314 发表于 2009-11-25 08:51

还是不错的嘛,谢谢

lzgschina 发表于 2009-11-25 08:53

很强大

group 发表于 2009-11-25 08:57

那么好的东西,怎么可以不顶!!

shawnca 发表于 2009-11-25 09:02

LZ太强大了!!!!!!!!!

tcscdz 发表于 2009-11-25 09:14

好东西,一定要支持。

lightofheaven 发表于 2009-11-25 09:22

这个好,结合自动汉化程序,汉化MOD就方便多了,谢谢LZ

newboss 发表于 2009-11-25 09:30

原帖由 dtooboss 于 2009-11-25 8:15:00 发表
下载不了的qq中转地址http://31.dc.ftn.qq.com/ftn_handler/d72bfbaacf233c38df50cfed6cf53d06f137a664c4e8acfa6932849e3f141ed1adf49154a50e4ecacd99559b90b7d37b39c320cb932adbddf298094d37126e51/火炬mod自

你的意思是,先用之前发布的 MOD自动汉化1.01程序 汉化一次后.如果还有未汉化的,再用这个 火炬MOD自助汉化 工具手动补充汉化是吗?

279003350 发表于 2009-11-25 09:49

强大

liyangdegame 发表于 2009-11-25 11:03

这个要严重支持

DarkDevil 发表于 2009-11-25 11:07

太强大了。。。。。。。。。。。。。。。。。。。。。。。

7028639 发表于 2009-11-25 11:30

很好 很强大~~~~~~

水中月xu 发表于 2009-11-25 11:41

这么好的东西确实要支持啊!!!!!

mickshishuo 发表于 2009-11-25 11:47

很好很强大

fancky 发表于 2009-11-25 11:48

不錯喔 已經可以自己開發了

23585780 发表于 2009-11-25 17:20

具楼主说可以支持MOD新增的装备,看来很多很好的MOD都有望出全中文版的了

joanking 发表于 2009-11-25 17:27

牛人~~~~~~~~~~~~~~~~

zwdsdtc 发表于 2009-11-25 19:08

很好很强大

誰De包籽 发表于 2009-11-25 19:23

这个是更新版?
页: [1] 2
查看完整版本: 你想自己汉化mod吗?发布自助翻译程序,希望大家喜欢。