Skip to content

Commit

Permalink
Fill out MessageData a bit more, and link to upstream JSON Schema def…
Browse files Browse the repository at this point in the history
…inition (#37)
  • Loading branch information
eemeli authored Jan 8, 2024
1 parent eca10b1 commit 0e2e2e7
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,31 @@ The other `interface` descriptions below are intended to represent plain objects

### MessageData

The `MessageData` interface will be defined by
the MF2 data model developed by the MF2 working group.
The `MessageData` interface is defined by the
[MF2 data model](https://github.com/unicode-org/message-format-wg/tree/main/spec/data-model)
developed by the Unicode MessageFormat working group.
It contains a parsed representation of a single message for a particular locale.

```ts
interface MessageData {}
type MessageData = PatternMessage | SelectMessage;

interface PatternMessage {
type: 'message';
declarations: Declaration[];
pattern: Pattern;
}

interface SelectMessage {
type: 'select';
declarations: Declaration[];
selectors: Expression[];
variants: Variant[];
}
```

The full and exact definition of the message data model is given by its
[JSON Schema definition](https://github.com/unicode-org/message-format-wg/blob/main/spec/data-model/message.json).

### MessageFormat

The `Intl.MessageFormat` constructor creates a `MessageFormat` instance
Expand Down

0 comments on commit 0e2e2e7

Please sign in to comment.