Language Packs with Visual Basic 2010?

Status
Not open for further replies.

sk3llgamerZDay

Level 2
Thread author
Verified
Jan 15, 2014
94
77
64
Flamestopia's Main Central Sqaure
Anybody know how I would make a multilanguage software by using language packs and a listbox to change the language? Sorta like what CCleaner(legit) did and Security Shield (rouge) did. (Yes I know they're 2 different things) How do I use language packs with my project using a listbox or whatever to select a language..? If anybody knows, please leave a comment. Thanks - Flames
 
Last edited by a moderator:
  • Like
Reactions: Malware1
You can use a XML file

your Xml file should be something like this :

Code:
<main>
<lang>
<lg1>Something</lg1>
<lg2>Something else</lg2>
..
..
..
</lang>
</main>

then write a code like that to load your xml file

Code:
Dim sFileLang As String = Application.StartupPath.ToString & "yourlangfile.xml"
Dim Doc As New XmlDocument
Doc.Load(sFileLang)
For Each lang As Xml.XmlNode In Doc("main")
Dim main As New Dictionary(Of String, String)
For I As Integer = 1 To 2 'here the number of text line you need
lg(I) = lang("lg" & I).InnerText
Next

Finally you can replace text in your sheet as you wish

Code:
me.mycontrol.text = lg(1)
me.myothercontrol.text  = lg(2)


use a combobox for selecting the xml file
use something like that to scan your directory containing the lang file and check if the lang file is the correct one

Code:
Dim Files As New List(Of String)

        For Each F As String In IO.Directory.GetFiles(Application.StartupPath & "\lang\", "*.xml")
            Try
                Dim XML As New XmlDocument
                XML.Load(F)

                If XML("main")("lang")("lg1").InnerXml = "main" Then
                    Files.Add(IO.Path.GetFileNameWithoutExtension(F))
                End If
            Catch ex As Exception
            End Try
        Next

I hope it will help
 
Last edited:
  • Like
Reactions: Malware1
Status
Not open for further replies.

You may also like...