Socket
Socket
Sign inDemoInstall

@lingui/babel-plugin-extract-messages

Package Overview
Dependencies
Maintainers
1
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lingui/babel-plugin-extract-messages

Extract messages for translation


Version published
Weekly downloads
178K
increased by13.65%
Maintainers
1
Weekly downloads
 
Created

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

2.4.0 (2018-08-09)

Better support for custom file formats and initial support for Create React App.

New Features

  • New message catalog format: Gettext PO file (#256)
  • New lingui init command which detects project type and install all required packages (#253)
  • Allow customize messages for missing translations (#255)
  • lingui extract detects create-react-app projects and extracts messages using rect-app babel preset

Bug Fixes

  • lingui add-locale accepts any valid BCP-47 locale (#182)
  • Flow types are correctly exported for all packages (#250)

<a name="2.3.0"></a>

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 js-lingui. 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

Package last updated on 09 Aug 2018

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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc