https://github.com/romantomjak/translate
Command line tool for Google's Cloud Translation API
https://github.com/romantomjak/translate
cli cli-utility google-cloud google-cloud-translate translate translation-api translation-service
Last synced: 12 months ago
JSON representation
Command line tool for Google's Cloud Translation API
- Host: GitHub
- URL: https://github.com/romantomjak/translate
- Owner: romantomjak
- License: mit
- Created: 2019-02-19T20:44:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-11T14:15:48.000Z (over 6 years ago)
- Last Synced: 2025-01-23T07:10:00.400Z (about 1 year ago)
- Topics: cli, cli-utility, google-cloud, google-cloud-translate, translate, translation-api, translation-service
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# translate [](https://travis-ci.org/romantomjak/translate) [](https://coveralls.io/github/romantomjak/translate?branch=master) [](https://godoc.org/github.com/romantomjak/translate)
Command line client for Google's Cloud Translation API
---
## Requirements
You'll need to sign up for [Cloud Translation](https://cloud.google.com/translate/) to get your API Key.
## Install
```shell
go get -u github.com/romantomjak/translate
```
## Usage
To translate with automatic source language detection:
```shell
$ export TRANSLATE_KEY=xxx
$ export TRANSLATE_TO=en
$ translate kuģis
ship
```
if that doesn't work, you can specify source language manually:
```shell
$ translate -from lv kuģis
ship
```
You can, of course, explicitly override environment values via arguments:
```shell
$ translate -key yyy -to fr kuģis
navire
```
### Translating whole sentences
By default each space separated argument is treated as a word and will get translated on its own line like so:
```shell
$ translate mans kuģis ir visskaistākais
my
ship
and
the most beautiful
```
To translate whole sentences, wrap it in quotes like so:
```shell
$ translate "mans kuģis ir visskaistākais"
my ship is the most beautiful
```
## Contributing
You can contribute in many ways and not just by changing the code! If you have
any ideas, just open an issue and tell me what you think.
Contributing code-wise - please fork the repository and submit a pull request.
## License
MIT