Git Product home page Git Product logo

epub-translator's Introduction

epub-translator

Actions Status

epub-translator is an utility to translate EPub books.

  • Utilize DeepL API (You need to register DeepL API plan)
  • Leave the original text for reference, and insert the translated text below per paragraph

Translation sample

This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .

Build

Prerequisites

  • JDK 11
  • GraalVM (If you want to build a native image directly)
  • Docker or Podman (If you want to build a native image in a container)

Building

The application can be built and executed directly from the source dir using

./gradlew build
java -jar build\quarkus-app\quarkus-run.jar --src my.epub

Creating an uber-jar

The application can be packaged using following command:

./gradlew quarkusBuild -Dquarkus.package.type=uber-jar

It produces the epub-translator-runner.jar file in the build directory.

Configuration

place application.yml to <epub-translator working directory>/config/application.yml

application.yml

ePubTranslator:
  deepL:
    apiEndpoint: https://api.deepl.com # If you subscribe free API plan, use "https://api-free.deepl.com" instead.
    apiKey: <put your api key here>
  language:
    source: en        # default source language
    destination: ja   # default destination language

Execution

uber-jar

java -jar epub-translator-runner.jar --src <path to source epub file> [--dst <path to destination epub file>] \
[--srcLang <source language>] [--dstLang <destination language>]

Database and DeepL limited credits

A database is kept of previous translations. This is especially useful if a translation fails during processing, to avoid spending credit on already translated content. It also makes it possible to incrementally translate a book using limited credits, by running the translation again later when more credits are available

The database is located at ~username/.epub-translator.

epub-translator can count the characters in the file using --count. This can be used to estimate the cost in DeepL credits before executing the translation.

Fixing bad output files

If the translated epub is not readable by your e-reader, it may be fixable by Calibre. Calibre has an eBook conversion tool, and converting the output book from epub to epub tends to fix the problems.

epub-translator's People

Contributors

ynojima avatar dependabot[bot] avatar arberg avatar dependabot-preview[bot] 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.