Open Chinese Convert
0.4.3
A project for conversion between Traditional and Simplified Chinese
|
00001 00028 // In your project you should replace './opencc' with 'opencc' 00029 var OpenCC = require('./opencc'); 00030 00031 // Load the default Simplified to Traditional config 00032 var opencc = new OpenCC('zhs2zht.ini'); 00033 00034 // Set conversion mode 00035 opencc.setConversionMode(OpenCC.CONVERSION_FAST); 00036 00037 // Sync API 00038 var converted = opencc.convertSync("汉字"); 00039 console.log(converted); 00040 00041 // Async API 00042 opencc.convert("汉字", function (err, converted) { 00043 console.log(converted); 00044 });