Last active
December 17, 2017 03:27
-
-
Save skypce/d04b16cc5dc0797f8f148282fcab8d78 to your computer and use it in GitHub Desktop.
script dictionary and translator from google with trans
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
SEL=$(xsel -o) | |
T="$(/usr/local/bin/trans -l es -o /tmp/output -theme=none :es "$SEL")" #echo "Translation:" "$T" >> /tmp/ | |
ansi2html /tmp/output | |
#yad --html --title="Google translate and definition" --width=450 --height=300 --center --text=/tmp/output | |
# notify-send "$T" | |
#yad --info --title="Translation" --text="$T" | |
zenity --text-info --title="Google diccionary and translator" --filename=/tmp/output | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, for it works needs the follow packages:
Dependencies:
pip install ansi2html
sudo apt-get install xsel zenity
This commands are for setup trans , a awesome translator for console:
wget git.io/trans
chmod +x trans
sudo mv trans /usr/local/bin/trans
Now the last steps:
sudo chmod +x transdic
sudo mv transdic /usr/local/bin
Change the line 3 "-l es" to your language: examples: en, pl , etc.
If you are using ubuntu , go to system settings -> keyboard -> shortcuts -> custom shortcuts and add transdic and set your shortcut key.
Now when you select a piece of text and press the shortcut key, the script automatically will translate it to specified language and give you the mean of the word . Enjoy.