i18n-jsautotranslate 3.13.12 → 3.15.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.
Files changed (4) hide show
  1. package/LICENSE +21 -201
  2. package/README.md +17 -35
  3. package/index.js +585 -284
  4. package/package.json +1 -1
package/LICENSE CHANGED
@@ -1,201 +1,21 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 xnx3
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -8,12 +8,12 @@
8
8
  </h4>
9
9
  <h4 align="center">
10
10
  简体中文 |
11
- <a href="http://translate.zvo.cn/4019.html?language=chinese_traditional">繁體中文</a> |
12
- <a href="http://translate.zvo.cn/4019.html?language=english">English</a> |
13
- <a href="http://translate.zvo.cn/4019.html?language=japanese">しろうと</a> |
14
- <a href="http://translate.zvo.cn/4019.html?language=russian">Русский язык</a> |
15
- <a href="http://translate.zvo.cn/4019.html?language=german">deutsch</a> |
16
- <a href="http://translate.zvo.cn/4019.html?language=french">Français</a>
11
+ <a href="http://translate.zvo.cn/index.html?language=chinese_traditional">繁體中文</a> |
12
+ <a href="http://translate.zvo.cn/index.html?language=english">English</a> |
13
+ <a href="http://translate.zvo.cn/index.html?language=japanese">しろうと</a> |
14
+ <a href="http://translate.zvo.cn/index.html?language=russian">Русский язык</a> |
15
+ <a href="http://translate.zvo.cn/index.html?language=german">deutsch</a> |
16
+ <a href="http://translate.zvo.cn/index.html?language=french">Français</a>
17
17
  </h4>
18
18
 
19
19
  # 特性说明
