@intlayer/docs 8.2.4 → 8.3.0-canary.1

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 (135) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -0
  2. package/dist/cjs/blog.cjs.map +1 -1
  3. package/dist/cjs/common.cjs +1 -1
  4. package/dist/cjs/common.cjs.map +1 -1
  5. package/dist/cjs/doc.cjs.map +1 -1
  6. package/dist/cjs/frequentQuestions.cjs.map +1 -1
  7. package/dist/cjs/generated/blog.entry.cjs +1 -1
  8. package/dist/cjs/generated/blog.entry.cjs.map +1 -1
  9. package/dist/cjs/generated/docs.entry.cjs +1 -1
  10. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  11. package/dist/cjs/generated/frequentQuestions.entry.cjs +1 -1
  12. package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
  13. package/dist/cjs/generated/legal.entry.cjs +1 -1
  14. package/dist/cjs/generated/legal.entry.cjs.map +1 -1
  15. package/dist/cjs/legal.cjs.map +1 -1
  16. package/dist/esm/blog.mjs.map +1 -1
  17. package/dist/esm/common.mjs +1 -1
  18. package/dist/esm/common.mjs.map +1 -1
  19. package/dist/esm/doc.mjs.map +1 -1
  20. package/dist/esm/frequentQuestions.mjs.map +1 -1
  21. package/dist/esm/generated/blog.entry.mjs.map +1 -1
  22. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  23. package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
  24. package/dist/esm/generated/legal.entry.mjs.map +1 -1
  25. package/dist/esm/legal.mjs.map +1 -1
  26. package/dist/types/blog.d.ts +1 -1
  27. package/dist/types/common.d.ts +1 -1
  28. package/dist/types/common.d.ts.map +1 -1
  29. package/dist/types/doc.d.ts +1 -1
  30. package/dist/types/frequentQuestions.d.ts +1 -1
  31. package/dist/types/generated/blog.entry.d.ts +1 -1
  32. package/dist/types/generated/docs.entry.d.ts +1 -1
  33. package/dist/types/generated/frequentQuestions.entry.d.ts +1 -1
  34. package/dist/types/generated/legal.entry.d.ts +1 -1
  35. package/dist/types/legal.d.ts +1 -1
  36. package/docs/ar/compiler.md +73 -8
  37. package/docs/ar/configuration.md +74 -27
  38. package/docs/ar/intlayer_with_nextjs_compiler.md +13 -5
  39. package/docs/ar/intlayer_with_tanstack.md +22 -1
  40. package/docs/ar/intlayer_with_vite+react_compiler.md +13 -5
  41. package/docs/de/compiler.md +74 -9
  42. package/docs/de/configuration.md +61 -22
  43. package/docs/de/intlayer_with_nextjs_compiler.md +12 -4
  44. package/docs/de/intlayer_with_tanstack.md +22 -1
  45. package/docs/de/intlayer_with_vite+react_compiler.md +12 -4
  46. package/docs/en/compiler.md +79 -1
  47. package/docs/en/configuration.md +50 -9
  48. package/docs/en/intlayer_with_nextjs_compiler.md +9 -1
  49. package/docs/en/intlayer_with_tanstack.md +23 -2
  50. package/docs/en/intlayer_with_vite+react_compiler.md +9 -1
  51. package/docs/en-GB/compiler.md +72 -6
  52. package/docs/en-GB/configuration.md +50 -10
  53. package/docs/en-GB/intlayer_with_nextjs_compiler.md +22 -3
  54. package/docs/en-GB/intlayer_with_tanstack.md +22 -1
  55. package/docs/en-GB/intlayer_with_vite+react_compiler.md +22 -3
  56. package/docs/es/compiler.md +71 -6
  57. package/docs/es/configuration.md +65 -26
  58. package/docs/es/intlayer_with_nextjs_compiler.md +9 -1
  59. package/docs/es/intlayer_with_tanstack.md +22 -1
  60. package/docs/es/intlayer_with_vite+react_compiler.md +9 -1
  61. package/docs/fr/compiler.md +69 -4
  62. package/docs/fr/configuration.md +62 -23
  63. package/docs/fr/intlayer_with_nextjs_compiler.md +9 -1
  64. package/docs/fr/intlayer_with_tanstack.md +22 -1
  65. package/docs/fr/intlayer_with_vite+react_compiler.md +9 -1
  66. package/docs/hi/compiler.md +74 -9
  67. package/docs/hi/configuration.md +70 -23
  68. package/docs/hi/intlayer_with_nextjs_compiler.md +15 -7
  69. package/docs/hi/intlayer_with_tanstack.md +22 -1
  70. package/docs/hi/intlayer_with_vite+react_compiler.md +15 -7
  71. package/docs/id/compiler.md +73 -8
  72. package/docs/id/configuration.md +67 -20
  73. package/docs/id/intlayer_with_nextjs_compiler.md +13 -5
  74. package/docs/id/intlayer_with_tanstack.md +22 -1
  75. package/docs/id/intlayer_with_vite+react_compiler.md +13 -5
  76. package/docs/it/compiler.md +73 -8
  77. package/docs/it/configuration.md +66 -27
  78. package/docs/it/intlayer_with_nextjs_compiler.md +12 -4
  79. package/docs/it/intlayer_with_tanstack.md +22 -1
  80. package/docs/it/intlayer_with_vite+react_compiler.md +12 -4
  81. package/docs/ja/compiler.md +75 -10
  82. package/docs/ja/configuration.md +70 -23
  83. package/docs/ja/intlayer_with_nextjs_compiler.md +13 -5
  84. package/docs/ja/intlayer_with_tanstack.md +22 -1
  85. package/docs/ja/intlayer_with_vite+react_compiler.md +13 -5
  86. package/docs/ko/compiler.md +75 -10
  87. package/docs/ko/configuration.md +70 -23
  88. package/docs/ko/intlayer_with_nextjs_compiler.md +22 -3
  89. package/docs/ko/intlayer_with_tanstack.md +22 -1
  90. package/docs/ko/intlayer_with_vite+react_compiler.md +22 -3
  91. package/docs/pl/compiler.md +73 -8
  92. package/docs/pl/configuration.md +71 -29
  93. package/docs/pl/intlayer_with_nextjs_compiler.md +13 -5
  94. package/docs/pl/intlayer_with_tanstack.md +22 -1
  95. package/docs/pl/intlayer_with_vite+react_compiler.md +13 -5
  96. package/docs/pt/compiler.md +74 -9
  97. package/docs/pt/configuration.md +62 -23
  98. package/docs/pt/intlayer_with_nextjs_compiler.md +12 -4
  99. package/docs/pt/intlayer_with_tanstack.md +22 -1
  100. package/docs/pt/intlayer_with_vite+react_compiler.md +12 -4
  101. package/docs/ru/compiler.md +74 -9
  102. package/docs/ru/configuration.md +61 -22
  103. package/docs/ru/intlayer_with_nextjs_compiler.md +11 -3
  104. package/docs/ru/intlayer_with_tanstack.md +22 -1
  105. package/docs/ru/intlayer_with_vite+react_compiler.md +11 -3
  106. package/docs/tr/compiler.md +73 -8
  107. package/docs/tr/configuration.md +77 -42
  108. package/docs/tr/intlayer_with_nextjs_compiler.md +11 -3
  109. package/docs/tr/intlayer_with_tanstack.md +22 -1
  110. package/docs/tr/intlayer_with_vite+react_compiler.md +11 -3
  111. package/docs/uk/compiler.md +74 -9
  112. package/docs/uk/configuration.md +207 -165
  113. package/docs/uk/intlayer_with_nextjs_compiler.md +13 -5
  114. package/docs/uk/intlayer_with_tanstack.md +22 -1
  115. package/docs/uk/intlayer_with_vite+react_compiler.md +13 -5
  116. package/docs/vi/compiler.md +75 -10
  117. package/docs/vi/configuration.md +97 -21
  118. package/docs/vi/intlayer_with_nextjs_compiler.md +14 -6
  119. package/docs/vi/intlayer_with_tanstack.md +22 -1
  120. package/docs/vi/intlayer_with_vite+react_compiler.md +14 -6
  121. package/docs/zh/compiler.md +75 -10
  122. package/docs/zh/configuration.md +77 -42
  123. package/docs/zh/intlayer_with_nextjs_compiler.md +13 -5
  124. package/docs/zh/intlayer_with_tanstack.md +22 -1
  125. package/docs/zh/intlayer_with_vite+react_compiler.md +13 -5
  126. package/package.json +17 -17
  127. package/src/blog.ts +1 -1
  128. package/src/common.ts +2 -1
  129. package/src/doc.ts +1 -1
  130. package/src/frequentQuestions.ts +1 -1
  131. package/src/generated/blog.entry.ts +1 -1
  132. package/src/generated/docs.entry.ts +1 -1
  133. package/src/generated/frequentQuestions.entry.ts +1 -1
  134. package/src/generated/legal.entry.ts +1 -1
  135. package/src/legal.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-09-09
