https://github.com/koala-framework/trl-webpack-plugin
https://github.com/koala-framework/trl-webpack-plugin
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/koala-framework/trl-webpack-plugin
- Owner: koala-framework
- License: bsd-2-clause
- Created: 2018-10-08T15:30:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-06T11:00:19.000Z (over 3 years ago)
- Last Synced: 2025-03-13T09:14:59.608Z (over 1 year ago)
- Language: TypeScript
- Size: 55.7 KB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trl-webpack-plugin
## Usage
Add Plugin in `webpack.config.js`
const vendorPoFiles = [];
glob.sync(path.resolve(__dirname, '../vendor/*/*/trl/en.po')).forEach(i => {
vendorPoFiles.push(i.replace(/\/en\.po$/, '/[language].po'));
});
const languages = ['de'];
plugins: [
...
new TrlPlugin.default({
uniquePrefix,
languages,
webCodeLanguage: 'de',
translations: {
web: TrlPlugin.loadTranslations(['../trl/[language].po'], languages),
kwf: TrlPlugin.loadTranslations(vendorPoFiles, languages),
}
})
...
]
also add uniquePrefix to define plugin, this is used as prefix for trl functions
new webpack.DefinePlugin({
UNIQUE_PREFIX: JSON.stringify(uniquePrefix ? uniquePrefix + "-" : "")
})