translation tools (new & improved!)

Discussion in 'Japan Toys' started by Ultra999, Aug 7, 2008.

  1. Ultra999

    Ultra999 Post Pimp

    Joined:
    Oct 30, 2007
    Messages:
    2,642
    translation tools (new & improved!)
    i thought i'd give back to the community that has helped me out so much.
    i hacked together these javascript utilities to make translating japanese sites quicker.

    simply copy the scripts into your bookmarks toolbar for easy, single-click access.
    sorry about the page width; the -url- tag wouldn't accept/link these scripts since they don't start with the "http" keyword.


    translate current page or selection via google
    Code:
    javascript:var%20tx_userSelection;if(window.getSelection){tx_userSelection=window.getSelection();}else%20if(document.selection){tx_userSelection=document.selection.createRange();}var%20tx_selectedText=tx_userSelection;if(tx_userSelection.text)tx_selectedText=tx_userSelection.text;function%20tx_display(txt){var%20popup=window.open('http://translate.google.com/translate_t?text='+encodeURIComponent(txt)+'&langpair=ja|en&hl=en&ie=UTF-8&sl=ja&tl=en','tx-g','width=780,height=565,scrollbars=yes,toolbar=no,menubar=no,location=yes,directories=no');if(window.focus){popup.focus()}};if(tx_selectedText!=''){tx_display(tx_selectedText)}else{window.location.href='http://translate.google.com/translate?u='+encodeURIComponent(window.location.href)+'&sl=ja&tl=en&hl=en&ie=UTF-8'}
    translate current page or selection via babelfish
    Code:
    javascript:var%20tx_userSelection;if(window.getSelection){tx_userSelection=window.getSelection();}else%20if(document.selection){tx_userSelection=document.selection.createRange();}var%20tx_selectedText=tx_userSelection;if(tx_userSelection.text)tx_selectedText=tx_userSelection.text;function%20tx_display(txt){var%20popup=window.open('http://babelfish.yahoo.com/translate_txt?trtext='+encodeURIComponent(txt)+'&ei=UTF-8&doit=done&fr=bf-res&intl=1&tt=urltext&lp=ja_en','tx-b','width=485,height=565,scrollbars=yes,toolbar=no,menubar=no,location=yes,directories=no');if(window.focus){popup.focus()}};if(tx_selectedText!=''){tx_display(tx_selectedText)}else{window.location.href='http://us.lrd.yahoo.com/_ylt=A0LEUFlN1plI2GsAIVeu7s4F/SIG=11sl0ed31/EXP=1218127821/*-http%3A//babelfish.yahoo.com/translate_url?trurl='+encodeURIComponent(window.location.href)+'&ei=UTF-8&doit=done&fr=bf-home&intl=1&tt=url&lp=ja_en'}
    let me know if they don't work for you guys — they've only been tested on safari 3 & firefox 3.

    happy toy hunting!
     
    leili and toothaction like this.
  2. marswillrule

    marswillrule Line of Credit

    Joined:
    Aug 23, 2006
    Messages:
    1,636
    Location:
    Planet Motherfucker
    translation tools (new & improved!)
    Re: translation tools

    excellent.

    thanks.
     
  3. jetJagger

    jetJagger Toy Prince

    Joined:
    Apr 11, 2006
    Messages:
    488
    Location:
    Seatopia
    translation tools (new & improved!)
    Re: translation tools

    That is just awesome. They all seem to work fine in Firefox 3.

    Edit: Whoops...almost. The selected pop-up script has a weird bit of behavior in Firefox. The original page window/tab is replaced by an [object Window] page. Still, very cool. Thanks.

    --
    jJ
     
  4. Ultra999

    Ultra999 Post Pimp

    Joined:
    Oct 30, 2007
    Messages:
    2,642
    translation tools (new & improved!)
    Re: translation tools

    thanks for the feedback! i'm glad it's useful to some of you.

    i cleaned up the code a bit and also fixed the third option to be more standards compliant. it now behaves properly in firefox.

    please let me know of any other bugs and/or modifications you would like to see.
     
    toothaction likes this.
  5. pickleloaf

    pickleloaf Super Deformed

    Joined:
    Apr 11, 2007
    Messages:
    5,882
    translation tools (new & improved!)
    Re: translation tools

    i'd love a modification that would speak to yahoo japan sellers and convince them to sell to me at a much lower cost
     
  6. pickleloaf

    pickleloaf Super Deformed

    Joined:
    Apr 11, 2007
    Messages:
    5,882
    translation tools (new & improved!)
    Re: translation tools

    oh, with free shipping
     
  7. liquidsky

    liquidsky Vintage

    Joined:
    Dec 17, 2005
    Messages:
    7,725
    translation tools (new & improved!)
    Re: translation tools

    That's really cool.
    Saves a couple steps.

    Thanks for sharing!
     
  8. Ultra999

    Ultra999 Post Pimp

    Joined:
    Oct 30, 2007
    Messages:
    2,642
    translation tools (new & improved!)
    Re: translation tools

    by request, a fourth option has been added to translate selected text via google as well as babelfish.
    now you can display both google and babelfish windows side by side for better combined translation efforts.

    please update your previously bookmarked versions with these latest changes.

    enjoy, and thanks for the input!
     
    toothaction likes this.
  9. CrazySid

    CrazySid Fresh Meat

    Joined:
    Apr 20, 2008
    Messages:
    8
    Location:
    on Earth
    translation tools (new & improved!)
    Re: translation tools

    Thanz. It's very helpful to translate.
     
  10. Anonymous

    Anonymous Guest

    translation tools (new & improved!)
    Re: translation tools

    Very nice. Thanks!
     
  11. coasterbear

    coasterbear Toy Prince

    Joined:
    Sep 12, 2007
    Messages:
    243
    Location:
    SF Bay Area
    translation tools (new & improved!)
    Re: translation tools

    Even easier:

    Go to

    http://translate.google.com/translate_tools?hl=en

    There you will find a link that you can add to your link bar. When you click it, it will translate the current page or , if something is selected, the selection.
     
  12. Nate

    Nate Line of Credit

    Joined:
    Jan 17, 2008
    Messages:
    1,991
    Location:
    SoCal
    Name:
    NateORMaddie
    translation tools (new & improved!)
    Re: translation tools

    This is awesome! Thanks a lot for sharing.
     
  13. Ultra999

    Ultra999 Post Pimp

    Joined:
    Oct 30, 2007
    Messages:
    2,642
    translation tools (new & improved!)
    Re: translation tools

    i wish i had known about that earlier. it certainly would have saved me all the effort of coding up my own! i wonder why it's not linked from their main language page?
    now i'll have to see if my hack job is anywhere near what they've done for themselves. i should combine my page/selection scripts into one as well.
    thanks for posting that link!

    at least the babelfish script is still useful. i've noticed that it really requires both translations to make sense of many pages.

    does anyone know if these types of bookmarklet scripts work on the iphone?
     
    toothaction likes this.
  14. Ultra999

    Ultra999 Post Pimp

    Joined:
    Oct 30, 2007
    Messages:
    2,642
    translation tools (new & improved!)
    Re: translation tools

    new and improved! now with less options!

    the two separate scripts for each translator have been combined into one.

    if no text is selected on the page, it translates the entire page. if there is a selection, only that portion is translated and displayed in a popup window.
    so even though google provides a similar bookmarklet, this one is a little more convenient for multi-translation-comparison.

    thanks to coasterbear for the inspiration!
     
    leili and toothaction like this.
  15. toothaction

    toothaction Team Tsubu Staff Member

    Joined:
    Feb 10, 2011
    Messages:
    13,172
    Location:
    Detroit
    Name:
    David
    flickr:
    toothaction
    Instagram:
    thebeautifulpuffin
    translation tools (new & improved!)
    ^^^ Old gold!
     
    leili likes this.

Share This Page