auto-i18n-plugin-core 1.1.10 → 1.1.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-i18n-plugin-core",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "description": "vite, webpack automatic translation plugin core code.",
5
5
  "keywords": [
6
6
  "i18n",
@@ -38,6 +38,7 @@
38
38
  "@vitalets/google-translate-api": "^9.2.0",
39
39
  "axios": "^1.6.8",
40
40
  "crypto-js": "^4.2.0",
41
+ "progress": "^2.0.3",
41
42
  "tunnel": "0.0.6"
42
43
  },
43
44
  "devDependencies": {
@@ -50,6 +51,7 @@
50
51
  "@types/babel__generator": "^7.6.8",
51
52
  "@types/crypto-js": "^4.2.2",
52
53
  "@types/node": "^20.3.3",
54
+ "@types/progress": "^2.0.7",
53
55
  "@types/tunnel": "^0.0.7",
54
56
  "babel-plugin-import": "^1.13.6",
55
57
  "rollup": "^4.3.0",
@@ -58,6 +60,9 @@
58
60
  "rollup-plugin-terser": "^7.0.2",
59
61
  "typescript": "^5.1.6"
60
62
  },
63
+ "volta": {
64
+ "extends": "../../package.json"
65
+ },
61
66
  "scripts": {
62
67
  "build": "rollup -c ./rollup.config.ts --configPlugin typescript"
63
68
  }
package/readme-en.md CHANGED
@@ -32,7 +32,7 @@ pnpm run preview // Don't select React, contains too much English text
32
32
  ## 📖 Supported Features
33
33
 
34
34
  - **Frameworks**: All JavaScript-based frontend frameworks (Vue2/3, React, etc.)
35
- - **Build Tools**: Fully compatible with Webpack, Vite, and Rollup 🚀
35
+ - **Build Tools**: Fully compatible with Webpack, Vite, Rsbuild and Rollup 🚀
36
36
  - **Translation Services**: Default support for **Youdao** and **Google** translation, plus custom translators
37
37
 
38
38
  ---
@@ -63,6 +63,14 @@ npm install webpack-auto-i18n-plugin --save-dev
63
63
  yarn add webpack-auto-i18n-plugin --dev
64
64
  ```
65
65
 
66
+ #### **⚡ Rsbuild Project:**
67
+
68
+ ```bash
69
+ npm install rsbuild-auto-i18n-plugin --save-dev
70
+ # 或
71
+ yarn add rsbuild-auto-i18n-plugin --dev
72
+ ```
73
+
66
74
  ---
67
75
 
68
76
  ### 2️⃣ Language Switching 🌐
@@ -191,13 +199,32 @@ module.exports = {
191
199
  }
192
200
  ```
193
201
 
202
+ #### **Rsbuild Configuration Example** (rsbuild.config.js):
203
+
204
+ ````javascript
205
+ const rsbuildPluginsAutoI18n = require('rsbuild-auto-i18n-plugin')
206
+ const { YoudaoTranslator } = require('rsbuild-auto-i18n-plugin')
207
+
208
+ export default defineConfig({
209
+ plugins: [
210
+ pluginReact(),
211
+ rsbuildPluginsAutoI18n({
212
+ targetLangList: ['en'],
213
+ translator: new YoudaoTranslator({
214
+ appId: '4cdb9baea8066fef',
215
+ appKey: 'ONI6AerZnGRyDqr3w7UM730mPuF8mB3j'
216
+ })
217
+ })
218
+ ],
219
+ });
220
+
194
221
  ---
195
222
 
196
223
  ### 4️⃣ Translator Configuration Examples 🛠️
197
224
 
198
225
  The plugin uses Google Translate by default (with a default proxy port of 7890). When the network does not support accessing Google, we recommend using **Youdao Translate** ✨, which has excellent translation quality. Currently, the plugin has built - in support for Google, Youdao, and Baidu translation services. If you need to customize a translator, you can refer to the examples below.
199
226
 
200
- The following examples use `vite` as an example, and `webpack` is similar.
227
+ The following examples use `vite` as an example, and `webpack`、`rsbuild` is similar.
201
228
 
202
229
  #### **Using Google Translate (Default)**
203
230
 
@@ -215,7 +242,7 @@ translator: new GoogleTranslator({
215
242
  }
216
243
  })
217
244
  ...
218
- ```
245
+ ````
219
246
 
220
247
  #### **Using Youdao Translation**
221
248
 
@@ -479,6 +506,10 @@ Since v1.0.5, simply import the generated `index.js` in your entry file - no nee
479
506
 
480
507
  Original authors: wenps, xu-code, Caleb-Xu, Winfans
481
508
 
509
+ ### v1.1.10 (Recommended Version)
510
+
511
+ - Added rsbuild plugin
512
+
482
513
  ## Changelog
483
514
 
484
515
  ### v1.1.9 (Recommended Version)
package/readme.md CHANGED
@@ -34,7 +34,7 @@ tips:有道翻译需要用户自己去申请有道的翻译服务,demo里面
34
34
  ## 📖 支持范围
35
35
 
36
36
  - **框架**: 支持所有编译为 JS 的前端框架(如 Vue2/3 和 React 等)。
37
- - **构建工具**: 完美兼容 Webpack、Vite 和 Rollup 🚀。
37
+ - **构建工具**: 完美兼容 Webpack、Vite、Rsbuild 和 Rollup 🚀。
38
38
  - **翻译服务**: 默认支持 **有道翻译** 和 **谷歌翻译**,并支持自定义翻译器。
39
39
 
40
40
  ---
@@ -65,6 +65,14 @@ npm install webpack-auto-i18n-plugin --save-dev
65
65
  yarn add webpack-auto-i18n-plugin --dev
66
66
  ```
67
67
 
68
+ #### **⚡ Rsbuild 项目:**
69
+
70
+ ```bash
71
+ npm install rsbuild-auto-i18n-plugin --save-dev
72
+ # 或
73
+ yarn add rsbuild-auto-i18n-plugin --dev
74
+ ```
75
+
68
76
  ---
69
77
 
70
78
  ### 2️⃣ 语言切换 🌐
@@ -193,13 +201,33 @@ module.exports = {
193
201
  }
194
202
  ```
195
203
 
204
+ #### **Rsbuild 配置示例** (rsbuild.config.js):
205
+
206
+ ```javascript
207
+ const rsbuildPluginsAutoI18n = require('rsbuild-auto-i18n-plugin')
208
+ const { YoudaoTranslator } = require('rsbuild-auto-i18n-plugin')
209
+
210
+ export default defineConfig({
211
+ plugins: [
212
+ pluginReact(),
213
+ rsbuildPluginsAutoI18n({
214
+ targetLangList: ['en'],
215
+ translator: new YoudaoTranslator({
216
+ appId: '4cdb9baea8066fef',
217
+ appKey: 'ONI6AerZnGRyDqr3w7UM730mPuF8mB3j'
218
+ })
219
+ })
220
+ ]
221
+ })
222
+ ```
223
+
196
224
  ---
197
225
 
198
226
  ### 4️⃣ 翻译器配置示例 🛠️
199
227
 
200
228
  插件默认使用谷歌翻译(默认配置代理端口7890)。在网络不支持访问谷歌的情况下,我们推荐使用 **有道翻译** ✨,其翻译效果优秀。目前插件已经内置谷歌、有道和百度翻译功能。如果需要自定义翻译器,可参考下方的示例。
201
229
 
202
- 以下示例以 `vite` 为例,`webpack` 与其类似。
230
+ 以下示例以 `vite` 为例,`webpack`、`rsbuild` 与其类似。
203
231
 
204
232
  #### **使用谷歌翻译(默认)**
205
233
 
@@ -485,6 +513,10 @@ const HelloWorld: React.FC<HelloWorldProps> = ({ name = 'World' }) => {
485
513
 
486
514
  ## 更新日志
487
515
 
516
+ ### v1.1.10 (推荐版本)
517
+
518
+ - 新增 rsbuild 插件
519
+
488
520
  ### v1.1.9 (推荐版本)
489
521
 
490
522
  - 修复 deepScan 切分字符串不处理换行符等问题