{"id":13726607,"url":"https://github.com/cca-io/rescript-react-intl-extractor","last_synced_at":"2025-07-24T23:33:53.701Z","repository":{"id":36967616,"uuid":"133238656","full_name":"cca-io/rescript-react-intl-extractor","owner":"cca-io","description":"Extracts messages for localization from ReScript source files.","archived":false,"fork":false,"pushed_at":"2024-11-11T16:14:54.000Z","size":346,"stargazers_count":33,"open_issues_count":1,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-11T17:23:44.568Z","etag":null,"topics":["react-intl","rescript"],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cca-io.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-13T13:17:53.000Z","updated_at":"2023-12-08T10:04:49.000Z","dependencies_parsed_at":"2024-01-06T07:38:06.809Z","dependency_job_id":"bf1b0fe1-7ecc-449f-8e3f-9d6940d7a5d2","html_url":"https://github.com/cca-io/rescript-react-intl-extractor","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cca-io%2Frescript-react-intl-extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cca-io%2Frescript-react-intl-extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cca-io%2Frescript-react-intl-extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cca-io%2Frescript-react-intl-extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cca-io","download_url":"https://codeload.github.com/cca-io/rescript-react-intl-extractor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227489210,"owners_count":17780529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react-intl","rescript"],"created_at":"2024-08-03T01:03:14.438Z","updated_at":"2024-12-01T05:13:52.428Z","avatar_url":"https://github.com/cca-io.png","language":"OCaml","funding_links":[],"categories":["Reason"],"sub_categories":[],"readme":"# rescript-react-intl-extractor\n\nExtracts messages for localization from [ReScript] source files.\n\nThis assumes that you are using the [rescript-react-intl] bindings for [react-intl].\n\n[![NPM](https://nodei.co/npm/rescript-react-intl-extractor-bin.png?compact=true)](https://nodei.co/npm/rescript-react-intl-extractor-bin/)  \n![Build Status](https://github.com/cca-io/rescript-react-intl-extractor/workflows/CI/badge.svg)\n\n## Installation\n\nBinaries for macOS, Linux and Windows can be installed via npm or yarn. For global installation, run\n\n```sh\nnpm install -g rescript-react-intl-extractor-bin\n```\n\nAlternatively, the binaries are also available for download on the [releases page].\n\n## Usage\n\n```sh\nrescript-react-intl-extractor [--allow-duplicates] [path...]\n```\n\nwhere `path` is a ReScript (`*.res`) source file or a directory containing such source files. Multiple files/directories may be specified.\n\nThe `--allow-duplicates` option allows messages with identical `id` props if the `defaultMessage` props are identical as well.\n\n## Output\n\nThe output (a JSON array of all extracted messages sorted by id) is written to stdout. It will look like this:\n\n```json\n[\n  {\n    \"id\": \"message.hello\",\n    \"defaultMessage\": \"Hello\"\n  },\n  {\n    \"id\": \"message.world\",\n    \"defaultMessage\": \"World\"\n  },\n  {\n    \"id\": \"some.message.id\",\n    \"defaultMessage\": \"Some message\"\n  }\n]\n```\n\n## Message Definition (ReScript Syntax)\n\nFormatted messages may be defined in your source files in one of the following ways:\n\n1.  inline in `FormattedMessage`:\n\n```rescript\n\u003cReactIntl.FormattedMessage id=\"some.message.id\" defaultMessage=\"Some message\" /\u003e\n```\n\nor\n\n```rescript\nopen ReactIntl\n...\n\u003cFormattedMessage id=\"some.message.id\" defaultMessage=\"Some message\" /\u003e\n```\n\n2.  within a module with the `[@intl.messages]` attribute:\n\n```rescript\nopen ReactIntl\n\nmodule Msg = {\n  @@intl.messages\n\n  let hello = {id: \"message.hello\", defaultMessage: \"Hello\"}\n  let world = {id: \"message.world\", defaultMessage: \"World\"}\n}\n```\n\nYou also can pass descriptions to the records with:\n\n```rescript\nlet foo = @intl.description(\"Hello description\") {id: \"message.hello\", defaultMessage: \"Hello\"}\n```\n\n## Building and Testing\n\nThe ReScript parser is included as a git submodule. Therefore, after checking out the sources, first run\n\n    git submodule update --init --recursive\n\nInstall OCaml and OPAM, and create an OPAM switch with OCaml version 4.14.1.\n\nThen run\n\n    opam pin add rescript-react-intl-extractor.dev . --no-action\n    opam install . --deps-only --with-doc --with-test\n\nTo build the project, run\n\n    opam exec -- dune build\n\nTo run the tests, do\n\n    opam exec -- dune runtest\n\n[rescript]: https://rescript-lang.org/\n[rescript-react-intl]: https://github.com/cca-io/rescript-react-intl\n[bs-react-intl-ppx]: https://github.com/ahrefs/bs-react-intl-ppx\n[react-intl]: https://github.com/yahoo/react-intl\n[releases page]: https://github.com/cca-io/rescript-react-intl-extractor/releases\n[esy]: https://esy.sh\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcca-io%2Frescript-react-intl-extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcca-io%2Frescript-react-intl-extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcca-io%2Frescript-react-intl-extractor/lists"}