# trans-epub
[![Crates.io](https://img.shields.io/crates/v/trans-epub.svg)](https://crates.io/crates/trans-epub)
[![Docs.rs](https://docs.rs/trans-epub/badge.svg)](https://docs.rs/trans-epub)
[![CI](https://github.com/tomiyan/trans-epub/workflows/CI/badge.svg)](https://github.com/tomiyan/trans-epub/actions)
[![Rust GitHub Template](https://img.shields.io/badge/Rust%20GitHub-Template-blue)](https://rust-github.github.io/)
This is a CLI tool to translate EPUB using OpenAI / Gemini API.
## CAUTION
- If a translated book is available, we strongly recommend that you purchase it.
- This is only a tool to assist in reading books that have not been translated.
- Although the API is called in parallel, the translation takes a long time because of the ratelimit.
- Also, although the translation is done in units of 20 lines, if the number of lines does not match the original text and the translated text, the API is called again for each line, which is more expensive than simply translating the text.
![Translate sample](./docs/images/translate_sample.png)
## Installation
### Cargo
* Install the rust toolchain in order to have cargo installed by following
[this](https://www.rust-lang.org/tools/install) guide.
* run `cargo install trans-epub`
## Execution
Install
```bash
curl -OL https://github.com/tomiyan/trans-epub/releases/download/0.0.10/trans-epub-0.0.10-macos-arm64.tar.gz
tar xvzf trans-epub-0.0.10-macos-arm64.tar.gz
```
Use Open AI help
```bash
./trans-epub open-ai --help
Use OpenAI API
Usage: trans-epub open-ai [OPTIONS] --input --output