@@ -26,7 +26,30 @@ where `path` is a Reason source file or a directory containing Reason source fil
26
26
27
27
The ` --allow-duplicates ` option allows messages with identical ` id ` props if the ` defaultMessage ` props are identical as well.
28
28
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:
30
53
31
54
1 . inline in ` FormattedMessage ` :
32
55
@@ -42,6 +65,25 @@ open ReactIntl;
42
65
<FormattedMessage id="some.message.id" defaultMessage="Some message" />
43
66
```
44
67
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
+
45
87
2 . using ` ReactIntl.defineMessages ` :
46
88
47
89
``` reason
@@ -93,30 +135,11 @@ let messages =
93
135
};
94
136
```
95
137
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
-
115
138
## Building and Testing
116
139
117
140
Install [ esy] as follows:
118
141
119
- % npm install -g esy@latest
142
+ % npm install -g esy
120
143
121
144
Then you can install the project dependencies using:
122
145
0 commit comments