vite-auto-i18n-plugin 1.1.12 → 1.1.14
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 +2 -2
- package/readme-en.md +24 -3
- package/readme.md +22 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-auto-i18n-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"description": "Vite automatic translation plugin compatible with Rollup",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@babel/core": "^7.23.2",
|
|
34
34
|
"@babel/preset-env": "^7.23.2",
|
|
35
35
|
"@babel/preset-typescript": "^7.23.2",
|
|
36
|
-
"auto-i18n-plugin-core": "1.1.
|
|
36
|
+
"auto-i18n-plugin-core": "1.1.14"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@babel/types": "^7.23.0",
|
package/readme-en.md
CHANGED
|
@@ -55,7 +55,7 @@ npm install vite-auto-i18n-plugin --save-dev
|
|
|
55
55
|
yarn add vite-auto-i18n-plugin --dev
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
#### **🛠️ Webpack Project:**
|
|
58
|
+
#### **🛠️ Webpack Project (Compatible with Webpack 4/5):**
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
61
|
npm install webpack-auto-i18n-plugin --save-dev
|
|
@@ -386,6 +386,7 @@ import '../lang/index.js' // 📍 Must be imported on the first line of the entr
|
|
|
386
386
|
| insertFileExtensions | string[] | ❌ | `[]` | List of file extensions to insert translation code into |
|
|
387
387
|
| isClear | boolean | ❌ | `false` | Whether to clear content not in context (clear source language key-value pairs not in context), only supported in build mode |
|
|
388
388
|
| isClearSpace | boolean | ❌ | `false` | Whether to remove whitespace from both ends of source strings, whitespace is preserved by default |
|
|
389
|
+
| languageJsonMode | string | ❌ | `'merged'` | Language JSON storage mode: `'merged'` (all languages in one index.json) or `'split'` (separate json file for each language) |
|
|
389
390
|
|
|
390
391
|
---
|
|
391
392
|
|
|
@@ -474,6 +475,12 @@ To update translations, simply modify `index.json`.
|
|
|
474
475
|
- `index.json` in `globalPath` is the core translation file
|
|
475
476
|
- Changes take effect immediately after saving
|
|
476
477
|
|
|
478
|
+
4. **JSON Storage Mode Switching** ⚠️
|
|
479
|
+
|
|
480
|
+
- When switching `languageJsonMode` config (`merged` ↔ `split`), it's **strongly recommended** to set `rewriteConfig` to `true`.
|
|
481
|
+
- This ensures the plugin regenerates config files and avoids errors caused by conflicts between old and new mode files.
|
|
482
|
+
- After switching modes, the plugin will automatically handle JSON file merging or splitting.
|
|
483
|
+
|
|
477
484
|
---
|
|
478
485
|
|
|
479
486
|
## 📦 User Group
|
|
@@ -506,12 +513,26 @@ Since v1.0.5, simply import the generated `index.js` in your entry file - no nee
|
|
|
506
513
|
|
|
507
514
|
Original authors: wenps, xu-code, Caleb-Xu, Winfans
|
|
508
515
|
|
|
516
|
+
## Changelog
|
|
517
|
+
|
|
518
|
+
### v1.1.13 (Recommended Version)
|
|
519
|
+
|
|
520
|
+
- Added JSON split configuration
|
|
521
|
+
|
|
522
|
+
### v1.1.12 (Recommended Version)
|
|
523
|
+
|
|
524
|
+
- Optimized console output format
|
|
525
|
+
|
|
526
|
+
### v1.1.11 (Recommended Version)
|
|
527
|
+
|
|
528
|
+
- Optimized console output format, reduced redundant printing
|
|
529
|
+
- Added translation progress bar display
|
|
530
|
+
- Support for Webpack 4
|
|
531
|
+
|
|
509
532
|
### v1.1.10 (Recommended Version)
|
|
510
533
|
|
|
511
534
|
- Added rsbuild plugin
|
|
512
535
|
|
|
513
|
-
## Changelog
|
|
514
|
-
|
|
515
536
|
### v1.1.9 (Recommended Version)
|
|
516
537
|
|
|
517
538
|
- Fixed issue where deepScan string splitting wasn't handling line breaks and other special characters
|
package/readme.md
CHANGED
|
@@ -57,7 +57,7 @@ npm install vite-auto-i18n-plugin --save-dev
|
|
|
57
57
|
yarn add vite-auto-i18n-plugin --dev
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
#### **🛠️ Webpack
|
|
60
|
+
#### **🛠️ Webpack 项目 (兼容 Webpack 4/5):**
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
63
|
npm install webpack-auto-i18n-plugin --save-dev
|
|
@@ -389,6 +389,7 @@ import '../lang/index.js' // 📍 必须在入口文件中第一行引入,文
|
|
|
389
389
|
| insertFileExtensions | string[] | ❌ | `[]` | 要插入翻译代码的文件扩展名列表 |
|
|
390
390
|
| isClear | boolean | ❌ | `false` | 是否清除已经不在上下文中的内容(清除项目中不再使用到的源语言键值对),仅仅支持打包模式下使用 |
|
|
391
391
|
| isClearSpace | boolean | ❌ | `false` | 是否清除源字符串中左右两边的空格,默认会保留空格 |
|
|
392
|
+
| languageJsonMode | string | ❌ | `'merged'` | 语言JSON存储模式:`'merged'`(所有语言合并到一个index.json)或 `'split'`(每种语言单独一个json文件) |
|
|
392
393
|
|
|
393
394
|
---
|
|
394
395
|
|
|
@@ -479,6 +480,12 @@ const HelloWorld: React.FC<HelloWorldProps> = ({ name = 'World' }) => {
|
|
|
479
480
|
- `globalPath` 目录中的 `index.json` 是核心翻译文件。
|
|
480
481
|
- 修改并保存后,您的翻译内容将立即更新。
|
|
481
482
|
|
|
483
|
+
4. **JSON 存储模式切换** ⚠️
|
|
484
|
+
|
|
485
|
+
- 当切换 `languageJsonMode` 配置(`merged` ↔ `split`)时,**强烈建议**将 `rewriteConfig` 设置为 `true`。
|
|
486
|
+
- 这样可以确保插件重新生成配置文件,避免新旧模式文件冲突导致的错误。
|
|
487
|
+
- 切换模式后,插件会自动处理 JSON 文件的合并或拆分。
|
|
488
|
+
|
|
482
489
|
---
|
|
483
490
|
|
|
484
491
|
## 📦 用户群
|
|
@@ -513,6 +520,20 @@ const HelloWorld: React.FC<HelloWorldProps> = ({ name = 'World' }) => {
|
|
|
513
520
|
|
|
514
521
|
## 更新日志
|
|
515
522
|
|
|
523
|
+
### v1.1.13 (推荐版本)
|
|
524
|
+
|
|
525
|
+
- 新增json拆分配置
|
|
526
|
+
|
|
527
|
+
### v1.1.12 (推荐版本)
|
|
528
|
+
|
|
529
|
+
- 优化控制台输出格式
|
|
530
|
+
|
|
531
|
+
### v1.1.11 (推荐版本)
|
|
532
|
+
|
|
533
|
+
- 优化控制台输出格式,减少冗余打印
|
|
534
|
+
- 新增翻译进度条显示
|
|
535
|
+
- 支持 Webpack 4
|
|
536
|
+
|
|
516
537
|
### v1.1.10 (推荐版本)
|
|
517
538
|
|
|
518
539
|
- 新增 rsbuild 插件
|