ANNOUNCEMENT:

There will be some planned downtime starting Wednesday, June 15th at 9am EDT. The board will be closed for approximately 12 to 24 hours while we work on migrating to a new forum software. For more information on the move, check out the Board Change Announcements thread.
It is currently Mon Dec 22, 2025 4:04 am




Post new topic Reply to topic  [ 14 posts ] 
 translation tools (new & improved!) 
Author Message
Post Pimp
User avatar

Joined: Tue Oct 30, 2007 9:05 pm
Posts: 2633
Reply with quote
Post 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!


Last edited by Ultra999 on Wed Aug 13, 2008 5:29 pm, edited 7 times in total.



Thu Aug 07, 2008 7:54 pm
Profile WWW
Comment King
User avatar

Joined: Wed Aug 23, 2006 7:48 am
Posts: 1353
Location: Planet Motherfucker
Reply with quote
Post Re: translation tools
excellent.

thanks.

_________________
WANTS


Thu Aug 07, 2008 7:59 pm
Profile
Toy Prince

Joined: Tue Apr 11, 2006 3:17 am
Posts: 401
Reply with quote
Post 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
Profile
Post Pimp
User avatar

Joined: Tue Oct 30, 2007 9:05 pm
Posts: 2633
Reply with quote
Post 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
Profile WWW
Super Deformed
User avatar

Joined: Wed Apr 11, 2007 5:19 pm
Posts: 5861
Location: durham/chapel hill
Reply with quote
Post 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
Profile WWW
Super Deformed
User avatar

Joined: Wed Apr 11, 2007 5:19 pm
Posts: 5861
Location: durham/chapel hill
Reply with quote
Post 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
Profile WWW
Vintage

Joined: Sat Dec 17, 2005 2:54 pm
Posts: 7412
Location: Far From the Maddening Crowds
Reply with quote
Post Re: translation tools
That's really cool.
Saves a couple steps.

Thanks for sharing!


Fri Aug 08, 2008 7:10 am
Profile
Post Pimp
User avatar

Joined: Tue Oct 30, 2007 9:05 pm
Posts: 2633
Reply with quote
Post 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
Profile WWW
Fresh Meat
User avatar

Joined: Sun Apr 20, 2008 9:49 pm
Posts: 8
Location: on Earth
Reply with quote
Post Re: translation tools
Thanz. It's very helpful to translate.


Fri Aug 08, 2008 8:24 am
Profile
Reply with quote
Post Re: translation tools
Very nice. Thanks!


Fri Aug 08, 2008 11:04 am
Toy Prince
User avatar

Joined: Wed Sep 12, 2007 10:31 am
Posts: 243
Location: SF Bay Area
Reply with quote
Post 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.


Sat Aug 09, 2008 9:02 pm
Profile
Line of Credit
User avatar

Joined: Fri Jan 18, 2008 12:44 am
Posts: 1748
Location: Los Angeles
Reply with quote
Post Re: translation tools
This is awesome! Thanks a lot for sharing.

_________________
OLD FLICKRNEW-IPERNITYTRADEWANTSBLOG


Sun Aug 10, 2008 1:32 pm
Profile WWW
Post Pimp
User avatar

Joined: Tue Oct 30, 2007 9:05 pm
Posts: 2633
Reply with quote
Post 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
Profile WWW
Post Pimp
User avatar

Joined: Tue Oct 30, 2007 9:05 pm
Posts: 2633
Reply with quote
Post 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
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.