Skip to content

Instantly share code, notes, and snippets.

@DenimTornado
Created September 30, 2013 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DenimTornado/6771031 to your computer and use it in GitHub Desktop.
Save DenimTornado/6771031 to your computer and use it in GitHub Desktop.
From http://habrahabr.ru/post/195900/#comment_6794244 Перевести выделенное с автоматически определённого языка в выбранный Забиндить на хоткей как: «translate ru» или «translate en»
#!/bin/bash
source=$(xsel -o | sed "s/["'<>]//g")
trans="$(wget -U "Mozilla/5.0" -qO - "http://translate.google.com/translate_a/t?client=t&text=${source}&sl=auto&tl=$1" | sed 's/[[["//' | cut -d " -f 1)"
url=`echo "$trans" | xclip -filter -selection clipboard`
notify-send -t 2500 "$source" "$trans"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment