
Security News
Node.js Moves Toward Stable TypeScript Support with Amaro 1.0
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
react-intl-universal-extract
Advanced tools
Extract react-intl-universal's default messages in source code to locale files.
For example, suppose you have a file:
render() {
const name = 'Tony';
return (<>
{intl.get('hello1').d('Hello World')}
{intl.get('hello2', {name} ).d(`Hello ${name}`)}
</>);
}
This tool will generate a json file which contains the extracted messages.
{
"hello1": "Hello World",
"hello2": "Hello {name}",
}
Note that if the default message contains variables in ES6 template strings format (Hello ${name}
), it will be transformed to ICU format (Hello {name}
).
npm install --save-dev react-intl-universal-extract
In package.json
, add a script:
"scripts": {
"intl:extract": "npx react-intl-universal-extract --cmd extract --source-path ./src --output-path ./src/locales/en_US.json --verbose",
}
Then run npm run intl:extract
.
Parameters:
cmd
: only "extract" is supported currently.source-path
: The source code directory path such as "./src"output-path
: The extracted json file path such as "./src/locales/en_US.json"const intlTool = require('react-intl-universal-extract');
const result = intlTool.extract({
sourcePath: './test-files',
});
console.log(result);
/** result:
[{
key: 'hello2',
path: 'test-files/App.js',
originalDefaultMessage: 'Hello ${name}',
transformedDefaultMessage: 'Hello {name}'
}]
*/
This software is free to use under the BSD license.
See "develop.md"
FAQs
A react-intl-universal message extractor
The npm package react-intl-universal-extract receives a total of 139 weekly downloads. As such, react-intl-universal-extract popularity was classified as not popular.
We found that react-intl-universal-extract demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.