Translate a Japanese PowerPoint (.pptx) to English with python-pptx: Grouped Shapes, Tables, Speaker Notes, and an Overflow Check
Description and use
The script translates a Japanese PowerPoint to English, handling grouped shapes, tables, speaker notes, and checking for text overflow.
Problem
Simple python-pptx translation loops miss grouped shapes, tables and speaker notes, and translated text can overflow its boxes.
Outcome
The script processes all text containers, including grouped shapes, tables, and speaker notes, and performs an overflow check, producing a fully translated deck with no residual Japanese and no text overflow.
Workflow
- Extract every text container with walk_shapes, yielding key, text_frame, width, height.
- Export each text frame’s content to a CSV with a stable key.
- Translate the CSV entries using an offline glossary.
- Apply the translated text back to the corresponding text frames.
- Check each text frame for leftover Japanese and for overflow against its width and height.
- Flag any overflowed text for manual review.
- Render the resulting deck with LibreOffice to verify layout.
Evidence
Simple python‑pptx translation loops miss grouped shapes, tables and speaker notes. This one exports every Japanese paragraph to a CSV you can review, writes the English back, then checks for leftover Japanese and text that no longer fits.
The code below was run on October 25, 2026, with python‑pptx 1.0.2 and Python 3.13.5 on a small Japanese sample deck we made up for testing.
The before/after check was rendered with LibreOffice, not PowerPoint, so spacing in PowerPoint may differ a little.
- Record date: 2026-10-25T14:41:25.751Z