Coder Social home page Coder Social logo

tinyx3k / epub-translator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from quantrancse/epub-translator

0.0 0.0 0.0 74 KB

A tool for translating epub files to different languages using the Google Translate API, with support for custom dictionaries.

License: MIT License

Python 100.00%

epub-translator's Introduction

Python Version MIT License


Logo

epub-translator

A tool for translating epub files to different languages using the Google Translate API, with support for custom dictionaries.

Download · Screenshots · Script Usage

Table of Contents

About The Project

A tool for translating epub files to different languages using the Google Translate API, with support for custom dictionaries.

Features

  • 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.

Getting Started

Download the execution file below. Run and follow the instructions.

Windows: epub-translator.exe ~ 12MB

Custom Dictionary Usage

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 :.

Prerequisites

  • python3
  • google_trans_new
  • requests
  • bs4
  • lxml
  • tqdm
pip install google_trans_new requests bs4 lxml tqdm

Important

Script Usage

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 API, 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

Notes

  • 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 the epub-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.

Screenshots

Demo

Issues

  • 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 API may cause Google to ban your IP from getting its translation service shortly. If this happens, you should change your IP via VPN.

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

epub-translator's People

Contributors

quantrancse avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.