Open dinfyru opened 7 years ago
~~You should load necessary javascript bundle for the chosen language. The simple way is to make a html page for each locale and redirect to the necessary one via link.~~
You should create a configuration for each language, for example:
module.exports = [
{
...
plugins: [
new I18nPlugin(languages.en)
],
output: {
...
filename: 'en.js'
}
},
{
...
plugins: [
new I18nPlugin(languages.ru)
],
output: {
...
filename: 'ru.js'
}
}
];
It will produce a javascript bundles with corresponding translations (two for your example). And you'll have to load the necessary one depending on the chosen language.
There is a small example here: https://github.com/webpack/webpack/blob/master/examples/i18n/webpack.config.js
How can i change default lang in app (setLocale or other)? webpack.config.js
app.js
__('login_form.emailField')
en.js
ru.js