https://github.com/utahta/trans
Google Translate CLI written in Go
https://github.com/utahta/trans
go golang google translate
Last synced: 12 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 (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T04:05:51.000Z (over 3 years ago)
- Last Synced: 2025-06-21T23:03:30.129Z (12 months ago)
- Topics: go, golang, google, translate
- Language: Go
- Homepage:
- Size: 2.43 MB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```