3
- updatedAt: 2026-02-25
3
+ updatedAt: 2026-03-10
4
4
  title: Intlayer 编译器 | 用于 i18n 的自动内容提取
5
5
  description: 使用 Intlayer 编译器自动化您的国际化流程。直接从组件中提取内容,实现 Vite、Next.js 等框架中更快速、更高效的 i18n。
6
6
  keywords:
@@ -20,6 +20,9 @@ slugs:
20
20
  - doc
21
21
  - compiler
22
22
  history:
23
+ - version: 8.2.0
24
+ date: 2026-03-10
25
+ changes: Update compiler options, add FilePathPattern support
23
26
  - version: 8.1.7
24
27
  date: 2026-02-25
25
28
  changes: 更新编译器选项
@@ -157,13 +160,12 @@ import { type IntlayerConfig, Locales } from "intlayer";
157
160
  const config: IntlayerConfig = {
158
161
  compiler: {
159
162
  /**
160
- * 指示是否应启用编译器。
161
- * 设置为 'build-only' 可在开发期间跳过编译器并加快启动速度。
163
+ * 设置为 “build-only” 以在开发期间跳过编译器并加快启动速度。
162
164
  */
163
165
  enabled: true,
164
166
 
165
167
  /**
166
- * 遍历要优化的代码的模式。
168
+ * Pattern to traverse the code to optimize.
167
169
  */
168
170
  transformPattern: [
169
171
  "**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}",
@@ -171,23 +173,28 @@ const config: IntlayerConfig = {
171
173
  ],
172
174
 
173
175
  /**
174
- * 要从优化中排除的模式。
176
+ * Pattern to exclude from the optimization.
175
177
  */
176
178
  excludePattern: ["**/node_modules/**"],
177
179
 
178
180
  /**
179
- * 优化后字典的输出目录。
181
+ * 优化字典的输出目录。
180
182
  */
181
- outputDir: "i18n",
183
+ output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
184
+
185
+ /**
186
+ * 仅在生成的文件中插入内容,不含键。
187
+ */
188
+ noMetadata: false,
182
189
 
183
190
  /**
184
191
  * 字典键前缀
185
192
  */
186
- dictionaryKeyPrefix: "", // 移除基本前缀
193
+ dictionaryKeyPrefix: "", // Remove base prefix
187
194
 
188
195
  /**
189
- * 指示是否应在转换后保存组件。
190
- * 这样,编译器只需运行一次即可转换应用程序,然后可以将其移除。
196
+ * 指示转换后是否应保存组件。
197
+ * 这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
191
198
  */
192
199
  saveComponents: false,
193
200
  },
@@ -209,3 +216,61 @@ npx intlayer fill # 填充缺失的翻译
209
216
  ```
210
217
 
211
218
  > 有关更多详细信息,请参阅 [CLI 文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/cli/ci.md)
219
+
220
+ ### 编译器配置参考
221
+
222
+ 可以在 `intlayer.config.ts` 文件的 `compiler` 块中配置以下属性:
223
+
224
+ - **enabled**:
225
+ - _类型_: `boolean | 'build-only'`
226
+ - _默认值_: `true`
227
+ - _描述_: 指示是否应启用编译器。
228
+ - **dictionaryKeyPrefix**:
229
+ - _类型_: `string`
230
+ - _默认值_: `'comp-'`
231
+ - _描述_: 提取的字典键的前缀。
232
+ - **transformPattern**:
233
+ - _类型_: `string | string[]`
234
+ - _默认值_: `['**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}', '!**/node_modules/**']`
235
+ - _描述_: 遍历代码进行优化的模式。
236
+ - **excludePattern**:
237
+ - _类型_: `string | string[]`
238
+ - _默认值_: `['**/node_modules/**']`
239
+ - _描述_: 优化中排除的模式。
240
+ - **outputDir** (Deprecated):
241
+ - _类型_: `string`
242
+ - _默认值_: `'compiler'`
243
+ - _描述_: 存储提取的字典的目录。
244
+
245
+ - **output**:
246
+ - _类型_: `FilePathPattern`
247
+ - _默认值_: `({ key }) => 'compiler/${key}.content.json'`
248
+ - _描述_: 定义输出文件路径。替换 `outputDir`。处理动态变量,如 `{{locale}}`、`{{key}}`、`{{fileName}}`、`{{extension}}`、`{{format}}`、`{{dirPath}}`、`{{componentFileName}}`、`{{componentExtension}}`、`{{componentFormat}}`。可以设置为字符串(使用 `'my/{{var}}/path'` 格式)或函数。
249
+ - _注意_: `./**/*` 路径相对于组件解析。`/**/*` 路径相对于 Intlayer 的 `baseDir` 解析。
250
+ - _示例_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
251
+
252
+ - **noMetadata**:
253
+ - _类型_: `boolean`
254
+ - _默认值_: `false`
255
+ - _描述_: 指示是否应在文件中保存元数据。如果为 true,编译器将不会保存字典的元数据(键、内容包装器)。
256
+ - _注意_: 如果与 `loadJSON` 插件一起使用,则非常有用。
257
+ - _示例_: 如果为 `true`:
258
+ ```json
259
+ {
260
+ "key": "value"
261
+ }
262
+ ```
263
+ 如果为 `false`:
264
+ ```json
265
+ {
266
+ "key": "value",
267
+ "content": {
268
+ "key": "value"
269
+ }
270
+ }
271
+ ```
272
+
273
+ - **saveComponents**:
274
+ - _类型_: `boolean`
275
+ - _默认值_: `false`
276
+ - _描述_: 指示转换后是否应保存组件。
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2024-08-13
3
- updatedAt: 2026-02-25
3
+ updatedAt: 2026-03-11
4
4
  title: 配置
5
5
  description: 了解如何为您的应用程序配置 Intlayer。了解各种设置和选项,以根据您的需求自定义 Intlayer。
6
6
  keywords:
@@ -14,18 +14,24 @@ slugs:
14
14
  - concept
15
15
  - configuration
16
16
  history:
17
+ - version: 8.3.0
18
+ data: 2026-03-11
19
+ changes: 将 'baseDir' 从 'content' 配置移动到 'system' 配置
20
+ - version: 8.2.0
21
+ date: 2026-03-10
22
+ changes: 更新编译器选项,增加 'output' 和 'noMetadata' 支持
17
23
  - version: 8.1.7
18
24
  date: 2026-02-25
19
25
  changes: 更新编译器选项
20
26
  - version: 8.0.6
21
27
  date: 2026-02-12
22
- changes: Add support for Open Router, Alibaba, Amazon, Google Vertex Bedrock, Fireworks, Groq, Hugging Face, and Together.ai providers
28
+ changes: 新增对 Open Router, Alibaba, Amazon, Google Vertex Bedrock, Fireworks, Groq, Hugging Face, 以及 Together.ai 提供商的支持
23
29
  - version: 8.0.5
24
30
  date: 2026-02-06
25
31
  changes: 在 AI 配置中添加 `dataSerialization`
26
32
  - version: 8.0.0
27
33
  date: 2026-01-22
28
- changes: Move `importMode` build configuration to `dictionary` configuration.
34
+ changes: importMode 构建配置移动到字典配置。
29
35
  - version: 8.0.0
30
36
  date: 2026-01-18
31
37
  changes: 将系统配置与内容配置分离。将内部路径移至 `system` 属性。添加 `codeDir` 以将内容文件与代码转换分离。
@@ -422,7 +428,7 @@ const config: IntlayerConfig = {
422
428
  */
423
429
  compiler: {
424
430
  /**
425
- * Indicates if the compiler should be enabled.
431
+ * 指示是否应启用编译器。
426
432
  */
427
433
  enabled: true,
428
434
 
@@ -440,18 +446,23 @@ const config: IntlayerConfig = {
440
446
  excludePattern: ["**/node_modules/**"],
441
447
 
442
448
  /**
443
- * Output directory for the optimized dictionaries.
449
+ * 优化字典的输出目录。
444
450
  */
445
- outputDir: "compiler",
451
+ output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
446
452
 
447
453
  /**
448
- * Dictionary key prefix
454
+ * 仅在生成的文件中插入内容,不含键。
455
+ */
456
+ noMetadata: false,
457
+
458
+ /**
459
+ * 字典键前缀
449
460
  */
450
461
  dictionaryKeyPrefix: "", // Remove base prefix
451
462
 
452
463
  /**
453
- * Indicates if the components should be saved after being transformed.
454
- * That way, the compiler can be run only once to transform the app, and then it can be removed.
464
+ * 指示转换后是否应保存组件。
465
+ * 这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
455
466
  */
456
467
  saveComponents: false,
457
468
  },
@@ -707,7 +718,7 @@ export default config;
707
718
  #### 属性
708
719
 
709
720
  - **autoFill**:
710
- - _类型_:`boolean | string | { [key in Locales]?: string }`
721
+ - _类型_:`boolean | string | FilePathPattern | { [key in Locales]?: string }`
711
722
  - _默认值_:`undefined`
712
723
  - _描述_:指示内容应如何使用 AI 自动填充。可以在 `intlayer.config.ts` 文件中全局声明。
713
724
  - _示例_:true
@@ -730,13 +741,6 @@ export default config;
730
741
  - _示例_: `['.data.ts', '.data.js', '.data.json']`
731
742
  - _备注_: 自定义文件扩展名可以帮助避免冲突。
732
743
 
733
- - **baseDir**:
734
- - _类型_: `string`
735
- - _默认值_: `process.cwd()`
736
- - _描述_: 项目的基础目录。
737
- - _示例_: `'/path/to/project'`
738
- - _备注_: 用于解析所有与 Intlayer 相关的目录。
739
-
740
744
  - **dictionaryOutput**:
741
745
  - _类型_: `string[]`
742
746
  - _默认值_: `['intlayer']`
@@ -756,10 +760,26 @@ export default config;
756
760
  - _描述_: 存储代码的目录路径,相对于基础目录。
757
761
  - _备注_: 用于监视代码文件以进行转换(修剪、优化)。将此与 `contentDir` 分开可以提高构建性能,避免不必要地扫描内容文件。
758
762
 
763
+ ---
764
+
765
+ ### 系统配置
766
+
767
+ 与 Intlayer 内部路径和输出结果相关的设置。这些设置通常是内部的,用户无需修改。
768
+
769
+ #### 属性
770
+
771
+ - **baseDir**:
772
+ - _类型_: `string`
773
+ - _默认值_: `process.cwd()`
774
+ - _描述_: 项目的基础目录。
775
+ - _示例_: `'/path/to/project'`
776
+ - _备注_: 用于解析所有与 Intlayer 相关的目录。
777
+
759
778
  - **dictionariesDir**:
760
779
  - _类型_: `string`
761
- - _默认_: `'.intlayer/dictionaries'`
762
- - _描述_: 用于存储中间结果或输出结果的目录路径。
780
+ - _默认值_: `'.intlayer/dictionary'`
781
+ - _描述_: 用于存储本地化词典的目录。
782
+ - _示例_: `'translations'`
763
783
 
764
784
  - **moduleAugmentationDir**:
765
785
  - _类型_: `string`
@@ -774,19 +794,6 @@ export default config;
774
794
  - _描述_: 用于存储未合并字典的目录。
775
795
  - _示例_: `'translations'`
776
796
 
777
- - **dictionariesDir**:
778
- - _类型_: `string`
779
- - _默认值_: `'.intlayer/dictionary'`
780
- - _描述_: 用于存储本地化词典的目录。
781
- - _示例_: `'translations'`
782
-
783
- - **i18nextResourcesDir**:
784
- - _类型_: `string`
785
- - _默认值_: `'i18next_dictionary'`
786
- - _描述_: 用于存储 i18n 词典的目录。
787
- - _示例_: `'translations'`
788
- - _注意_: 确保该目录已为 i18next 输出类型进行配置。
789
-
790
797
  - **typesDir**:
791
798
  - _类型_: `string`
792
799
  - _默认值_: `'types'`
@@ -823,11 +830,11 @@ export default config;
823
830
  - **locale**
824
831
  - **location**
825
832
  - **importMode**:
826
- - _Note_: **Deprecated**: Use `dictionary.importMode` instead.
827
- - _Type_: `'static' | 'dynamic' | 'fetch'`
828
- - _Default_: `'static'`
829
- - _Description_: Controls how dictionaries are imported.
830
- - _Example_: `'dynamic'`
833
+ - _注意_: **Deprecated**: Use `dictionary.importMode` instead.
834
+ - _类型_: `'static' | 'dynamic' | 'fetch'`
835
+ - _默认值_: `'static'`
836
+ - _描述_: Controls how dictionaries are imported.
837
+ - _示例_: `'dynamic'`
831
838
  - **priority**
832
839
  - **live**
833
840
  - **schema**
@@ -959,10 +966,10 @@ Intlayer 支持多个 AI 提供商,以增强灵活性和选择。目前支持
959
966
  - _注意_:可用于禁用字典构建,例如当应避免在 Node.js 环境中执行时。
960
967
 
961
968
  - **checkTypes**:
962
- - _Type_: `boolean`
963
- - _Default_: `false`
964
- - _Description_: 指示构建是否应检查 TypeScript 类型并记录错误。
965
- - _Note_: 这可能会减慢构建速度。
969
+ - _类型_: `boolean`
970
+ - _默认值_: `false`
971
+ - _描述_: 指示构建是否应检查 TypeScript 类型并记录错误。
972
+ - _注意_: 这可能会减慢构建速度。
966
973
 
967
974
  - **optimize**:
968
975
  - _类型_:`boolean`
@@ -975,7 +982,7 @@ Intlayer 支持多个 AI 提供商,以增强灵活性和选择。目前支持
975
982
  - _注意_: 确保所有键在 `useIntlayer` 调用中是静态声明的。例如 `useIntlayer('navbar')`。
976
983
 
977
984
  - **importMode**:
978
- - _Note_: **Deprecated**: Use `dictionary.importMode` instead.
985
+ - _注意_: **Deprecated**: Use `dictionary.importMode` instead.
979
986
  - _类型_: `'static' | 'dynamic' | 'fetch'`
980
987
  - _默认值_: `'static'`
981
988
  - _描述_: 控制字典的导入方式。
@@ -1054,3 +1061,31 @@ Intlayer 支持多个 AI 提供商,以增强灵活性和选择。目前支持
1054
1061
  - _类型_:`string`
1055
1062
  - _默认值_: `'compiler'`
1056
1063
  - _描述_:存储提取字典的目录,相对于您的项目基准路径。
1064
+
1065
+ - **output**:
1066
+ - _类型_: `FilePathPattern`
1067
+ - _默认值_: `({ key }) => 'compiler/${key}.content.json'`
1068
+ - _描述_: 定义输出文件路径。替换 `outputDir`。处理动态变量,如 `{{locale}}`、`{{key}}`、`{{fileName}}`、`{{extension}}`、`{{format}}`、`{{dirPath}}`、`{{componentFileName}}`、`{{componentExtension}}`、`{{componentFormat}}`。可以设置为字符串(使用 `'my/{{var}}/path'` 格式)或函数。
1069
+ - _注意_: `./**/*` 路径相对于组件解析。`/**/*` 路径相对于 Intlayer 的 `baseDir` 解析。
1070
+ - _示例_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
1071
+
1072
+ - **noMetadata**:
1073
+ - _类型_: `boolean`
1074
+ - _默认值_: `false`
1075
+ - _描述_: 指示是否应在文件中保存元数据。如果为 true,编译器将不会保存字典的元数据(键、内容包装器)。
1076
+ - _注意_: 如果与 `loadJSON` 插件一起使用,则非常有用。
1077
+ - _示例_: 如果为 `true`:
1078
+ ```json
1079
+ {
1080
+ "key": "value"
1081
+ }
1082
+ ```
1083
+ 如果为 `false`:
1084
+ ```json
1085
+ {
1086
+ "key": "value",
1087
+ "content": {
1088
+ "key": "value"
1089
+ }
1090
+ }
1091
+ ```
@@ -20,6 +20,9 @@ slugs:
20
20
  applicationTemplate: https://github.com/aymericzip/intlayer-next-no-lolale-path-template
21
21
  youtubeVideo: https://www.youtube.com/watch?v=e_PPG7PTqGU
22
22
  history:
23
+ - version: 8.2.0
24
+ date: 2026-03-09
25
+ changes: Update compiler options, add FilePathPattern support
23
26
  - version: 8.1.6
24
27
  date: 2026-02-23
25
28
  changes: 初始版本
@@ -128,23 +131,28 @@ const config: IntlayerConfig = {
128
131
  },
129
132
  compiler: {
130
133
  /**
131
- * 指示是否启用编译器。
134
+ * 指示是否应启用编译器。
132
135
  */
133
136
  enabled: true,
134
137
 
135
138
  /**
136
- * 优化后字典的输出目录。
139
+ * 优化字典的输出目录。
137
140
  */
138
- outputDir: "compiler",
141
+ output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
142
+
143
+ /**
144
+ * 仅在生成的文件中插入内容,不含键。
145
+ */
146
+ noMetadata: false,
139
147
 
140
148
  /**
141
149
  * 字典键前缀
142
150
  */
143
- dictionaryKeyPrefix: "", // 移除基础前缀
151
+ dictionaryKeyPrefix: "", // Remove base prefix
144
152
 
145
153
  /**
146
154
  * 指示转换后是否应保存组件。
147
- * 这样,编译器只需运行一次即可转换应用程序,然后即可将其移除。
155
+ * 这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
148
156
  */
149
157
  saveComponents: false,
150
158
  },
@@ -441,12 +441,33 @@ export const Route = createFileRoute("/{-$locale}/")({
441
441
  component: RouteComponent,
442
442
  head: ({ params }) => {
443
443
  const { locale } = params;
444
+ const path = "/"; // The path for this route
445
+
444
446
  const metaContent = getIntlayer("app", locale);
445
447
 
446
448
  return {
449
+ links: [
450
+ // Canonical link: Points to the current localized page
451
+ { rel: "canonical", href: getLocalizedUrl(path, locale) },
452
+
453
+ // Hreflang: Tell Google about all localized versions
454
+ ...localeMap(({ locale: mapLocale }) => ({
455
+ rel: "alternate",
456
+ hrefLang: mapLocale,
457
+ href: getLocalizedUrl(path, mapLocale),
458
+ })),
459
+
460
+ // x-default: For users in unmatched languages
461
+ // Define the default fallback locale (usually your primary language)
462
+ {
463
+ rel: "alternate",
464
+ hrefLang: "x-default",
465
+ href: getLocalizedUrl(path, defaultLocale),
466
+ },
467
+ ],
447
468
  meta: [
448
469
  { title: metaContent.title },
449
- { content: metaContent.meta.description, name: "description" },
470
+ { name: "description", content: metaContent.meta.description },
450
471
  ],
451
472
  };
452
473
  },
@@ -19,6 +19,9 @@ slugs:
19
19
  applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
20
20
  youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
21
21
  history:
22
+ - version: 8.2.0
23
+ date: 2026-03-09
24
+ changes: Update compiler options, add FilePathPattern support
22
25
  - version: 8.1.6
23
26
  date: 2026-02-23
24
27
  changes: 首次发布
@@ -130,23 +133,28 @@ const config: IntlayerConfig = {
130
133
  },
131
134
  compiler: {
132
135
  /**
133
- * 指示是否启用编译器。
136
+ * 指示是否应启用编译器。
134
137
  */
135
138
  enabled: true,
136
139
 
137
140
  /**
138
- * 优化后字典的输出目录。
141
+ * 优化字典的输出目录。
139
142
  */
140
- outputDir: "compiler",
143
+ output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
144
+
145
+ /**
146
+ * 仅在生成的文件中插入内容,不含键。
147
+ */
148
+ noMetadata: false,
141
149
 
142
150
  /**
143
151
  * 字典键前缀
144
152
  */
145
- dictionaryKeyPrefix: "", // 移除基础前缀
153
+ dictionaryKeyPrefix: "", // Remove base prefix
146
154
 
147
155
  /**
148
156
  * 指示转换后是否应保存组件。
149
- * 这样,编译器只需运行一次即可转换应用程序,然后即可将其移除。
157
+ * 这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
150
158
  */
151
159
  saveComponents: false,
152
160
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/docs",
3
- "version": "8.2.4",
3
+ "version": "8.3.0-canary.1",
4
4
  "private": false,
5
5
  "description": "Intlayer documentation",
6
6
  "keywords": [
@@ -49,43 +49,43 @@
49
49
  ],
50
50
  "scripts": {
51
51
  "prebuild": "bun tools/generateEntry.ts",
52
- "build": "tsdown --config tsdown.config.ts",
53
- "build:ci": "tsdown --config tsdown.config.ts",
54
- "clean": "rimraf ./dist .turbo",
52
+ "build": "bun --bun tsdown --config tsdown.config.ts",
53
+ "build:ci": "bun --bun tsdown --config tsdown.config.ts",
54
+ "clean": "bun --bun rimraf ./dist .turbo",
55
55
  "dev": "tsdown --config tsdown.config.ts --watch",
56
- "format": "biome format . --check",
57
- "format:fix": "biome format --write .",
58
- "lint": "biome lint .",
59
- "lint:fix": "biome lint --write .",
56
+ "format": "bun --bun biome format . --check",
57
+ "format:fix": "bun --bun biome format --write .",
58
+ "lint": "bun --bun biome lint .",
59
+ "lint:fix": "bun --bun biome lint --write .",
60
60
  "prepublish": "cp -f ../README.md ./README.md",
61
61
  "publish": "bun publish || true",
62
62
  "publish:canary": "bun publish --access public --tag canary || true",
63
63
  "publish:latest": "bun publish --access public --tag latest || true",
64
64
  "review": "bun tools/review.ts",
65
65
  "serve": "webpack serve --config ./webpack.config.ts",
66
- "test": "vitest run",
66
+ "test": "bun --bun vitest run",
67
67
  "test:markdown": "bun tools/markdownFormatting.ts",
68
- "test:watch": "vitest",
68
+ "test:watch": "bun --bun vitest",
69
69
  "translate": "bun tools/translate.ts",
70
70
  "transpile": "webpack --config ./webpack.config.ts",
71
71
  "typecheck": "tsc --noEmit --project tsconfig.types.json",
72
72
  "watch": "webpack --config ./webpack.config.ts --watch"
73
73
  },
74
74
  "dependencies": {
75
- "@intlayer/config": "8.2.3",
76
- "@intlayer/core": "8.2.3",
77
- "@intlayer/types": "8.2.3"
75
+ "@intlayer/config": "8.3.0-canary.1",
76
+ "@intlayer/core": "8.3.0-canary.1",
77
+ "@intlayer/types": "8.3.0-canary.1"
78
78
  },
79
79
  "devDependencies": {
80
- "@intlayer/api": "8.2.3",
81
- "@intlayer/cli": "8.2.3",
82
- "@types/node": "25.3.5",
80
+ "@intlayer/api": "8.3.0-canary.1",
81
+ "@intlayer/cli": "8.3.0-canary.1",
82
+ "@types/node": "25.4.0",
83
83
  "@utils/ts-config": "1.0.4",
84
84
  "@utils/ts-config-types": "1.0.4",
85
85
  "@utils/tsdown-config": "1.0.4",
86
86
  "fast-glob": "3.3.3",
87
87
  "rimraf": "6.1.3",
88
- "tsdown": "0.21.0",
88
+ "tsdown": "0.21.2",
89
89
  "typescript": "5.9.3",
90
90
  "vitest": "4.0.18"
91
91
  },
package/src/blog.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DeclaredLocales, LocalesValues } from '@intlayer/types';
1
+ import type { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
2
2
  import {
3
3
  defaultLocale,
4
4
  type FileMetadata,
package/src/common.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { join } from 'node:path';
2
2
  import { getLocalizedUrl } from '@intlayer/core/localization';
3
3
  import { getMarkdownMetadata } from '@intlayer/core/transpiler';
4
- import { Locales, type LocalesValues } from '@intlayer/types';
4
+ import type { LocalesValues } from '@intlayer/types/module_augmentation';
5
+ import * as Locales from '@intlayer/types/locales';
5
6
 
6
7
  export const defaultLocale = Locales.ENGLISH;
7
8
 
package/src/doc.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DeclaredLocales, LocalesValues } from '@intlayer/types';
1
+ import type { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
2
2
  import {
3
3
  defaultLocale,
4
4
  type FileMetadata,
@@ -1,4 +1,4 @@
1
- import type { DeclaredLocales, LocalesValues } from '@intlayer/types';
1
+ import type { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
2
2
  import {
3
3
  defaultLocale,
4
4
  type FileMetadata,
@@ -5,7 +5,7 @@ import { readFile } from 'node:fs/promises';
5
5
  import { join, dirname as pathDirname } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { getPackageJsonPath, getProjectRequire } from '@intlayer/config/utils';
8
- import type { LocalesValues } from '@intlayer/types';
8
+ import type { LocalesValues } from '@intlayer/types/module_augmentation';
9
9
 
10
10
  // Robustly resolve the base directory of the @intlayer/docs package in both
11
11
  // bundled environments (Next.js) and standalone CLIs (MCP via npx).
@@ -5,7 +5,7 @@ import { readFile } from 'node:fs/promises';
5
5
  import { join, dirname as pathDirname } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { getPackageJsonPath, getProjectRequire } from '@intlayer/config/utils';
8
- import type { LocalesValues } from '@intlayer/types';
8
+ import type { LocalesValues } from '@intlayer/types/module_augmentation';
9
9
 
10
10
  // Robustly resolve the base directory of the @intlayer/docs package in both
11
11
  // bundled environments (Next.js) and standalone CLIs (MCP via npx).
@@ -5,7 +5,7 @@ import { readFile } from 'node:fs/promises';
5
5
  import { join, dirname as pathDirname } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { getPackageJsonPath, getProjectRequire } from '@intlayer/config/utils';
8
- import type { LocalesValues } from '@intlayer/types';
8
+ import type { LocalesValues } from '@intlayer/types/module_augmentation';
9
9
 
10
10
  // Robustly resolve the base directory of the @intlayer/docs package in both
11
11
  // bundled environments (Next.js) and standalone CLIs (MCP via npx).
@@ -5,7 +5,7 @@ import { readFile } from 'node:fs/promises';
5
5
  import { join, dirname as pathDirname } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { getPackageJsonPath, getProjectRequire } from '@intlayer/config/utils';
8
- import type { LocalesValues } from '@intlayer/types';
8
+ import type { LocalesValues } from '@intlayer/types/module_augmentation';
9
9
 
10
10
  // Robustly resolve the base directory of the @intlayer/docs package in both
11
11
  // bundled environments (Next.js) and standalone CLIs (MCP via npx).
package/src/legal.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DeclaredLocales, LocalesValues } from '@intlayer/types';
1
+ import type { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
2
2
  import {
3
3
  defaultLocale,
4
4
  type FileMetadata,