From 48d791c4e6dc590be202a8b21a8fdba1576b6f60 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Fri, 19 Jun 2020 15:34:38 +0200 Subject: [PATCH] 0.9.0 changes and readme (#60) --- CHANGELOG.md | 10 +++++++- README.md | 65 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee576bb..60a81f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index da2bdc1..c17b6ce 100644 --- a/README.md +++ b/README.md @@ -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`: @@ -42,6 +65,25 @@ open ReactIntl; ``` +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 @@ -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: