A tool for translating epub files to different languages using the Google Translate, with support for custom dictionaries.
Download
Β·
Screenshots
Β·
Script Usage
A tool for translating epub files to different languages using the Google Translate, with support for custom dictionaries.
- Autodetect source languages and support multiple destination languages.
- Keeping the structure of the original epub file (images, table of contents, text style,...)
- Support custom translation dictionaries (after translated).
- Support multiprocessing to speed up.
- Auto checking the new tool version.
Download the execution file below. Run and follow the instructions.
Windows: epub-translator.exe ~ 12MB
The custom dictionary will replace the original translated text by Google Translate with your own text.
- The custom dictionary is a
.txt
file with line by line in the format:
[original_translated_text]:[your_translated_text]
- Text is case sensitive with special characters (except colon) and spaces are are allowed, separated from the other by the single colon
:
.
- python3
- google_trans_new
- requests
- bs4
- lxml
- tqdm
pip install google_trans_new requests bs4 lxml tqdm
or
pip install -r requirements.txt
Important
- To deal with the
json.decoder.JSONDecodeError
: lushan88a/google_trans_new#36
usage: epub-translator.py [-h] [-v] [-l dest_lang] [-d dict_path] epub_file_path
A tool for translating epub files to different languages
using the Google Translate, with support for custom dictionaries.
positional arguments:
epub_file_path path to the epub file
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-l dest_lang, --lang dest_lang
destination language
-d dict_path, --dict dict_path
path to the translation dictionary
- The translated epub file will be named
[original_file]_translated.epub
and located in the same folder as the original epub file. - Suported destination languages are shown in
LANGUAGES
variable in theepub-translator.py
file. - This tool uses autodetect source languages when translating. If you have a problem with it, contact me and maybe I will add the manual select source languages.
- I only tested the tool on some of my favorite books and light novels.Β
- This tool may be buggy. Some books may crash with complex epub structure or some of the text will not be translated.
- Sometimes, too many translation requests to the Google Translate may cause Google to ban your IP from getting its translation service shortly. If this happens, you should change your IP via VPN.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
- Author - @quantrancse