A robust and feature-rich Python command-line tool for translating SubRip (SRT) subtitle files. Supports Google Translate, DeepL, and MyMemory with intelligent mixed-language handling, HTML tag preservation, and resilient error recovery.
- Modular Architecture: Easy to extend with new translation services.
- Multiple Services: Google Translate (default), DeepL, and MyMemory.
- Resilient Recovery: Automatic retries with exponential backoff and resume capability for interrupted translations.
- Parallel Processing: Use
--workersto speed up translation of large files. - Mixed-Language Handling: Sentence-level language detection for mixed subtitles.
- HTML Tag Preservation: Keeps
<i>,<b>, etc., styling intact. - Batch Processing: Translate multiple files or entire directories at once.
- Configuration: Support for
.envfiles for secure API key management.
-
From PyPI (Recommended):
pip install srt-translator-cli
-
From Source:
git clone https://github.com/fam007e/srt_trans.git cd srt_trans pip install .
For developers wanting to run tests and build the package, we provide a Makefile:
# 1. Create venv
python -m venv .venv
# 2. Setup all dev/test dependencies
make setup
# 3. Run all checks (lint, type-check, tests)
make check
# 4. Build binary
make build
# 5. (Optional) Install in editable mode
pip install -e .srt-translator-cli movie.srt -t esFor more detailed information, please see our dedicated documentation:
- Usage Guide - Deep dive into CLI options and examples.
- API Reference - How to use SRT Translator as a library.
- Contributing - How to help improve this project.
SRT Translator supports over 70 languages. Run the following command to see the full list:
srt-translator-cli --list-languagesThis project is licensed under the MIT License. See the LICENSE file for details.