pi-epub-translator

extensionmaintained

Translate EPUB books in Pi while preserving structure, styling, images, footnotes, and packaging.

by — · v0.1.3 · published 1w ago

$ pi install npm:pi-epub-translator
downloads/mo
0
stars
2
last push
1w ago
open issues
0

Signals

license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

No downloads in the last 12 weeks.

README

Pi EPUB Translator

npm version publish license

A Pi extension for translating selected EPUB content while preserving the book's XML structure and EPUB package.

See it in action

Pi EPUB Translator workflow from /translate-epub to a completed EPUB

The demo uses the normal package installation flow and a real sample EPUB. Translation progress is shortened in the recording.

Highlights

  • Review first — edit the AI-proposed document scope and glossary before translating.
  • Preserve structure — translated fragments must keep their tags and attributes; package members are checked before output.
  • Parallel workers — isolated, no-session Pi workers claim fragments through SQLite leases and fencing.
  • Manage runs — inspect progress, request cancellation, and retry eligible failed fragments.

Install

pi install npm:pi-epub-translator

Use

  1. Put a non-DRM EPUB in input/.
  2. Start Pi normally with pi.
  3. Run /translate-epub.
  4. Choose the EPUB, model, thinking level, target language, and worker count.
  5. Review the document scope and glossary, then confirm.
  6. Find the translated EPUB in output/ after the run completes.

The source EPUB is not modified. Run state is stored in .parallel-translate/.

Commands

CommandDescription
/translate-epubStart the guided translation workflow.
/epub-progressShow progress for the current or most recent run.
/epub-cancelRequest cancellation at the next worker checkpoint.
/epub-retryReset eligible failed fragments and start replacement workers.

Requirements

  • Pi CLI
  • Node.js and npm
  • Python 3.10+
  • A local EPUB without DRM
  • At least one model configured in Pi

Selected EPUB content is sent to the configured Pi model. Check your provider's data-handling policy before translating private books.

Files

PathPurpose
input/Source EPUBs; ignored by Git
output/Translated EPUBs; ignored by Git
.parallel-translate/SQLite run state; ignored by Git

Do not commit books, translated output, credentials, or run state.

Development

npm ci
npm test
python3 tests/test_run_store.py
npm pack --dry-run

For local source testing only:

pi --approve -e ./src/index.ts

Release

Publishing is automated by .github/workflows/publish-npm.yml when a v* tag is pushed:

npm version patch
git push --follow-tags

The workflow checks the tag/version match, runs both test suites, and publishes the package with npm provenance.

Repository · Issues · MIT License