How to make a google translater(Noob Friendly!)

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
4 posts Page 1 of 1
Contributors
User avatar
Proprogrammer
VIP - Donator
VIP - Donator
Posts: 415
Joined: Sun Oct 03, 2010 11:14 pm

NOTE: THIS IS NOT MY CODE NOTHING HERE IS MINE! BUT WOULD LIKE TO GIVE IT OUT TO SHOW YOU!
+REP WOULD BE APRRECIATED!

FIrst you will have to download the .dll on the bottom, dont worry it is free!

What you will need-
- 2 listboxes
- 2 buttons
- 2 textboxes

-listbox1 will be displaying the language you will be converting
-listbox2 will be displaying the language you will be having the text converted to
-button1 will be the translater button to start the translation process
-button2 will be switch the listboxes languages, like from spanish to english is the original, but when you hit this button it will be english to spanish
-textbox1 will be the place for you typing the language you want to be converted
-textbox2 will be the outcome of your conversion


Now lets get to the coding!

This is for when the form loads!
Code: Select all
 Try
            For i As Integer = 0 To Google.API.Translate.LanguageUtility.LanguageCollection.Count - 1

                Me.ListBox1.Items.Add(Google.API.Translate.LanguageUtility.LanguageCollection(i))
                Me.ListBox2.Items.Add(Google.API.Translate.LanguageUtility.LanguageCollection(i))
            Next
            Me.ListBox1.Items.RemoveAt(0)
            Me.ListBox2.Items.RemoveAt(0)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
This is for the translater button
Code: Select all
Try
            Me.TextBox2.Text = Google.API.Translate.Translator.Translate(Me.TextBox1.Text, Me.ListBox1.SelectedIndex + 1, Me.ListBox2.SelectedIndex + 1)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
Now finally for the switch button(if you want!)
Code: Select all
Try
            Dim X1 As Int16
            Dim X2 As Int16

            X1 = Me.ListBox1.SelectedIndex
            X2 = Me.ListBox2.SelectedIndex

            Me.ListBox1.SelectedIndex = X2
            Me.ListBox2.SelectedIndex = X1

        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
Thanks For Reading Give +REP, For me sharing!
:mrgreen: :mrgreen: :mrgreen: :mrgreen:
You do not have the required permissions to view the files attached to this post.
Last edited by Proprogrammer on Sat Oct 23, 2010 1:22 pm, edited 1 time in total.
------------------------------------------------------------------------------
Proprogrammer, not just a Programmer.
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

can you give the source cuz its not working for me
User avatar
Proprogrammer
VIP - Donator
VIP - Donator
Posts: 415
Joined: Sun Oct 03, 2010 11:14 pm

source code/project file has been added!
------------------------------------------------------------------------------
Proprogrammer, not just a Programmer.
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

thanks and i already made it b4 project added xD

i think it looks better with combo box
4 posts Page 1 of 1
Return to “Tutorials”