A babel plugin to extract i18n message from React components that use react-i18next.
- Support i18next
t
translation function features:- Interpolation
- Formatting
- Plurals,
e.g.
key_plural
, (key_plural_0
is not supported) - Context,
e.g.
key_context
orkey_context_plural
- Support
I18n
Component(render prop) - Support
Trans
Component - Support
translate
HOC - Support
Interpolate
Component
$ npm install -D babel-plugin-react-i18next-parser
This babel plugin only visits ES6 modules which import
react-i18next
.
{
"plugins": [
["react-i18next-parser", {
"defaultNamespace": "defaultNS",
"output": "locales",
"locales": ["en", "fr"]
}]
]
}
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 theoutput
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