Socket
Socket
Sign inDemoInstall

@lingui/babel-plugin-extract-messages

Package Overview
Dependencies
4
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lingui/babel-plugin-extract-messages

Babel plugin for collecting messages from source code for internationalization


Version published
Weekly downloads
162K
increased by10.07%
Maintainers
1
Created
Weekly downloads
 

Package description

What is @lingui/babel-plugin-extract-messages?

@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.

What are @lingui/babel-plugin-extract-messages's main functionalities?

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"
          }
        ]
      }
    ]
  ]
}
```

Other packages similar to @lingui/babel-plugin-extract-messages

Changelog

Source

3.13.1 (2022-01-21)

Bug Fixes

  • add lingui core to macro peer dependencies (#1187) (daaa773)
  • cloud service import() on case-sensitive filesystems (#1174) (5feb120)
  • i18n.activate should load instantly new messages (#1182) (f8f47a2)
  • remove the obsolete defineMessages function from the typings. (#1179) (19b032f)

Readme

Source

License Version Downloads

@lingui/babel-plugin-extract-messages

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.

Installation

npm install --save-dev @lingui/babel-plugin-extract-messages
# yarn add --dev @lingui/babel-plugin-extract-messages

Usage

.babelrc

{
  "plugins": ["@lingui/babel-plugin-extract-messages"]
}

Via CLI

babel --plugins @lingui/babel-plugin-extract-messages script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["@lingui/babel-plugin-extract-messages"]
})

License

MIT

Keywords

FAQs

Last updated on 21 Jan 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc