Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Format Handlers Overview

Format handlers live in the src/formats/ module. Each handler is responsible for:

  1. Parsing the source document structure (cells, paragraphs, PDF content streams, etc.).
  2. Extracting text units to translate.
  3. Delegating translation to TranslationService.
  4. Reconstructing the output document with translated text, preserving all non-text structure.

The central router is formats::translate_file, which reads the file extension from RuntimeConfig and dispatches to the correct handler. An unrecognised extension returns AppError::UnsupportedFormat.

Handlers at a Glance

FormatHandler moduleKey challenge
CSV / TSVformats::csv_tsvPreserve column structure across all rows
DOCXformats::docxTranslate paragraph runs while keeping styles, numbering, and tables intact
PDFformats::pdfParse content streams, rasterise background, render translated text at correct positions

Sub-pages