$npx -y skills add tristan-mcinnis/PPT-Translator-Formatting-Intact-with-LLMs --skill ppt-translatorTranslate 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 wher
| 1 | # PowerPoint Translation Skill |
| 2 | |
| 3 | Translate PowerPoint presentations while preserving all formatting including fonts, colors, spacing, tables, and alignment. |
| 4 | |
| 5 | ## When to Use This Skill |
| 6 | |
| 7 | - Translating `.pptx` files between languages |
| 8 | - Batch translating multiple presentations in a directory |
| 9 | - Preserving slide formatting during translation (especially CJK ↔ English) |
| 10 | - When you need to inspect intermediate XML for debugging |
| 11 | |
| 12 | ## Setup |
| 13 | |
| 14 | Before first use, set up the environment: |
| 15 | |
| 16 | ```bash |
| 17 | # Navigate to the scripts directory |
| 18 | cd .claude/skills/ppt-translator/scripts |
| 19 | |
| 20 | # Create virtual environment and install dependencies |
| 21 | python3 -m venv .venv |
| 22 | source .venv/bin/activate # macOS/Linux |
| 23 | pip install -r requirements.txt |
| 24 | |
| 25 | # Configure API keys |
| 26 | cp example.env .env |
| 27 | # Edit .env with your provider API key(s) |
| 28 | ``` |
| 29 | |
| 30 | ## Basic Usage |
| 31 | |
| 32 | ```bash |
| 33 | cd .claude/skills/ppt-translator/scripts |
| 34 | source .venv/bin/activate |
| 35 | |
| 36 | python main.py /path/to/presentation.pptx \ |
| 37 | --provider openai \ |
| 38 | --source-lang zh \ |
| 39 | --target-lang en |
| 40 | ``` |
| 41 | |
| 42 | ## Provider Configuration |
| 43 | |
| 44 | | Provider | Environment Variable | Default Model | |
| 45 | |-----------|---------------------|----------------------------| |
| 46 | | openai | `OPENAI_API_KEY` | `gpt-5.2-2025-12-11` | |
| 47 | | anthropic | `ANTHROPIC_API_KEY` | `claude-sonnet-4-5-20250514` | |
| 48 | | deepseek | `DEEPSEEK_API_KEY` | `deepseek-chat` | |
| 49 | | grok | `GROK_API_KEY` | `grok-4.1-fast` | |
| 50 | | gemini | `GEMINI_API_KEY` | `gemini-3-flash-preview` | |
| 51 | |
| 52 | ## CLI Reference |
| 53 | |
| 54 | | Option | Description | Default | |
| 55 | |--------|-------------|---------| |
| 56 | | `--provider` | LLM provider: `openai`, `anthropic`, `deepseek`, `grok`, `gemini` | `openai` | |
| 57 | | `--model` | Override default model for provider | Provider default | |
| 58 | | `--source-lang` | Source language ISO code | `zh` | |
| 59 | | `--target-lang` | Target language ISO code | `en` | |
| 60 | | `--max-chunk-size` | Characters per API request | `1000` | |
| 61 | | `--max-workers` | Threads for slide extraction | `4` | |
| 62 | | `--keep-intermediate` | Retain XML files for debugging | `false` | |
| 63 | |
| 64 | ## Output Files |
| 65 | |
| 66 | For each input `presentation.pptx`, the tool generates: |
| 67 | |
| 68 | 1. `presentation_original.xml` - Extracted source content (deleted unless `--keep-intermediate`) |
| 69 | 2. `presentation_translated.xml` - Translated content (deleted unless `--keep-intermediate`) |
| 70 | 3. `presentation_translated.pptx` - Final translated presentation with formatting intact |
| 71 | |
| 72 | ## Common Workflows |
| 73 | |
| 74 | ### Translate a Single File (Chinese → English) |
| 75 | |
| 76 | ```bash |
| 77 | python main.py deck.pptx --provider anthropic --source-lang zh --target-lang en |
| 78 | ``` |
| 79 | |
| 80 | ### Batch Translate a Directory |
| 81 | |
| 82 | ```bash |
| 83 | python main.py /path/to/presentations/ --provider openai --source-lang ja --target-lang en |
| 84 | ``` |
| 85 | |
| 86 | ### Debug Translation Issues |
| 87 | |
| 88 | ```bash |
| 89 | python main.py deck.pptx --keep-intermediate --provider deepseek |
| 90 | # Inspect the generated XML files to see extracted/translated content |
| 91 | ``` |
| 92 | |
| 93 | ### Use a Specific Model |
| 94 | |
| 95 | ```bash |
| 96 | python main.py deck.pptx --provider openai --model gpt-5-mini |
| 97 | ``` |
| 98 | |
| 99 | ### Translate with Gemini (Cost-Effective) |
| 100 | |
| 101 | ```bash |
| 102 | python main.py deck.pptx --provider gemini --source-lang ko --target-lang en |
| 103 | ``` |
| 104 | |
| 105 | ## Supported Languages |
| 106 | |
| 107 | Use standard ISO 639-1 language codes: |
| 108 | |
| 109 | | Code | Language | |
| 110 | |------|----------| |
| 111 | | `zh` | Chinese (Simplified) | |
| 112 | | `en` | English | |
| 113 | | `ja` | Japanese | |
| 114 | | `ko` | Korean | |
| 115 | | `es` | Spanish | |
| 116 | | `fr` | French | |
| 117 | | `de` | German | |
| 118 | | `pt` | Portuguese | |
| 119 | | `ru` | Russian | |
| 120 | | `ar` | Arabic | |
| 121 | |
| 122 | ## Design Notes |
| 123 | |
| 124 | ### Font Scaling |
| 125 | |
| 126 | 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. |
| 127 | |
| 128 | ### Caching |
| 129 | |
| 130 | Repeated strings within a presentation are cached to avoid redundant API calls. This is especially useful for presentations with recurring headers, footers, or terminology. |
| 131 | |
| 132 | ### Chunking |
| 133 | |
| 134 | Long text blocks are intelligently split at sentence boundaries to stay within API limits while preserving translation quality. |
| 135 | |
| 136 | ## Troubleshooting |
| 137 | |
| 138 | ### "API key not found" |
| 139 | |
| 140 | Ensure your `.env` file in the scripts directory contains the correct environment variable: |
| 141 | ```bash |
| 142 | OPENAI_API_KEY=sk-... |
| 143 | ANTHROPIC_API_KEY=sk-ant-... |
| 144 | ``` |
| 145 | |
| 146 | ### Formatting looks wrong |
| 147 | |
| 148 | 1. Use `--keep-intermediate` to inspect the XML files |
| 149 | 2. Check if the source presentation has unusual formatting |
| 150 | 3. Try a different provider |
| 151 | |
| 152 | ### Translation incomplete |
| 153 | |
| 154 | 1. Check for API rate limits with your provider |
| 155 | 2. Try reducing `--max-chunk-size` for very long text blocks |
| 156 | 3. Ensure your API key has sufficient quota |
| 157 | |
| 158 | ## Script Reference |
| 159 | |
| 160 | The `scripts |