0.0.4 • Published 3 years ago

webpack-translate v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

webpack-translate

中文 | EN

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:

apitypeDefault valueexplain
translateTypesarraystring"en"Target language abbreviation to be translated, query abbreviation address
suffixstring"js"The suffix of the output language file
pathstring'./src/components/locales/'The address of the output language file relative to the project root directory
sourcestring'../src/components/locales/zh_CN.js'Documents to be translated as source language