How To Make A Translator Using Google API In vb.net
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.
3 posts
Page 1 of 1
Hi Guys ,
Now I Will Teach You To Create An App Using Google API To Translate
I Think Same As This Tutorial Posted In This Website Anyway This Tutorial Is Even Made Easy For Everyone (starters) .
First Open Visual Basic 2008 or 2010 anyway i am using visual basic 2008 express edition .
>> Create A New Project >>>
>>Form Will Load Then Go To Form1 Properties Then Text Name It Anything You Want>>>
>>Inserting Tools - You Will Need Two Text Boxes , one combo box and a button >>>>
Textbox1 Is To Inserting Words To Translate
Textbox2 Is To The Results (Translated)
Combobox1 To Select Translating Language
Button1 To Translate
>>Insert The Dll Files You Can Download It For Free>>>
How To Insert The Dll Files Just Click Properties In The Top And Click Add Reference Then A Windows Will Open With Tabs
There Will Be Tabpage Named "Browse" Go To That Tab Page And Browse The Dll And And Click Button Ok
>>Coding Begins>>
Double Click Form1 And Erase Everything There and Paste The Code Given Below
Now The App Will Open The Type Something In Textbox1 and now select a language in the combobox
and click button1 then you can see the text you typed in the textbox1 will be translated in to selected language you selected in the combobox and the
textbox2 you can see there the translated text .
Credit Me
Now I Will Teach You To Create An App Using Google API To Translate
I Think Same As This Tutorial Posted In This Website Anyway This Tutorial Is Even Made Easy For Everyone (starters) .
First Open Visual Basic 2008 or 2010 anyway i am using visual basic 2008 express edition .
>> Create A New Project >>>
>>Form Will Load Then Go To Form1 Properties Then Text Name It Anything You Want>>>
>>Inserting Tools - You Will Need Two Text Boxes , one combo box and a button >>>>
Textbox1 Is To Inserting Words To Translate
Textbox2 Is To The Results (Translated)
Combobox1 To Select Translating Language
Button1 To Translate
>>Insert The Dll Files You Can Download It For Free>>>
How To Insert The Dll Files Just Click Properties In The Top And Click Add Reference Then A Windows Will Open With Tabs
There Will Be Tabpage Named "Browse" Go To That Tab Page And Browse The Dll And And Click Button Ok
>>Coding Begins>>
Double Click Form1 And Erase Everything There and Paste The Code Given Below
Code: Select all
>>Debug>>
Public Class Form1
Dim GoogleTranslator As New Google.API.Translate.TranslateClient("")
Dim sourcestring As String
Dim translatedstring As String
Dim ISO_language As String
'created By mshimranpro
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ComboBox1.Items.Add("English")
Me.ComboBox1.Items.Add("French")
Me.ComboBox1.Items.Add("Chinese")
Me.ComboBox1.Items.Add("Italian")
Me.ComboBox1.Items.Add("German")
Me.ComboBox1.Items.Add("Spanish")
Me.ComboBox1.Items.Add("Russian")
Me.ComboBox1.Items.Add("Japanese")
Me.ComboBox1.Items.Add("Korean")
Me.ComboBox1.Items.Add("Arabic")
Me.ComboBox1.Items.Add("Latin")
Me.ComboBox1.Items.Add("Greek")
Me.ComboBox1.Items.Add("Tagalog")
End Sub
'=======================languages=======
'for the sample i will use some of them...lol
'Languages enum
'some fonts are not supported so ,check your machines..lol
'
'=============================================
'AFRIKAANS' : 'af',
'ALBANIAN' : 'sq',
'AMHARIC' : 'am',
'ARABIC' : 'ar',
'ARMENIAN' : 'hy',
'AZERBAIJANI' : 'az',
'BASQUE' : 'eu',
'BELARUSIAN' : 'be',
'BENGALI' : 'bn',
'BIHARI' : 'bh',
'BRETON' : 'br',
'BULGARIAN' : 'bg',
'BURMESE' : 'my',
'CATALAN' : 'ca',
'CHEROKEE' : 'chr',
'CHINESE' : 'zh',
'CHINESE_SIMPLIFIED' : 'zh-CN',
'CHINESE_TRADITIONAL' : 'zh-TW',
'CORSICAN' : 'co',
'CROATIAN' : 'hr',
'CZECH' : 'cs',
'DANISH' : 'da',
'DHIVEHI' : 'dv',
'DUTCH': 'nl',
'ENGLISH' : 'en',
'ESPERANTO' : 'eo',
'ESTONIAN' : 'et',
'FAROESE' : 'fo',
'FILIPINO' : 'tl',
'FINNISH' : 'fi',
'FRENCH' : 'fr',
'FRISIAN' : 'fy',
'GALICIAN' : 'gl',
'GEORGIAN' : 'ka',
'GERMAN' : 'de',
'GREEK' : 'el',
'GUJARATI' : 'gu',
'HAITIAN_CREOLE' : 'ht',
'HEBREW' : 'iw',
'HINDI' : 'hi',
'HUNGARIAN' : 'hu',
'ICELANDIC' : 'is',
'INDONESIAN' : 'id',
'INUKTITUT' : 'iu',
'IRISH' : 'ga',
'ITALIAN' : 'it',
'JAPANESE' : 'ja',
'JAVANESE' : 'jw',
'KANNADA' : 'kn',
'KAZAKH' : 'kk',
'KHMER' : 'km',
'KOREAN' : 'ko',
'KURDISH': 'ku',
'KYRGYZ': 'ky',
'LAO' : 'lo',
'LATIN' : 'la',
'LATVIAN' : 'lv',
'LITHUANIAN' : 'lt',
'LUXEMBOURGISH' : 'lb',
'MACEDONIAN' : 'mk',
'MALAY' : 'ms',
'MALAYALAM' : 'ml',
'MALTESE' : 'mt',
'MAORI' : 'mi',
'MARATHI' : 'mr',
'MONGOLIAN' : 'mn',
'NEPALI' : 'ne',
'NORWEGIAN' : 'no',
'OCCITAN' : 'oc',
'ORIYA' : 'or',
'PASHTO' : 'ps',
'PERSIAN' : 'fa',
'POLISH' : 'pl',
'PORTUGUESE' : 'pt',
'PORTUGUESE_PORTUGAL' : 'pt-PT',
'PUNJABI' : 'pa',
'QUECHUA' : 'qu',
'ROMANIAN' : 'ro',
'RUSSIAN' : 'ru',
'SANSKRIT' : 'sa',
'SCOTS_GAELIC' : 'gd',
'SERBIAN' : 'sr',
'SINDHI' : 'sd',
'SINHALESE' : 'si',
'SLOVAK' : 'sk',
'SLOVENIAN' : 'sl',
'SPANISH' : 'es',
'SUNDANESE' : 'su',
'SWAHILI' : 'sw',
'SWEDISH' : 'sv',
'SYRIAC' : 'syr',
'TAJIK' : 'tg',
'TAMIL' : 'ta',
'TATAR' : 'tt',
'TELUGU' : 'te',
'THAI' : 'th',
'TIBETAN' : 'bo',
'TONGA' : 'to',
'TURKISH' : 'tr',
'UKRAINIAN' : 'uk',
'URDU' : 'ur',
'UZBEK' : 'uz',
'UIGHUR' : 'ug',
'VIETNAMESE' : 'vi',
'WELSH' : 'cy',
'YIDDISH' : 'yi',
'YORUBA' : 'yo',
'UNKNOWN' : ''
Sub chooseLanguage()
If ComboBox1.SelectedIndex = 0 Then
ISO_language = "en"
End If
If ComboBox1.SelectedIndex = 1 Then
ISO_language = "fr"
End If
If ComboBox1.SelectedIndex = 2 Then
ISO_language = "zn"
End If
If ComboBox1.SelectedIndex = 3 Then
ISO_language = "it"
End If
If ComboBox1.SelectedIndex = 4 Then
ISO_language = "de"
End If
If ComboBox1.SelectedIndex = 5 Then
ISO_language = "es"
End If
If ComboBox1.SelectedIndex = 6 Then
ISO_language = "ru"
End If
If ComboBox1.SelectedIndex = 7 Then
ISO_language = "ja"
End If
If ComboBox1.SelectedIndex = 8 Then
ISO_language = "ko"
End If
If ComboBox1.SelectedIndex = 9 Then
ISO_language = "ar"
End If
If ComboBox1.SelectedIndex = 10 Then
ISO_language = "la"
End If
If ComboBox1.SelectedIndex = 11 Then
ISO_language = "el"
End If
If ComboBox1.SelectedIndex = 12 Then
ISO_language = "tl"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.TextBox1.Text = "" Then
MsgBox("Required Field!!!")
TextBox1.Focus()
Exit Sub
End If
If Me.ComboBox1.Text = "" Then
MsgBox("Required Field!!!")
ComboBox1.Focus()
Exit Sub
End If
Translate()
End Sub
Sub Translate()
Try
chooseLanguage()
sourcestring = Me.TextBox1.Text
translatedstring = GoogleTranslator.TranslateAndDetect(sourcestring, ISO_language, "")
Catch ex As Exception
MessageBox.Show("Error while Connecting to Google..." & ex.ToString, "Google API Sample")
End Try
Me.TextBox2.Text = translatedstring
End Sub
End Class
Now The App Will Open The Type Something In Textbox1 and now select a language in the combobox
and click button1 then you can see the text you typed in the textbox1 will be translated in to selected language you selected in the combobox and the
textbox2 you can see there the translated text .
Credit Me
You do not have the required permissions to view the files attached to this post.
Find my programs on Softpedia
ERROR
Exception: Google.API.GoogleServiceException: [response status:403]Suspected Terms of Service Abuse. Please see http://code.google.com/apis/errors
at Google.API.RequestUtility.Deserialize[T](String text)
at Google.API.RequestUtility.GetResponseData[T](IRequestInfo requestInfo)
at Google.API.GoogleClient.GetResponseData[T](GoogleRequest request)
at Google.API.Translate.TranslateClient.NativeTranslate(String text, String from, String to, String format)
at Google.API.Translate.TranslateClient.TranslateAndDetect(String text, String to, String format, String& from)
at Google.API.Translate.TranslateClient.TranslateAndDetect(String text, String to, String& from)
at WindowsApplication1.Form1.Translate() in C:\Users\******\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb:line 221
Exception: Google.API.GoogleServiceException: [response status:403]Suspected Terms of Service Abuse. Please see http://code.google.com/apis/errors
at Google.API.RequestUtility.Deserialize[T](String text)
at Google.API.RequestUtility.GetResponseData[T](IRequestInfo requestInfo)
at Google.API.GoogleClient.GetResponseData[T](GoogleRequest request)
at Google.API.Translate.TranslateClient.NativeTranslate(String text, String from, String to, String format)
at Google.API.Translate.TranslateClient.TranslateAndDetect(String text, String to, String format, String& from)
at Google.API.Translate.TranslateClient.TranslateAndDetect(String text, String to, String& from)
at WindowsApplication1.Form1.Translate() in C:\Users\******\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb:line 221
wow im very impressed mshimranpro something you didnt completely copy from someone 

3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023