a module for tanslating Chinese(汉字) to pinyin
Pull request Compare This branch is 22 commits behind sofish:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
.travis.yml
LICENSE
han.js
package.json
readme.md

readme.md

Han(汉)

Build Status

a module for tanslating Chinese(汉字) to pinyin.

Installation

$ npm install han

Usage

Use the letter method to translate Chinese in to english letter:

var han = require('han');

han.letter('中文') // zhong wen
han.letter('中文', '-') // zhong-wen
han.letter('中文', function(err, result){
  console.log(result) // zhong wen
})

The letter method has 3 params by default, the can all be optional, it depends on you(^^). follow the message below, you can also find it at lib/translate.js:

/* @param `chinese` {String} Chinese word
 * @param [optional] `separator` {String} separator for the letters
 * @param [optional] `callback(err, result)` {Function} if a callback is specified,
 *   the program will use an async way to do the translation 
 */

License

Licensed under MIT.

Contributers:

Specail thank to fayland for providing the unicode table of Chinese.