Skip to main content

Translate subtitles and documents from your terminal

Project description

fanyit

Install. Translate. Done.

Zero-config CLI tool for translating subtitles and documents. Works out of the box with no API keys or setup required.

Install

pip install fanyit

Quick Start

Translate a subtitle file - no engine flag needed:

fanyi subs movie.srt --target zh

That's it. Fanyi automatically finds a working translation engine or uses its built-in demo engine.

For real translations, run setup once:

fanyi setup

Quality Tiers

Choose your speed/quality tradeoff:

fanyi subs movie.srt --target zh --quality fast      # Draft quality, maximum speed
fanyi subs movie.srt --target zh --quality standard  # Everyday use (default)
fanyi subs movie.srt --target zh --quality best      # Publication quality, slower

Supported Formats

Format Extensions Description
SRT .srt SubRip subtitle format
ASS/SSA .ass, .ssa Advanced SubStation Alpha
VTT .vtt WebVTT subtitle format
Text .txt Plain text files
Markdown .md Markdown documents
PDF .pdf PDF documents (text extraction)
DOCX .docx Microsoft Word documents
Audio .mp3, .wav Audio transcription + translation

Advanced

Configuration File

Create ~/.fanyi.yaml or run fanyi setup:

engine: ollama
target_language: zh
ollama_host: http://localhost:11434
ollama_model: llama3

Environment Variables

export FANYI_ENGINE=openai
export FANYI_OPENAI_API_KEY=your-key
export FANYI_TARGET_LANGUAGE=zh

All Engines

Engine Description Requires API Key
OpenAI GPT-based translation Yes
DeepL Professional translation API Yes
Ollama Local LLM (private, offline) No
Mock Built-in demo engine No

All CLI Options

fanyi translate file.txt --engine openai --target zh --source en
fanyi translate file.txt --quality best --context-lines 5
fanyi translate ./docs/ --recursive --concurrency 4
fanyi translate file.txt --no-cache --resume --glossary terms.csv
fanyi subs movie.srt --target ja --quality fast
fanyi check          # Verify engine connectivity
fanyi config --show  # View current config
fanyi cache stats    # Cache statistics
fanyi jobs list      # View interrupted jobs

License

MIT

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

fanyit-0.2.0.tar.gz (88.9 kB view details)

Uploaded Source

Built Distribution

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

fanyit-0.2.0-py3-none-any.whl (64.4 kB view details)

Uploaded Python 3

File details

Details for the file fanyit-0.2.0.tar.gz.

File metadata

  • Download URL: fanyit-0.2.0.tar.gz
  • Upload date:
  • Size: 88.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for fanyit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 96e513d7174fe671634ba1273a9022a5521406d691509d318903cb23d07f4099
MD5 b2543eb8d1f52cd75847510f873e2968
BLAKE2b-256 6e71ac7d4e7512f0425f06e2d4c0650f74120390b71f3bf3868988839b1591ca

See more details on using hashes here.

File details

Details for the file fanyit-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: fanyit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 64.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for fanyit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65e31cea7db1763af414d2bca350648c2ff2fe272dea54615d0268483735dcf7
MD5 43a2d37dee11516d9221631027b91b39
BLAKE2b-256 dcf913822a094c0d6c524f92064f4170087fd3add88cabaac326f4eea86a4b54

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