Hey, made a 10 min class to do this. It doesn't use jQuery at all, so
it will work as fast as possible.
You only need to specify the translating function.

Made a blog post to detail its use.

http://flesler.blogspot.com/2008/05/textnode-translator-for-javascript.html

I never used Google translator, but it probably requires AJAX, so pay
attention to the 'sync' part.

Cheers

--
Ariel Flesler
http://flesler.blogspot.com


On 7 mayo, 16:22, Joe <[EMAIL PROTECTED]> wrote:
> Balazs,
>
> Thanks, but I tried your plugin and it did not work.  There is no demo
> for say clicking a button and converting the page; the bookmarklet is
> cool, but doesn't really help when I can't get the plugin to work.  I
> emailed you so hopefully I'll hear back...
>
> I did actually re-create your plugin, but didn't author it or add any
> bells and whistles, just translating an entire page and/or element...
>
> Cheers.
>
> Joe
>
> www.subprint.com
>
> On May 7, 1:39 pm, Balazs Endresz <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi! I replied in the previous thread but it hasn't appeared in Google
> > groups, just 
> > here:http://www.nabble.com/Selector-Madness!--How-to-Select-all-the-Text-o...
> > So there is a translate plugin that works this way:
>
> >http://code.google.com/p/jquery-translate/
>
> > On May 5, 9:32 pm, Joe <[EMAIL PROTECTED]> wrote:
>
> > > Last week I had a question on how to traverse the DOM and find all 
> > > elements that had some text (p, a, li, h1, etc.) so I could manipulate
> > > it with Google's translation API.  Well with some help from the
> > > community I was able to accomplish this feat.
>
> > >http://groups.google.com/group/jquery-en/browse_thread/thread/c63da32...
>
> > > However, I have a bigger problem.  Now, when I grab theallproperelements:
>
> > > $a = $(' #container > * ').contents();
>
> > > And parse thru them tofindwhich ones have text, it does just that
> > > BUT if an unordered list is within a div and that UL has text it will
> > > show up not only with the UL, but within the DIV as well.
>
> > > $a.each(function()
> > > { ... translate stuff here ..});
>
> > > So in iteration one, wefindthe DIV, and then locate any andALLtext
> > > in the DIV.  Quite a bit for the header navigation.
>
> > > Example Result for Div:
> > > HOME BUSINESS CONTACT ABOUT
>
> > > Then the next iteration is the UL, and it finds its text, which is
> > > basically the same as the DIV's text result.
>
> > > Example Result for UL:
> > > HOME BUSINESS CONTACT ABOUT
>
> > > Then the next iteration is the LI element, which has the proper text
> > > but,
>
> > > The next iteration is the A element which is finally the text I
> > > actually want to translate.
>
> > > Example Result for LI and A:
> > > HOME
>
> > > So myquestionis how can Itraversedown and grab thelastchild on
> > > that particular "branch" of theDOM.  Surely there's a way to check if
> > > current node has or does not have a child, but how with jQuery?
>
> > > Thanks!
>
> > > BTW, Ariel Fleisler's recommendation from the previous post appears to
> > > be the best approach, but my pure Javascript mixing with jQuery skills
> > > are not quite up to snuff to hash that out...- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

Reply via email to