Skip to content
epub-translate logo

EPUB Bilingual Translate Skill

epub-translate

A skill for creating bilingual EPUB books by adding translated text alongside the original content while preserving the original formatting and structure.

SKILL.md

Full skill instructions

EPUB Bilingual Translate Skill

Overview

This skill creates bilingual EPUB files by adding translated text alongside the original content while preserving the original formatting and structure. It follows a 4-step workflow: extract, translate, update metadata, and reassemble.

Functionality

  • Extracts content from EPUB archives
  • Creates bilingual text content in HTML/​XHTML files by adding translations alongside original text
  • Updates metadata to reflect the bilingual nature of the content
  • Reassembles bilingual content into a valid EPUB archive
  • Preserves original formatting, structure, and non-text content
  • Unzips and parses EPUB files to identify navigation and content files
  • Supports multiple target languages for bilingual output

Workflow

  1. Extract: Unzip the EPUB file to access its contents (HTML files, metadata, etc.)
  2. Translate: Identify text content in HTML/​XHTML files and add translations alongside original text
  3. Update Metadata: Modify language settings in content.opf and other relevant files to reflect bilingual content
  4. Reassemble: Zip the bilingual files back into a valid EPUB archive

Implementation Details

  • Reads EPUB as a zip archive (mimetype, META-INF/, EPUB/ folder structure)
  • Parses HTML/​XHTML files to extract translatable text while preserving tags
  • Updates DC metadata language field in content.opf to indicate bilingual content
  • Maintains the original file structure and properties during reassembly
  • Validates the final EPUB file to ensure it's a properly formatted archive
  • Uses unzip -d command to extract the EPUB file to a temporary directory
  • Opens each file in the extracted EPUB folder to examine its content
  • Adds translated text alongside the original text in each file
  • Preserves the original text while adding translations
  • Compresses the bilingual files back into an EPUB file

Usage

  1. Extract the source EPUB using unzip
  2. Add translated text alongside original content in HTML files while keeping the markup intact
  3. Update language metadata in content.opf to indicate bilingual content
  4. Reassemble using zip command with proper options to maintain EPUB format
  5. Verify the result with unzip -t to ensure integrity

Usage Examples

Create a bilingual English-Chinese book about mybook.epub, and save it to mybook_bilingual.epub.

Key Considerations

  • EPUB files are essentially ZIP archives with a specific structure
  • The mimetype file must be the first file in the archive and stored without compression
  • Language attributes in HTML files and metadata should reflect the bilingual nature
  • All original file paths and structures must be preserved during reassembly
  • Original text content must be preserved alongside the new translations
  • No automated scripts should be created for translation; instead, create a TODO list of files that need translation
  • Directly read file content and perform modifications on the files rather than using automated processes

Bilingual Formatting Standards

To ensure optimal reading experience in bilingual EPUB files:

  • Use paragraph-by-paragraph comparison format, with translated text immediately following the corresponding original paragraph
  • Maintain consistent formatting for both languages throughout the document
  • Preserve the original document structure while integrating translated content
  • Use appropriate language tags (lang attributes) for both original and translated text
  • Clearly separate original and translated content with visual indicators (e.g., different text colors, spacing, or containers)
  • Ensure proper text direction and typography for both languages
  • Maintain consistent font sizes and styles that work well for both languages
  • Follow a structured approach: original paragraph, then translated paragraph, maintaining the logical flow of content

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View