Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@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 70,259 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.