TranslateIt

If you are sometime read site, man pages or other text on foreign languages, this article can help you.

So, you are select text (don't copy), no matter browser, console or IM, press Mod4+Control+t and get notify with translating text. It's so simple!

Note:The script doesn't lead to hangup for Awesome, if no internet. It's use Google.Translate.

Script requires: curl, html2text, iconv, awk, sed, xclip

First, you need create bash script named gtranslate and put them to your script folder.
 * 1) !/bin/bash

if [ -z "$1" ] then echo "Exiting" fi text="$1" l_source="auto" l_target="ru"      #change to your language result=$(curl --connect-timeout 1 -s -i --user-agent "" -d "sl=$l_source" -d "tl=$l_target" --data-urlencode "text=$text" https://translate.google.com) encoding=$(awk '/Content-Type: .* charset=/ {sub(/^.*charset=["'\]?/,""); sub(/[ "'\].*$/,""); print}' <<<"$result") result=$(iconv -f $encoding <<<"$result" | awk 'BEGIN {RS=" "};/]* id=["'\]?result_box["'\]?/' | html2text -utf8 | sed 's/<[^>]*>//g') echo $result | xclip -in -sel clip result=`echo "naughty.notify({title=\"Перевод: \", text=\" $result\", timeout = 20})"` echo $result | awesome-client - exit Give them rights for execute: chmod +x gtranslate
 * 1) copy translated text to clipboard

So, add in your rc.lua follow function: function clip_translate local clip = nil clip = awful.util.pread("xclip -o") if clip then awful.util.spawn("/home/user/script/gtranslate \"" .. clip .."\"",false)  --change path to script end end

And, finally, add keybinding on Standart program section: awful.key ({modkey, "Control" }, "t", function clip_translate end),

Awesome 3.5

Due to the fact that in Lua 5.2 introduced an explicit declaration of libraries as local variables, you need to remove local, ie make a call naughtly follows Remove 'local' in your rc.lua befor naughtly: naughty = require("naughty")

Restart Awesome, and enjoy!