mkdocs-autotranslate
A MkDocs plugin + CLI that keeps a multilingual MkDocs site in sync across language trees: it detects content that exists in one language but not another — blog posts, pages, any path you point it at — and can create the missing translations via DeepL.
- Plugin (
autotranslate): at build time, reports untranslated content — optionally fails strict builds. Never touches the network. - CLI (
autotranslate): dry-run report by default;--writecreates missing translated files for human review before commit.
Install
pip install mkdocs-autotranslate
Plugin usage
Add to mkdocs.yml:
plugins:
- autotranslate:
languages: [en, nl] # directories under docs/
paths: [blog/posts] # dirs/files/globs under each language dir
mode: report # report | strict (fail build on gaps)
With Material's multi-language recipe you typically run one build per language config; add the plugin to each (or the shared base config).
CLI usage
# dry-run: shows what WOULD be created, writes nothing, needs no API key
autotranslate --docs-dir docs
# apply: creates missing posts via DeepL (review the git diff!)
autotranslate --docs-dir docs --write
Options:
| Flag | Default | Meaning |
|---|---|---|
--docs-dir |
(required) | Path to your docs/ directory |
--languages |
en nl |
Language subdirectories to compare |
--paths |
blog/posts |
Dirs/files/globs under each language dir |
--write |
off | Create files instead of reporting only |
DeepL key
The CLI looks for a DeepL auth key in $DEEPL_API_KEY or
~/.config/deepl/api_key (mode 0600). Keys ending in :fx automatically
use the free endpoint (api-free.deepl.com); all others use the pro
endpoint. Free tier is 500,000 characters/month.
Guarantees
- Never overwrites existing files (idempotent; re-runs are no-ops)
- Drafts (
draft: true) are never propagated - Front matter preserved structurally: title translated, date/categories verbatim
- Fenced code blocks pass through untranslated
- A provenance comment is appended to generated files
- The plugin itself performs no network calls — translation is always an explicit author-run step so machine output gets reviewed before publishing
Development
pip install -e '.[test]'
pytest
License
MIT
Metadata
Release files for mkdocs-autotranslate 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mkdocs_autotranslate-0.2.0.tar.gz | 13.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mkdocs_autotranslate-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.2 kB
Release files / mkdocs_autotranslate-0.2.0.tar.gz
| Download URL | mkdocs_autotranslate-0.2.0.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a119c98a3f14868fbf69ae1eab52e669736e943d270e222b0e04ee029159271
|
|
BLAKE2b-256 checksum How to use checksums |
c849b5645ce4e34f363ad560a81b373c1f1556527413689346bc0575d71a00ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / mkdocs_autotranslate-0.2.0-py3-none-any.whl
| Download URL | mkdocs_autotranslate-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e1b1e91e8a745e2536c3ecac960ba267078381ec0f91f7d38af3d48e0f680bf
|
|
BLAKE2b-256 checksum How to use checksums |
176e9d3645e241251d04d0ea56d6f7c5501f39559b171a1dc6aee29332302042
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|