Legacy lightweight translation utilities for PPTX and DOCX.
This repository is still usable for simple document-translation workflows, but new development has moved to translation-app, which covers a broader scope.
Utilities for translating Japanese PPTX and DOCX files to English while preserving document structure.
scripts/translate_pptx_inplace.py: main PPTX translation pipelinescripts/apply_cache_only.py: apply an existing PPTX translation cachescripts/manual_docx_translation.py: prepare/apply manual DOCX translationsscripts/translate_docx.py: DOCX CLI via backend orchestratorbackend/app/main.py: minimal FastAPI DOCX APItools/estimate_cost.py: cost estimation utility
- PPTX path is the main implemented workflow.
- Manual DOCX path is usable.
- Backend DOCX API is minimal and primarily covered by tests.
scripts/translate_pptx_inplace.py --helpis currently broken due to an unescaped%in an argparse help string.- PPTX
--offlinemode emits mock translations, not real offline translation.
python -m venv .venv
source .venv/bin/activate
pip install openai requests python-docx fastapi uvicorn pydantic-settings defusedxml pytest jsonschema
cp .env.example .envSet OPENAI_API_KEY for online translation runs.
python scripts/translate_pptx_inplace.py \
--in input.pptx \
--out output_en.pptx \
--glossary glossary.jsonOutputs:
translation_cache.jsonbilingual.csvaudit.jsontranslation.log
python scripts/apply_cache_only.py \
--in input.pptx \
--out output_en.pptx \
--cache translation_cache.jsonPrepare template:
python scripts/manual_docx_translation.py prepare \
--input input.docx \
--template translations/template.jsonApply completed translations:
python scripts/manual_docx_translation.py apply \
--input input.docx \
--translations translations/filled.json \
--output output_en.docxuvicorn backend.app.main:app --reloadEndpoints:
GET /healthzGET /readyzPOST /api/translateGET /api/jobs/{job_id}GET /api/jobs/{job_id}/download
python -m pytest tests -qFocused suites:
python -m pytest tests/test_integration.py -q
python -m pytest tests/test_docx_adapter.py -q
python -m pytest tests/test_smoke_translate_docx.py -q