mkdocs-mdpo-plugin

Mkdocs plugin for translations using PO files.


Keywords
i18n, internationalization, markdown, mdpo, mkdocs, plugin, po, python, translation
License
BSD-3-Clause
Install
pip install mkdocs-mdpo-plugin==0.0.27

Documentation

mkdocs-mdpo-plugin

PyPI version Downloads Test Documentation Cloudflare DNS

Translations for Mkdocs using PO files, fully customizable. Compatible with mkdocs-material, based on mdpo.

Documentation: en - es

Install

pip install mkdocs-mdpo-plugin

Usage

Enable the plugin in your mkdocs.yml:

plugins:
  - mdpo

Minimal configuration

With mkdocs-material

theme:
  name: material
  language: en

extra:
  alternate:
    - name: English
      lang: en
    - name: EspaΓ±ol
      link: es
      lang: es

plugins:
  - mdpo

Standalone

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.