Pelican plugin for managing l10n with po4a
Project description
pelican-po4a: Pelican plugin for managing l10n with po4a
Pelican plugin for managing l10n with po4a
Features and limitations
This plugin is intended to help with integrating po4a into the Pelican build process. With po4a, it is possible to translate entire content files using any gettext tool, e.g. Weblate.
The plugin does the following:
- Track content files and their translation counterparts to build the
source/translation list in
po4a.conf
- Support the generic
$lang
pattern for po4a.conf source/translation sets - Write a
po4a.conf
file matching Pelican settings and content - Update message catalogs based on source files
- Update translations based on message catalogs
The plugin supports the following other plugins:
- i18n_subsites – the po4a plugin only acts on the main language and writes data once
- jinja2content – the wrapped readers are detected for content format detection
- asciidoc_readers – reader is supported and detected for content format detection
Currently, the plugin has the following limitations:
- If anything changed (source content for main language or translations), the build has
to be run twice (a
CRITICAL
message is emitted to notify the user). This is because we have no control over the order in which languages are built, and translated sites ( when usingi18n_subsites
) might be built before translations are picked up jinja2content
blocks and vanilla HTML blocks in Markdown are not handled by po4a, they are added to the catalogs verbatim- Markdown files need to have separators around metadata (frontmatter) sections, because po4a requires them
Patches welcome!
Installation
This plugin can be installed via:
python -m pip install pelican-po4a
After doing that, append po4a
to your PLUGINS
setting.
Obviously, you also need to have po4a
itself installed.
Usage
The following settings are available:
Setting | Description | Default |
---|---|---|
PO4A_CONF |
(Relative) path to po4a.conf file |
./po4a.conf |
PO4A_PO_DIR |
(Relative) path to the catalog directory | ./po |
PO4A_CATALOG |
Name of the message catalog | pelican-website |
PO4A_PAGE_PATTERN |
Generic pattern for translation paths of pages | content/pages/{lang}/{relpath} |
PO4A_POST_PATTERN |
Generic pattern for translation paths of posts | content/posts/{lang}/{relpath} |
All necessary po4a actions are automatically taken when building the main site language.
If changes were made, a CRITICAL
message is logged, and starting the build again is required
(cf. limitations).
Contributing
Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.
To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.
License
This project is licensed under the Apache-2.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pelican_po4a-1.0.0b3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c4dd667e0e320007a1b44d707afd16c8670ef0a7ca076c7e7005a7022b4ddd6 |
|
MD5 | 5d41325b4a983aae3024d088b306cbec |
|
BLAKE2b-256 | 49a29ee360145b19b948f0858788829da28d605f27943e29a28fdfd2b3b001e0 |