Skip to content

YIN-Renlong/srt-trilingual-translator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SRT Trilingual Translator

License: MIT Python Version

A command-line tool to translate .srt subtitle files into multiple languages (specifically Italian, Chinese, and English) using the DeepL API.

Features

  • Parses standard .srt subtitle files.
  • Automatically detects the source language of the subtitles.
  • Translates text in efficient batches to respect API limits.
  • Uses a tqdm progress bar to show translation status.
  • Generates a new, combined .srt file with all three languages for each subtitle block.
  • Securely loads your API key from a .env file.

Tech Stack

  • Language: Python 3
  • Libraries: deepl, langdetect, python-dotenv, tqdm

Installation

  1. Clone the repository:

    git clone https://github.com/YIN-Renlong/srt-trilingual-translator.git
    cd srt-trilingual-translator
  2. Create a virtual environment (recommended):

    python3 -m venv venv
    source venv/bin/activate
  3. Install the required dependencies:

    pip install -r requirements.txt
  4. Set up your API Key: Create a file named .env in the project root and add your DeepL API key:

    DEEPL_API_KEY="YOUR_DEEPL_API_KEY_HERE"
    

Usage

Run the script from your terminal, passing the path to one or more .srt files as arguments.

python3 srt_translator.py /path/to/your/file.srt

For multiple files:

python3 srt_translator.py movie1.srt movie2.srt

The script will create a new file for each input, named original-name_tri_it_zh_en-GB.srt, in the same directory.

License

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

About

A Python script to translate SRT subtitle files into multiple languages using the DeepL API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages