A command line tool that translate chinese to english and vice versa, it also provides the feature of querying the translation history.
Right now, it only supports the English and Chinese languages.
When I want to translate words between chinese and english, using the Google translation web page I need to choose the source and target language. It is less convenient to me. So I decide to develop a command line tool that simplify the translation work since it can identify the language automatically.
cobra
: the core of the command lineviper
: store the translation api key and secrethttp
: use to call translation api
- Translation:
trans "I love coding" # 我喜欢编码
trans 我喜欢游泳 # I like swimming
- History record
trans -l
# Query| Result|CreateTime
# ----| ---|-------
# Chinese people are very intelligent| **人非常聪明|2024-04-18 17:02:10
# 我们的爱从未消失| Our love never disappears|2024-04-18 17:04:12
# make the world much better| 让世界变得更美好|2024-04-18 17:04:30
- Clean up history record
trans -c # successfully cleared
appId: "{baidu_app_id}"
appSecret: "{baidu_app_secret}"
fileName: "go_translator_record.csv
https://fanyi-api.baidu.com/manage/developer
go build -o trans main.go
go install trans
# or
make deploy