skullbrain.org
http://skullbrain.org/legacy/

translation tools (new & improved!)
http://skullbrain.org/legacy/viewtopic.php?f=3&t=23785
Page 1 of 1

Author:  Ultra999 [ Thu Aug 07, 2008 7:54 pm ]
Post subject:  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!

Author:  marswillrule [ Thu Aug 07, 2008 7:59 pm ]
Post subject:  Re: translation tools

excellent.

thanks.

Author:  jetJagger [ Thu Aug 07, 2008 8:20 pm ]
Post subject:  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

Author:  Ultra999 [ Fri Aug 08, 2008 5:30 am ]
Post subject:  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.

Author:  pickleloaf [ Fri Aug 08, 2008 5:34 am ]
Post subject:  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

Author:  pickleloaf [ Fri Aug 08, 2008 5:35 am ]
Post subject:  Re: translation tools

oh, with free shipping

Author:  liquidsky [ Fri Aug 08, 2008 7:10 am ]
Post subject:  Re: translation tools

That's really cool.
Saves a couple steps.

Thanks for sharing!

Author:  Ultra999 [ Fri Aug 08, 2008 8:17 am ]
Post subject:  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!

Author:  CrazySid [ Fri Aug 08, 2008 8:24 am ]
Post subject:  Re: translation tools

Thanz. It's very helpful to translate.

Author:  geotaro [ Fri Aug 08, 2008 11:04 am ]
Post subject:  Re: translation tools

Very nice. Thanks!

Author:  coasterbear [ Sat Aug 09, 2008 9:02 pm ]
Post subject:  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.

Author:  Nate [ Sun Aug 10, 2008 1:32 pm ]
Post subject:  Re: translation tools

This is awesome! Thanks a lot for sharing.

Author:  Ultra999 [ Tue Aug 12, 2008 5:34 am ]
Post subject:  Re: translation tools

coasterbear wrote:
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.

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?

Author:  Ultra999 [ Wed Aug 13, 2008 5:27 pm ]
Post subject:  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!

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/