An AI-powered English-Chinese translator for the command line
Project description
Y-Translator CLI
An AI-powered command-line translator that converts between English and Chinese.
Installation
From PyPI (pip)
pip install y-translator-cli
With uv tool (recommended)
Install from PyPI:
uv tool install y-translator-cli
Or install from source:
git clone https://github.com/yourusername/y-translator.git
cd y-translator
uv tool install -e .
Usage
Start the translator:
trans
Or translate text directly:
trans "Hello, world!"
trans "你好,世界!"
Options:
-h, --help: Show help message-v, --version: Show version information--verbose: Enable debug mode--model MODEL: Specify AI model to use (default: qwen3.6-flash)--api-key KEY: Set DashScope API key-n, --no-stream: Disable streaming mode
Environment Variables
You can set the following environment variables:
DASHSCOPE_API_KEY: Your DashScope API keyAI_MODEL: AI model to use (default: qwen3.6-flash)
Examples
- Start the translator:
trans
- Enable debug mode:
trans --verbose
- Use a specific model:
trans --model qwen3.6-flash
- Disable streaming output:
trans -n
Development
Installation for Development
# Clone the repository
git clone https://github.com/yourusername/y-translator.git
cd y-translator
# Install with uv
uv sync --dev
Dependencies
The project depends on the following packages:
prompt_toolkit>=3.0.0- Interactive command-line interfaceagno>=0.1.0- AI agent framework (with DashScope provider)python-dotenv>=0.19.0- Environment variable managementsocksio- SOCKS proxy support
Building the Package
# Build with uv
uv build
Publishing to PyPI
-
Get PyPI API Token:
- Login to https://pypi.org
- Go to Account settings → API tokens
- Create a new API token (recommended: project-scoped, e.g.,
y-translator-cli)
-
Upload to PyPI with uv:
uv publish -
Version Bump (if version already exists): PyPI does not allow overwriting existing versions. If you get a "File already exists" error:
- Update
__version__intranslator/__init__.py - Rebuild:
uv build - Upload again:
uv publish
- Update
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file y_translator_cli-0.1.5.tar.gz.
File metadata
- Download URL: y_translator_cli-0.1.5.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c021b37d4c93ee825522c2e6178afbed98b1ef8df8ab709af345b1efd7c9e22c
|
|
| MD5 |
81874e4325483cd57e851d39193673ea
|
|
| BLAKE2b-256 |
93e417c4ac0adfaeb921f2707bb90696ccfb6dc8fef46b7172f90df5b88ddb91
|
File details
Details for the file y_translator_cli-0.1.5-py3-none-any.whl.
File metadata
- Download URL: y_translator_cli-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5ac7814531a2f6e2e14af86e761a030b1000b4538f86bac6ddbc88841fed37c
|
|
| MD5 |
b3b0fc1eaa0f2d3619f2a64c62bc6d23
|
|
| BLAKE2b-256 |
4ab323dd87987de9668e870f93b27b46bb49b9d386d8bf5618bd2fd3f79ce3ef
|