@@ -26,7 +26,30 @@ where `path` is a Reason source file or a directory containing Reason source fil
2626
2727The ` --allow-duplicates ` option allows messages with identical ` id ` props if the ` defaultMessage ` props are identical as well.
2828
29- Formatted messages may be defined in your source files in one of the following three ways:
29+ ## Output
30+
31+ The output (a JSON array of all extracted messages sorted by id) is written to stdout. It will look like this:
32+
33+ ``` json
34+ [
35+ {
36+ "id" : " message.hello" ,
37+ "defaultMessage" : " Hello"
38+ },
39+ {
40+ "id" : " message.world" ,
41+ "defaultMessage" : " World"
42+ },
43+ {
44+ "id" : " some.message.id" ,
45+ "defaultMessage" : " Some message"
46+ }
47+ ]
48+ ```
49+
50+ ## Message Definition (bs-react-intl 2.x)
51+
52+ Formatted messages may be defined in your source files in one of the following ways:
3053
31541 . inline in ` FormattedMessage ` :
3255
@@ -42,6 +65,25 @@ open ReactIntl;
4265<FormattedMessage id="some.message.id" defaultMessage="Some message" />
4366```
4467
68+ 2 . within a module with the ` [@intl.messages] ` attribute:
69+
70+ ``` reason
71+ open ReactIntl;
72+
73+ module Msg = {
74+ [@intl.messages];
75+
76+ let hello = {id: "message.hello", defaultMessage: "Hello"};
77+ let world = {id: "message.world", defaultMessage: "World"};
78+ };
79+ ```
80+
81+ ## Message Definition (bs-react-intl 1.x)
82+
83+ Formatted messages may be defined in your source files in one of the following ways:
84+
85+ 1 . inline in ` FormattedMessage ` (see above)
86+
45872 . using ` ReactIntl.defineMessages ` :
4688
4789``` reason
@@ -93,30 +135,11 @@ let messages =
93135 };
94136```
95137
96- The output (a JSON array of all extracted messages sorted by id) is written to stdout. It will look like this:
97-
98- ``` json
99- [
100- {
101- "id" : " message.hello" ,
102- "defaultMessage" : " Hello"
103- },
104- {
105- "id" : " message.world" ,
106- "defaultMessage" : " World"
107- },
108- {
109- "id" : " some.message.id" ,
110- "defaultMessage" : " Some message"
111- }
112- ]
113- ```
114-
115138## Building and Testing
116139
117140Install [ esy] as follows:
118141
119- % npm install -g esy@latest
142+ % npm install -g esy
120143
121144Then you can install the project dependencies using:
122145
0 commit comments