ppt-translator
Translate PowerPoint presentations while preserving formatting (fonts, colors, alignment, tables). Supports multiple LLM providers (OpenAI, Anthropic, DeepSeek, Grok, Gemini). Use when translating .pptx files between languages, especially for CJK to/from English translations where text expansion/contraction is a concern.
git clone https://github.com/tristan-mcinnis/PPT-Translator-Formatting-Intact-with-LLMs
T=$(mktemp -d) && git clone --depth=1 https://github.com/tristan-mcinnis/PPT-Translator-Formatting-Intact-with-LLMs "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.claude/skills/ppt-translator" ~/.claude/skills/tristan-mcinnis-ppt-translator-formatting-intact-with-llms-ppt-translator && rm -rf "$T"
.claude/skills/ppt-translator/SKILL.mdPowerPoint Translation Skill
Translate PowerPoint presentations while preserving all formatting including fonts, colors, spacing, tables, and alignment.
When to Use This Skill
- Translating
files between languages.pptx - Batch translating multiple presentations in a directory
- Preserving slide formatting during translation (especially CJK ↔ English)
- When you need to inspect intermediate XML for debugging
Setup
Before first use, set up the environment:
# Navigate to the scripts directory cd .claude/skills/ppt-translator/scripts # Create virtual environment and install dependencies python3 -m venv .venv source .venv/bin/activate # macOS/Linux pip install -r requirements.txt # Configure API keys cp example.env .env # Edit .env with your provider API key(s)
Basic Usage
cd .claude/skills/ppt-translator/scripts source .venv/bin/activate python main.py /path/to/presentation.pptx \ --provider openai \ --source-lang zh \ --target-lang en
Provider Configuration
| Provider | Environment Variable | Default Model |
|---|---|---|
| openai | | |
| anthropic | | |
| deepseek | | |
| grok | | |
| gemini | | |
CLI Reference
| Option | Description | Default |
|---|---|---|
| LLM provider: , , , , | |
| Override default model for provider | Provider default |
| Source language ISO code | |
| Target language ISO code | |
| Characters per API request | |
| Threads for slide extraction | |
| Retain XML files for debugging | |
Output Files
For each input
presentation.pptx, the tool generates:
- Extracted source content (deleted unlesspresentation_original.xml
)--keep-intermediate
- Translated content (deleted unlesspresentation_translated.xml
)--keep-intermediate
- Final translated presentation with formatting intactpresentation_translated.pptx
Common Workflows
Translate a Single File (Chinese → English)
python main.py deck.pptx --provider anthropic --source-lang zh --target-lang en
Batch Translate a Directory
python main.py /path/to/presentations/ --provider openai --source-lang ja --target-lang en
Debug Translation Issues
python main.py deck.pptx --keep-intermediate --provider deepseek # Inspect the generated XML files to see extracted/translated content
Use a Specific Model
python main.py deck.pptx --provider openai --model gpt-5-mini
Translate with Gemini (Cost-Effective)
python main.py deck.pptx --provider gemini --source-lang ko --target-lang en
Supported Languages
Use standard ISO 639-1 language codes:
| Code | Language |
|---|---|
| Chinese (Simplified) |
| English |
| Japanese |
| Korean |
| Spanish |
| French |
| German |
| Portuguese |
| Russian |
| Arabic |
Design Notes
Font Scaling
The tool automatically scales fonts down (70% for text, 80% for tables) to accommodate text expansion when translating from compact languages (Chinese, Japanese, Korean) to English. This prevents text overflow in fixed-size text boxes.
Caching
Repeated strings within a presentation are cached to avoid redundant API calls. This is especially useful for presentations with recurring headers, footers, or terminology.
Chunking
Long text blocks are intelligently split at sentence boundaries to stay within API limits while preserving translation quality.
Troubleshooting
"API key not found"
Ensure your
.env file in the scripts directory contains the correct environment variable:
OPENAI_API_KEY=sk-... ANTHROPIC_API_KEY=sk-ant-...
Formatting looks wrong
- Use
to inspect the XML files--keep-intermediate - Check if the source presentation has unusual formatting
- Try a different provider
Translation incomplete
- Check for API rate limits with your provider
- Try reducing
for very long text blocks--max-chunk-size - Ensure your API key has sufficient quota
Script Reference
The
scripts/ directory contains:
- Entry pointmain.py
- Python dependenciesrequirements.txt
- Environment variable templateexample.env
- Core translation moduleppt_translator/
- CLI argument parsingcli.py
- PPT extraction and regenerationpipeline.py
- Chunking and cachingtranslation.py
- LLM provider implementationsproviders/