Package Exports
- tencent-translate-cli
- tencent-translate-cli/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tencent-translate-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Tencent Translate CLI
Translate Chinese to English in your terminal using Tencent Cloud API.
Install
npm install -g tencent-translate-cli
Setup
- Get API keys from Tencent Cloud Console
- Enable Translation Service
- Set environment variables:
macOS/Linux:
# Add to ~/.zshrc or ~/.bashrc
echo 'export TENCENT_SECRET_ID=your_secret_id' >> ~/.zshrc
echo 'export TENCENT_SECRET_KEY=your_secret_key' >> ~/.zshrc
source ~/.zshrc
Windows:
setx TENCENT_SECRET_ID "your_secret_id"
setx TENCENT_SECRET_KEY "your_secret_key"
Or use .env file:
echo "TENCENT_SECRET_ID=your_secret_id" > .env
echo "TENCENT_SECRET_KEY=your_secret_key" >> .env
Usage
Run the translator:
tt
# or
tencent-translate
Type Chinese text and press Enter to translate. Type exit
to quit.
$ tt
> 你好世界
Translation: Hello World
> 今天天气很好
Translation: The weather is very good today
> exit
Goodbye!
Features
- Interactive CLI interface
- Real-time translation
- Global installation
- Environment variable support
.env
file support
Troubleshooting
"Service has not been opened" error: Enable the service at TMT Console
Authentication issues: Check your API keys at API Management
License
MIT © john