Please check post for Java jQuery Plug-In with sample code

http://groups.google.com/group/Google-AJAX-Search-API/browse_thread/thread/868231b9f712f1d4/213338edd8ece302#213338edd8ece302

or you can check out a live sample on my website http://visachoice.appspot.com


Chef
U.S. Immigration Guide
http://visachoice.appspot.com

On Mar 10, 5:21 am, sebastian de comocomo <[email protected]>
wrote:
> Hi Reggie,
>
> Could you publish the solution?
>
> Thanks
>
> Sebastian
>
> On 10/03/09 12:47, "Reggie" <[email protected]> wrote:
>
>
>
> > Never mind, I figured it out. Once again, thanks very much for your
> > help, it is much appreciated!
>
> > On Mar 10, 11:15 am, Reggie <[email protected]> wrote:
> >> Last quick question, how would I be able pick up the required language
> >> pair dynamically/ Do I have to generate the javascript dynamically
> >> after a postback?
>
> >> On Mar 10, 10:39 am, Jeremy Geerdes <[email protected]> wrote:
>
> >>> How you would do this will depend very much on the nature of your  
> >>> page, the number of fields you're wanting to translate, and a number  
> >>> of other factors. The simplest way, of course, would be to loop  
> >>> through the fields you want to translate, generating what's called a  
> >>> function closure for each one so that it will be able to find itself  
> >>> back when the translation returns.  For instance:
>
> >>> var fields=document.getElementsByTagName('input');
> >>> var srcLang=''; // leave blank to auto-detect
> >>> var desLang='en'; // change to whatever you want it to go to
>
> >>> var myClosure=function(field){ // here is the closure, a function that  
> >>> returns a function
> >>>   return function(response){
> >>>    if(!response.error){
> >>>     field.value=response.translation
> >>>    }
> >>>   }
>
> >>> }
>
> >>> for(var i=0;i<fields.length;i++){
>
> >>> google
> >>> .language
> >>> .translate(fields[i].value,srcLang,desLang,myClosure(fields[i]));
>
> >>> }
>
> >>> If there is a large number of small fields, though, it may be better  
> >>> performance-wise to combine them into groups that are separated out by  
> >>> xml or some other markup that your script will be able to parse out  
> >>> when the translation returns.  The key here will be that, when using  
> >>> the JSAPI, you will be using the GET method, and Google limits URL  
> >>> lengths - which is how parameters are passed with the GET method - to  
> >>> no more than 2,000 characters, including encoded characters and such.
>
> >>> 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://jgee.
> >>> ..
> >>> [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 10, 2009, at 5:13 AM, Reggie wrote:
>
> >>>> hi all, loving the language api. I am having a problem figuring out
> >>>> how I can dynamically translate all text fields on a web page when the
> >>>> page loads, can anyone help?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to