auto-i18n-plugin-core 1.1.5 → 1.1.6

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.5",
3
+ "version": "1.1.6",
4
4
  "description": "vite, webpack automatic translation plugin core code.",
5
5
  "keywords": [
6
6
  "i18n",
package/readme-en.md CHANGED
@@ -341,6 +341,7 @@ import '../lang/index.js' // 📍 Must be imported on the first line of the entr
341
341
  | deepScan | boolean | ❌ | `false` | Experimental: Whether to perform deep string scanning |
342
342
  | commonTranslateKey | string | ❌ | `''` | General translation key |
343
343
  | insertFileExtensions | string[] | ❌ | `[]` | List of file extensions to insert translation code into |
344
+ | isClear | boolean | ❌ | `false` | Whether to clear content not in context (clear source language key-value pairs not in context) |
344
345
 
345
346
  ---
346
347
 
@@ -463,6 +464,10 @@ Original authors: wenps, xu-code, Caleb-Xu, Winfans
463
464
 
464
465
  ## Changelog
465
466
 
467
+ ### v1.1.5 (Recommended Version)
468
+
469
+ - Added support for interpolation translation
470
+
466
471
  ### v1.1.4 (Recommended Version)
467
472
 
468
473
  - Fixed template string processing exception in exclude functions
package/readme.md CHANGED
@@ -121,11 +121,11 @@ export default {
121
121
 
122
122
  ```js
123
123
  window.langMap = {
124
- 'en': {
125
- 'zccsau6': 'hello'
124
+ en: {
125
+ zccsau6: 'hello'
126
126
  },
127
127
  'zh-cn': {
128
- 'zccsau6': '你好'
128
+ zccsau6: '你好'
129
129
  }
130
130
  }
131
131
  ```
@@ -331,28 +331,29 @@ import '../lang/index.js' // 📍 必须在入口文件中第一行引入,文
331
331
 
332
332
  ## ⚙️ 配置参数说明
333
333
 
334
- | 参数 | 类型 | 必选 | 默认值 | 描述 |
335
- | -------------------- | ---------- | ---- | ------------------------ | ---------------------------------------------------------- |
336
- | enabled | boolean | ❌ | `true` | 是否触发翻译。 |
337
- | translateType | string | ❌ | `full-auto` | 翻译状态,默认有两种可选`full-auto` 和 `semi-auto` 。 |
338
- | translateKey | string | ✅ | `$t` | 翻译调用函数名称,例如`$t` 表示翻译调用时的函数名 |
339
- | excludedCall | string[] | ❌ | `['$i8n', 'require', …]` | 标记不会被翻译的函数调用列表 |
340
- | excludedPattern | RegExp[] | ❌ | `[/\.\w+$/]` | 用于标记排除不翻译的字符串模式,例如文件路径中的文件后缀 |
341
- | excludedPath | string[] | ❌ | `['node_modules']` | 指定需要排除翻译的文件夹路径,例如默认会跳过`node_modules` |
342
- | includePath | RegExp[] | ❌ | `[/src\//]` | 指定只翻译某些目录路径(白名单),默认为`src` |
343
- | globalPath | string | ❌ | `'./lang'` | 翻译文件配置生成路径 |
344
- | distPath | string | ✅ | `''` | 打包后生成的文件位置路径 |
345
- | distKey | string | ✅ | `'index'` | 打包后生成的翻译主文件名称 |
346
- | namespace | string | ✅ | `lang` | 项目命名空间,用于区分不同项目的翻译配置 |
347
- | originLang | string | ✅ | `'zh-cn'` | 源语言,翻译以此语言为基础 |
348
- | targetLangList | string[] | ✅ | `['en']` | 目标语言列表,支持配置多个语言 |
349
- | buildToDist | boolean | ❌ | `false` | 是否在构建结束后将最新的翻译文件打包到主包中,默认不打包 |
350
- | translator | Translator | ❌ | `GoogleTranslator` | 翻译器实例 |
351
- | translatorOption | object | ❌ | `{}` | 翻译器的配置项,优先级低于`translator` |
352
- | rewriteConfig | boolean | ❌ | `true` | 插件每次运行时是否重写配置文件 |
353
- | deepScan | boolean | ❌ | `false` | 实验性属性,表示是否进行深层扫描字符串 |
354
- | commonTranslateKey | string | ❌ | `''` | 通用翻译key |
355
- | insertFileExtensions | string[] | ❌ | `[]` | 要插入翻译代码的文件扩展名列表 |
334
+ | 参数 | 类型 | 必选 | 默认值 | 描述 |
335
+ | -------------------- | ---------- | ---- | ------------------------ | ------------------------------------------------------------------ |
336
+ | enabled | boolean | ❌ | `true` | 是否触发翻译。 |
337
+ | translateType | string | ❌ | `full-auto` | 翻译状态,默认有两种可选`full-auto` 和 `semi-auto` 。 |
338
+ | translateKey | string | ✅ | `$t` | 翻译调用函数名称,例如`$t` 表示翻译调用时的函数名 |
339
+ | excludedCall | string[] | ❌ | `['$i8n', 'require', …]` | 标记不会被翻译的函数调用列表 |
340
+ | excludedPattern | RegExp[] | ❌ | `[/\.\w+$/]` | 用于标记排除不翻译的字符串模式,例如文件路径中的文件后缀 |
341
+ | excludedPath | string[] | ❌ | `['node_modules']` | 指定需要排除翻译的文件夹路径,例如默认会跳过`node_modules` |
342
+ | includePath | RegExp[] | ❌ | `[/src\//]` | 指定只翻译某些目录路径(白名单),默认为`src` |
343
+ | globalPath | string | ❌ | `'./lang'` | 翻译文件配置生成路径 |
344
+ | distPath | string | ✅ | `''` | 打包后生成的文件位置路径 |
345
+ | distKey | string | ✅ | `'index'` | 打包后生成的翻译主文件名称 |
346
+ | namespace | string | ✅ | `lang` | 项目命名空间,用于区分不同项目的翻译配置 |
347
+ | originLang | string | ✅ | `'zh-cn'` | 源语言,翻译以此语言为基础 |
348
+ | targetLangList | string[] | ✅ | `['en']` | 目标语言列表,支持配置多个语言 |
349
+ | buildToDist | boolean | ❌ | `false` | 是否在构建结束后将最新的翻译文件打包到主包中,默认不打包 |
350
+ | translator | Translator | ❌ | `GoogleTranslator` | 翻译器实例 |
351
+ | translatorOption | object | ❌ | `{}` | 翻译器的配置项,优先级低于`translator` |
352
+ | rewriteConfig | boolean | ❌ | `true` | 插件每次运行时是否重写配置文件 |
353
+ | deepScan | boolean | ❌ | `false` | 实验性属性,表示是否进行深层扫描字符串 |
354
+ | commonTranslateKey | string | ❌ | `''` | 通用翻译key |
355
+ | insertFileExtensions | string[] | ❌ | `[]` | 要插入翻译代码的文件扩展名列表 |
356
+ | isClear | boolean | ❌ | `false` | 是否清除已经不在上下文中的内容(清除项目中不再使用到的源语言键值对) |
356
357
 
357
358
  ---
358
359
 
@@ -477,6 +478,10 @@ const HelloWorld: React.FC<HelloWorldProps> = ({ name = 'World' }) => {
477
478
 
478
479
  ## 更新日志
479
480
 
481
+ ### v1.1.5 (推荐版本)
482
+
483
+ - 支持插值翻译
484
+
480
485
  ### v1.1.4 (推荐版本)
481
486
 
482
487
  - 修复排除函数处理模版字符串异常问题