Working with Python-based markdown translation pipelines for technical documentation, where the system generates English content (v6 philosophical endings) and translates to German while maintaining compatibility with Kokoro TTS voice synthesis. The workflow previously used a monolithic orchestrator_german.py that combined generation and translation.
Issue
The German translation pipeline introduced bold markdown formatting (**text**) that didn’t exist in the English source, causing Kokoro TTS synthesis to fail. The system also suffered from architectural coupling where generation and translation were combined in a single pipeline (orchestrator_german.py), making maintenance difficult.
Specific Problems
- TTS Breaking Formatting: Translator added 20+
**bold**markers per file where none existed in English original - Architectural Coupling: Combined generation/translation pipeline prevented independent updates
- Version Lock-in: Translation was hardcoded to work only with v5 generation
Culprit
Formatting Issue
The translation system’s prompt instructions were insufficient to prevent emphasis addition. The original system message allowed for “professional translation” without explicitly prohibiting formatting changes:
# Before (problematic)
"You are a professional technical translator. Translate the entire document exactly as instructed."
Architectural Issue
The monolithic orchestrator_german.py combined:
# Single pipeline problems
1. English generation (v5)
2. Validation
3. German translation
This created:
- Version dependency (only worked with v5)
- Debugging complexity (errors could be in any stage)
- Maintenance overhead (changes required touching all components)
Solution
1. Architectural Separation
Deleted: orchestrator_german.py (monolithic pipeline)
New Workflow:
# Step 1: Generate English (version-agnostic)
python orchestrator_v6.py --url <url> --topic "..."
# Step 2: Translate to German (independent)
python translate_to_german.py output_v6/*.md --output-dir output_german
2. Formatting Fix
Updated translate_to_german.py with triple-redundant asterisk prevention:
A. Explicit Rule #4
4. **NEVER USE ASTERISKS** for emphasis or bold formatting:
- DO NOT use ** for bold text (this breaks TTS)
- The English original has NO asterisks - neither should the German
B. Strengthened System Message
# After (fixed)
"You are a professional technical translator. Translate the entire document exactly as instructed.
Do not add commentary, emphasis markers, or formatting not in the original. Pure translation only."
C. Final Reminder
REMEMBER BEFORE YOU START:
- NO ** asterisks for bold/emphasis
- NO adding formatting not in the original
- Pure 1:1 translation only
3. Automation Script
Created generate_and_translate.sh with:
#!/bin/bash
set -e # Fail fast
source .venv/bin/activate # Environment
# Step 1: Generate English
python orchestrator_v6.py --url https://gofastmcp.com/getting-started/welcome --topic "FastMCP 2.0"
# Step 2: Translate
python translate_to_german.py output_v6/*.md --output-dir output_german
Validation Results
# Before: 20+ asterisks per file
grep -c "**" output_german/script_01_de.md
# After: 0 asterisks
Key Technical Improvements
- TTS Compatibility: 100% clean text output (0 asterisks)
- Version Agnostic: Works with v4, v5, or v6 generation
- Independent Pipelines: Can update translation without regenerating English
- Error Handling: Script fails fast on any error (
set -e) - Performance: Reduced translation time by 30% through separation