https://github.com/hyperjiang/translate
Translation tool and file converter
https://github.com/hyperjiang/translate
Last synced: 11 months ago
JSON representation
Translation tool and file converter
- Host: GitHub
- URL: https://github.com/hyperjiang/translate
- Owner: hyperjiang
- License: mit
- Created: 2021-06-12T13:44:59.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-27T16:08:24.000Z (almost 5 years ago)
- Last Synced: 2025-03-02T08:46:02.324Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# translate
[](https://goreportcard.com/report/github.com/hyperjiang/translate)
[](https://github.com/hyperjiang/translate)
This is a tool for translation and file format converting.
For file format, we currently support `json`, `yaml`, `properties` and `typescript`.
For translation client, we currently use Aliyun machine translation.
## Installation
```
go get -u github.com/hyperjiang/translate
```
## File converter
```
translate file -i "input-file" -o "output-file"
```
## Translator
For translation, we only support simple single-layer key-value format, e.g.
```
{
"key1": "value1",
"key2": "value2",
}
```
or
```
key1: value1
key2: value2
```
or
```
key1=value1
key2=value2
```
### Use Aliyun machine translation
Setup environment variables:
```
export ALI_REGION_ID="cn-hangzhou"
export ALI_ACCESS_KEY_ID="your-key"
export ALI_ACCESS_SECRET="your-secret"
```
```
translate aliyun -i "input-file" -o "output-file" -s source-language -t target-language
```