agentsclimarketplace

Epub monolingual translation

Skill mauriciopoppe/epub-translation/skills/epub-monolingual-translation

Convert monolingual EPUB files from a source language to a target language. Use when asked to translate an EPUB, ebook, or book file while preserving its technical integrity, structural layout, and metadata.From its SKILL.md

Install
npx -y skills add mauriciopoppe/epub-translation --skill epub-monolingual-translation

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.3 KB, as published. Nobody here has run it

EPUB Monolingual Translation Skill

Overview

This skill enables agents to translate EPUB files. It handles deconstruction, surgical text replacement (preserving HTML attributes), metadata updates, and spec-compliant reconstruction.

Location

Supporting scripts are located in the scripts/ directory adjacent to this SKILL.md.

Dependencies

  • Python 3.x
  • beautifulsoup4, lxml
  • Environment: Use the project's .venv if available, or create one: python3 -m venv .venv

Workflow

1. Setup

Ensure the virtual environment is ready and dependencies are installed.

  • Mac/Linux: source .venv/bin/activate && pip install beautifulsoup4 lxml
  • Windows: .venv\Scripts\activate && pip install beautifulsoup4 lxml

2. Deconstruction

Extract the EPUB to a temporary directory.

python3 ./scripts/epub_manager.py extract <INPUT_FILE> <TEMP_DIR>

3. Translation

Iterate through .xhtml or .html files in <TEMP_DIR>.

  1. Extract: ID:N|text strings using ./scripts/translate_processor.py extract.
  2. Translate: Translate the text content to the target language. Preserve 'product manager'.
  3. Apply: Save translations to a temp file and use ./scripts/translate_processor.py apply.

4. Metadata

Update <dc:language> in content.opf.

python3 ./scripts/translate_processor.py metadata <OPF_FILE> <LANG_CODE>

5. Reconstruction

Re-pack the EPUB. The script handles the mimetype rule.

python3 ./scripts/epub_manager.py pack <TEMP_DIR> <OUTPUT_FILE>

Validation

To ensure the scripts are functioning correctly, you can run the included unit tests:

python3 -m unittest discover ./tests

Guidelines

  • Always use the .venv python interpreter.
  • Maintain all HTML tags/attributes exactly.
  • CRITICAL: Preserve all leading and trailing spaces in translations. If a source string starts or ends with a space, the translation MUST also contain it.
  • The mimetype file must be first and uncompressed (enforced by epub_manager.py).

Keep looking

Skills are one crate of 608,475. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.