A translation tool for using PO file with MkDocs. Compatible with Read the Docs and Weblate.
MkDocs PO I18n is currently installable directly from GitHub. The following can be added to a requirements.txt file or a pyproject.toml file, where desiredhash is the commit hash you wish to install:
"mkdocs-po-i18n @ git+https://github.com/kattni/mkdocs-po-i18n#desiredhash"
Note: Always pin to a commit hash when installing a package directly from GitHub. Doing so serves the same purpose as pinning a package to a specific release; in the event that the API changes or a bug is introduced, you won't be caught by surprise when your workflow breaks.
Required prerequisites can be found here.
Optional Read the Docs set up can be found here.
To do a local build of the site in English, run the following:
$ build_md_translations enTo live serve the build of your site in English, run the following:
$ live_serveIf your primary language is not English, you need to add a language code. For example, to live serve the site with German as your primary langauge, run the following:
$ live_serve deThe first step towards translating content is to generate the PO template files. To generate the POT files, run the following:
$ build_pot_translationsThe next step is generating the desired language PO files. You can run this command with one or more language codes. For example, to generate the PO files for French, run the following:
$ build_po_translations frTo build the site locally with translated content, you can run this command with one or more language codes. For example, to build in French, run the following:
$ build_md_translations frDocs can be found here.