gulp-opencc

A Gulp plugin for convert chinese based on OpenCC.

Usage

This plugin is mainly used for converting Chinese in Gulp tasks defined in the file, gulpfile.js. As it is based on OpenCC, you can use it with passing options, in which you can specify the type of converting:

  • S2t: Simplified Chinese to Traditional Chinese
  • T2s: Traditional Chinese to Simplified Chinese
  • S2tw: Simplified Chinese to Traditional Chinese (Taiwan Standard) Simplified Chinese
  • Tw2s: Traditional Chinese (Taiwan Standard) to Simplified Chinese
  • S2hk: Simplified Chinese to Traditional Chinese (Hong Kong Standard)
  • Hk2s: Traditional Chinese (Hong Kong Standard) to Simplified Chinese
  • S2twp: Simplified Chinese to Traditional Chinese (Taiwan Standard) with Taiwanese idiom and convert into Taiwanese common words
  • Tw2sp: Traditional Chinese (Taiwan Standard) to Simplified Chinese with Mainland Chinese Idiom and converted into common Chinese vocabulary
  • T2tw: Traditional Chinese (OpenCC Standard) to Taiwan Standard
  • T2hk: Traditional Chinese (OpenCC Standard) to Hong Kong (OpenCC Standard)
/** gulpfile.js */
const opencc = require('gulp-opencc');

gulp.task('convert-chinese', () => {
    gulp.src('zh.json')
        .pipe(opencc.default({
            type: 's2tw'
        }))
        .pipe(rename('zh_TW.json'))
        .pipe(gulp.dest('build/'));
});Copy the code

Release History

  • = = = = = = = = = = = = = = = = = = = =1.0.0 Initial release= = = = = = = = = = = = = = = = = = = =
    • 1.0.1 doc: update the document of this project

How to contribute

Have an idea? Found a bug? See how to contribute.

License

MIT © aleen42