You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,18 +7,20 @@ OpenCC is a translation library for Traditional and Simplified Chinese with dict
7
7
`node-opencc` is a brand new project that imports OpenCC database and test case, and translates text without installing any native components.
8
8
9
9
## Usage
10
-
You can only access `node-opencc` programmatically. Since dictionaries are huge, they are loaded asynchronously with Promise interface. Thus, all translations on `node-opencc` will return `thenable`.
10
+
11
+
You can only access `node-opencc` programmatically. Since dictionaries are huge, they are loaded asynchronously with Promise interface. Thus, all translations on `node-opencc` will be completed in Promise fashion.
11
12
12
13
For example,
13
14
14
15
```
15
16
const opencc = require('node-opencc');
16
17
17
-
opencc.hongKongToSimplified('滑鼠').then(result => result === '鼠标');
18
-
opencc.traditionalToHongKong('僞').then(result => result === '偽');
18
+
await opencc.hongKongToSimplified('滑鼠') === '鼠标';
19
+
await opencc.traditionalToHongKong('僞') === '偽';
19
20
```
20
21
21
22
`node-opencc` supports multiple type of translations:
23
+
22
24
* Hong Kong to Simplified Chinese (`hongKongToSimplified`)
23
25
* Simplified Chinese to Hong Kong (`simplifiedToHongKong`)
24
26
* Simplified Chinese to Traditional Chinese (`simplifiedToTraditional`)
@@ -37,9 +39,11 @@ Although `node-opencc` tries to redo `OpenCC` with pure JavaScript, there are fe
37
39
* Use `withPhrases` options
38
40
39
41
## Changelog
40
-
* 2016-02-25 (0.0.2): First public release
42
+
43
+
Please refer to change log [here](CHANGELOG.md).
41
44
42
45
## Contribution
46
+
43
47
You may want to head to [OpenCC](https://github.com/byvoid/opencc) for dictionary contribution.
44
48
45
49
Love this extension? [Star](https://github.com/compulim/node-opencc/stargazers) us!
0 commit comments