Skip to content

SRT Translator

Build Status License: MIT Python: 3.8+

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.

✨ Features

  • 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 --workers to 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 .env files for secure API key management.

🚀 Quick Start

Installation

  1. From PyPI (Recommended):

    pip install srt-translator-cli
  2. From Source:

    git clone https://github.com/fam007e/srt_trans.git
    cd srt_trans
    pip install .

Developer Setup

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 .

Basic Usage

srt-translator-cli movie.srt -t es

📚 Documentation

For more detailed information, please see our dedicated documentation:

🛠 Supported Languages

SRT Translator supports over 70 languages. Run the following command to see the full list:

srt-translator-cli --list-languages

⚖ License

This project is licensed under the MIT License. See the LICENSE file for details.

🙏 Acknowledgements

About

Subtitle (srt) translator.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors