A minimalist, stateless CLI tool powered by the DeepSeek API for interactive English/Chinese translation and grammar checking. Provides authentic American English translations and revisions.
- Ready to Use: Launch globally via command, enter dialogue mode instantly.
- Auto EN/ZH Translation: Automatically detects the input language. Translates Chinese into natural American English, and English into fluent Chinese.
- Grammar Check (
/check): Points out grammar and phrasing errors in English sentences, providing 2-3 native, authentic alternatives. - Explanation Language Toggle (
/lang): Toggle AI explanations between English (default) and Chinese using/lang enor/lang zh. - Mode Toggle (
/mode): Switch between detail mode (default) and simple mode (/mode simple). Simple mode only outputs the direct translation or correction without any extra explanation. - Word Lookup with IPA: When the input is a single word or short term, the English result includes its American IPA transcription (e.g.
apple /ˈæp.əl/). - Text-to-Speech (
/say): Reads the last translation aloud with Microsoft Edge neural voices (msedge-tts), falling back to the localsaycommand when offline. Use/say stopto cancel. - Clear Screen (
/clear): Instantly clears the terminal output for a fresh view. - Stateless Requests: No contextual memory between prompts, drastically reducing API token consumption.
- Input History (
↑/↓): Recall previously entered text and commands with the arrow keys, readline-style. Pressing↓past the newest entry restores your unsubmitted draft.
If you have downloaded the source code, navigate to the project directory and run:
npm install -g .You can build a standalone package file and share it:
- In the project directory, run:
npm pack- This generates a file like
t-cli-translator-1.0.0.tgz. Share this file with others. - Anyone with Node.js installed can install it globally from the file:
npm install -g path/to/t-cli-translator-1.0.0.tgzIf this package is published to the npm registry, you can install it globally on any machine:
npm install -g t-cli-translator(Note: Replace t-cli-translator with your actual package name if you change it before publishing).
The tool relies on the DeepSeek API. You MUST obtain a DeepSeek API Key.
There are two ways to configure it:
Option A: System Environment Variable (Highly Recommended)
Add this to your ~/.bashrc or ~/.zshrc:
export DEEPSEEK_API_KEY="sk-your_api_key_here"Option B: Using an .env file
Create a .env file in the directory where you run the command (or the project root):
DEEPSEEK_API_KEY=sk-your_api_key_hereSimply run the command in your terminal to enter the interactive translator:
t-clit-cli > 你好,今天天气真不错。
# 翻译: Hello, the weather is really nice today.
t-cli > This tool is very useful for me.
# 翻译: 这个工具对我来说非常有用。
t-cli > 苹果
# apple /ˈæp.əl/
t-cli > /say
# Reads "apple" aloud. Use /say stop to cancel playback.
t-cli > /check He don't know nothing about the project.
# 语法检查与润色结果:
# 1. 错误分析: "He don't" 语法错误,第三人称单数应使用 doesn't。"don't know nothing" 属于双重否定,在标准英语中不正确。
# 2. 修改建议: He doesn't know anything about the project.
# 3. 更好的地道表达:
# - He's completely clueless about the project.
# - He knows absolutely nothing about the project.
t-cli > exit
# Goodbye!
To quit the tool: Type exit, quit, or press Ctrl+C.