babel-plugin-i18next-extract
TypeScript icon, indicating that this package has built-in type declarations

0.10.0 • Public • Published

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.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.10.015,245latest

Version History

VersionDownloads (Last 7 Days)Published
0.10.015,245
0.9.216,048
0.9.139
0.9.04,828
0.9.0-rc.111
0.9.0-rc103
0.8.34,931
0.8.21,048
0.8.110
0.8.038
0.7.2711
0.7.110
0.7.010
0.6.1339
0.6.010
0.5.0616
0.4.27
0.4.10
0.4.021
0.3.00
0.2.6148
0.2.51
0.2.41
0.2.30
0.2.20
0.2.10
0.2.00
0.1.23
0.1.10
0.1.029
0.1.0-rc.30
0.1.0-rc.10
0.1.0-rc1
0.1.0-alpha.30
0.1.0-alpha.21
0.1.0-alpha.10

Package Sidebar

Install

npm i babel-plugin-i18next-extract

Weekly Downloads

44,209

Version

0.10.0

License

MIT

Unpacked Size

165 kB

Total Files

25

Last publish

Collaborators

  • gilbsgilbs