tapi is a command line tool to access google translate from terminal.
Run setup dialog using:
Provide the API Key and languages preferences and you’re ready to go.
Notice: Setup will save a configuration file at: $HOME/.tapirc with your API key, and preferences.
tapi "some string to translate"
Notice:tapi will perform a reverse request if Google Translate replied with similar text as user’s input. In that matter, translating between 2 languages is as easy and does not require different input from the user.
Also important, you mustenable billing on your google developer account in order for the API to reply with a proper response. With that in mind, you should probably review Translate API Pricing page. At this moment, current pricing is: $20 per 1,000,000 characters of text.
Once obtaining the key, set up your preferred target and origin languages and the reset is pretty straightforward.
From Github Releases
tapi is written in Go. To have a working go environment, follow Go’s Getting Started guide. tapi uses glide - Vendor Package Management for Golang, follow the short install guide their excellent README file.
configure: export GOPATH=YOUR_GOLANG_PATH
go get github.com/eladg/tapi
go build -o $GOPATH/bin/tapi tapi.go
To execute, make sure compiled file is on $PATH. It’s recommended to set something like: export PATH=$PATH:$GOPATH/bin for your builds.