Install
npm i -D topbuzz-i18n-webpack-plugin
Usage
This plugin will extract all text items for i18n into different files, classify with different js packages. example:
the package name is the some as webpack entry file
Options
plugins: [
...
new I18nPlugin(languageConfig, optionsObj)
],
optionsObj.objectName
: the default value is__
, you can change it to other function name.optionsObj.devPath
: the default value is./
, which defalut path to write files, when start in webpack dev server.optionsObj.outputPath
: the default value is output path in webpack config, which defalut path to write files.optionsObj.fileMap
: the default value is{}
, which will map the text items in different files into the same one.
objectName is different when you use import(es6 commonjs) or require; require i18n file just set modules name,
example
localization devPath: './output_source' objectName: '_localization2.default' fileMap: 'js/pgc/earning-setting': 'js/pgc/revenue' 'js/pgc/earning-billing': 'js/pgc/revenue' 'js/pgc/earning-contract': 'js/pgc/revenue' 'js/pgc/earning-overview': 'js/pgc/revenue' 'js/pgc/stats-summary': 'js/pgc/statistics' 'js/pgc/stats-video-analysis': 'js/pgc/statistics' 'js/pgc/stats-content-detail': 'js/pgc/statistics'
Maintainers
dlutwuwei |