Now that you've declared some messages, it's time to extract them.
Add the following command to your
and execute with
ID Interpolation Pattern
Make sure this pattern matches
idInterpolationPattern when you use
@formatjs/ts-transformer in Bundling with formatjs or you'll get a
Given a file that has the following messages:
running the above command will create a file called
During extraction, we'll preserve explicit declared IDs and insert a hash as an ID for messages without. We recommend against explicit IDs since it can cause collision.
Automatic ID Generation
Since manual IDs are discouraged, we've provided a
babel plugin and a
TypeScript AST transformer that will automatically insert message IDs in your transpiled code. For more details please visit Bundling with formatjs.
Translation Management System (TMS) Integration
The default format generated from
@formatjs/cli might not work with the specific TMS/vendor you're working with. You can specify a custom formatter with
--format <formatFile> that allows you to convert that format into something tailored to your TMS. For example:
If your vendor accepts the format like
you can run
We also provide several builtin formatters to integrate with 3rd party TMSes so feel free to create PRs to add more.
|Transifex's Structured JSON|
|Smartling ICU JSON|
|Crowdin Chrome JSON|
|Lokalise Structured JSON|