A modern command-line translator powered by LLMs
Project description
dtrans
A modern command-line translator powered by LLMs.
Note: This is a ground-up rewrite of translate-shell with a focus on LLM-based translation and a significantly improved CLI experience.
Features
- LLM-powered translation via DeepSeek, Gemini, ChatGPT, or any OpenAI-compatible API
- Verify your translations with alternatives, comparisons, and contextual examples
- Rich terminal UI with beautiful panels, tables, and spinners
- Modern CLI with explicit long-form flags and intuitive language syntax
- Configurable providers via a simple TOML config file
Installation
pipx install dtrans
Or with pip:
pip install dtrans
Quick Start
- Create your configuration file at
~/.config/dtrans/config.toml:
default_provider = "deepseek"
[providers.deepseek]
api_key = "sk-..."
model = "deepseek-chat"
[providers.openai]
api_key = "sk-..."
model = "gpt-4o"
[providers.gemini]
api_key = "..."
model = "gemini-1.5-flash"
- Translate:
# Auto-detect source, translate to French
dtrans --to fr "Hello, world!"
# Specify source and target
dtrans en:fr "Hello, world!"
# Brief mode (translation text only)
dtrans --brief "Hello, world!"
# Identify language
dtrans --identify "手紙"
Usage
Usage: dtrans [OPTIONS] TEXT
Options:
--from TEXT Source language code (e.g. 'en', 'ja'). Omit to auto-detect.
--to TEXT Target language code (e.g. 'fr', 'zh'). Defaults to system locale.
--provider TEXT Override the default provider from the config file.
--brief / --verbose
Brief mode prints only the translation. Verbose is the default in a TTY.
--identify Identify the source language and exit.
--version Show version and exit.
--help Show this message and exit.
Language Syntax
| Pattern | Meaning |
|---|---|
:fr |
Auto-detect source → French |
ja: |
Japanese → default target |
en:fr |
English → French |
Custom Providers
Any OpenAI-compatible API can be configured:
[providers.local]
base_url = "http://localhost:11434/v1"
api_key = "ollama"
model = "llama3"
Development
# Clone
git clone https://github.com/kriss-spy/deep-translate-shell.git
cd deep-translate-shell
# Install in editable mode with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Lint
ruff check src tests
mypy src
License
See LICENSE.
Project details
Release history Release notifications | RSS feed
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 dtrans-1.0.2.tar.gz.
File metadata
- Download URL: dtrans-1.0.2.tar.gz
- Upload date:
- Size: 97.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fde276b29185f482db00460c17ddb13262e44b3ff33f259eb58babda0c55cb4c
|
|
| MD5 |
ec3a7ee33123d0a25265cee1b2aca0bf
|
|
| BLAKE2b-256 |
88e99d05e66ecea097c90ba9d0bf3a67327ddcf2216d25955d92c06417602891
|
Provenance
The following attestation bundles were made for dtrans-1.0.2.tar.gz:
Publisher:
publish.yml on kriss-spy/deep-translate-shell
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dtrans-1.0.2.tar.gz -
Subject digest:
fde276b29185f482db00460c17ddb13262e44b3ff33f259eb58babda0c55cb4c - Sigstore transparency entry: 1708455117
- Sigstore integration time:
-
Permalink:
kriss-spy/deep-translate-shell@cffeeefa62f1143850fe4218b95fb57293d8c300 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/kriss-spy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cffeeefa62f1143850fe4218b95fb57293d8c300 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dtrans-1.0.2-py3-none-any.whl.
File metadata
- Download URL: dtrans-1.0.2-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc7664d676268b6cd0efa23ce9dd1427eda9452c2fa50f7579628cc667b297e3
|
|
| MD5 |
ff781e588f6e0d9c5e61aad44db084f5
|
|
| BLAKE2b-256 |
1dfcc2264db61c049c82592403c1da64517bb9d73c92f0959e80cfbf710facd7
|
Provenance
The following attestation bundles were made for dtrans-1.0.2-py3-none-any.whl:
Publisher:
publish.yml on kriss-spy/deep-translate-shell
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dtrans-1.0.2-py3-none-any.whl -
Subject digest:
cc7664d676268b6cd0efa23ce9dd1427eda9452c2fa50f7579628cc667b297e3 - Sigstore transparency entry: 1708455199
- Sigstore integration time:
-
Permalink:
kriss-spy/deep-translate-shell@cffeeefa62f1143850fe4218b95fb57293d8c300 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/kriss-spy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cffeeefa62f1143850fe4218b95fb57293d8c300 -
Trigger Event:
push
-
Statement type: