Ja nje shembull ne vb.Net, per komentime skam shume kohe momentalisht,
por per te shiquar se si funksionon, proceso hap pas hapi ne debug mode.
Kodi PHP:
Imports System.IO
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
GetLang(Application.StartupPath + "\Language\en.lng")
EnglishToolStripMenuItem.Checked = True
End Sub
Dim sContent() As String
Private Sub GetLang(path As String)
FileToArray(path, sContent)
Me.Text = GetText("frmForma", sContent)
LanguageToolStripMenuItem.Text = GetText("mnuLang", sContent)
lblName.Text = GetText("lblName", sContent)
lblPass.Text = GetText("lblPass", sContent)
btnLogin.Text = GetText("btnLogin", sContent)
End Sub
Private Sub EnglishToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles EnglishToolStripMenuItem.Click
GetLang(Application.StartupPath + "\Language\en.lng")
EnglishToolStripMenuItem.Checked = True
ShqipToolStripMenuItem.Checked = False
End Sub
Private Sub FileToArray(path As String, ByRef array() As String)
Dim myFile As StreamReader = New StreamReader(path, System.Text.Encoding.Default)
Dim strTemp As String = myFile.ReadToEnd()
array = strTemp.Split(vbNewLine)
myFile.Close()
End Sub
Private Function GetText(pattern As String, sContent() As String) As String
Dim strTemp As String = ""
For Each s As String In sContent
If s.IndexOf(pattern) >= 0 Then
strTemp = s.Substring(s.IndexOf("=") + 1)
End If
Next
Return strTemp
End Function
Private Sub ShqipToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ShqipToolStripMenuItem.Click
GetLang(Application.StartupPath + "\Language\sq.lng")
EnglishToolStripMenuItem.Checked = False
ShqipToolStripMenuItem.Checked = True
End Sub
End Class
Projekti:
LanguageChange
Krijoni Kontakt