Socket
Socket
Sign inDemoInstall

babel-plugin-i18next-extract

Package Overview
Dependencies
73
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-i18next-extract

Statically extract translation keys from i18next application.


Version published
Weekly downloads
51K
decreased by-21.12%
Maintainers
1
Install size
25.6 MB
Created
Weekly downloads
 

Readme

Source

Logo

babel-plugin-i18next-extract

License: MIT CI Netlify Status Test Coverage

NPM


babel-plugin-i18next-extract is a Babel Plugin that will traverse your Javascript/Typescript code in order to find i18next translation keys.

Features

  • ✅ Keys extraction in JSONv4 format.
  • ✅ Detection of i18next.t() function calls.
  • ✅ Full react-i18next support.
  • ✅ Plurals support.
  • ✅ Contexts support.
  • ✅ Namespace detection.
  • ✅ Disable extraction on a specific file sections or lines using comment hints.
  • ✅ Overwrite namespaces, plurals and contexts on-the-fly using comment hints.
  • … and more?

Documentation

You can check out the full documentation at i18next-extract.netlify.com.

Quick Start

Installation

yarn add --dev babel-plugin-i18next-extract

# or

npm i --save-dev babel-plugin-i18next-extract

Minimal configuration

If you don't have a babel configuration yet, you can follow the Configure Babel documentation page to get started.

Declare the plugin like any other plugin in your .babelrc and you're good to go:

{
  "plugins": [
    "i18next-extract",
    // […] your other plugins […]
  ]
}

You may want to specify additional configuration options:

{
  "plugins": [
    ["i18next-extract", {"nsSeparator": "~"}],
    // […] your other plugins […]
  ]
}

For an exhaustive list of configuration options, check out the Configuration page.

Once the plugin is setup, you can build your app normally or run Babel through Babel CLI:

yarn run babel -f .babelrc 'src/**/*.{js,jsx,ts,tsx}'

# or

npm run babel -f .babelrc 'src/**/*.{js,jsx,ts,tsx}'

Extracted translations land in the extractedTranslations/ directory by default.

Keywords

FAQs

Last updated on 30 Dec 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc