Skip to content

Commit

Permalink
0.9.0 changes and readme (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
cknitt authored Jun 19, 2020
1 parent 86d7236 commit 48d791c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 22 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Changelog

## 0.9.0 - 2020-06-19

- Upgraded Reason parser to Reason 3.6.0 (release).
- OCaml 4.08, Dune 2.
- Migrated tests to [Rely](https://reason-native.com/docs/rely/).
- Moved CI to GitHub Actions.
- macOS, Linux and Windows binaries built by CI.

## 0.8.0 - 2020-02-12

- Upgraded Reason parser to Reason 3.6.0 (8f71db0)
- Upgraded dependencies.

## 0.8.0 - 2019-02-12
## 0.7.0 - 2019-02-12

- Upgraded Reason parser to Reason 3.4.0.
- Upgraded dependencies.
Expand Down
65 changes: 44 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,30 @@ where `path` is a Reason source file or a directory containing Reason source fil

The `--allow-duplicates` option allows messages with identical `id` props if the `defaultMessage` props are identical as well.

Formatted messages may be defined in your source files in one of the following three ways:
## Output

The output (a JSON array of all extracted messages sorted by id) is written to stdout. It will look like this:

```json
[
{
"id": "message.hello",
"defaultMessage": "Hello"
},
{
"id": "message.world",
"defaultMessage": "World"
},
{
"id": "some.message.id",
"defaultMessage": "Some message"
}
]
```

## Message Definition (bs-react-intl 2.x)

Formatted messages may be defined in your source files in one of the following ways:

1. inline in `FormattedMessage`:

Expand All @@ -42,6 +65,25 @@ open ReactIntl;
<FormattedMessage id="some.message.id" defaultMessage="Some message" />
```

2. within a module with the `[@intl.messages]` attribute:

```reason
open ReactIntl;
module Msg = {
[@intl.messages];
let hello = {id: "message.hello", defaultMessage: "Hello"};
let world = {id: "message.world", defaultMessage: "World"};
};
```

## Message Definition (bs-react-intl 1.x)

Formatted messages may be defined in your source files in one of the following ways:

1. inline in `FormattedMessage` (see above)

2. using `ReactIntl.defineMessages`:

```reason
Expand Down Expand Up @@ -93,30 +135,11 @@ let messages =
};
```

The output (a JSON array of all extracted messages sorted by id) is written to stdout. It will look like this:

```json
[
{
"id": "message.hello",
"defaultMessage": "Hello"
},
{
"id": "message.world",
"defaultMessage": "World"
},
{
"id": "some.message.id",
"defaultMessage": "Some message"
}
]
```

## Building and Testing

Install [esy] as follows:

% npm install -g esy@latest
% npm install -g esy

Then you can install the project dependencies using:

Expand Down

0 comments on commit 48d791c

Please sign in to comment.