Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kevcui/translate-cli

:speech_balloon: Use translation service in your terminal
https://github.com/kevcui/translate-cli

cli command-line command-line-tool deepl deepl-translator google-translate google-translator nodejs puppeteer

Last synced: about 2 months ago
JSON representation

:speech_balloon: Use translation service in your terminal

Awesome Lists containing this project

README

        

# translate-cli

Use web translation service in terminal, without requiring any additional API registration.

## Supported services

- [Google Translate](https://translate.google.com/)
- [DeepL](https://www.deepl.com/translator)

## Dependency

- [puppeteer-core](https://github.com/puppeteer/puppeteer/): core library of puppeteer, headless Chrome
- [commander](https://github.com/tj/commander.js): argument options parser

## Installation

```
npm i puppeteer-core commander
```

## Usage

```
Usage: ./translate.js [-p ] [-f ] [-s ]

Options:
-p, --path path to chrome/chromium binary
default "/usr/bin/chromium"
-f, --from language ISO code of text to translate
default "en"
-t, --to language ISO code of target language
default "en"
-s, --service supported service: google, deepl
default "goodle"
-h, --help display help for command
```

### Examples

- Translate text to EN:

```bash
$ ./translate.js Schnappi Das Kleine Krokodil
Schnappi the little crocodil
```

- Translate text to DE:

```bash
$ ./translate.js -t de 'Hold my beer'
Halte mein Bier
```

- Translate text to Simplified Chinese, using DeepL:

```bash
$ ./translate.js -t zh -s deepl 'stay the fuck home'
宅在家里
```

---

Buy Me A Coffee