Two things:

First, could you provide a link to your page so we can see what your  
Javascript looks like in completion?  The snippet that you've provided  
won't work because you're not really waiting for the translation API  
to return before you actually submit the form.  So the API returns its  
result, but the browser isn't listening anymore.

Second, why don't you just use LWP or even LWP::Simple to run the  
translation in the Perl program?  It would dramatically simplify the  
process by not having to wait for the API to return before the form is  
actually submitted, and if you simply wrote a subroutine that would  
run the translation, you could utilize it to translate your English  
results back into French.

Rev. Jeremy R. Geerdes, Pastor
Debra Heights Wesleyan Church
4025 Lower Beaver Rd.
Des Moines, IA 50310

p/f: (515) 279-5212
h: (515) 277-7491
[EMAIL PROTECTED]




On Oct 6, 2008, at 2:19 PM, Syl wrote:

>
> Hi - I've searched and searched without success.
>
> I have a legacy Perl search application.
> Although my database content is only in Englishm I want to use the API
> so that the word gets translated on the fly, and searches the
> translated word in order to return English results.
> Like this :
>
> User types in search for : acier
> API translates to : steel
> My perl function searches for : steel  ........... and returns the
> results.
>
> Why is this not working (the $title is being passed successfully) :
>
>  google.language.translate("$title", "fr", "en", function(result) {
>   if (!result.error) {
>          var sendToPerl;
>
> document.getElementById("sendToPerl").value=result.translation;
>  }
>
> NOW PERL BEGINS :
> this returns empty :
>  <input type="hidden" id="sendToPerl" value="$sendToPerl">
> so does this :
>  document.write('<input type="text" name="sendToPerl" value="' +
> sendToPerl + '">');
>
> Altho FireFox does populate the text box with :
> [object HTMLInputElement]
>
> THANKS - Syl
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX API" 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