O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  

Buy the book!
Yahoo! Hacks
By Paul Bausch
October 2005
More Info

Translate Any Page with Yahoo!
The World Wide Web has pages in every language, and Yahoo! can help you break through the language barrier
[Discuss (0) | Link to this hack]

Because the Web is a global space, we've all come across pages in different languages, especially among search results. If you're searching for information about a phrase like hamburger recipe, it's strange to come across a page about it in German. It's stranger still to find a mention of your name on a page in a foreign language. Imagine my surprise when I was searching Yahoo! for my name and found it at the Russian site shown in .

Figure 1. Russian text with my name (Paul Bausch)

I can't read Russian, so of course I had no idea what the text said. I had recently added a photo gallery of old radio dials to my web site; I could tell they were linking to it, but I wanted to know what they were saying.

Yahoo! Language Tools

Yahoo!'s Language Tools page (http://tools.search.yahoo.com/language) has some ways to help you work with other languages. Among them is a translation service that will translate any block of text to a different language. I copied the Russian text from , pasted it into the text area labeled "Translate this web text," chose "From Russian to English" from the drop-down list of languages, and clicked Translate. Yahoo! responded with this:

Radio Dials. The gallery of the photographs of ancient, I will not be

afraid this word, radios-scale. The author of collection, photographer

Paul Bausch, decided thus to publish the paternal collection of radio

receivers. 3x, dreams about their own tsifrozerkalke with the

macro-objective become increasingly more importunately.

As you can see, the Yahoo! translation tool isn't perfect, but it's good enough to give a sense of what the page is talking about. The translated text refers to the "paternal collection" of photos, because the radios I photographed belonged to my father. I still have no idea what the last sentence of the translation means, but I'm closer to understanding now than when it was in Russian.


If you'd like to limit the search results that Yahoo! returns to one language or a handful of languages, you can set your preferred languages in your search preferences. By default, Yahoo! returns the best search results from any language.

A faster way to translate any page you find in Yahoo! Search results is via the "Translate this page" link included within the results for non-English pages. highlights the link in the search results.

Figure 2. The "Translate this page" link in Yahoo! Search results

Clicking the "Translate this page" link takes you to a translated version of the page, rather than the page in its original language.

If you find yourself translating pages frequently, there are some ways to speed up the process. You can translate an entire web page by copying and pasting the URL into the field labeled "Translate this web page" on the Yahoo! Language Tools page, choosing the language from the drop-down menu, and clicking Translate. Yahoo! will display the page with all of the text translated.

Another quick way to translate entire pages is with the Yahoo! Toolbar . If you've already installed the Yahoo! Toolbar, choose Add/Edit Buttons… from the Toolbar Settings button to bring up the Customize Yahoo! Toolbar page. Check the box next to Translate Current Page under Search & Navigation and then click Finished. You should now see a small yellow fish button, like the one shown in , on your toolbar.

Figure 3. The Translate button on the Yahoo! Toolbar

From any web page, you can click the Translate button and Yahoo! will display a version in English. Yahoo! will also automatically detect the source language, so you don't need to choose a language from a menu. This is also handy if you can't tell what language the page is in. If you just want to translate a block of text instead of the entire page, you can click the arrow next to the fish and choose Language and Translation Tools from the menu; you'll go to the Yahoo! Language Tools page, where you can paste the text you want to translate into the translation form.

If the Yahoo! Toolbar isn't your style and copying and pasting into the Language Tools isn't fast enough, you can create your own Translate button with an understanding of Yahoo! Translation URLs and a JavaScript bookmarklet.

A Translation Bookmarklet

If you visit the Yahoo! Language Tools page and translate a page by URL, you'll end up at a Yahoo! page that uses frames. The top frame includes the Yahoo! Search logo and several links: View Original, Print Translation, Language Tools, and so on. The bottom frame is the original web page, with all of the text translated into a different language. shows such a translated page, with the O'Reilly Hacks page in Spanish in the bottom frame.

Figure 4. The Hacks site translated into Spanish

Looking at the URL in the address bar, you'll see that you're at a Yahoo! page with some parameters passed to it in the querystring, including the URL of the page to be translated. The whole URL looks like this:


Here are the three variables passed in the URL:


The type of translation to perform


The URL of the page to translate


A code that represents the language to translate from and to

Knowing how to build Yahoo! Translate URLs, you can create a bookmarklet to fetch the current page URL, construct the proper Yahoo! Translate URL, and open it in a new window.

O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.