# topbuzz-i18n-webpack-plugin

> Embed localization into your bundle

Latest version **1.1.2** (published 2017-09-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install topbuzz-i18n-webpack-plugin
pnpm add topbuzz-i18n-webpack-plugin
yarn add topbuzz-i18n-webpack-plugin
bun add topbuzz-i18n-webpack-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2017-09-22 |
| First published | 2017-07-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4.3 < 5.0.0 \|\| >= 5.10 |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | dlutwuwei |
| Maintainers | dlutwuwei |

## Links

- npm: https://www.npmjs.com/package/topbuzz-i18n-webpack-plugin
- Repository: https://github.com/dlutwuwei/byted-i18n-webpack-plugin
- Homepage: https://webpack.js.org
- Issues: https://github.com/dlutwuwei/byted-i18n-webpack-plugin/issues
- npm.io page: https://npm.io/package/topbuzz-i18n-webpack-plugin

## Dependencies (4)

- [npm](https://npm.io/package/npm.md) ^5.4.2
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [install](https://npm.io/package/install.md) ^0.10.1
- [glob-to-regexp](https://npm.io/package/glob-to-regexp.md) ^0.3.0

## Recent versions

- 1.1.2 (latest) — 2017-09-22
- 1.1.1 — 2017-09-22
- 1.1.0 — 2017-09-22
- 1.0.16 — 2017-09-13
- 1.0.15 — 2017-09-13
- 1.0.14 — 2017-09-12
- 1.0.13 — 2017-09-10
- 1.0.12 — 2017-09-10
- 1.0.11 — 2017-08-17
- 1.0.10 — 2017-08-16
- 1.0.9 — 2017-08-16
- 1.0.8 — 2017-08-16
- 1.0.7 — 2017-08-11
- 1.0.6 — 2017-08-02
- 1.0.5 — 2017-08-02
- … 5 more at https://npm.io/package/topbuzz-i18n-webpack-plugin/versions

## README

<div align="center">
  <!-- replace with accurate logo e.g from https://worldvectorlogo.com/ -->
  <a href="https://github.com/webpack/webpack">
    <img width="200" height="200" vspace="" hspace="25"
      src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg">
  </a>
  <h1>i18n Plugin</h1>
  <p>i18n (localization) plugin for Webpack.<p>
</div>

## Install

```bash
npm i -D topbuzz-i18n-webpack-plugin
```

## Usage

This plugin will extract all text items for i18n into different files， classify with different js packages. example:

```json
{
  "js/pgc/signin": {
    "PasswordLengthWrong": "パスワードは、6文字以上が必要です",
    "PasswordSpaceWrong": "パスワードの最初と最後にスペースを使うことはできませんが、それ以外の場所には使うことができます",
    "SignMethodEmail": "Emailで無料会員登録する"
  },
  "js/pgc/fault": {
    "ErrorWhoops": "...あれ？...",
    "Error404": "該当するページは見つかりませんでした。",
    "Error500": "エラーが発生しました。再度お試しください。",
    "GoHome": "ホームへ"
  }
}
```
> the package name is the some as webpack entry file

## Options

```
plugins: [
  ...
  new I18nPlugin(languageConfig, optionsObj)
],
```
 - `optionsObj.objectName`: the default value is `__`, you can change it to other function name.
 - `optionsObj.devPath`: the default value is `./`, which defalut path to write files, when start in webpack dev server.
  - `optionsObj.outputPath`: the default value is output path in webpack config, which defalut path to write files.
 - `optionsObj.fileMap`: the default value is `{}`, which will map the text items in different files into the same one.

> objectName is different when you use import(es6 commonjs) or require;
  require i18n file just set modules name, 
##example
```js
  new I18nPlugin(localization, {
    devPath: './output_source',
    objectName: '_localization2.default',
    fileMap: {
      'js/pgc/earning-setting': 'js/pgc/revenue',
      'js/pgc/earning-billing': 'js/pgc/revenue',
      'js/pgc/earning-contract': 'js/pgc/revenue',
      'js/pgc/earning-overview': 'js/pgc/revenue',
      'js/pgc/stats-summary': 'js/pgc/statistics',
      'js/pgc/stats-video-analysis': 'js/pgc/statistics',
      'js/pgc/stats-content-detail': 'js/pgc/statistics'
    }
  })
```
## Maintainers

<table>
  <tbody>
    <tr>
      <td align="center">
        <img width="150" height="150"
        src="https://avatars1.githubusercontent.com/u/3362483?v=3&s=460">
        </br>
        <a href="https://github.com/bebraw">dlutwuwei</a>
      </td>
    </tr>
  <tbody>
</table>

---
_Source: https://npm.io/package/topbuzz-i18n-webpack-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
