Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/utahta/trans
Google Translate CLI written in Go
https://github.com/utahta/trans
go golang google translate
Last synced: about 2 months ago
JSON representation
Google Translate CLI written in Go
- Host: GitHub
- URL: https://github.com/utahta/trans
- Owner: utahta
- License: mit
- Created: 2018-01-28T14:13:11.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T04:05:51.000Z (almost 2 years ago)
- Last Synced: 2023-07-28T13:01:18.732Z (over 1 year ago)
- Topics: go, golang, google, translate
- Language: Go
- Homepage:
- Size: 2.43 MB
- Stars: 11
- Watchers: 4
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trans
[![Go Report Card](https://goreportcard.com/badge/github.com/utahta/trans)](https://goreportcard.com/report/github.com/utahta/trans)
Google Translate CLI written in Go.
## Required
You must first set up authentication by creating a API Key or service account of GCP.
### API Key
The API Key documentation can be found [here](https://cloud.google.com/translate/docs/auth#using_an_api_key).
Set the environment variable `TRANS_API_KEY` to the API Key.
### Or Service Account
The service account documentation can be found [here](https://cloud.google.com/iam/docs/creating-managing-service-accounts).
Set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to the file path of the JSON file that contains your service account key.
## Note
You need a little bit of money to use google translate API.
e.g. it costs $0.06 for 2889 characters.## Installation
```sh
$ go get -u github.com/utahta/trans/cmd/trans
```## Usage
```sh
$ trans -t en こんにちは
Hello
```
```sh
$ trans -t ja this is a pen
これはペンです
```
```sh
$ trans -t ja -r "this is a pen"
これはペンです
this is a pen
```