Skip to content

Commit

Permalink
update readme and package name
Browse files Browse the repository at this point in the history
  • Loading branch information
sidke committed Mar 12, 2021
1 parent e8a1c6e commit cd6669d
Show file tree
Hide file tree
Showing 4 changed files with 1,911 additions and 1,751 deletions.
5 changes: 5 additions & 0 deletions .npmrc
@@ -0,0 +1,5 @@
@valimail:registry=https://npm.pkg.github.com

_auth={${NPM_GITHUB_TOKEN}
//npm.pkg.github.com/:_authToken=${NPM_GITHUB_TOKEN}

26 changes: 17 additions & 9 deletions README.md
Expand Up @@ -11,25 +11,30 @@
<h2 align="center">Install</h2>

npm

```bash
npm i -D @matthewbschneider/i18n-webpack-plugin
npm i -D @valimail/i18n-webpack-plugin
```

yarn

```bash
yarn add -D @matthewbschneider/i18n-webpack-plugin
yarn add -D @valimail/i18n-webpack-plugin
```

<h2 align="center">Usage</h2>

This plugin creates bundles with translations baked in. So you can serve the translated bundle to your clients.
Example:

```
console.log(__("Hello World"));
console.log(__("Missing Text"));
```

```
var path = require("path");
var I18nPlugin = require("@matthewbschneider/i18n-webpack-plugin");
var I18nPlugin = require("@valimail/i18n-webpack-plugin");
var languages = {
"en": null,
"de": require("./de.json")
Expand Down Expand Up @@ -58,8 +63,10 @@ module.exports = Object.keys(languages).map(function(language) {
"Hello World": "Hallo Welt"
}
```
current [example](https://github.com/zainulbr/i18n-webpack-plugin/tree/master/example).
original [example](https://github.com/webpack/webpack/tree/v4.0.0/examples/i18n) from un maintenance repo

current [example](https://github.com/zainulbr/i18n-webpack-plugin/tree/master/example).
original [example](https://github.com/webpack/webpack/tree/v4.0.0/examples/i18n) from un maintenance repo

<h2 align="center">Options</h2>

```
Expand All @@ -68,7 +75,8 @@ 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 hidden.
- `optionsObj.nested`: the default value is `false`. If set to `true`, the keys in `languageConfig` can be nested. This option is interpreted only if `languageConfig` isn't a function.

- `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 hidden.
- `optionsObj.nested`: the default value is `false`. If set to `true`, the keys in `languageConfig` can be nested. This option is interpreted only if `languageConfig` isn't a function.

0 comments on commit cd6669d

Please sign in to comment.