Ebeo / google-api-for-dotnet

Automatically exported from code.google.com/p/google-api-for-dotnet
0 stars 0 forks source link

Attempting to translate string > 5000 chars throws exception #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attempt to translate string > 5000 characters 

What is the expected output? What do you see instead?

   Expected translated string, exception thrown, returns 400

What version of the product are you using? On what operating system?

   GoogleTranslateAPI.dll 0.1.1.0

Please provide any additional information below.

   Would be handy if API accepted full string, split, translated, returned
full string.

Original issue reported on code.google.com by TempInbo...@gmail.com on 19 Jan 2009 at 9:27

GoogleCodeExporter commented 9 years ago
I've not test so large input. I'll try it.

Try googletranslateapi 0.2. You need .net 3.5.

"   Would be handy if API accepted full string, split, translated, returned
full string."

If google has length limit of the text, I'll add this function.

Original comment by iron9li...@gmail.com on 1 Mar 2009 at 8:05

GoogleCodeExporter commented 9 years ago
please check google's terms:
http://code.google.com/intl/ru/apis/ajaxlanguage/terms.html
"You will not, and will not permit your end users or other third parties to...
submit any request exceeding 5000 characters in length, to the translation 
components
of the Service"

Original comment by Admin.My...@gmail.com on 14 Mar 2009 at 6:00

GoogleCodeExporter commented 9 years ago
Thank you "Admin.MyMentor"!!!

To TempInboxAdmin:
I don't think there's a universal method splitting text in all languages.

Any idea?

Original comment by iron9li...@gmail.com on 14 Mar 2009 at 8:12

GoogleCodeExporter commented 9 years ago
If there are many special characters in the string to translate this limit gets
reduced even more. no idea why this could be. The error is "(414) Request-URI 
Too Large"

If you try to translate text that contains this string at the end:
 05/03----15/04 € 100.00 € 10.00 <br />
 16/04----30/04 € 120.00 € 12.00 <br />
 16/06----39/06 € 200.00 € 14.00 <br />
 01/07----19/07 € 250.00 € 19.00 <br />
 01/05----39/05 € 150.00 € 19.00 <br />
 01/06----19/06 € 180.00 € 19.00 <br />
 16/07----39/07 € 300.00 € 19.00 <br />
 01/08----29/08 € 350.00 € 19.00 <br />
 26/08----19/09 € 250.00 € 19.00 <br />
 11/09----39/09 € 200.00 € 19.00 <br />
 01/10----19/10 € 180.00 € 19.00 <br />
 16/10----39/10 € 150.00 € 19.00 <br />

In my test scenario the limit with this string was 1520 characters. Could it be 
that
in this case is using internally a GET request and not a POST??
If you think this is unrelated I would open a new issue request.
I'm using version 0.2

Original comment by mmaar...@libero.it on 4 Jul 2009 at 9:17

GoogleCodeExporter commented 9 years ago
every translate task will be a GET request, not POST.
This is the url format:
http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q={query}&lang
pair={langpair}&format={format}

The query is the (url format) encoded text (may larger than the original) you 
want to
translate.

If you get a GoogleServiceException with error code 414 and error info "request 
url
too large", I think you should ask google first.

Original comment by iron9li...@gmail.com on 4 Jul 2009 at 5:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I'm experiencing the same issue. Trimming <br /> from the string to be 
translated
makes it work. Strange!

In addition, this happens in Firefox 3.5 for me but it works in IE7. 

Original comment by karl%ivi...@gtempaccount.com on 21 Jul 2009 at 3:04

GoogleCodeExporter commented 9 years ago
I think I can do nothing for this.
I can't split the text, even check the length of the generated url is not easy.

Original comment by iron9li...@gmail.com on 22 Jul 2009 at 7:27

GoogleCodeExporter commented 9 years ago
In fact, there is the way to translate more than 5000 characters, you have to 
use 
post request instead of get.

Original comment by umaxfun on 25 Aug 2009 at 7:31

GoogleCodeExporter commented 9 years ago
I can implement it if policy violation is acceptable to you :)

Original comment by umaxfun on 25 Aug 2009 at 7:32

GoogleCodeExporter commented 9 years ago
Can it be? Show me your code :)

Original comment by iron9li...@gmail.com on 26 Aug 2009 at 4:13

GoogleCodeExporter commented 9 years ago
Use WebInvokeAttribute instead of WebGetAttribute.

Only the Translate API can work with POST.

And, I got this: [response status:204]clip sweeping.

Original comment by iron9li...@gmail.com on 26 Aug 2009 at 6:44

GoogleCodeExporter commented 9 years ago
hi umaxfun,

I found that the post method will auto split at the mid of my sentences when 
translating. This makes the translation not accurate as the meaning becomes 
different.

Original comment by huiping....@gmail.com on 29 Oct 2010 at 6:18

GoogleCodeExporter commented 9 years ago
hi umaxfun,

I found that the post method will auto split at the mid of my sentences when 
translating. This makes the translation not accurate as the meaning becomes 
different.

Original comment by huiping....@gmail.com on 29 Oct 2010 at 6:19