| Author |
Message |
|
Ultra999
Post Pimp
Joined: Tue Oct 30, 2007 9:05 pm Posts: 2633
|
 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 googleCode: 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 babelfishCode: 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!
Last edited by Ultra999 on Wed Aug 13, 2008 5:29 pm, edited 7 times in total.
|
| Thu Aug 07, 2008 7:54 pm |
|
 |
|
marswillrule
Comment King
Joined: Wed Aug 23, 2006 7:48 am Posts: 1353 Location: Planet Motherfucker
|
 Re: translation tools
excellent.
thanks.
_________________ WANTS
|
| Thu Aug 07, 2008 7:59 pm |
|
 |
|
jetJagger
Toy Prince
Joined: Tue Apr 11, 2006 3:17 am Posts: 401
|
 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
_________________ -- jJ
Jet Jaguar Want List
|
| Thu Aug 07, 2008 8:20 pm |
|
 |
|
Ultra999
Post Pimp
Joined: Tue Oct 30, 2007 9:05 pm Posts: 2633
|
 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.
|
| Fri Aug 08, 2008 5:30 am |
|
 |
|
pickleloaf
Super Deformed
Joined: Wed Apr 11, 2007 5:19 pm Posts: 5861 Location: durham/chapel hill
|
 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
_________________ http://www.silvaandgold.com/ :: wants :: flickr
Chriz74 wrote: Oh jesus what a bunch of nerds.
|
| Fri Aug 08, 2008 5:34 am |
|
 |
|
pickleloaf
Super Deformed
Joined: Wed Apr 11, 2007 5:19 pm Posts: 5861 Location: durham/chapel hill
|
 Re: translation tools
oh, with free shipping
_________________ http://www.silvaandgold.com/ :: wants :: flickr
Chriz74 wrote: Oh jesus what a bunch of nerds.
|
| Fri Aug 08, 2008 5:35 am |
|
 |
|
liquidsky
Vintage
Joined: Sat Dec 17, 2005 2:54 pm Posts: 7412 Location: Far From the Maddening Crowds
|
 Re: translation tools
That's really cool. Saves a couple steps.
Thanks for sharing!
|
| Fri Aug 08, 2008 7:10 am |
|
 |
|
Ultra999
Post Pimp
Joined: Tue Oct 30, 2007 9:05 pm Posts: 2633
|
 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!
|
| Fri Aug 08, 2008 8:17 am |
|
 |
|
CrazySid
Fresh Meat
Joined: Sun Apr 20, 2008 9:49 pm Posts: 8 Location: on Earth
|
 Re: translation tools
Thanz. It's very helpful to translate.
|
| Fri Aug 08, 2008 8:24 am |
|
 |
|
geotaro
|
 Re: translation tools
Very nice. Thanks!
|
| Fri Aug 08, 2008 11:04 am |
|
 |
|
coasterbear
Toy Prince
Joined: Wed Sep 12, 2007 10:31 am Posts: 243 Location: SF Bay Area
|
 Re: translation tools
Even easier: Go to http://translate.google.com/translate_tools?hl=enThere 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.
|
| Sat Aug 09, 2008 9:02 pm |
|
 |
|
Nate
Line of Credit
Joined: Fri Jan 18, 2008 12:44 am Posts: 1748 Location: Los Angeles
|
 Re: translation tools
This is awesome! Thanks a lot for sharing.
_________________ OLD FLICKR • NEW-IPERNITY • TRADE • WANTS • BLOG
|
| Sun Aug 10, 2008 1:32 pm |
|
 |
|
Ultra999
Post Pimp
Joined: Tue Oct 30, 2007 9:05 pm Posts: 2633
|
 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?
|
| Tue Aug 12, 2008 5:34 am |
|
 |
|
Ultra999
Post Pimp
Joined: Tue Oct 30, 2007 9:05 pm Posts: 2633
|
 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!
|
| Wed Aug 13, 2008 5:27 pm |
|
|