Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roccomuso/gtranslate
Node.js Google translate CLI tool!
https://github.com/roccomuso/gtranslate
cli google javascript language nodejs tool translate
Last synced: 19 days ago
JSON representation
Node.js Google translate CLI tool!
- Host: GitHub
- URL: https://github.com/roccomuso/gtranslate
- Owner: roccomuso
- Created: 2017-07-10T14:21:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T11:43:35.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T08:31:32.642Z (10 months ago)
- Topics: cli, google, javascript, language, nodejs, tool, translate
- Language: JavaScript
- Size: 438 KB
- Stars: 7
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gtranslate
[![NPM Version](https://img.shields.io/npm/v/gtranslate.svg)](https://www.npmjs.com/package/gtranslate)
![node](https://img.shields.io/node/v/gtranslate.svg)
[![Dependency Status](https://david-dm.org/roccomuso/gtranslate.png)](https://david-dm.org/roccomuso/gtranslate)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)> Node.js Google translate CLI tool!
## Install
$ npm install -g gtranslate
[![NPM](https://nodei.co/npm/gtranslate.png?downloads=true&downloadRank=true)](https://nodei.co/npm/gtranslate/)
## Usage
1. Register and setup a new **API key** from the [Google Cloud](https://support.google.com/cloud/answer/6158862?hl=en).
2. type `gtranslate register ` with your APIKEY:
**Heads Up**! The API_KEY is stored in your home directory in a file called `.gtranslate`
3. That's it!
### Common usage
Register a new `API_KEY`:
$ gtranslate -r
Translate with language autodetect and default target language:
$ gtranslate
Basic translation (with source language autodetect):
$ gtranslate -t en
Provide the `--source (-s)` language:
$ gtranslate -s it -t en
Set a default target language:
$ gtranslate --set-target it
(By default EN is the default target language)
## Available options
```text
--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]
```## Build
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`.
## Author
Rocco Musolino ([@roccomuso](https://twitter.com/roccomuso))