Skip to content

feat(i18n): add typed plural and select message variants #503

Description

@LMLiam

Outcome

Define and implement typed plural and select message variants after the base registry and generated catalogue are stable.

Design gate

Before adding a dependency or public type, compare these options with real catalogue call sites:

  1. a small Kotventure closed model for only the categories required by the accepted use cases;
  2. Unicode Common Locale Data Repository (CLDR) plural rules through an established library;
  3. International Components for Unicode (ICU) message support.

Show dependency size, supported locales, rule-update ownership, runtime cost, generated API shape, and failure behaviour. Obtain maintainer approval. Do not add ICU or CLDR data speculatively.

Required contract

  • The catalogue compiler owns variant schemas and generated placeholder types.
  • Every locale must use the same placeholder name and type for a catalogue key.
  • Select keys form a closed generated set. Unknown values fail; they do not select the last branch.
  • Plural categories come only from the approved rule source. Do not infer categories from English.
  • Require an explicit other branch for plural and select variants.
  • Validate missing, extra, and unreachable branches at build time where the approved rule model permits it.
  • Runtime lookup remains fail-fast for malformed generated or external data.

Acceptance criteria

  • The maintainer approves the rule source, dependency, and generated call sites.
  • The compiler generates typed plural and select arguments.
  • Cross-locale placeholder and branch schemas are checked before generation.
  • Required other, unknown select, missing branch, and locale-rule cases have tests.
  • Runtime code does not embed an unreviewed English-only rule.
  • Documentation states rule-data version and update ownership.

Dependencies

Blocked by #48, #49, and the catalogue-completeness child of #322. Implement diagnostics before runtime variants when useful.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: i18nTranslation / localisationroadmapIncluded in the public roadmap projecttype: featureNew capability

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions