Skip to content

Add GNU gettext catalog I/O (parse .po, compile/read .mo)#322

Merged
JE-Chen merged 1 commit into
devfrom
feat/gettext-catalog-batch
Jun 22, 2026
Merged

Add GNU gettext catalog I/O (parse .po, compile/read .mo)#322
JE-Chen merged 1 commit into
devfrom
feat/gettext-catalog-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

The repo has i18n_test (pseudo-localisation, catalog placeholder checks) and message_format (ICU rendering) but no reader for the de-facto translation format — GNU gettext .po / .mo. This parses .po, compiles the binary .mo (the same format Python's own gettext reads), and exposes gettext/ngettext/pgettext.

Layers

  • Headless core: je_auto_control/utils/gettext_catalog/gettext_catalog.pyGettextCatalog (gettext/ngettext/pgettext/add/to_mo_bytes/compile_mo) + parse_po/parse_po_file/read_mo/read_mo_file. Handles contexts, plurals, multi-line strings, escapes, and the Plural-Forms header (evaluated via gettext.c2py). Pure stdlib (re/struct/gettext.c2py), no PySide6.
  • Facade: all re-exported + __all__.
  • Executor: AC_gettext_translate, AC_gettext_ngettext → {text}.
  • MCP: ac_gettext_translate / ac_gettext_ngettext.
  • Script Builder: two CommandSpecs under Data.

Tests / docs

  • test/unit_test/headless/test_gettext_catalog_batch.py — 11 headless tests (singular/fallback, plural, context, header metadata + Plural-Forms, .mo round-trip, stdlib gettext.GNUTranslations reads our .mo, bad-magic ValueError, programmatic build + wiring + facade).
  • EN/Zh feature docs v114_features_doc.rst + toctrees; 3 README What's-new sections.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 94 complexity · 0 duplication

Metric Results
Complexity 94
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit fdbe851 into dev Jun 22, 2026
17 of 18 checks passed
@JE-Chen JE-Chen deleted the feat/gettext-catalog-batch branch June 22, 2026 04:20
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant