Skip to content

cloudyview/ppt-translator

Repository files navigation

PPTranslate — Translate PowerPoint Files Without Breaking the Layout

The only PPT translator that preserves every font, color, position, and animation — powered by Claude AI.

This is the open-source engine powering pptranslate.com — the hosted version with no setup required.

GitHub Stars License: MIT Python 3.11+ Live Demo Powered by Claude


PPTranslate Demo

Try it live → pptranslate.com


Why not Google Translate or DeepL?

They destroy your slides. Every time.

PPTranslate Google Translate DeepL Manual + ChatGPT
Layout preserved ✅ 100% by design ❌ Often breaks ⚠️ Partial ❌ Manual work
Charts & diagrams
AI-quality translation ✅ Claude Sonnet ⚠️ Mediocre ✅ Good ✅ Good
Self-hostable N/A
Open source ✅ MIT N/A

How it works

PPTX files are ZIP archives of XML. A text run looks like this:

<a:r>
  <a:rPr lang="en-US" sz="2400" b="1"/>  <!-- formatting — NEVER touched -->
  <a:t>Hello World</a:t>                 <!-- text — only this is replaced -->
</a:r>

PPTranslate surgically replaces only <a:t> nodes. Formatting lives in <a:rPr> — which is never modified. Layout is preserved by construction, not post-processing.

The translation engine uses Claude Tool Use to force structured output — eliminating the JSON parse errors that plague naive LLM translation approaches. We went from 16 errors per 843 translations to zero errors across 1,214 translations after this fix.


Quick start

git clone https://github.com/cloudyview/ppt-translator.git
cd ppt-translator
pip install -r requirements.txt
echo "ANTHROPIC_API_KEY=sk-ant-..." > .env
python app.py
# Open http://localhost:8000

CLI

python cli.py presentation.pptx --src English --tgt Japanese
python cli.py deck.pptx --src English --tgt Spanish -o deck_es.pptx

REST API

curl -X POST http://localhost:8000/translate \
  -F "file=@deck.pptx" \
  -F "src_lang=英文" \
  -F "tgt_lang=日文" \
  -o deck_japanese.pptx

Supported languages

Chinese (Simplified · Traditional) · English · Japanese · Korean · French · German · Spanish


Features

  • Zero layout damage — only <a:t> text nodes are modified, never <a:rPr>
  • SmartArt & charts — translates diagram data and chart labels
  • Overflow protection — auto-shrinks font when translated text is significantly longer
  • Textbox expansion — proportionally widens single-line headings
  • Structured output — Claude Tool Use enforces valid responses, no JSON parse errors
  • Full user auth — JWT, email verification, usage limits per plan
  • Admin dashboard — real-time stats: users, translations, Claude token costs
  • Web UI + REST API + CLI — use however you want
  • One-command deploy — systemd + nginx setup for Ubuntu 24.04

Production deployment (Ubuntu 24.04)

sudo ANTHROPIC_API_KEY=sk-ant-... DOMAIN=translator.yourdomain.com bash deploy.sh

Configures Python virtualenv, systemd service (auto-restart), and nginx reverse proxy automatically.


Project structure

ppt-translator/
├── translator.py    # Core engine — XML surgery + Claude Tool Use
├── app.py           # FastAPI server — auth, usage limits, admin backend
├── database.py      # SQLite — users, usage_log, waitlist, token tracking
├── cli.py           # Command-line interface
├── frontend.html    # Web UI (drag-and-drop translator)
├── account.html     # User account management
├── pricing.html     # Pricing page
├── admin.html       # Admin dashboard (users, translations, API costs)
├── deploy.sh        # Ubuntu one-command deploy
└── nginx.conf       # nginx config

The technical story

The hardest problem wasn't translation quality — it was getting Claude to return reliably structured output for 50+ text items per slide without a single parse error.

Our first approach (ask Claude for a JSON array) failed because Claude would occasionally split individual sentences into character arrays. Switching to Tool Use with named properties (t0, t1, t2...) reduced errors to zero. Read the full breakdown →


Contributing

PRs welcome. Open an issue first for major changes.


Star history

Star History Chart


License

MIT — see LICENSE


If this saves you from a broken slide deck, please ⭐ star the repo — it helps others find it.

About

Translate PowerPoint files across 7 languages while keeping every font, color, and layout exactly as designed.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors