2006-02-17

Translate using bookmark keywords

If you are familiar with Google Language Tools, you know that there are provisions for turning perfect foreign language pages into severely broken but sometimes human parsable English, or sometimes the other way too. It's just not very accessable being on some remote web page, when I want to translate this page, now. And before someone mentions browser extensions that do that kind of thing, I'll add that they add clutter to menus or toolbars, which I don't want.

But there is a very trivial solution anyway: the bookmarklet's little sister, Smart Keywords, as they are apparently called today, or Smart Bookmarks, or Bookmark Keywords, as they were called when the feature came to Mozilla in 2002. How quickly names change over time, eh?

Anyway, the idea is simple enough: treat the browser address field a bit like a command line. Type a command name, optionally followed by a space and a parameter, press return, and the browser looks up the command URL from your bookmarks, using the command name as a keyword (rather than having you chase through your unwieldy maze of bookmarks) and replaces occurrences of %s in it with the parameter you might have passed. (If you don't pass a parameter, the %s is kept intact, at least in Firefox.) And like so many other really basic ideas like this, it's immensely useful.

Today I made myself a handful of keyword bookmarks for Google Language tools, one for each language, translating from German, French, Italian, Portuguese, Japanese, Korean and simplified Chinese to English, naming them by their ISO-639-1 two-letter language codes, de, fr, it, pt, ja, ko, cn. (Actually, I made two for Spanish and Japanese, as I tend to forget it's es and not sp, and ja and not jp.)

When you have bookmarked them (or those you want), visit the bookmark properties view and name them in the Keyword field. I tucked all of mine into a bookmark folder I called "translate" way down in the least accessable parts of my bookmarks, so they won't get in the way of anything.

Here is where the fun begins. Whenever I end up on a page I can't read due to it being written in some unfamiliar language, but would want to get at least a vague concept of, I prepend "ja " to the addess field and hit return, or whichever language the page was written in. Totally keyboard driven goodness, never more than seven key strokes away; Ctrl-L, Home, j a Space Return.

The expressiveness of the command line, the swift accessibility of built-in keyboard shortcuts and the clean user interface of an extensionless browser. Just the way I like it. The user interface is all neatly tucked away in your head. Non-programmers can make these things all on their own too, and it's not limited to just searches, either, as you noted above.

And for us programmers, it's trivial to marry them with common bookmarklet making, if you make the occasional bookmarklet that requires user input, typically otherwise done by way of prompt(). %s works just as described above, in a javascript bookmarklet URL, too. Keep innovating, making the most of the tools at your disposal!

5 comments:

  1. Very clever Firefox trick, I love it, thanks very much.

    I own a French holiday Gite and end up quite often having to labouriously copy and paste Tourist information links to Google translate - you've definitely saved me some time.

    Love it so much I'm passing the tip on in my own Blog

    ReplyDelete
  2. There's actually an easier way of doing that. Simply use this as the bookmark:
    Translate, and Google will automatically figure out the language. Saves the time of making 8 bookmarks, and having to figure out what language each page is.

    ReplyDelete
  3. Or to make it REALLY simple, add a bookmarklet with the address javascript:location.href="http://translate.google.com/translate?u=" + location.href + "&hl=en&safe=off&ie=UTF-8&oe=UTF-8";

    ...

    ReplyDelete
  4. I don't see how involving javascript to achieve this effect makes anything any simpler. Also -- and while it's not any particular issue in this case, in the generic case I would advise against using bookmarklets for things like this that don't need javascript, as the above bookmarklet will leak an HTTP referer header, telling the page you end up at where you came from, which (in some cases and to some people) may intrude on their privacy.

    ReplyDelete
  5. Another interesting we (ptaff.ca) have produced is called Liendex.

    Liendex builds a collection of hyperlink to many language tools (both in french and english) using only query. In some cases, like the grand dictionnaire terminologique, we use bookmarklets because they do not want to use a REST url.

    Enjoy!

    ReplyDelete

Limited HTML (such as <b>, <i>, <a>) is supported. (All comments are moderated by me amd rel=nofollow gets added to links -- to deter and weed out monetized spam.)

I would prefer not to have to do this as much as you do. Comments straying too far off the post topic often lost due to attention dilution.

Note: Only a member of this blog may post a comment.