Skip to content

Add ICU-lite MessageFormat (plural/select/selectordinal)#321

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

Add ICU-lite MessageFormat (plural/select/selectordinal)#321
JE-Chen merged 1 commit into
devfrom
feat/message-format-batch

Conversation

@JE-Chen

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

Copy link
Copy Markdown
Member

Summary

i18n_test.check_catalog only compares placeholder sets and interpolate does flat ${var} substitution — neither can render the count-aware messages real localisation needs, e.g. "{count, plural, one {# item} other {# items}}". This implements the ICU MessageFormat subset most apps use.

Layers

  • Headless core: je_auto_control/utils/message_format/message_format.pyformat_message, plural_category, ordinal_category. Recursive-descent parser → AST → render. Supports {name}, select, plural, selectordinal with CLDR categories, exact =N, the # count, offset:, nesting and ICU apostrophe quoting. Injectable plural/ordinal rule callables. Pure stdlib, no PySide6.
  • Facade: all re-exported + __all__.
  • Executor: AC_format_message (pattern + JSON args + locale) → {text}.
  • MCP: ac_format_message.
  • Script Builder: one CommandSpec under Data.

Tests / docs

  • test/unit_test/headless/test_message_format_batch.py — 13 headless tests (placeholder, plural one/other + #, exact =N, select, selectordinal incl. 11th, offset, nested select+plural, apostrophe quoting, category helpers incl. French, injectable rules + wiring + facade).
  • EN/Zh feature docs v113_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 90 complexity · 0 duplication

Metric Results
Complexity 90
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 6a1fa1a into dev Jun 22, 2026
16 checks passed
@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