在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):cca-io/rescript-react-intl-extractor开源软件地址(OpenSource Url):https://github.com/cca-io/rescript-react-intl-extractor开源编程语言(OpenSource Language):OCaml 75.7%开源软件介绍(OpenSource Introduction):rescript-react-intl-extractorExtracts messages for localization from ReScript source files. Also supports the legacy Reason syntax. This assumes that you are using the rescript-react-intl bindings for react-intl. InstallationBinaries for macOS, Linux and Windows can be installed via npm or yarn. For global installation, run npm install -g rescript-react-intl-extractor-bin Alternatively, the binaries are also available for download on the releases page. Usagerescript-react-intl-extractor [--allow-duplicates] [path...] where The OutputThe output (a JSON array of all extracted messages sorted by id) is written to stdout. It will look like this: [
{
"id": "message.hello",
"defaultMessage": "Hello"
},
{
"id": "message.world",
"defaultMessage": "World"
},
{
"id": "some.message.id",
"defaultMessage": "Some message"
}
] Message Definition (ReScript Syntax)Formatted messages may be defined in your source files in one of the following ways:
<ReactIntl.FormattedMessage id="some.message.id" defaultMessage="Some message" /> or open ReactIntl
...
<FormattedMessage id="some.message.id" defaultMessage="Some message" />
open ReactIntl
module Msg = {
@@intl.messages
let hello = {id: "message.hello", defaultMessage: "Hello"}
let world = {id: "message.world", defaultMessage: "World"}
} You also can pass descriptions to the records with: let foo = @intl.description("Hello description") {id: "message.hello", defaultMessage: "Hello"} Message Definition (Legacy Reason Syntax)Formatted messages may be defined in your source files in one of the following ways:
<ReactIntl.FormattedMessage id="some.message.id" defaultMessage="Some message" /> or open ReactIntl;
...
<FormattedMessage id="some.message.id" defaultMessage="Some message" />
open ReactIntl;
module Msg = {
[@intl.messages];
let hello = {id: "message.hello", defaultMessage: "Hello"};
let world = {id: "message.world", defaultMessage: "World"};
}; You also can pass descriptions to the records with: let foo = [@intl.description "Hello description"] {id: "message.hello", defaultMessage: "Hello"}; let hello = [%intl "hello"]
let world = [%intl {msg: "world", desc: "Some description"}] Building and TestingThe ReScript parser is included as a git submodule. Therefore, after checking out the sources, first run
Install Ocaml and OPAM, and create an OPAM switch with OCaml version 4.06.1. Then run
To build the project, run
To run the tests, do
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论