@yxw007/translate 0.3.1 → 0.4.0

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/README.md CHANGED
@@ -30,12 +30,13 @@ English | [简体中文](./README_zh-CN.md)
30
30
 
31
31
  | Name | Support | Description |
32
32
  | ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
33
- | google | | Commissioned and ready for use |
34
- | azure translate | | Commissioned and ready for use |
35
- | amazon translate | | Commissioned and ready for use |
36
- | baidu | | Commissioned and ready for use |
37
- | deepl | | Commissioned and ready for use |
38
- | openai | | Commissioned and ready for use |
33
+ | google | | Commissioned and ready for use |
34
+ | azure translate | | Commissioned and ready for use |
35
+ | amazon translate | | Commissioned and ready for use |
36
+ | baidu | | Commissioned and ready for use |
37
+ | deepl | | Commissioned and ready for use |
38
+ | openai | | Commissioned and ready for use |
39
+ | tencent | ✔ | Commissioned and ready for use |
39
40
  | yandex | | I have not tuned in as I do not have a bank account supported by the platform (help from those who are in a position to do so is welcome and appreciated) |
40
41
 
41
42
  ## 🚀 Install
@@ -72,7 +73,7 @@ English | [简体中文](./README_zh-CN.md)
72
73
  const { translator, engines } = required("@yxw007/translate")
73
74
  ```
74
75
 
75
- - example
76
+ - Translation examples
76
77
  ```typescript
77
78
  translator.addEngine(engines.google());
78
79
  const res1 = await translator.translate("hello", { from: "en", to: "zh" });
@@ -82,11 +83,22 @@ English | [简体中文](./README_zh-CN.md)
82
83
  console.log(res2);
83
84
  ```
84
85
 
85
- 输出结果
86
+ Output results
86
87
  ```bash
87
88
  ['你好']
88
89
  ["你好", "好的"]
89
90
  ```
91
+ - Language detection examples
92
+ ```typescript
93
+ translator.addEngine(engines.google());
94
+ const res1 = await translator.checkLanguage("hello", { engine:"google" });
95
+ console.log("en");
96
+
97
+ ```
98
+ Output results
99
+ ```bash
100
+ en
101
+ ```
90
102
 
91
103
  ### Browser
92
104
 
package/README_zh-CN.md CHANGED
@@ -32,13 +32,13 @@ Translate 是一个支持多翻译引擎的翻译工具库,它提供了一套
32
32
 
33
33
  | name | 支持 | 描述 |
34
34
  | ---------------- | ---- | -------------------------------------------------------------------------- |
35
- | google | | 已投产,可以正常使用 |
36
- | azure translate | | 已投产,可以正常使用 |
37
- | amazon translate | | 已投产,可以正常使用 |
38
- | baidu | | 已投产,可以正常使用 |
39
- | deepl | | 已投产,可以正常使用 |
40
- | openai | | 已投产,可以正常使用 |
41
- | tencent | | 已投产,可以正常使用 |
35
+ | google | | 已投产,可以正常使用 |
36
+ | azure translate | | 已投产,可以正常使用 |
37
+ | amazon translate | | 已投产,可以正常使用 |
38
+ | baidu | | 已投产,可以正常使用 |
39
+ | deepl | | 已投产,可以正常使用 |
40
+ | openai | | 已投产,可以正常使用 |
41
+ | tencent | | 已投产,可以正常使用 |
42
42
  | yandex | | 由于我没有平台支持的银行账号,所以未调通(欢迎有条件的朋友帮忙调通,感谢) |
43
43
 
44
44
 
@@ -76,7 +76,7 @@ Translate 是一个支持多翻译引擎的翻译工具库,它提供了一套
76
76
  const { translator, engines } = required("@yxw007/translate")
77
77
  ```
78
78
 
79
- - example
79
+ - 翻译例子
80
80
  ```typescript
81
81
  translator.addEngine(engines.google());
82
82
  const res1 = await translator.translate("hello", { from: "en", to: "zh" });
@@ -91,6 +91,17 @@ Translate 是一个支持多翻译引擎的翻译工具库,它提供了一套
91
91
  ['你好']
92
92
  ["你好", "好的"]
93
93
  ```
94
+ - 语言检测例子
95
+ ```typescript
96
+ translator.addEngine(engines.google());
97
+ const res1 = await translator.checkLanguage("hello", { engine:"google" });
98
+ console.log("en");
99
+ ```
100
+
101
+ 输出结果
102
+ ```bash
103
+ en
104
+ ```
94
105
 
95
106
  ### Browser
96
107