Skip to content

feat(xliff): add MF1 format and PGS support for export/import - #20

Merged
jsahleen merged 9 commits into
mainfrom
msg-cli-15
Jul 20, 2026
Merged

feat(xliff): add MF1 format and PGS support for export/import#20
jsahleen merged 9 commits into
mainfrom
msg-cli-15

Conversation

@jsahleen

@jsahleen jsahleen commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Bump @worldware/msg to ^0.8.1 and add MF1 tooling deps (@messageformat/icu-messageformat-1, @messageformat/parser).
  • Persist message format (NONE / MF1 / MF2) on XLIFF 2.2 unit@type as msg:* during export/import.
  • Add MF1 ICU plural / selectordinal / select ↔ XLIFF PGS conversion (pgs-mf1.ts), with MF1-friendly segment bodies (# / {name}).
  • Keep existing MF2 .match ↔ PGS path (pgs-mf2.ts).

Closes #15

Test plan

  • npm test — 288 tests green
  • npx tsc --noEmit and npm run build pass
  • Coverage > 90% (~94.9% lines)
  • MF1 plural/selectordinal/select round-trip via PGS; nested multi-switch nests as ICU
  • Export sets type="msg:MF1" (etc.); import restores attributes.format
  • MF2 PGS path unchanged (including ordinals)
  • CI green on the PR

jsahleen and others added 9 commits July 19, 2026 20:20
Pull in format-aware msg 0.8.1 plus @messageformat/icu-messageformat-1
and parser for MF1↔PGS conversion. Refs #15.

Co-authored-by: Cursor <cursoragent@cursor.com>
Encode/decode MsgFormat via XLIFF unit type (msg:NONE|MF1|MF2) and
resolve inherited format. Refs #15.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add mf1MessageToPgsExport / pgsImportToMf1Message stubs that return null
so TDD tests fail until Phase 4. Refs #15.

Co-authored-by: Cursor <cursoragent@cursor.com>
Persist resolved format on unit@type, route MF1 through PGS stubs, and
tolerate messageformat options as Map or plain object for ordinals.
Refs #15.

Co-authored-by: Cursor <cursoragent@cursor.com>
Convert via mf1ToMessageData into shared PGS export; reconstruct nested
ICU on import, mapping plural vars to #. Refs #15.

Co-authored-by: Cursor <cursoragent@cursor.com>
Emit ICU #/{name} segment text on MF1 export, reuse MsgFormat from
@worldware/msg, clarify resolveMessageFormat args, and DRY import
segment joins. Refs #15.

Co-authored-by: Cursor <cursoragent@cursor.com>
Cover helper round-trips and import-command e2e for NONE/MF1/MF2 plus
MF1 plural PGS, and edge cases for malformed MF1. Refs #15.

Co-authored-by: Cursor <cursoragent@cursor.com>
Update README, export/import specs, and project info for unit@type
(msg:*) and MF1 ICU ↔ PGS support. Refs #15.

Co-authored-by: Cursor <cursoragent@cursor.com>
Extract pgsExportForFormat, simplify segment text join, and export
SelectMessage for docs/typing consistency. Refs #15.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jsahleen
jsahleen marked this pull request as ready for review July 20, 2026 02:37
@jsahleen
jsahleen merged commit fd66be0 into main Jul 20, 2026
1 check passed
@jsahleen
jsahleen deleted the msg-cli-15 branch July 20, 2026 03:04
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.

Add support for MessageFormat 1

1 participant