https://github.com/aduryagin/localization-webpack-plugin
Make separate JSON localization files for every chunk
https://github.com/aduryagin/localization-webpack-plugin
chunk json localization plugin separate webpack
Last synced: about 2 months ago
JSON representation
Make separate JSON localization files for every chunk
- Host: GitHub
- URL: https://github.com/aduryagin/localization-webpack-plugin
- Owner: aduryagin
- License: mit
- Created: 2017-10-07T18:56:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-22T07:41:08.000Z (over 8 years ago)
- Last Synced: 2024-04-28T19:20:15.781Z (about 2 years ago)
- Topics: chunk, json, localization, plugin, separate, webpack
- Language: JavaScript
- Size: 63.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# LocalizationWebpackPlugin
Make separate JSON localization files for every chunk
* [See demo](https://warm-savannah-71686.herokuapp.com/)
* [See source of demo](https://github.com/aiduryagin/localization-webpack-plugin-demo)
## Usage
This plugin creates merged JSON files with translations for cunks. One JSON file by one chunk.
To get link to JSON file with translations you need to write in code
```javascript
// 'chunkLocalizationURL: {"chunkName": "warAndPeace", "lang": "en"}' will be replaced by 'warAndPeace.en.json'
const linksToTranslationFiles = {
warAndPeaceEN: 'chunkLocalizationURL: {"chunkName": "warAndPeace", "lang": "en"}',
warAndPeaceRU: 'chunkLocalizationURL: {"chunkName": "warAndPeace", "lang": "ru"}'
};
```
## Options
```javascript
plugins: [
...
new LocalizationWebpackPlugin({
filename: '[chunkname].[lang].json', // Avaible: [chunkname], [hash], [lang]
locales: ['en', 'ru'],
}),
],
```
* `filename`: the default value is `[chunkname].[lang].json` Avaible tags is `[chunkname], [hash], [lang]`
* `locales`: the default value is `['en']`