samir
Posts: 21
Joined: Wed Jan 03, 2018 8:40 pm

Translate Any Text You Select On Your solus Desktop With A Keyboard Shortcut And Notifications

Sat Jan 06, 2018 2:37 pm

ifind this useful iwant to share it

first make sure u install this from software center

libnotify
wget
xsel
zenity
xclip

then create new document text in ur home directory name it 'notitrans' and copy the script into the document and choose ur language like ido for arabic exemple for english (en) french (fr) ... any language u want

http://gph.is/2AzDCnp



Code: Select all

#!/usr/bin/env bash
text="$(xsel -o)"
translate="$(wget -U "Mozilla/5.0" -qO - "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&q=$(echo $text | sed "s/[\"'<>]//g")" | sed "s/,,,0]],,.*//g" | awk -F'"' '{print $2, $6}')"
echo "$translate" | xclip -selection clipboard
notify-send --icon=info "$text" "$translate"




then on terminal
chmod +x ~/notitrans


after this move it to /bin ( as root )

http://gph.is/2F5vKO9

last think is put a custom keyboard shortcut like ido write this ... name = translate highlighted text
command = notitrans

http://gph.is/2F7oqS6

now select what you want on desktop and press the shortcut u make .. ;)

http://gph.is/2AxHcP4
Attachments
Peek 2018-01-06 14-11.gif
Peek 2018-01-06 14-11.gif (205.83 KiB) Viewed 260 times
Last edited by samir on Sun Jan 07, 2018 12:12 am, edited 2 times in total.


Return to “Share All The Things!”