Skip to content
This repository has been archived by the owner on Mar 6, 2019. It is now read-only.

A babel plugin to extract i18n message from React components that use react-i18next.

License

Notifications You must be signed in to change notification settings

skyuplam/babel-plugin-react-i18next-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-react-i18next-parser

A babel plugin to extract i18n message from React components that use react-i18next.

Features

Installation

$ npm install -D babel-plugin-react-i18next-parser

Usage

This babel plugin only visits ES6 modules which import react-i18next.

Via .babelrc

.babelrc

{
  "plugins": [
    ["react-i18next-parser", {
      "defaultNamespace": "defaultNS",
      "output": "locales",
      "locales": ["en", "fr"]
    }]
  ]
}

Options

  • defaultNamespace: string, required, the default namespace in your i18next options, default: translation
  • output: string, the output folder name. The folder will be created under the root of project directory, default: locales
  • locales: array, required, the output locale folders created under the output directory, default: ['en']
  • namespaceSeparator, string, the symbol to separate the namespace and key, default: ':'
  • moduleSourceName, string, the module source name to look for, default: react-i18next

Inspirations