Google Translate

First, you will need a translator-script. I've found two versions. First version taken from here. from urllib2 import urlopen from urllib import urlencode import sys
 * 1) !/usr/bin/env python


 * 1) The google translate API can be found here:
 * 2) http://code.google.com/apis/ajaxlanguage/documentation/#Examples

lang1=sys.argv[1] lang2=sys.argv[2] langpair='%s|%s'%(lang1,lang2) text=' '.join(sys.argv[3:]) base_url='http://ajax.googleapis.com/ajax/services/language/translate?' params=urlencode( (('v',1.0), ('q',text), ('langpair',langpair),) ) url=base_url+params content=urlopen(url).read start_idx=content.find('"translatedText":"')+18 translation=content[start_idx:] end_idx=translation.find('"}, "') translation=translation[:end_idx] print translation

Idea of second version from here: wget -qO- "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=$2|${3:-en}" | sed 's/.*"translatedText":"\([^"]*\)".*}/\1\n/'

Save one of them to any/dir/google-translate and make executable.

You should add function aw_translate to your rc.lua.

function aw_translate local val = nil awful.prompt.run({ text=val and tostring(val),       selectall = true,        fg_cursor = black,        bg_cursor = orange,        prompt = " Translate: "}, mypromptbox.widget,        function(expr)            -- if you use the second script, you will need "any/dir/google-translate" .. expr .. " en hu"            -- "en hu": "source language" "target language", you may want to change this            local f = io.popen("any/dir/google-translate en hu " .. expr)           if f then                val = f:read("*line")                f:close            else                val = " "            end            notify_keychain = naughty.notify({ text = expr .. ' ' .. val .. " ",               timeout = 0, position = "bottom_right" })           root.keys(awful.util.table.join(                keychain["awesome"],                awful.key({},"Escape",function reset_keychain end)           ))        end,        nil, awful.util.getdir("cache") .. "/translate") end

After this you can use aw_translate (eg. with keybinding).