The Idea

After working with the english Language often I needed a fast way for translating words found in texts, homepages, mails or whatever.

This depends on: klipper, dcop (so kde), a shell script, a browser ...

This little guide will tell you how you can translate words in the clip board. First you have to doubleclick a word or simply mark it with the mouse as if you would like to copy'n'paste with X (not CTRL+C as usually done in the M$ environment). Next you trigger a script which finds out what the last element added to the clipboard is and a browser is started queueing dict.leo.org for the wanted word.

first step - the script

The script which calls the dict.leo.org page. Not really? Yes to be particular it calls the pda.leo.org page - it contains less adds.

#!/bin/sh
a=`dcop klipper klipper getClipboardContents`
b=`echo $a | tr -cd "[:alpha:]"`
konqueror  "http://pda.leo.org/?lp=ende&lang=en&searchLoc=0&cmpType=relaxed&relink=on&sectHdr=on&spellToler=std&search=$b"

chmod 0755 .dict_leo_script

desktop integration

open the "control center" -> "Regional & Accessibility" -> KHotKeys -> New Action

1. next give the new action a name "dict lookup"

2. in the next tab "triggers" create a new shortcut trigger, for example "CTRL+~" as i use it. I had no collusions yet.

3. in the "actions" tab add "command/url" and select the script in /home/joachim/ it's called ".dict_leo_script" the dot at the beginning is there to hide it in the konqueror

4. we're done, click apply and close the dialog

using it

mark a word or doubleclick* it

  • might not an option on link labels on a homepage

afterwards press "CTRL+~" to invoke the translation

Powered by MediaWiki