Skip to content

Add translation tracking - #602

Open
mcmah309 wants to merge 2 commits into
funstory-ai:mainfrom
mcmah309:translation_tracking
Open

mcmah309 wants to merge 2 commits into
funstory-ai:mainfrom
mcmah309:translation_tracking

Conversation

@mcmah309

@mcmah309 mcmah309 commented Aug 1, 2026 •

Copy link
Copy Markdown

PR Title

Adds translation tracking to the api so you can see how translations were mapped between the documents. Enabled through an opt-in config flag.

PR Type

  • ✨ Enhancement
  • 🐛 Bug Fix
  • 📚 Documentation
  • 🏗️ Refactor
  • 🧪 Test
  • 🧹 Chore

Breaking Changes

Contributor Checklist

  • I have fully read and understood the CONTRIBUTING.md guide.
  • I have performed a self-review of my own code.
  • My changes follow the project's code style and guidelines
  • I have linked the related issue(s) in the description above (if applicable)
  • I have updated relevant documentation (if applicable)
  • I have added necessary tests that prove my fix is effective or that my feature works (if applicable)
  • All new and existing tests passed locally with my changes
  • My changes generate no new warnings or errors
  • I understand that due to limited maintainer resources, only small PRs are accepted. Suggestions with proof-of-concept patches are appreciated, and my patch may be rewritten if necessary.

Testing Instructions

Screenshots (if applicable)

Additional Notes


Summary by cubic

Adds opt-in translation tracking that maps source paragraphs to translated outputs with geometry and layout info, exposed via TranslateResult.translation_tracking.

New Features

  • enable_translation_tracking on TranslationConfig collects per-paragraph input/output, page_number, box, layout_label, placeholders, and optional per-character char_boxes.
  • Debug mode also collects tracking and writes it to translate_tracking.json, without attaching it to the result.
  • Split-part page numbers are rebased to document indices; merged results concatenate tracking and renumber multi_paragraph_id.

Migration

  • Enable with enable_translation_tracking=True; read translation_tracking from TranslateResult (only present when enabled).

Written for commit f6c0be6. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread babeldoc/format/pdf/high_level.py Resolved
Comment thread babeldoc/format/pdf/result_merger.py Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant