Go Back   Google Chrome Forums > Google Chrome > Chrome Plugins


http://chromeplugins.org/frwrdicon.jpg
Top Tip : Click here to Boost Your PC & Chrome Browsing Speed
Reply
 
Thread Tools Display Modes
  #1  
Old 04-08-2009, 05:42 PM
Junior Member
 
Join Date: Apr 2009
Location: Madrid
Posts: 15
Lightbulb Instant Page Translator

Hi everyone,
yesterday I decided to upgrade a script that was making an interrogation to Google web page translate. Actually the one I've seen could only translate the current page in English... not very versatile.
So I decided to add a prompt where you can type the language you want Google to translate the page in. The prompt allow a string of 2 chars as input and if it doesn't represent any language (as 'zz') then the default 'en' is used.

That's the code of the script:

javascript:A14nH=location.href; L3f7=prompt('Choose%20destination%20language%20(2%20chars%20abbreviation):%20','en'); if(L3f7.length==2) {location='http://translate.google.es/translate?u='%20+%20encodeURIComponent(A14nH)+'&sl=auto&tl='+L3f7;}else{alert ('Invalid%20language%20abbreviation.')}

Finally all the power of translation is at the reach of our cursor! Now I can enjoy to translate pages from Chinese to Arabic in a click!

Gianluca

Last edited by Gianluca Ferrario; 04-08-2009 at 05:51 PM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 04-08-2009, 08:43 PM
Stamga's Avatar
Super Moderator/Designer
 
Join Date: Mar 2009
Location: Qc, Canada
Posts: 599
Send a message via MSN to Stamga
Default

Really useful! but it would be useful to know the language abbreviations.. because I typed in fr for French and it gave me another language. Thanks
__________________

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 04-09-2009, 04:22 PM
Junior Member
 
Join Date: Apr 2009
Location: Madrid
Posts: 15
Default Abbreviations

Abbreviations are the same that Google translate use, so 2 letters written in lowercase. I suppose these abbreviation comes from ISO 639. In your case French is fr.
When I will have some time I will try to create a script that validate the language name string.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 04-09-2009, 05:58 PM
Stamga's Avatar
Super Moderator/Designer
 
Join Date: Mar 2009
Location: Qc, Canada
Posts: 599
Send a message via MSN to Stamga
Default

OK, it works, but the only thing is that the header put on the top of the page says this: "Esta página ha sido traducida automáticamente. Volver a la página de traducción
Ver la Página Web Original" which I suppose is spanish... Is there any way of making that english instead? Thanks
__________________

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 04-10-2009, 06:21 AM
Junior Member
 
Join Date: Apr 2009
Location: Madrid
Posts: 15
Default

well, just change the query to translate.google.com instead of translate.google.es. I live in Spain so I forgot to change it...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 04-10-2009, 02:03 PM
Stamga's Avatar
Super Moderator/Designer
 
Join Date: Mar 2009
Location: Qc, Canada
Posts: 599
Send a message via MSN to Stamga
Default

Ok thanks!
__________________

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 04-20-2009, 09:03 PM
Junior Member
 
Join Date: Apr 2009
Location: Madrid
Posts: 15
Default

Hi,
I just finished to upgrade this bookmarklet. Now it can translate a whole page in the desired language OR you can simply select with the mouse a text to be translated that is in the page and then click on the bookmarklet to have the translation in a popup window. Enjoy!

javascript:function x(){loc=location.href; lang=prompt('Choose%20destination%20language%20(2% 20chars%20abbreviation):%20','en'); if (lang.length==2){flag=true;}else{flag=false; alert ('Invalid%20language%20abbreviation.')}text = ''; if (window.getSelection) { text= window.getSelection(); } else if (document.getSelection) { text = document.getSelection(); } else if (document.selection) { text = document.selection.createRange().text;}}function y(){if((flag==true) && (text=='')){location='http://translate.google.com/translate?u='%20+%20encodeURIComponent(loc)+'&sl=a uto&tl='+lang;}} function z(){if ((flag==true) && (text!='')){ var res=window.open('http://translate.google.com/translate_t?text='+text+'&sl=auto&tl='+ lang ,'gTranslate_popup','left='+((window.screenX||wind ow.screenLeft)+10)+',top='+((window.screenY||windo w.screenTop)+10)+',height=500px,width=640px,resiza ble=1,scrollbars=1');window.setTimeout(function(){ res.focus()},300)}} x(); y(); z();
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 05-15-2009, 01:47 PM
Junior Member
 
Join Date: May 2009
Posts: 3
Unhappy

Did the last bookmarklet work for anybody ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 05-15-2009, 02:07 PM
Junior Member
 
Join Date: Apr 2009
Location: Madrid
Posts: 15
Default

well, I think yes. What's the problem?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10  
Old 05-15-2009, 03:03 PM
Junior Member
 
Join Date: May 2009
Posts: 3
Unhappy

The first link provides works as a charm, however the last just doesnt work. No reaction.


All I did was created a Bookmark through the Bookmark manager, the same way I created for the first one
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
editing/skinning the default home page (most visited page) jbell Chrome Plugins 1 03-14-2009 02:49 AM




Chrome Central - Chrome Talk - Chrome Tips and Tricks - Chrome Plugins - Chrome Themes - Chrome Tools - Bugs and Vulnerabilities - Chrome Tech - General Chat


All times are GMT. The time now is 01:07 AM.


Powered by vBulletin® Version 3.7.4 PL1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Google Chrome and Google™ is a Trademark of Google Inc
This site chromeplugins.org is not affiliated with or sponsored by Google Inc.
Thanks: Taree SEO Forum and John