Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Google Translate API v2 - Use in my project

Posted on 2011-09-14
8
Medium Priority
?
3,387 Views
Last Modified: 2012-05-12
I have the sample bulid working with api key and client id set up. But How can I use it my my own project? its vb and the samples are all in c#.

Google's getting started guides are only for the samples.

If anyone is using this, Which are the steps I need to take?

Thanks
0
Comment
Question by:Dabosa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 15

Accepted Solution

by:
Minh Võ Công earned 800 total points
ID: 36540363
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 36541374
Is your project is asp.net web application or is it a Desktop application. If its webapplication you can use javascript for Google map.
http://www.codeproject.com/KB/custom-controls/LatLaysFlat-Part1.aspx

Regards,
Ram
0
 

Author Comment

by:Dabosa
ID: 36541431
Its a Windows forms application, translate api
thanks
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Dabosa
ID: 36541617
Im more interested how I can integrate the api in a project.

I dont undertand how to do it from this:

http://code.google.com/intl/sv-SE/apis/language/translate/v2/using_rest.html#auth

0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 36541631
I am not sure if that is possible, You need to use browser control in your winforms application for that.

Regards,
Ram
0
 

Author Comment

by:Dabosa
ID: 36541687
It should be, When I've created the API key it asks me if im going to use it in a desktop app or for web service.. These are the sample files:

http://code.google.com/intl/sv-SE/apis/language/translate/v2/libraries.html
0
 
LVL 12

Assisted Solution

by:Ramkisan Jagtap
Ramkisan Jagtap earned 200 total points
ID: 36541732
Hi,
Please add the Google.Apis.Translate.v2.dll  as reference to your project and below is the VB code for google translate Api.

Imports System.Collections.Generic
Imports System.ComponentModel
Imports Google.Apis.Samples.Helper
Imports Google.Apis.Translate.v2
Imports Google.Apis.Translate.v2.Data
Imports TranslationsResource = Google.Apis.Translate.v2.Data.TranslationsResource
Namespace Translate.TranslateText
      Friend Class Program
            <Description("input")> _
            Public Class TranslateInput
                  <Description("text to translate")> _
                  Public SourceText As String = "Who ate my candy?"
                  <Description("target language")> _
                  Public TargetLanguage As String = "fr"
            End Class
            <STAThread> _
            Private Shared Sub Main(args As String())
                  ' Initialize this sample.      
                  CommandLine.EnableExceptionHandling()
                  CommandLine.DisplayGoogleSampleHeader("Translate Sample")
                  ' Ask for the user input.              TranslateInput input = CommandLine.CreateClassFromUserinput<TranslateInput>(); // Create the service.              
                  Dim service = New TranslateService() With { _
                        Key .Key = ClientCredentials.ApiKey _
                  }
                  CommandLine.WriteAction("Translating to '" + input.TargetLanguage & "' ...")
                  Dim srcText As String() = New () {"Hello world!", input.SourceText}
                  Dim response As TranslationsListResponse = service.Translations.List(srcText, input.TargetLanguage).Fetch()
                  Dim translations = New List(Of String)()
                  For Each translation As TranslationsResource In response.Translations
                        translations.Add(translation.TranslatedText)
                        CommandLine.WriteResult("translation", translation.TranslatedText)
                  Next
                  ' Translate the text (back) to english.        
                  CommandLine.WriteAction("Translating to english ...")
                  response = service.Translations.List(translations, "en").Fetch()
                  For Each translation As TranslationsResource In response.Translations
                        CommandLine.WriteResult("translation", translation.TranslatedText)
                  Next
                  ' ...and we are done.          
                  CommandLine.PressAnyKeyToExit()
            End Sub
      End Class
End Namespace
0
 

Author Closing Comment

by:Dabosa
ID: 36559146
Got it to work, importing all of the resources and using the c# vb converters.
1

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question