Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
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
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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.