sullenor / i18n-webpack-plugin

Embed localization into your bundle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm deps chat

i18n Plugin

i18n (localization) plugin for Webpack.

Install

npm i -D i18n-webpack-plugin

Usage

see webpack/webpack/examples/i18n.

Options

plugins: [
  ...
  new I18nPlugin(languageConfig, optionsObj)
],
  • optionsObj.functionName: the default value is __, you can change it to other function name.
  • optionsObj.failOnMissing: the default value is false, which will show a warning message, if the mapping text cannot be found. If set to true, the message will be an error message.
  • optionsObj.hideMessage: the default value is false, which will show the warning/error message. If set to true, the message will be hide.
  • optionsObj.keyset: the default value is false. Turns on the support of the nested dictionaries. Possible values: boolean, string or a custom function. String value adds the default keyset value and supports [name] and [ext] aliases. Example: __('keyset', 'key') will look for {keyset: {key: 'any value'}} in the localization object.
  • optionsObj.pluralIdentName: chooses the identifier name to be used for the plural keys. Default: count.
  • optionsObj.pluralRule: chooses the rule for the dynamic keys. Supports string aliases. Default: 0.

Development

  • npm run test will run tests
  • npm run autotest will watch lib, test and index.js for changes and retest

Maintainers


Juho Vepsäläinen

Joshua Wiens

Kees Kluskens

Sean Larkin

About

Embed localization into your bundle

License:MIT License


Languages

Language:JavaScript 100.0%