Node.js Google translate CLI tool!
$ npm install -g gtranslate
-
Register and setup a new API key from the Google Cloud.
-
type
gtranslate register <API_KEY>
with your APIKEY:
Heads Up! The API_KEY is stored in your home directory in a file called .gtranslate
- That's it!
Register a new API_KEY
:
$ gtranslate -r <API_KEY>
Translate with language autodetect and default target language:
$ gtranslate <text>
Basic translation (with source language autodetect):
$ gtranslate -t en <text>
Provide the --source (-s)
language:
$ gtranslate -s it -t en <text>
Set a default target language:
$ gtranslate --set-target it
(By default EN is the default target language)
--register OR -r Set a new Google Translate API KEY
--source OR -s Provide the source language
--target OR -t Provide the target language
--set-target OR -st Set a default target language [EN by default]
Clone this repository to your local folder, then link it to enable you to use the command line tool from your source folder using npm link
.
Then you can simply call gtranslate -t it -s en "really cool"
.
Don't forget to register your api key before using it as well.
Tests are written in mocha and run by npm test
or npm run test-watch
.
Rocco Musolino (@roccomuso)