0.0.4 • Published 3 years ago
webpack-translate v0.0.4
webpack-translate
Install:
npm install webpack-translate
or
yarn add webpack-translate
Use:
//webpack.config.js
//Plugins property in webpack configuration
import Translate from "webpack-translate";
plugins: [
new Translate({
translateTypes:["en", "ko", "ja","gd"],
suffix:"js",
path:path.resolve(__dirname,"./src/components/locales"),
source:path.resolve(__dirname,"./src/components/locales/zh_CN.js")
}),
//Other wenpack plugins
]
Document:
api | type | Default value | explain |
---|---|---|---|
translateTypes | arraystring | "en" | Target language abbreviation to be translated, query abbreviation address |
suffix | string | "js" | The suffix of the output language file |
path | string | './src/components/locales/' | The address of the output language file relative to the project root directory |
source | string | '../src/components/locales/zh_CN.js' | Documents to be translated as source language |