switch-chinese 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -3
- package/readme.md +19 -18
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "switch-chinese",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Convert between simplified and traditional Chinese characters",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "Convert between simplified and traditional Chinese characters. 切換正體/簡體中文,超輕量級,支援自訂詞彙與「一簡多繁」轉換,無任何相依性。",
|
|
5
5
|
"main": "stcasc.lib.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
"繁体中文",
|
|
18
18
|
"簡體中文",
|
|
19
19
|
"繁體中文",
|
|
20
|
-
"正體中文"
|
|
20
|
+
"正體中文",
|
|
21
|
+
"简繁切换",
|
|
22
|
+
"簡繁切換",
|
|
23
|
+
"繁简转换",
|
|
24
|
+
"繁簡轉換"
|
|
21
25
|
],
|
|
22
26
|
"author": "Hoothin",
|
|
23
27
|
"license": "MIT",
|
package/readme.md
CHANGED
|
@@ -4,30 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/switch-chinese) [](https://www.npmjs.com/package/switch-chinese)
|
|
6
6
|
|
|
7
|
+
Install
|
|
8
|
+
---
|
|
9
|
+
``` shell
|
|
10
|
+
npm install switch-chinese
|
|
11
|
+
```
|
|
7
12
|
|
|
8
13
|
演示
|
|
9
14
|
---
|
|
10
15
|
+ 基礎用法
|
|
11
16
|
|
|
12
17
|
``` js
|
|
13
|
-
import Stcasc from './stcasc.lib.js';
|
|
14
18
|
const stcasc = Stcasc();
|
|
15
|
-
const sc = "香烟 香烟袅袅 烟雾里 里长面子 吃干面 干 把考卷发回来 卷发 知识产权";
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
const sc = "简繁转换 繁简切换 香烟 香烟袅袅 烟雾里 里长面子 吃干面 干 把考卷发回来 卷发 知识产权";
|
|
20
|
+
const tc = stcasc.traditionalized(sc);
|
|
21
|
+
console.log(tc);
|
|
22
|
+
//簡繁轉換 繁簡切換 香菸 香煙裊裊 煙霧裡 里長面子 吃乾麵 幹 把考卷發回來 捲髮 智慧財產權
|
|
18
23
|
```
|
|
19
24
|
|
|
20
|
-
``` js
|
|
21
|
-
const stcasc = Stcasc({}, {}, true);
|
|
22
|
-
const sc = "知识产权";
|
|
23
|
-
console.log(stcasc.traditionalized(sc));
|
|
24
|
-
//知識産權
|
|
25
|
-
```
|
|
26
25
|
|
|
27
|
-
+
|
|
26
|
+
+ Import
|
|
28
27
|
|
|
29
|
-
```
|
|
30
|
-
npm install switch-chinese
|
|
28
|
+
``` shell
|
|
31
29
|
import Stcasc from 'switch-chinese';
|
|
32
30
|
```
|
|
33
31
|
|
|
@@ -41,11 +39,11 @@ stcasc.traditionalized("简体中文");
|
|
|
41
39
|
+ 轉簡體中文
|
|
42
40
|
|
|
43
41
|
``` js
|
|
44
|
-
stcasc.simplized("
|
|
45
|
-
|
|
42
|
+
stcasc.simplized("繁體中文");
|
|
43
|
+
//繁体中文
|
|
46
44
|
```
|
|
47
45
|
|
|
48
|
-
+
|
|
46
|
+
+ 添加快取,避免重複生成字典
|
|
49
47
|
|
|
50
48
|
``` js
|
|
51
49
|
let cache = loadCacheAtYourWay();
|
|
@@ -62,11 +60,14 @@ const custom = {
|
|
|
62
60
|
"转换": "轉檔",
|
|
63
61
|
"软件": "軟體"
|
|
64
62
|
};
|
|
65
|
-
|
|
63
|
+
const stcasc = Stcasc(cache, custom);
|
|
66
64
|
```
|
|
67
65
|
|
|
68
66
|
+ 禁用用語轉換
|
|
69
67
|
|
|
70
68
|
``` js
|
|
71
|
-
|
|
69
|
+
const stcasc = Stcasc({}, {}, true);
|
|
70
|
+
const sc = "知识产权";
|
|
71
|
+
console.log(stcasc.traditionalized(sc));
|
|
72
|
+
//知識産權
|
|
72
73
|
```
|