@@ -22,9 +22,9 @@
22
22
  * **极其灵活扩展。** 您可指定它[只翻译某些指定区域的元素](http://translate.zvo.cn/4063.html)、[自定义切换语言方式及美化](http://translate.zvo.cn/4056.html)、[某些id、class、tag不被翻译](https://translate.zvo.cn/4061.html)、[自定义翻译术语](https://translate.zvo.cn/4070.html) ...... 只要你想的,它都能做到。做不到的,你找我我来让它做到!
23
23
  * **自动切换语种。** [自动根据用户的语言喜好及所在的国家切换到这个语种进行浏览](http://translate.zvo.cn/4065.html)
24
24
  * **极速翻译能力。** [内置三层缓存、预加载机制,毫秒级瞬间翻译的能力。它并不是你理解的大模型蜗牛似的逐个字往外出的那样](http://translate.zvo.cn/4026.html)
25
- * [**永久开源免费。** 采用Apache-2.0开源协议,您可永久免费使用](https://github.com/xnx3/translate/blob/master/LICENSE)。[另外你可以用它来做某些系统的三方插件直接售卖盈利](http://translate.zvo.cn/4036.html)、或者你是建站公司用它来做为一项高级功能盈利,我们都是完全认可并支持的,并不需要给我们任何费用!
25
+ * [**永久开源免费。** 采用MIT开源协议,您可永久免费使用](https://github.com/xnx3/translate/blob/master/LICENSE)。[另外你可以用它来做某些系统的三方插件直接售卖盈利](http://translate.zvo.cn/4036.html)、或者你是建站公司用它来做为一项高级功能盈利,我们都是完全认可并支持的,并不需要给我们任何费用!
26
26
  * **搜索引擎友好。** 完全不影响你本身网站搜索引擎的收录。爬虫所爬取的网页源代码,它不会对其进行任何改动,你可完全放心。[另外我们还有高级版本让你翻译之后的页面也能被搜索引擎收录](http://translate.zvo.cn/236896.html)
27
- * **支持私有部署。** [在某些政府机关及大集团内部项目中,对数据隐私及安全保密有强要求场景、或者完全不通外网的场景,可以自行私有部署翻译API服务](http://translate.zvo.cn/4052.html)
27
+ * **支持私有部署。** [在某些政府机关及大集团内部项目中,对数据隐私及安全保密有强要求场景、或者完全不通外网的场景,可以自行私有部署翻译API服务](http://translate.zvo.cn/391129.html)
28
28
  * **全球网络节点**。美洲、亚洲、欧洲 ... 都有网络节点,它能自动适配最快节点,每间隔1分钟自动获取一次延迟最小的节点进行接入使用,使全球范围使用都可高效稳定。
29
29
  * **HTML整体翻译**。[提供开放API接口,传入html文件(html源代码)及要翻译为的语言即可拿到翻译后的html源码。完美支持识别各种复杂及不规范html代码,
30
30
  支持翻译前的微调,比如不翻译某个区域、图片翻译、js语法操作html文件中的元素进行增删改等。](https://translate.zvo.cn/4022.html)
@@ -65,6 +65,7 @@
65
65
  * **[增加对指定标签的属性进行翻译](http://translate.zvo.cn/231504.html)**,可以增加对指定html标签的某个或某些属性进行翻译。比如element、vue 等框架,有些自定义的标签属性,想让其也正常翻译
66
66
  * **[本地语种也进行强制翻译](http://translate.zvo.cn/289574.html)**,切换为中文时,即使本地语种设置的是中文,网页中只要不是中文的元素,都会被翻译为要显示的语种
67
67
  * **[自定义通过翻译API进行时的监听事件](http://translate.zvo.cn/379207.html)**,当通过翻译API进行文本翻译时的整个过程进行监听,做一些自定义处理,比如翻译API请求前要做些什么、请求翻译API完成并在DOM渲染完毕后触发些什么。
68
+ * **[启用翻译中的遮罩层](http://translate.zvo.cn/407105.html)**,在进行通过翻译API进行翻译时,相关元素上面显示一层加载中的动画效果,让用户知道这段文本正在进行处理中
68
69
 
69
70
  # 在线体验
70
71
  http://res.zvo.cn/translate/demo.html
@@ -139,6 +140,8 @@ translate.execute();//进行翻译
139
140
 
140
141
  [详细使用说明](https://translate.zvo.cn/4041.html) | [Vue2 中使用 translate.js 在线 Demo](https://lruihao.github.io/vue-el-demo/#/translate-js)
141
142
 
143
+
144
+
142
145
  # 谁在使用
143
146
 
144
147
  开源项目:
@@ -186,20 +189,6 @@ tcdn是translate.js 的高级版本,它的能力是让你原本的网站可以
186
189
  ### 服务器部署
187
190
  需要一个干净的服务器,不依赖任何环境的情况下进行的部署,需要你懂点linux命令行, 部署方式参考: [https://translate.zvo.cn/236899.html](https://translate.zvo.cn/236899.html)
188
191
 
189
- # 开源仓库目录结构
190
- * **deploy** - 部署相关,比如shell文件、sql数据库文件等
191
- * **doc** - 一些文档相关
192
- * **translate.admin** - [TCDN的管理后台,PC端的WEB管理后台,可以通过此添加翻译的源站、绑定别的域名及设置域名所展现的语言、针对翻译的过程中支持使用JavaScript脚本自定义调优,比如设置哪些不被翻译、设置一些自定义术语库等。并且提供了CDN的基本能力,比如根据URL清除缓存、根据域名清除缓存等。](http://translate.zvo.cn/41163.html)
193
- * **translate.api** - [翻译开放接口,他不同于 translate service 的点在于 translate service 开放的是文本翻译接口,而 translate api 开放的是html翻译接口,你传入一个网页的url,它返回的是这个网页被翻译之后源码(此特性非常适合对不同语言上SEO优化)](http://translate.zvo.cn/41165.html)
194
- * **translate.core** - [TCDN的公共模块,无具体功能]
195
- * **translate.js** - [提供了针对html的分析及翻译能力。在现有的html页面中引入一个js可以快速实现当前页面语种切换的能力。且适配面非常广泛!只要是html的,它都能适配(包含VUE、uniapp等),在很多情况下,它是单独进行使用的,在你的老网站中加入几行js代码即可植入,使其快速具备语种切换能力。](http://translate.zvo.cn/4019.html)
196
- * **translate.service** - [翻译服务,它对接了 小牛翻译、google翻译、华为云翻译 等翻译服务,如果需要别的翻译服务或者局域网无网环境下部署,也可以快速对接自有翻译接口。它的作用是开放文本翻译接口,将 translate.js中 需要翻译的文本传入,然后将翻译之后的文本输出。提供批量翻译能力(一个翻译请求可以包含数千段需要翻译的文本)。
197
- 并且它开放翻译接口,不止适用于 translate.js,你可以用在任何需要对接翻译接口的地方进行使用。其开放接口,说明参见:http://api.translate.zvo.cn/doc/translate.json.html](http://translate.zvo.cn/41164.html)
198
- * **translate.user** - [TCDN 对用户开放访问的,当在 translate admin 中添加源站,并绑定域名指向某个语种后,用户访问这个域名时,便会访问进此,有此进行网页翻译的调度、缓存的处理等。当用户第一次访问某个页面时,缓存中没有,会通过 translate api 从源站获取网页源码,然后进行翻译,将翻译之后的html源码在此进行缓存,然后返回给用户浏览器进行显示。 当有用户在此访问这个页面时,便会直接从缓存中取。](http://translate.zvo.cn/41166.html)
199
-
200
- 其中每一个都是可以作为一个单独的项目进行使用,比如 translate.service 便可以作为文本翻译接口进行使用、translate.api 可以作为html文件翻译接口使用、translate.js 可以作为网页端直接嵌入几行js代码就能快速翻译来使用。
201
- 另外像是如果你网站已经配置好,不需要在使用 translate.admin 管理后台,你可以将此停掉,从而降低服务器资源的占用。
202
-
203
192
 
204
193
  # 项目由来
205
194
  2021年,translate 翻译服务项目创建,最初为简化Google网页翻译JS进行了封装,可以更简单进行使用,但是因为扩展极其有限,文档也没那么好,于是开始了重构。
@@ -259,22 +248,15 @@ tcdn是translate.js 的高级版本,它的能力是让你原本的网站可以
259
248
  如果您在使用过程中遇到任何异常情况,请详细说一下您遇到的问题。如果可以,请写下您的网站,以便我们可以更全面地测试,以便快速找到问题所在
260
249
  作者微信:xnx3com(使用交流可加QQ群进行,我看微信很不及时)
261
250
  Telegram : [untran](https://t.me/untran)
262
- 交流QQ群:181781514 (已满)
263
- 交流QQ群:641047127 (已满)
264
- 交流QQ群:240567964 (快满)
251
+ 交流QQ群:181781514(已满)
252
+ 交流QQ群:641047127(已满)
253
+ 交流QQ群:240567964(已满)
265
254
  交流QQ群:1034085260
255
+ 交流QQ群:1017938586
256
+ 作者邮箱:921153866@qq.com
266
257
  微信公众号:wangmarket
267
258
  github: [https://github.com/xnx3/translate](https://github.com/xnx3/translate)
268
- gitee: [https://gitee.com/mail_osc/translate](https://gitee.com/mail_osc/translate)
269
-
270
-
271
- # 寻找合作
272
- 寻找合作伙伴探讨盈利方式 - 以下全自有技术研发
273
-
274
- 1. html源码翻译开放API http://doc.zvo.cn/tcdn/api/doc.html
275
- 2. TCDN全自动网站源码级翻译,适合翻译后语种分别分配域名、进行SEO优化 http://translate.zvo.cn/236896.html
276
-
277
- 联系:17076012262(微信同号) 我们是纯技术团队,欢迎联系,希望能跟你探讨合作盈利商机,我们专心技术,您来拓展商务销售
259
+ gitee: [https://gitee.com/mail_osc/translate](https://gitee.com/mail_osc/translate)
278
260
 
279
261
 
280
262
  # 商业化声明