Skip to main content

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 key
  • AI_MODEL: AI model to use (default: qwen3.6-flash)

Examples

  1. Start the translator:
trans
  1. Enable debug mode:
trans --verbose
  1. Use a specific model:
trans --model qwen3.6-flash
  1. 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 interface
  • agno>=0.1.0 - AI agent framework (with DashScope provider)
  • python-dotenv>=0.19.0 - Environment variable management
  • socksio - SOCKS proxy support

Building the Package

# Build with uv
uv build

Publishing to PyPI

  1. 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)
  2. Upload to PyPI with uv:

    uv publish
    
  3. Version Bump (if version already exists): PyPI does not allow overwriting existing versions. If you get a "File already exists" error:

    • Update __version__ in translator/__init__.py
    • Rebuild: uv build
    • Upload again: uv publish

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

y_translator_cli-0.1.5.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

y_translator_cli-0.1.5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

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

Hashes for y_translator_cli-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c021b37d4c93ee825522c2e6178afbed98b1ef8df8ab709af345b1efd7c9e22c
MD5 81874e4325483cd57e851d39193673ea
BLAKE2b-256 93e417c4ac0adfaeb921f2707bb90696ccfb6dc8fef46b7172f90df5b88ddb91

See more details on using hashes here.

File details

Details for the file y_translator_cli-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for y_translator_cli-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b5ac7814531a2f6e2e14af86e761a030b1000b4538f86bac6ddbc88841fed37c
MD5 b3b0fc1eaa0f2d3619f2a64c62bc6d23
BLAKE2b-256 4ab323dd87987de9668e870f93b27b46bb49b9d386d8bf5618bd2fd3f79ce3ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page