Translations for Mkdocs using PO files, fully customizable. Compatible with mkdocs-material, based on mdpo.
pip install mkdocs-mdpo-plugin
Enable the plugin in your mkdocs.yml
:
plugins:
- mdpo
theme:
name: material
language: en
extra:
alternate:
- name: English
lang: en
- name: EspaΓ±ol
link: es
lang: es
plugins:
- mdpo
plugins:
- mdpo:
languages:
- en # first language is the original
- es
Both previous configurations will create the same layout of files building the
documentation. Given the next layout in a docs/
directory:
π docs
βββ π index.md
After the build, you will get:
π docs
βββ π es
βΒ Β βββ π index.md.po
βββ π index.md
Just translate the strings in docs/es/index.md.po
into Spanish, build again
with mkdocs build
and the site/
directory will look like:
π site
βββ π 404.html
βββ π assets
βΒ Β βββ π images
βΒ Β βββ π javascripts
βΒ Β βββ π stylesheets
βββ π es
βΒ Β βββ π index.html
βββ π index.html
βββ π sitemap.xml
βββ π sitemap.xml.gz
Simple and easy. The extraction of messages process and the produced layout are fully customizable, you can even translate code blocks! Check the full documentation here.