Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@lingui/babel-plugin-extract-messages
Advanced tools
Babel plugin for collecting messages from source code for internationalization
@lingui/babel-plugin-extract-messages is a Babel plugin designed to extract messages from your code for internationalization (i18n) purposes. It works in conjunction with the LinguiJS framework to help developers manage and translate text in their applications.
Extracting Messages
This feature allows you to extract messages from your codebase into a specified directory. The configuration specifies the directory where the extracted messages will be stored and whether to extract messages from `formatMessage` calls.
```json
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
[
"@lingui/babel-plugin-extract-messages",
{
"localeDir": "./locales/",
"extractFromFormatMessageCall": true
}
]
]
}
```
Custom Message Extraction
This feature allows you to define custom formatters for message extraction. The configuration includes a custom formatter with a specific name and pattern, enabling more flexible message extraction.
```json
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
[
"@lingui/babel-plugin-extract-messages",
{
"localeDir": "./locales/",
"extractFromFormatMessageCall": true,
"customFormatters": [
{
"name": "customFormatter",
"pattern": "customPattern"
}
]
}
]
]
}
```
babel-plugin-react-intl is a Babel plugin for extracting messages from React components that use the react-intl library. It is similar to @lingui/babel-plugin-extract-messages but is specifically designed for use with react-intl, making it a good choice for projects already using that library.
i18next-extract-gettext is a tool for extracting translation keys from JavaScript and TypeScript codebases that use the i18next library. It provides similar functionality to @lingui/babel-plugin-extract-messages but is tailored for use with i18next, offering a different approach to internationalization.
Babel plugin which extracts messages for translation from source files
@lingui/babel-plugin-extract-messages
is part of LinguiJS. See the documentation for all information, tutorials and examples.
npm install --save-dev @lingui/babel-plugin-extract-messages
# yarn add --dev @lingui/babel-plugin-extract-messages
.babelrc
(Recommended).babelrc
{
"plugins": ["@lingui/babel-plugin-extract-messages"]
}
babel --plugins @lingui/babel-plugin-extract-messages script.js
require("@babel/core").transform("code", {
plugins: ["@lingui/babel-plugin-extract-messages"]
})
FAQs
Babel plugin for collecting messages from source code for internationalization
The npm package @lingui/babel-plugin-extract-messages receives a total of 140,467 weekly downloads. As such, @lingui/babel-plugin-extract-messages popularity was classified as popular.
We found that @lingui/babel-plugin-extract-messages demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.