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.3.0 (2018-07-23)

Long-awaited backlog grooming.

New Features

  • Add support for locales (aka cultures) (#170). Thanks to Cristi Ingineru.
  • Allow React elements to be used as message variables (#183)
  • Support both Babel 6.x and 7.x (#171, #232, #238)
  • withI18n hoists statics of wrapped component (#166)
  • Date and i18n.date accepts date as a string (#155)
  • lingui extract shows progress (#180)
  • lingui extract throws an error when encountering different defaults for the same message (#200)
  • lingui compile shows useful error when message has syntax errors (#191)

Bug Fixes

  • Fix internal catalog names to avoid collisions. Internal catalogs are named <original_filename>.json, eg: App.js.json (#244)

Docs

<a name="2.2.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

yarn add --dev @lingui/babel-plugin-extract-messages
# npm install --save-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 23 Jul 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