https://github.com/compulim/opencc-loader
Webpack loader for converting Traditional Chinese into Simplified Chinese (and vice versa).
https://github.com/compulim/opencc-loader
Last synced: 4 days ago
JSON representation
Webpack loader for converting Traditional Chinese into Simplified Chinese (and vice versa).
- Host: GitHub
- URL: https://github.com/compulim/opencc-loader
- Owner: compulim
- License: mit
- Created: 2017-08-31T03:26:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-02T22:51:35.000Z (over 7 years ago)
- Last Synced: 2025-02-17T13:11:25.988Z (3 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
opencc-loader
=============[](https://badge.fury.io/js/opencc-loader)
Webpack loader for converting Traditional Chinese into Simplified Chinese (and vice versa) using [Open Chinese Convert](https://github.com/byvoid/opencc) and [`node-opencc`](https://github.com/compulim/node-opencc) package.
Usage
-----In your `webpack.config.js`, add `opencc-loader` as one of the loader for your JavaScript/JSX/TypeScript or text files. The following example translate from Traditional Chinese (Hong Kong) to Simplified Chinese.
```js
{
test : /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loaders: [
'react-hot-loader',
'babel-loader?presets[]=react&presets[]=es2015&presets[]=es2016&presets[]=es2017',
'opencc-loader?translation=hongKongToSimplified'
]
}
```Supported translation
---------------------| Type | Translation |
| ------------------------------- | ----------------------------------------- |
| `hongKongToSimplified` | Hong Kong to Simplified Chinese |
| `simplifiedToHongKong` | Simplified Chinese to Hong Kong |
| `simplifiedToTraditional` | Simplified Chinese to Traditional Chinese |
| `simplifiedToTaiwan` | Simplified Chinese to Taiwan |
| `simplifiedToTaiwanWithPhrases` | Simplified Chinese to Taiwan with phrases |
| `traditionalToHongKong` | Traditional Chinese to Hong Kong |
| `traditionalToSimplified` | Traditional Chinese to Simplified Chinese |
| `traditionalToTaiwan` | Traditional Chinese to Taiwan |
| `taiwanToSimplified` | Taiwan to Simplified Chinese |
| `taiwanToSimplifiedWithPhrases` | Taiwan to Simplified Chinese with phrases |For details of the translation, please refer to [`node-opencc`](https://github.com/compulim/node-opencc).
Contributions
-------------Like us? [Star us](https://github.com/compulim/opencc-loader/stargazers).
Want to make it better? Fork us and send us a [pull request](https://github.com/compulim/opencc-loader/pulls) or file an [issue](https://github.com/compulim/opencc-loader/issues).