1
- # esy-reason-project
1
+ # bs-react-intl-extractor
2
2
3
- [ ![ Build Status ] ( https://travis-ci.org/esy-ocaml/esy-reason-project.svg?branch=master )] ( https://travis-ci.org/esy-ocaml/esy-reason-project )
3
+ Extracts messages for localization from [ Reason ] source files.
4
4
5
- A project which demonstrates a Reason workflow with [ Esy] [ ] .
5
+ This assumes that you are using the
6
+ [ bs-react-intl] bindings for [ react-intl] and your source files define formatted messages as follows:
6
7
7
- [ Esy ] : https://github.com/esy-ocaml/esy
8
+ ``` re
9
+ <FormattedMessage id=" some.message.id" defaultMessage=" Some message" />
10
+ ```
8
11
12
+ The reason formatter (` refmt ` ) needs to be on the path.
9
13
10
14
## Usage
11
15
12
- You need Esy, you can install the beta using [ npm] [ ] :
16
+ ``` sh
17
+ bs-react-intl-extractor < directory>
18
+ ```
19
+
20
+ where ` directory ` is the directory containing yuor Reason source files.
21
+
22
+ The output (a JSON array of all extracted messages sorted by id) is written to stdout.
23
+
24
+ ## Known Issues
25
+
26
+ Performance is not optimal right now as the ` refmt ` executable is forked for the processing of each file.
27
+
28
+ ## How to build
29
+
30
+ Install [ esy] as follows:
13
31
14
32
% npm install -g esy@latest
15
33
@@ -33,8 +51,13 @@ using:
33
51
34
52
And test compiled executable:
35
53
36
- % esy ./_build/default/bin/hello .exe
54
+ % esy ./_build/default/bin/Extract .exe
37
55
38
56
Shell into environment:
39
57
40
58
% esy shell
59
+
60
+ [ reason ] : https://reasonml.github.io
61
+ [ bs-react-intl ] : https://github.com/alexfedoseev/bs-react-intl
62
+ [ react-intl ] : https://github.com/yahoo/react-intl
63
+ [ esy ] : https://esy.sh
0 commit comments