How to translate subtitles using Docker (Linux or WSL)
How to create a subtitle in your language simply
- Some knowledge on command line tools is required.
- To proceed, you will need a computer with Docker installed.
- Introduction
- Ensuring Docker is Installed
- Pull Ubuntu Image
- Create Container
- Install Dependencies that Need it.
- Install deepl-cli
- Download an English Subtitle of Movie
- Extract only dialog text using script that I created
- Translate it using deepl-cli
- Adjust words so that they are not too standardized
- Copy file JUQ-351.srt to new file
- Replace translated text to JUQ-351-id.srt
- Troubleshooting
Introduction
Hi everyone, are you want to create a subtitle in your language? It’s very smple. I have done and in here I will share how I create subtitle in my language. My language is Indonesian and you can create subtitle in your language. The way I use is free (no cost), I only using free tools. Tools that I used are :
- Docker
- deepl-cli (without api key)

Ensuring Docker is Installed
Make sure your computer or laptop have installed docker. By the way, I use Linux distro, but if you using Windows you can use WSL. In Linux, you can install docker using their package manager, ex. Ubuntu using apt, OpenSUSE using zypper, Fedora using dnf, and many other.
Pull Ubuntu Image
I use ubuntu focal image, so pull it using command :
$ docker pull ubuntu:focal
Create Container
Create container:
$ docker run -dit --name ubuntu-focal ubuntu:focal bashVerify:
$ docker container ls
Install Dependencies that Need it
Access your container that have created it.
$ docker container exec -it ubuntu-focal bash $ apt update && apt install vim wget curl unzip pip less -y
Install deepl-cli
You can visit the project at https://github.com/eggplants/deepl-cli. This tools is no using api-key, so you no need to buy deepl subscription. But deepl have limit only 1500 characters.
$ pip install deepl-cli # Test $ deepl -F en -T id -s <<<'Hi there! How are you?.' Hai! Apa kabar?
Download an English Subtitle of Movie
Search movie that you want to create subtitle. For example, I want to create subtitle for JAV ID JUQ-351.
Rename it:
Copy from your computer or laptop to container using command : (My workdir in : /root/works/demo)
$ docker cp JUQ-351.zip ubuntu-focal:/root/works/demo/JUQ-351.zipExtract it using unzip command:
$ unzip JUQ-351.zip

Extract only dialog text using script that I created
Use the script extract-text.sh to extract only dialog text. (see Attachments below)
$ bash extract-text.sh JUQ-351-en.srtThe output is

Count line of result_dialog.txt:
$ wc -l result_dialog.txt 620 result_dialog.txt
Translate it using deepl-cli
Because there are limits of characters from deepl, we must translate it per 50 lines.
$ sed -n '1,50p' result_dialog.txt > text.txt $ deepl -f text.txt -F en -T id >> translated-text.txt

$ sed -n '51,100p' result_dialog.txt > text.txt $ deepl -f text.txt -F en -T id >> translated-text.txtDo it until the last dialog text.
Adjust words so that they are not too standardized
Adjust words so that they are not too standardized
Copy file JUQ-351.srt to new file
cp JUQ-351-en.srt JUQ-351-id.srt
Replace translated text to JUQ-351-id.srt
Using script replace-text.sh
$ bash replace-text.sh JUQ-351-id.srt translated-text.txtThe result is

If you are still confused, you can ask me (rickoyuu). Have a good try :)
Troubleshooting
If you have translated too much in one day, you might get an error like this.
You can use free online proxy in https://www.sslproxies.org/ and change your user_agent by selecting one of the user agents in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent.
Example :
Try again.
$ deepl -f text.txt -F en -T id -t 30000 -v >> translated-text.txtSet timeout (-t) to 30000ms.
Attachments
This zip contains the scripts: rickoyuu_TranslateDocker_scripts.zip
Last update: 2025-03-13