JSPM

tencent-translate-cli

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q66757F
  • License MIT

Interactive command-line translation tool for Chinese to English using Tencent Cloud API

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

npm version License: MIT

Translate Chinese to English in your terminal using Tencent Cloud API.

Install

npm install -g tencent-translate-cli

Setup

  1. Get API keys from Tencent Cloud Console
  2. Enable Translation Service
  3. 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