2014-10-31 118 views
0

我有問題要翻譯,我可以翻譯按鈕,標籤,TextBoxs等,但我不知道怎麼翻譯MSGBOX ......我有這樣的代碼MSGBOX多語言

Imports System.Threading.Thread 
Imports System.Globalization  
Public Class FrmLlenguatje 
Private Sub btEspañol_Click(sender As Object, e As EventArgs) Handles btEspañol.Click 

    CurrentThread.CurrentUICulture = New CultureInfo("ES") 
    Dim p02Es As New Form1 
    p02Es.Show() 

    InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages(0) 
End Sub 

Private Sub btCatalà_Click(sender As Object, e As EventArgs) Handles btCatalà.Click 

    CurrentThread.CurrentUICulture = New CultureInfo("CA") 
    Dim p02Ca As New Form1 
    p02Ca.Show() 

    InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages(0) 
End Sub 
End Class 

而且我想知道一種方法來鏈接此按鈕單擊其他窗體,然後嘗試如果我可以創建一個If/else語句來翻譯這些MsgBox ..

我希望你能幫助我..謝謝!

回答

0

我用1個標籤,並在form_loading此字符串來確定O.S.當前語言:

label1.Text=Globalization.CultureInfo.CurrentCulture.ThreeLetterISOLanguageName 

一些3個字符的語言ID是:

ita, spa, eng, nld, fra, rus, zho. 

然後,當你創建一個消息框,使用了一些類似這樣的

If Form1.Label1.Text = "eng" Then 
If MsgBox("Save the changes?", vbYesNo) = vbYes Then 
else 
end if 
If Form1.Label1.Text = "spa" Then 
If MsgBox("¿Guardar los cambios?", vbYesNo) = vbYes Then 
else 
end if 

的是/否自動確定(翻譯)在您目前的語言。

catalan = cat