do you can post an example for ContentType.TEXT??? thank you
On Sep 11, 7:43 pm, "Ben Lisbakken" <[EMAIL PROTECTED]> wrote: > Paul-lmi -- > Try using the plaintext > option:http://code.google.com/apis/ajaxlanguage/documentation/reference.html... > > That should keep the newlines in there. > > Thanks, > Ben > > On Wed, Sep 10, 2008 at 6:49 PM, paul-lmi <[EMAIL PROTECTED]> wrote: > > > Could you elaborate on your example code a bit? I understand the > > concept, but I'm a little lost in the implementation in regards of > > what is fitting where. Could you maybe write it as an extension to > > the official examples? > > > On Jul 25, 9:00 pm, "jgeerdes [AJAX APIs \"Guru\"]" > > <[EMAIL PROTECTED]> wrote: > > > I could be wrong, but I really don't think that the Language API > > > returns formatted text like you're wanting. What you could do, > > > though, is submit separate queries for each line, using a function > > > closure that would remind your callback what it was replacing. > > > Something like this might work: > > > > function(textarea,source,destination){ > > > var lines=textarea.value.split(/\n/), > > > myCallback=function(srcStr){return function(result) > > > {finishTranslation(srcStr,textarea,result);}}; > > > for(var y=0;y<lines.length;y++){ > > > var line=lines[y]; > > > if(line.match(/[a-z]/i)){ > > > google.translate(line,source,destination,myCallback(line)); > > > } > > > }} > > > > function finishTranslation(srcStr,result){ > > > if(result.error){ > > > // Error processing here > > > return; > > > } > > > textarea.value.replace(srcStr,result.translation); > > > // Do other stuff > > > > } > > > > It should be noted that this will, in theory (I haven't tested it), > > > send a request for any line that contains an alphabetic character > > > (i.e., because you don't need to translate numbers or whitespace) and > > > then replace that string with the translation. > > > > Jeremy R. Geerdes > > > Effective website design & development > > > Des Moines, IA > > > > For more information or a project quote:http://jgeerdes.home.mchsi.com > > > [EMAIL PROTECTED] > > > > If you're in the Des Moines, IA, area, check out Debra Heights > > > Wesleyan Church! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
