Crates.io | trans-epub |
lib.rs | trans-epub |
version | 0.0.12 |
source | src |
created_at | 2024-06-16 05:43:04.688696 |
updated_at | 2024-08-03 07:24:15.897925 |
description | Translate EPUB with CLI |
homepage | https://github.com/tomiyan/trans-epub |
repository | https://github.com/tomiyan/trans-epub |
max_upload_size | |
id | 1273282 |
size | 277,728 |
This is a CLI tool to translate EPUB using OpenAI / Gemini API.
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.
cargo install trans-epub
Install
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
./trans-epub open-ai --help
Use OpenAI API
Usage: trans-epub open-ai [OPTIONS] --input <INPUT> --output <OUTPUT> --language <LANGUAGE> --api-key <API_KEY>
Options:
-i, --input <INPUT> input file path
-o, --output <OUTPUT> output file path
-l, --language <LANGUAGE> translate language
-m, --model <MODEL> OpenAI model ex(gpt-4o, gpt-4-turbo, gpt-3.5-turbo-1106) [default: gpt-4o]
-a, --api-key <API_KEY> OpenAI API Key [env: API_KEY]
--lines <LINES> Number of lines of translation [default: 20]
--requests <REQUESTS> Number of concurrent requests [default: 5]
-h, --help Print help
Use Open AI translate
export API_KEY=sk-....
./trans-epub open-ai -i ./origin.epub -o ./translated.epub -l Japanese
Wait a few minutes.
Use Gemini help
./trans-epub gemini --help
Use Gemini API
Usage: trans-epub gemini [OPTIONS] --input <INPUT> --output <OUTPUT> --language <LANGUAGE> --api-key <API_KEY>
Options:
-i, --input <INPUT> input file path
-o, --output <OUTPUT> output file path
-l, --language <LANGUAGE> translate language
-m, --model <MODEL> Gemini model ex(gemini-1.5-flash) [default: gemini-1.5-flash]
-a, --api-key <API_KEY> Gemini API Key [env: API_KEY]
--lines <LINES> Number of lines of translation [default: 100]
--requests <REQUESTS> Number of concurrent requests [default: 1]
-h, --help Print help
Use Gemini translate
export API_KEY=AI....
./trans-epub gemini -i ./origin.epub -o ./translated.epub -l Japanese
Wait a few minutes.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING.md.
Inspired by epub-translator