Open Chinese Convert  0.4.3
A project for conversion between Traditional and Simplified Chinese
 All Data Structures Files Functions Variables Groups Pages
demo.js
Go to the documentation of this file.
1 
28 // In your project you should replace './opencc' with 'opencc'
29 var OpenCC = require('./opencc');
30 
31 // Load the default Simplified to Traditional config
32 var opencc = new OpenCC('zhs2zht.ini');
33 
34 // Set conversion mode
35 opencc.setConversionMode(OpenCC.CONVERSION_FAST);
36 
37 // Sync API
38 var converted = opencc.convertSync("汉字");
39 console.log(converted);
40 
41 // Async API
42 opencc.convert("汉字", function (err, converted) {
43  console.log(converted);
44 });