Hi, I asked similar question before. Please see thread: http://groups.google.com/group/Google-AJAX-Search-API/browse_thread/thread/868231b9f712f1d4/f456614b384592e5#f456614b384592e5 http://groups.google.com/group/Google-AJAX-Search-API/browse_thread/thread/871da6bb9038b63b#
I think the best solution is Balazs Endresz's jQuery translation plug- in. This plug-in has these advantages: 1.Less coding. (see the sample code) 2.no limit for text length. 3.To be translated text is extracted from HTML and concatenated.And, less API requests are needed. Looks like Balazs has done substantial work to solve this issue. here is a minimalism sample: ( You can download sample code from http://code.google.com/p/djangopollsgae/downloads/list ) <html> <head> <p> Please download jquery[1].translate-1.2.4.min.js from http://code.google.com/p/jquery-translate/ jquery-1[1].2.6.min.js from http://jquery.com/ . Maybe the *.js files have been updated. Please change *.js file names accordinglly. </p> <script type="text/javascript" src="jquery-1[1].2.6.min.js"></ script> <script type="text/javascript" src="jquery [1].translate-1.2.4.min.js"></script> <script type="text/javascript"> function startTranslation(){ $('p').translate( 'en', 'es') } </script> </head> <body> <p id="textToTranslate">WASHINGTON, Nov 14 (Reuters) - Sales at U.S. retailers suffered a record decline in October as fears of recession sapped spending, but part of the drop was due to slumping gasoline prices, which helped buoy consumer confidence this month. The Commerce Department said on Friday that retail sales slumped 2.8 percent in October to a seasonally adjusted $363.7 billion, the largest decline since the department's current methodology was adopted in 1992, as mounting unemployment hit shoppers' appetites. </p> <input type="button" onclick="startTranslation();" value="Translate "/> </body> </html> Thanks, Chef Free Immigration Guide http://visachoice.appspot.com On Dec 2, 11:10 am, Jeremy Geerdes <[EMAIL PROTECTED]> wrote: > By the way, you can find resources to access the Language API in this > manner by checking out the link below: > > http://code.google.com/apis/ajaxlanguage/documentation/reference.html... > > Jeremy R. Geerdes > Effective website design & development > Des Moines, IA > > For more information or a project quote:http://jgeerdes.home.mchsi.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! > > On Dec 2, 2008, at 12:59 PM, Dan wrote: > > > > > > > From the API document, it seem that google.language.translate() is the > > only option to send the translation request, > > would you please give an example to use POST method? many thanks! > > > Dan > > > On Dec 2, 1:37 pm, Jeremy Geerdes <[EMAIL PROTECTED]> wrote: > >> When using GET requests, as your JS would be, you're going to run > >> into > >> the limitations of a GET request. I.e., you really can't send more > >> than 2,000 characters. You will have to re-engineer your application > >> to use POST or split your text into multiple segments. > > >> Jeremy R. Geerdes > >> Effective website design & development > >> Des Moines, IA > > >> For more information or a project quote:http:// > >> jgeerdes.home.mchsi.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! > > >> On Dec 2, 2008, at 12:26 PM, Dan wrote: > > >>> Hello all, I have a question about the length limit of translation > >>> API. > > >>> When I run my below sample code, the text length is 2200, i can not > >>> get translation result. But if i remove the second paragraph, the > >>> length is 660, then i get the translation result, can anyone verify > >>> that the length limit is less than 5000 characters (Google > >>> translation > >>> API terms gives the 5000 characters length limitation)? or point out > >>> any problem in my code? thanks a lot. > > >>> ================= > >>> <html> > >>> <head> > >>> <script type="text/javascript" src="http://www.google.com/jsapi"></ > >>> script> > >>> <script type="text/javascript"> > >>> google.load("language", "1"); > >>> </script> > > >>> <script> > >>> var text; > >>> var container; > >>> var length; > > >>> function start() { > >>> text = document.getElementById("text").innerHTML; > >>> container = document.getElementById("translation"); > >>> length=document.getElementById("length"); > >>> length.innerHTML= text.length; > > >>> google.language.translate(text, "es", "en", translateResult); > > >>> //return false; > >>> } > > >>> function translateResult(result) { > >>> if (result.translation) { > >>> container.innerHTML = result.translation; > >>> } > >>> else{ > >>> //var returnCode = document.getElementById("returnCode"); > >>> //returnCode.innerHTML = result.error.message; > >>> container.innerHTML = '<span style="color:red">Error > >>> Translating</span>'; > >>> } > >>> } > > >>> </script> > >>> </head> > > >>> <body> > >>> <div id="text"> > >>> Alojamiento y transportes en la ciudad > >>> <p>Hermosillo, Sonora.- Ante la instancia de Ignacio Búrquez > >>> Valenzuela de levantar el cerca en el terreno para continuar los > >>> trabajos de la ampliación del bulevar Quiroga, del cual se dice > >>> propietario sin mostrar documentos que lo avalen, el municipio de > >>> Hermosillo interpondrá una denuncia penal en su contra, advirtió > >>> el alcalde, Ernesto Gándara Camou. > > >>> Después de que el Ayuntamiento ordenara tirar el cerco que se > >>> levantó esta semana por Ignacio Búrquez obstruyendo los trabajos > >>> de la obra, de nueva cuenta se intentó ponerlo pero los elementos > >>> de la policía comisionados para atender este caso lo impidieron. > > >>> <p> > >>> Centro y Norte Oriente Sur Quintana Roo Campeche Foros Obituarios > >>> Esquelas Clima Sitios especiales Multimedia Audio Editoriales > >>> Videos Galerías Infografías Temas Artes y letras Autos Ciencia > >>> Futuro Modas Salud Viajes Decoración Bienes raíces Noticias en: > >>> Celular PDA Inicio Noticias en tu correo ir ayuda Acceso directo > >>> @ ir ayuda | menú Edición impresa Portada Anuncios > >>> Información especial Diario en la escuela Mapa de Mérida > >>> Revista Plan B Postales de mi tierra Yucatecos en México > >>> El extranjero Sitio oficial de los Mayas de Yucatán Fin de semana > >>> La entrevista La semana hace 50 años INTERNACIONAL > > >>> Transición en EE.UU. A Raúl Castro le gustaría reunirse con Obama > >>> en Guantánamo 1:13 p.m. LA HABANA, 26 de noviembre(AP).- El > >>> presidente cubano Raúl Castro dijo el miércoles que > >>> le complacería conocer al presidente electo estadounidense > >>> Barack Obama en ``terreno neutral'''': la base norteamericana en > >>> Bahía de Guantánamo. El líder cubano hizo su > >>> oferta en una entrevista con el actor y director de cine Sean > >>> Penn, quien escribió sobre ella en la revista The Nation. > >>> Penn dijo que le preguntó a Castro si se reuniría > >>> con Obama en Washington. El mandatario cubano dijo que "lo > >>> pensaría'''' y que no sería justo para ninguno > >>> tener que ir al territorio del otro. Por eso sugirió la > >>> base de Guantánamo. Castro dijo que él y Obama > >>> "debemos reunirnos y empezar a resolver nuestros > >>> problemas''''. Incluso sugirió un obsequio: los cubanos > >>> podrían enviar a Obama "de vuelta a casa con la > >>> bandera norteamericana que ondea sobre la Bahía de > >>> Guantánamo''''. > > >>> </div> > > >>> <A HREF="javascript:start()"> Click to translate!</A> > > >>> <div id="length"></div> > >>> <div id="translation"></div> > >>> <div id="returnCode"></div> > > >>> </body> > >>> </html>- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
