Skip to content

Instantly share code, notes, and snippets.

@KacperKozak
Created April 15, 2016 10:12
Show Gist options
  • Save KacperKozak/26651b63b12cd96451350f2ba18f655d to your computer and use it in GitHub Desktop.
Save KacperKozak/26651b63b12cd96451350f2ba18f655d to your computer and use it in GitHub Desktop.
Translate selected text
#!/usr/bin/env bash
notify-send --icon=info "$(xsel -o)" "$(wget -U "Mozilla/5.0" -qO - "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=pl&dt=t&q=$(xsel -o | sed "s/[\"'<>]//g")" | sed "s/,,,0]],,.*//g" | awk -F'"' '{print $2, $6}')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment