古埃及語翻譯 Frm.Controls(I).Caption = TranslateStr(Frm.Name, Frm.Controls(I).Name翻譯社 Frm.Controls(I).Caption)
別的,比較麻煩的是假如在同時有幾個Form顯示著的環境下要切換介面說話,那麼需要手工離別對各個窗口調用TranslateForm()函數,假如你想改良,那麼可以再寫個進程遍歷所有窗口並挪用該函數,這個就留給你來做吧。
N = GetPrivateProfileString(sSection, sKey, sDefVal, sValue翻譯社 127, LanguageFileName)
LanguageFileName = AddSplash(App.Path) & "ChineseT.Lan"
Dim I As Long
Cmd6=Quit Edit
Cmd3=Del Program
Open AddSplash(App.Path) & "Sys.Ini" For Input As #1
End If
Caption=PCTV Player
ListView.Title3=Type
'主動轉換Form上的一些根基控件(也可自行擴展,目前支援CommandButton翻譯社Label,OptionButton,CheckButton)
End If
End If
LanguageFileName = ""
Public Function TranslateStr(sSection As String翻譯社 sKey As String, sDefVal As String) As String
'選擇語言
SelectLanguage (Language) '設定全局變量,指定使用的說話
Caption=Edit PlayList...
For I = 0 To Frm.Controls.Count - 1
模組 MdlLanMgr.bas :
If Not FileExists(LanguageFileName) Then
Select Case LanName '憑據用戶選擇的說話的名稱,分別讀取分歧的語言文件
Case "Chinese(Traditional)":
Case "Chinese(Simplify)":
TranslateStr = sDefVal
If (TypeOf Frm.Controls(I) Is CommandButton) Or (TypeOf Frm.Controls(I) Is Label) _
TranslateForm Me '主動轉換介面文字
Resume Next
LabelCmd4=Help
挪用很簡單,在作為程式主窗口的Form中這麼寫:
End If
TranslateStr = Left(sValue, N)
Private LanguageFileName As String
End Sub
Close #1
[FormMain] LabelCmd6=Exit && Shut down computer ListView.Title4=Title |
'翻譯文字
End Select
ListView.Title1=ID
Cmd4=Move Up
If FileExists(AddSplash(App.Path) & "Sys.Ini") Then '從程式的設置裝備擺設文件中讀取前次設定的說話檔案名稱稱
Input #1, Language
其它Form中都用近似的寫法,在FormLoad中挪用TranslateForm(Me)的方式將Form上的Button,Label等切換語言文字。
LabelCmd3=Options...
Dim N As Long
Public Sub SelectLanguage(LanName As String)
[FormEdit]
Cmd1=Add Program
Next I
之前做過一個vb的小項目,用戶需要軟體同時可以或許支援中文和英文,為此寫了一個主動語言切換的模組來用,不敢獨享,拿來給人人參考一下翻譯
If N > 0 Then
LanguageFileName = AddSplash(App.Path) & "English.Lan"
Case Else:
End Sub
Option Explicit
Language = "English"
Cmd5=Move Down
Cmd2=Edit Program
End Sub
ErrFun:
LabelCmd5=Exit
Private Sub Form_Load()
Or (TypeOf Frm.Controls(I) Is OptionButton) Or (TypeOf Frm.Controls(I) Is CheckBox) Then
Attribute VB_Name = "ModuleLanMgr"
End Function
Exit Function
Dim sValue As String * 128
Public Sub TranslateForm(Frm As Form)
On Error Resume Next
On Error Resume Next
Private Declare Function GetPrivateProfileString& Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String翻譯社 ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long翻譯社 ByVal lpFileName As String)
ListView.Title2=Time
最後,用到的說話文件的格式像如許:
LabelCmd1=Start Play
LabelCmd2=Edit Play List
Frm.Caption = TranslateStr(Frm.Name, "Caption", Frm.Caption)
由於VB語言(這裡指VB6.0及之前版本,VB.NET屬於另外一種概念了)照樣挺弱的,所以也只能遷就這做到這個程度了,假如要增添一些其它控件或其它屬性的主動文字轉換支援,那麼
On Error Resume Next
Case "English":
LanguageFileName = AddSplash(App.Path) & "ChineseS.Lan"
On Error GoTo ErrFun
本篇文章引用自此: http://mypaper.pchome.com.tw/meteor0721/post/1325789038有關各國語文翻譯公證的問題歡迎諮詢天成翻譯公司02-77260931
留言列表