@yxw007/translate 0.3.2 → 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
@@ -73,7 +73,7 @@ English | [简体中文](./README_zh-CN.md)
73
73
  const { translator, engines } = required("@yxw007/translate")
74
74
  ```
75
75
 
76
- - example
76
+ - Translation examples
77
77
  ```typescript
78
78
  translator.addEngine(engines.google());
79
79
  const res1 = await translator.translate("hello", { from: "en", to: "zh" });
@@ -83,11 +83,22 @@ English | [简体中文](./README_zh-CN.md)
83
83
  console.log(res2);
84
84
  ```
85
85
 
86
- 输出结果
86
+ Output results
87
87
  ```bash
88
88
  ['你好']
89
89
  ["你好", "好的"]
90
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
+ ```
91
102
 
92
103
  ### Browser
93
104
 
package/README_zh-CN.md CHANGED
@@ -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