Hi Jeremy,
Thank you very much for your reply. It helped me to create a javascript which can translate content of size 5000 chars For non-js environment ajax api document says "In all cases, the method supported is GET" http://code.google.com/apis/ajaxlanguage/documentation/#fonje So does that mean i can do only get request or it means i can do get or post but at the end it will be "get". Thanks On Mar 3, 4:46 pm, Jeremy Geerdes <[email protected]> wrote: > Let me try to answer your questions as you asked them. > > Q: Ajax should send the request to server-side application, which is > doing post request? > > A: Exactly. If you are wanting to utilize the full 5000-character > string limit from a webpage via Javascript, you will need to use an > XMLHttpRequest (XHR) object to send a POST request to a proxy > application on your own server, which will then do a POST request to > Google's server and return the response to your XHR. Your XHR's > onreadystatechange handler will then eval the response and continue > processing as before. > > Q: Then at which url this application should send post request? > > A: Depending on which portion of the Language API you're wanting to > use (i.e., language translation or detection), your server-side proxy > application needs to submit its request to one of the two urls listed > at the link below: > > http://code.google.com/apis/ajaxlanguage/documentation/reference.html... > > Q: While using ajax api i get inbuilt methods from "google" so where i > can set the type of request. (get/post,or is it possible?) > > A: It is not possible to specify GET or POST with the standard API. To > do so, you will have to roll your own custom wrappers. > > Q: while using non-js env the server itself implement the get request > so there is no benefit if you use get or post at the end it will be get. > > A: Not true. Your server-side application can specify whether it wants > to use the GET or POST method to make requests. There is a significant > difference between the two methods in the way information is passed > between client (i.e., your server-side script) and host (i.e., > Google's servers). You will have to refer to the documentation of your > specific language and environment to see how to do this. > > Q: My script is running at server side , how can we achieve > translations up to 5000 chars. > > A: Check out the link above, and the one below for more information, > including code snippets for several major programming languages. > Since I believe all of the example code uses a simple GET request > (they were not specifically written for the Language API, but the same > principles continue to apply), you will have to figure out how to > specify a POST request for yourself. Usually, it's just a line or > two, plus any differences in passing arguments, etc. > > Jeremy R. Geerdes > Effective website design & development > Des Moines, IA > > For more information or a project > quote:http://jgeerdes.home.mchsi.comhttp://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com > [email protected] > > Unless otherwise noted, any price quotes contained within this > communication are given in US dollars. > > If you're in the Des Moines, IA, area, check out Debra Heights > Wesleyan Church! > > And check out my blog, Adventures in Web Development, > athttp://jgeerdes.blogspot.com > ! > > On Mar 2, 2009, at 11:47 PM, ronghester wrote: > > > > > Hi Jeremy, > > > If i correctly understand you ..you mean to say > > > Ajax should send the request to server-side application, which is > > doing post request? > > It true Then at which url this application should send post request. > > > While using ajax api i get inbuilt methods from "google" > > so where i can set the type of request. (get/post,or is it possible?) > > > while using non-js env the server itself implement the get request so > > there is no benefit if you use get or post at the end it will be get. > > > If we are talking about Google's official API , > > My script is running at server side , how can we achieve translations > > upto 5000 chars. > > > Please help. > > > thanks and regards > > > On Mar 2, 9:04 pm, Jeremy Geerdes <[email protected]> wrote: > >> There are two things to consider when it comes to the translation > >> string length limit. First, Google imposes a 2,000-character limit > >> on > >> URLs, effectively limiting the string you can translate with the GET > >> method to 2,000 - the length of the url and all other parameters, > >> etc. And second, the translation string is uri encoded before being > >> sent off, so a bunch of characters are translated into their hex > >> equivalents. > > >> That said, technically, the Translation API supports strings up to > >> 5,000 characters in length. You just have to utilize the POST method > >> to take advantage of that larger limit. This is a simple matter from > >> a server-side script, but when you're trying to make your page > >> dynamic > >> with JS, you have to get a little more creative. Specifically, you > >> have to write your own API that will take the strings to be > >> translated, pass them back to a proxy application on your own server > >> via an XMLHttpRequest object, have that server-side application run > >> the translation and return it back to your JS, and then eval the > >> response and do with it as desired. > > >> Jeremy R. Geerdes > >> Effective website design & development > >> Des Moines, IA > > >> For more information or a project quote:http://jgeerdes.home.mchsi.comhttp > >> ://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com > >> [email protected] > > >> Unless otherwise noted, any price quotes contained within this > >> communication are given in US dollars. > > >> If you're in the Des Moines, IA, area, check out Debra Heights > >> Wesleyan Church! > > >> And check out my blog, Adventures in Web Development, > >> athttp://jgeerdes.blogspot.com > >> ! > > >> On Mar 2, 2009, at 9:54 AM, ani007 wrote: > > >>> Hi, > > >>> The google AJAX API for translation fails for more than 1400 > >>> characters. > > >>> The IE crashes if the input is ore than 1415 characters. Is this is > >>> the maximum limit in characters that can be translated using this > >>> API ? > > >>> Thanks > >>> Ani --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-AJAX-Search-API?hl=en -~----------~----~----~----~------~----~------~--~---
