Installation
Using translate is easy. This command will install the translate executable
go get -u github.com/hankmartinez/translate/translate
Example from help
Multiple args are joined in a single phrase to translate
a simple cli for translation from google.
Usage:
[flags]
Flags:
-h, --help help for this command
--insecure ignore certificate errors (os env property $TRANSLATE_INSECURE has priority, if present whatever the value is, 'insecure' is assigned to true)
--sl string source language (os env property $TRANSLATE_SL has priority) (default "en")
--tl string target language (os env property $TRANSLATE_TL has priority) (default "it")
translate Hello My Friend -> Ciao amico
translate --tl ru Hello My Friend -> Привет мой друг
System 'Notify' (linux)
In conjunction with xsel you can set up a simple shell script
called by keyboard shortcut
#!/bin/bash
SELECTION=$(xsel -o)
notify-send --icon=info "Translate: $SELECTION" "$(translate $SELECTION)"
The result: