webpack-contrib / i18n-webpack-plugin

[DEPRECATED] Embed localization into your bundle
MIT License
318 stars 74 forks source link

Using default locale throws 'Missing localization' warnings #80

Open cjayyy opened 5 years ago

cjayyy commented 5 years ago

Bug report

What is the current behavior? If null is passed as localization argument while creating new I18nPlugin instance, warning about missing localizations occurs.

If the current behavior is a bug, please provide the steps to reproduce.

  1. Clone official example.
  2. Initialize npm project with dependencies.
  3. Define npm script: "build": "webpack"
  4. Run npm run build

Build succeeds but throws following warning:

WARNING in ./example.js
Missing localization: Missing Text

webpack.config.js:

const languages = {
  en: null,
  de: require("./de.json")
};

module.exports = Object.keys(languages).map(function(language) {  
  return {
    ...
    plugins: [
      new I18nPlugin(languages[language]) // in case 'language' is 'en' we get 'null'
    ]
    ...
});

What is the expected behavior? If passing null is recommended way how not to translate default language, plugin should behave differently than if try to get missing translation.

Other relevant information: webpack version: 4.29.6 Node.js version: v11.12.0 Operating System: macOS Mojave 10.14.4