Android app on sentence translation.

41 views
Skip to first unread message

Tejashree Deshpande

unread,
Jun 19, 2012, 10:53:41 AM6/19/12
to Pune-GTUG
Hello

I am developing an app in android which consumes the Microsoft's translator web service to translate the sentence. Following link gives the translator API provided by Microsoft translator.

But I am not getting how to consume this service in my application. following steps need to follow:-

- The hard coded sentence is retrieved from database
- Below the statement, 'Translate' button is provided which translates the above sentence in user selected language. At this point the web service needs to be consumed.
- List of languages are also stored in database, those are retrieved and user selects the language to translate. 

Problems-
1)how to send request and get response?
2)how to use JSON and REST protocols?
3)how to consume the client id and client secrete through web service?
4) how to get the list of languages available?
5) how to translate the sentence?


Anyone has idea of how to implement this? Need urgent response.

--
Thanks and Regards,
Tejashree Deshpande.

jaydeep

unread,
Jun 19, 2012, 1:49:25 PM6/19/12
to pune...@googlegroups.com
Hi Tejashree,

  Its difficult to explain each and everything here, 
but I will help you to realize the overview of the client application.

1. For sending request/ receiving a response, you will have to use an object of the class
HttpClient/DefaultHttpClient in android.

2. Create an object of HttpPost/ HttpGet(say A). Pass A a url to hit.
Pass A in execute() method of HttpClient object. If server is running fine, this should get 
you the response, additionally you can check HttpStatus Code of the response, it should be 200 (OK)
to proceed further.

3. These must be the parameters you have to pass on to the server while making the request.

4. There must be some API url to get the list of supported languages. Something like (SERVER_URL/languages or something.)

5. As you just said, Microsoft is running the translator service, it should give you the translated 
sentence as the response when you hit the URL as explained in step 2.

This is a very superficial overview. Hope it helps you.

jay w

unread,
Jun 19, 2012, 11:34:13 AM6/19/12
to pune...@googlegroups.com
Hi Tejashree,

  Its difficult to explain each and everything here, 
but I will help you to realize the overview of the client application.

1. For sending request/ receiving a response, you will have to use an object of the class
HttpClient/DefaultHttpClient in android.

2. Create an object of HttpPost/ HttpGet(say A). Pass A a url to hit.
Pass A in execute() method of HttpClient object. If server is running fine, this should get 
you the response, additionally you can check HttpStatus Code of the response, it should be 200 (OK)
to proceed further.

3. These must be the parameters you have to pass on to the server while making the request.

4. There must be some API url to get the list of supported languages. Something like (SERVER_URL/languages or something.)

5. As you just said, Microsoft is running the translator service, it should give you the translated 
sentence as the response when you hit the URL as explained in step 2.

This is a very superficial overview. Hope it helps you.
--
Visit our Blog at http://pune-gtug.blogspot.com for discussions, articles and videos.
Disclaimer - Please note Pune-GTUG is an independent group and opinions mentioned here are of individuals alone and in no way related to "Google", the corporation.
-------------------------------------------------------------------------------------------------------------------------
 
You received this message because you are subscribed to the Google Groups "Pune-GTUG" group.
To post to this group, send email to pune...@googlegroups.com
To unsubscribe from this group, send email to pune-gtug-...@googlegroups.com
For more options, visit this group at http://groups.google.co.in/group/pune-gtug?hl=en-GB



--
Thanks & Regards
---------------------------------
Jaydeep
Software Engineer
IntouchId : *2010-1111-1111
Twitter : @jaydeep_w
Github:  Jaydeepw 
---------------------------------

Tejashree Deshpande

unread,
Jun 20, 2012, 12:49:29 AM6/20/12
to pune...@googlegroups.com
Hello Jay,

                Thanks for the help. But do you have any sample code which will give the clear idea about its implementation. I searched it on google but the results were not satisfactory. 
Thanks and Regards,
Tejashree Deshpande.

jay w

unread,
Jun 20, 2012, 7:56:31 AM6/20/12
to pune...@googlegroups.com
If I get time, I will definitely create some sample code.
but I am sure, there must be some code available on Github.com
Reply all
Reply to author
Forward
0 new messages