mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 12:17:13 +00:00
xgettext counts a space as a format flag, so the prose `95% confidence` parses as the directive `% c` and the entry is marked python-format. Every translation moves the word behind the percent sign, msgfmt then reads `% V` and refuses the catalog. Quoted Jinja blocks and percent-encoded URLs fall into the same trap. A run over the documentation catalogs left 312 such entries in 19 files, none of which could be compiled to .mo. Removing the flag when writing does nothing: babel derives it from the msgid on every load, so the value in the file is decoration. gettext's own switch for this is no-python-format, which babel does not touch, and the writer now sets it on entries the derivation flags but that carry no real placeholder. The derived flag has to go at the same time, because gettext reads the flag line in order and `no-python-format, python-format` cancels itself out. What counts as a real placeholder was already spelled out in PROTECTED, so it moves into PRINTF and is used from both places rather than written twice. The repository lint gains the check that would have caught this. It compares the msgid against itself first and reports only when the translation alone fails, so a source string that mixes positional and named placeholders, which gettext accepts, does not raise a finding. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Shared Utilities (utils/)
This directory contains shared Python helpers used by custom modules and plugins.
Purpose
Use utils/ for reusable code that should not be duplicated across:
library/modules,plugins/action/,plugins/filter/,plugins/lookup/.
Typical shared utilities:
- API clients,
- validation/conversion helpers,
- path and configuration helpers,
- cross-plugin/module domain logic.
- Shared HTTP(S) connection handler for multiple modules.
- Common validation or transformation functions for user input.
- Utility functions for interacting with Docker, LDAP, etc.
- Grouped helper packages such as
utils/domains/for related domain logic.
Design Guidelines
- Keep helpers focused and composable.
- Avoid side effects during import.
- Prefer explicit function/class APIs over implicit globals.
- Keep dependencies minimal so modules/plugins stay lightweight.
Example Import
from utils.domains.primary_domain import get_primary_domain
What Does Not Belong Here
- Standalone executable modules (put in
library/). - Ansible plugin entrypoints (put in
plugins/*).
References
- Module utilities: https://docs.ansible.com/ansible/latest/dev_guide/developing_module_utilities.html
- Plugin development: https://docs.ansible.com/ansible/latest/dev_guide/developing_plugins.html