gettext catalog (.po files) to embeded localization in your Webpack bundles.Go from
npm install --save-dev webpack-i18n
Originally designed for use with turquoiseowl/i18n but should work with any .po file generation mechanism.
To localize text in your application, surround your strings with [[[ and ]]] markup characters to mark them as translatable:
Make your translations (for example using Poedit) to create the .po files
Add the webpack-i18n plugin to your Webpack config (notice the 'Locales' variable that indicates language/.po location):
const Path = ;const Webpack = ;const I18N = ;var Locales ="en-gb": null // Your application default language"pt-br": "pt-BR/messages.po";moduleexports = Object;
||Directory that should be used to locate your source files with strings for replacement (required)|
||Directory containing the po files as referenced by 'Locales' (required)|
||The delimiter token sequence (default:[[]])|
A 'webpack-i18n-temp' directory beneath you locales directory is created on each Webpack build. There is no need to deploy this directory to production and can be removed, for example using rimraf and the WebpackShellPlugin:
onBuildStart: 'echo "Webpack Start"' onBuildEnd: 'rimraf ./locales/webpack-i18n-temp'