@intlayer/docs 8.2.3 → 8.3.0-canary.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 (128) 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 +53 -17
  38. package/docs/ar/intlayer_with_nextjs_compiler.md +13 -5
  39. package/docs/ar/intlayer_with_vite+react_compiler.md +13 -5
  40. package/docs/ar/per_locale_file.md +1 -1
  41. package/docs/de/compiler.md +74 -9
  42. package/docs/de/configuration.md +49 -13
  43. package/docs/de/intlayer_with_nextjs_compiler.md +12 -4
  44. package/docs/de/intlayer_with_vite+react_compiler.md +12 -4
  45. package/docs/de/per_locale_file.md +1 -1
  46. package/docs/en/compiler.md +79 -1
  47. package/docs/en/configuration.md +39 -1
  48. package/docs/en/intlayer_with_nextjs_compiler.md +9 -1
  49. package/docs/en/intlayer_with_vite+react_compiler.md +9 -1
  50. package/docs/en/per_locale_file.md +1 -1
  51. package/docs/en-GB/compiler.md +72 -6
  52. package/docs/en-GB/configuration.md +39 -2
  53. package/docs/en-GB/intlayer_with_nextjs_compiler.md +22 -3
  54. package/docs/en-GB/intlayer_with_vite+react_compiler.md +22 -3
  55. package/docs/en-GB/per_locale_file.md +1 -1
  56. package/docs/es/compiler.md +71 -6
  57. package/docs/es/configuration.md +52 -16
  58. package/docs/es/intlayer_with_nextjs_compiler.md +9 -1
  59. package/docs/es/intlayer_with_vite+react_compiler.md +9 -1
  60. package/docs/fr/compiler.md +69 -4
  61. package/docs/fr/configuration.md +50 -14
  62. package/docs/fr/intlayer_with_nextjs_compiler.md +9 -1
  63. package/docs/fr/intlayer_with_vite+react_compiler.md +9 -1
  64. package/docs/hi/compiler.md +74 -9
  65. package/docs/hi/configuration.md +49 -13
  66. package/docs/hi/intlayer_with_nextjs_compiler.md +15 -7
  67. package/docs/hi/intlayer_with_vite+react_compiler.md +15 -7
  68. package/docs/hi/per_locale_file.md +1 -1
  69. package/docs/id/compiler.md +73 -8
  70. package/docs/id/configuration.md +46 -10
  71. package/docs/id/intlayer_with_nextjs_compiler.md +13 -5
  72. package/docs/id/intlayer_with_vite+react_compiler.md +13 -5
  73. package/docs/id/per_locale_file.md +1 -1
  74. package/docs/it/compiler.md +73 -8
  75. package/docs/it/configuration.md +54 -18
  76. package/docs/it/intlayer_with_nextjs_compiler.md +12 -4
  77. package/docs/it/intlayer_with_vite+react_compiler.md +12 -4
  78. package/docs/it/per_locale_file.md +1 -1
  79. package/docs/ja/compiler.md +75 -10
  80. package/docs/ja/configuration.md +50 -14
  81. package/docs/ja/intlayer_with_nextjs_compiler.md +13 -5
  82. package/docs/ja/intlayer_with_vite+react_compiler.md +13 -5
  83. package/docs/ko/compiler.md +75 -10
  84. package/docs/ko/configuration.md +50 -14
  85. package/docs/ko/intlayer_with_nextjs_compiler.md +22 -3
  86. package/docs/ko/intlayer_with_vite+react_compiler.md +22 -3
  87. package/docs/pl/compiler.md +73 -8
  88. package/docs/pl/configuration.md +47 -11
  89. package/docs/pl/intlayer_with_nextjs_compiler.md +13 -5
  90. package/docs/pl/intlayer_with_vite+react_compiler.md +13 -5
  91. package/docs/pl/per_locale_file.md +1 -1
  92. package/docs/pt/compiler.md +74 -9
  93. package/docs/pt/configuration.md +50 -14
  94. package/docs/pt/intlayer_with_nextjs_compiler.md +12 -4
  95. package/docs/pt/intlayer_with_vite+react_compiler.md +12 -4
  96. package/docs/pt/per_locale_file.md +1 -1
  97. package/docs/ru/compiler.md +74 -9
  98. package/docs/ru/configuration.md +49 -13
  99. package/docs/ru/intlayer_with_nextjs_compiler.md +11 -3
  100. package/docs/ru/intlayer_with_vite+react_compiler.md +11 -3
  101. package/docs/tr/compiler.md +73 -8
  102. package/docs/tr/configuration.md +53 -17
  103. package/docs/tr/intlayer_with_nextjs_compiler.md +11 -3
  104. package/docs/tr/intlayer_with_vite+react_compiler.md +11 -3
  105. package/docs/tr/per_locale_file.md +1 -1
  106. package/docs/uk/compiler.md +74 -9
  107. package/docs/uk/configuration.md +183 -147
  108. package/docs/uk/intlayer_with_nextjs_compiler.md +13 -5
  109. package/docs/uk/intlayer_with_vite+react_compiler.md +13 -5
  110. package/docs/vi/compiler.md +75 -10
  111. package/docs/vi/configuration.md +47 -11
  112. package/docs/vi/intlayer_with_nextjs_compiler.md +14 -6
  113. package/docs/vi/intlayer_with_vite+react_compiler.md +14 -6
  114. package/docs/vi/per_locale_file.md +1 -1
  115. package/docs/zh/compiler.md +75 -10
  116. package/docs/zh/configuration.md +54 -18
  117. package/docs/zh/intlayer_with_nextjs_compiler.md +13 -5
  118. package/docs/zh/intlayer_with_vite+react_compiler.md +13 -5
  119. package/package.json +16 -16
  120. package/src/blog.ts +1 -1
  121. package/src/common.ts +2 -1
  122. package/src/doc.ts +1 -1
  123. package/src/frequentQuestions.ts +1 -1
  124. package/src/generated/blog.entry.ts +1 -1
  125. package/src/generated/docs.entry.ts +1 -1
  126. package/src/generated/frequentQuestions.entry.ts +1 -1
  127. package/src/generated/legal.entry.ts +1 -1
  128. 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: Trình Biên Dịch Intlayer | Trích Xuất Nội Dung Tự Động cho i18n
5
5
  description: Tự động hóa quy trình quốc tế hóa của bạn với Trình Biên Dịch Intlayer. Trích xuất nội dung trực tiếp từ các component để i18n nhanh hơn và hiệu quả hơn trong Vite, Next.js và nhiều hơn nữa.
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-09
25
+ changes: Update compiler options, add FilePathPattern support
23
26
  - version: 8.1.7
24
27
  date: 2026-02-25
25
28
  changes: Cập nhật các tùy chọn trình biên dịch
@@ -157,13 +160,12 @@ import { type IntlayerConfig, Locales } from "intlayer";
157
160
  const config: IntlayerConfig = {
158
161
  compiler: {
159
162
  /**
160
- * Chỉ định liệu trình biên dịch có nên được bật hay không.
161
163
  * Đặt thành 'build-only' để bỏ qua trình biên dịch trong quá trình phát triển và tăng tốc thời gian khởi động.
162
164
  */
163
165
  enabled: true,
164
166
 
165
167
  /**
166
- * Mẫu để duyệt qua để tối ưu hóa.
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
- * Mẫu để loại trừ khỏi quá trình tối ưu hóa.
176
+ * Pattern to exclude from the optimization.
175
177
  */
176
178
  excludePattern: ["**/node_modules/**"],
177
179
 
178
180
  /**
179
- * Thư mục đầu ra cho các từ điển đã được tối ưu hóa.
181
+ * Thư mục đầu ra cho các từ điển được tối ưu hóa.
180
182
  */
181
- outputDir: "i18n",
183
+ output: ({ key }) => `compiler/${key}.content.json`,
182
184
 
183
185
  /**
184
- * Tiền tố phím từ điển
186
+ * Chỉ chèn nội dung vào tệp đã tạo, không có khóa.
185
187
  */
186
- dictionaryKeyPrefix: "", // Xóa tiền tố cơ sở
188
+ noMetadata: false,
187
189
 
188
190
  /**
189
- * Chỉ định liệu các component có nên được lưu sau khi được chuyển đổi hay không.
190
- * Bằng cách đó, trình biên dịch có thể được chạy chỉ một lần để chuyển đổi ứng dụng, sau đó có thể được gỡ bỏ.
191
+ * Tiền tố khóa từ điển
192
+ */
193
+ dictionaryKeyPrefix: "", // Remove base prefix
194
+
195
+ /**
196
+ * Cho biết liệu các thành phần có nên được lưu sau khi được chuyển đổi hay không.
197
+ * Bằng cách đó, trình biên dịch có thể được chạy một lần duy nhất để chuyển đổi ứng dụng, và sau đó nó có thể được gỡ bỏ.
191
198
  */
192
199
  saveComponents: false,
193
200
  },
@@ -209,3 +216,61 @@ npx intlayer fill # Điền các bản dịch còn thiếu
209
216
  ```
210
217
 
211
218
  > Để biết thêm chi tiết, hãy tham khảo [tài liệu CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/ci.md)
219
+
220
+ ### Tham khảo cấu hình trình biên dịch
221
+
222
+ Các thuộc tính sau có thể được cấu hình trong khối `compiler` của tệp `intlayer.config.ts` của bạn:
223
+
224
+ - **enabled**:
225
+ - _Loại_: `boolean | 'build-only'`
226
+ - _Mặc định_: `true`
227
+ - _Mô tả_: Cho biết trình biên dịch có nên được bật hay không.
228
+ - **dictionaryKeyPrefix**:
229
+ - _Loại_: `string`
230
+ - _Mặc định_: `'comp-'`
231
+ - _Mô tả_: Tiền tố cho các khóa từ điển được trích xuất.
232
+ - **transformPattern**:
233
+ - _Loại_: `string | string[]`
234
+ - _Mặc định_: `['**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}', '!**/node_modules/**']`
235
+ - _Mô tả_: Các mẫu để duyệt mã để tối ưu hóa.
236
+ - **excludePattern**:
237
+ - _Loại_: `string | string[]`
238
+ - _Mặc định_: `['**/node_modules/**']`
239
+ - _Mô tả_: Các mẫu để loại trừ khỏi quá trình tối ưu hóa.
240
+ - **outputDir** (Deprecated):
241
+ - _Loại_: `string`
242
+ - _Mặc định_: `'compiler'`
243
+ - _Mô tả_: Thư mục nơi lưu trữ các từ điển được trích xuất.
244
+
245
+ - **output**:
246
+ - _Loại_: `FilePathPattern`
247
+ - _Mặc định_: `({ key }) => 'compiler/${key}.content.json'`
248
+ - _Mô tả_: Xác định đường dẫn tệp đầu ra. Thay thế `outputDir`. Xử lý các biến động như `{{locale}}`, `{{key}}`, `{{fileName}}`, `{{extension}}`, `{{format}}`, `{{dirPath}}`, `{{componentFileName}}`, `{{componentExtension}}` và `{{componentFormat}}`. Có thể được đặt dưới dạng chuỗi bằng định dạng `'my/{{var}}/path'` hoặc dưới dạng hàm.
249
+ - _Ghi chú_: Các đường dẫn `./**/*` được giải quyết tương đối so với component. Các đường dẫn `/**/*` được giải quyết tương đối so với `baseDir` của Intlayer.
250
+ - _Ví dụ_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
251
+
252
+ - **noMetadata**:
253
+ - _Loại_: `boolean`
254
+ - _Mặc định_: `false`
255
+ - _Mô tả_: Cho biết liệu siêu dữ liệu có nên được lưu trong tệp hay không. Nếu true, trình biên dịch sẽ không lưu siêu dữ liệu của từ điển (khóa, trình bao bọc nội dung).
256
+ - _Ghi chú_: Hữu ích nếu được sử dụng với plugin `loadJSON`.
257
+ - _Ví dụ_: Nếu `true`:
258
+ ```json
259
+ {
260
+ "key": "value"
261
+ }
262
+ ```
263
+ Nếu `false`:
264
+ ```json
265
+ {
266
+ "key": "value",
267
+ "content": {
268
+ "key": "value"
269
+ }
270
+ }
271
+ ```
272
+
273
+ - **saveComponents**:
274
+ - _Loại_: `boolean`
275
+ - _Mặc định_: `false`
276
+ - _Mô tả_: Cho biết liệu các thành phần có nên được lưu sau khi được chuyển đổi hay không.
@@ -14,6 +14,9 @@ slugs:
14
14
  - concept
15
15
  - configuration
16
16
  history:
17
+ - version: 8.2.0
18
+ date: 2026-03-09
19
+ changes: Update compiler options, add 'output' and 'noMetadata' support
17
20
  - version: 8.1.7
18
21
  date: 2026-02-25
19
22
  changes: Cập nhật các tùy chọn trình biên dịch
@@ -437,7 +440,7 @@ const config: IntlayerConfig = {
437
440
  */
438
441
  compiler: {
439
442
  /**
440
- * Indicates if the compiler should be enabled.
443
+ * Cho biết trình biên dịch nên được bật hay không.
441
444
  */
442
445
  enabled: true,
443
446
 
@@ -455,18 +458,23 @@ const config: IntlayerConfig = {
455
458
  excludePattern: ["**/node_modules/**"],
456
459
 
457
460
  /**
458
- * Output directory for the optimized dictionaries.
461
+ * Thư mục đầu ra cho các từ điển được tối ưu hóa.
459
462
  */
460
- outputDir: "compiler",
463
+ output: ({ key }) => `compiler/${key}.content.json`,
461
464
 
462
465
  /**
463
- * Dictionary key prefix
466
+ * Chỉ chèn nội dung vào tệp đã tạo, không có khóa.
467
+ */
468
+ noMetadata: false,
469
+
470
+ /**
471
+ * Tiền tố khóa từ điển
464
472
  */
465
473
  dictionaryKeyPrefix: "", // Remove base prefix
466
474
 
467
475
  /**
468
- * Indicates if the components should be saved after being transformed.
469
- * That way, the compiler can be run only once to transform the app, and then it can be removed.
476
+ * Cho biết liệu các thành phần nên được lưu sau khi được chuyển đổi hay không.
477
+ * Bằng cách đó, trình biên dịch thể được chạy một lần duy nhất để chuyển đổi ứng dụng, sau đó thể được gỡ bỏ.
470
478
  */
471
479
  saveComponents: false,
472
480
  },
@@ -1073,7 +1081,7 @@ Các tùy chọn build áp dụng cho các plugin `@intlayer/babel` và `@intlay
1073
1081
  - _Lưu ý_: Đảm bảo tất cả các khóa được khai báo tĩnh trong các lệnh gọi `useIntlayer`. Ví dụ: `useIntlayer('navbar')`.
1074
1082
 
1075
1083
  - **importMode**:
1076
- - _Note_: **Deprecated**: Use `dictionary.importMode` instead.
1084
+ - _Ghi chú_: **Deprecated**: Use `dictionary.importMode` instead.
1077
1085
  - _Kiểu_: `'static' | 'dynamic' | 'fetch'`
1078
1086
  - _Mặc định_: `'static'`
1079
1087
  - _Mô tả_: Điều khiển cách các từ điển được nhập.
@@ -1091,10 +1099,10 @@ Các tùy chọn build áp dụng cho các plugin `@intlayer/babel` và `@intlay
1091
1099
  - _Lưu ý_: Chế độ live sẽ sử dụng live sync API để lấy các từ điển. Nếu cuộc gọi API thất bại, các từ điển sẽ được nhập động dưới dạng chế độ "dynamic".
1092
1100
  - _Lưu ý_: Tùy chọn này sẽ không ảnh hưởng đến các hàm `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` và `useDictionaryDynamic`.
1093
1101
  - **checkTypes**:
1094
- - _Type_: `boolean`
1095
- - _Default_: `false`
1096
- - _Description_: Cho biết liệu quá trình xây dựng có nên kiểm tra các kiểu TypeScript và ghi lại lỗi hay không.
1097
- - _Note_: Điều này có thể làm chậm quá trình xây dựng.
1102
+ - _Loại_: `boolean`
1103
+ - _Mặc định_: `false`
1104
+ - _Mô tả_: Cho biết liệu quá trình xây dựng có nên kiểm tra các kiểu TypeScript và ghi lại lỗi hay không.
1105
+ - _Ghi chú_: Điều này có thể làm chậm quá trình xây dựng.
1098
1106
 
1099
1107
  - **outputFormat**:
1100
1108
  - _Kiểu_: `'esm' | 'cjs'`
@@ -1157,3 +1165,31 @@ Các cài đặt kiểm soát trình biên dịch Intlayer, trình biên dịch
1157
1165
  - _Kiểu_: `string`
1158
1166
  - _Mặc định_: `'compiler'`
1159
1167
  - _Mô tả_: Thư mục nơi các từ điển trích xuất sẽ được lưu trữ, tương đối so với đường dẫn gốc dự án của bạn.
1168
+
1169
+ - **output**:
1170
+ - _Loại_: `FilePathPattern`
1171
+ - _Mặc định_: `({ key }) => 'compiler/${key}.content.json'`
1172
+ - _Mô tả_: Xác định đường dẫn tệp đầu ra. Thay thế `outputDir`. Xử lý các biến động như `{{locale}}`, `{{key}}`, `{{fileName}}`, `{{extension}}`, `{{format}}`, `{{dirPath}}`, `{{componentFileName}}`, `{{componentExtension}}` và `{{componentFormat}}`. Có thể được đặt dưới dạng chuỗi bằng định dạng `'my/{{var}}/path'` hoặc dưới dạng hàm.
1173
+ - _Ghi chú_: Các đường dẫn `./**/*` được giải quyết tương đối so với component. Các đường dẫn `/**/*` được giải quyết tương đối so với `baseDir` của Intlayer.
1174
+ - _Ví dụ_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
1175
+
1176
+ - **noMetadata**:
1177
+ - _Loại_: `boolean`
1178
+ - _Mặc định_: `false`
1179
+ - _Mô tả_: Cho biết liệu siêu dữ liệu có nên được lưu trong tệp hay không. Nếu true, trình biên dịch sẽ không lưu siêu dữ liệu của từ điển (khóa, trình bao bọc nội dung).
1180
+ - _Ghi chú_: Hữu ích nếu được sử dụng với plugin `loadJSON`.
1181
+ - _Ví dụ_: Nếu `true`:
1182
+ ```json
1183
+ {
1184
+ "key": "value"
1185
+ }
1186
+ ```
1187
+ Nếu `false`:
1188
+ ```json
1189
+ {
1190
+ "key": "value",
1191
+ "content": {
1192
+ "key": "value"
1193
+ }
1194
+ }
1195
+ ```
@@ -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: Phiên bản đầu tiên
@@ -128,23 +131,28 @@ const config: IntlayerConfig = {
128
131
  },
129
132
  compiler: {
130
133
  /**
131
- * Cho biết liệu trình biên dịch có nên được bật hay không.
134
+ * Cho biết trình biên dịch có nên được bật hay không.
132
135
  */
133
136
  enabled: true,
134
137
 
135
138
  /**
136
- * Thư mục đầu ra cho các từ điển đã được tối ưu hóa.
139
+ * Thư mục đầu ra cho các từ điển được tối ưu hóa.
137
140
  */
138
- outputDir: "compiler",
141
+ output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
142
+
143
+ /**
144
+ * Chỉ chèn nội dung vào tệp đã tạo, không có khóa.
145
+ */
146
+ noMetadata: false,
139
147
 
140
148
  /**
141
149
  * Tiền tố khóa từ điển
142
150
  */
143
- dictionaryKeyPrefix: "", // Xóa tiền tố cơ bản
151
+ dictionaryKeyPrefix: "", // Remove base prefix
144
152
 
145
153
  /**
146
- * Cho biết liệu các thành phần có nên được lưu lại sau khi được biến đổi hay không.
147
- * Bằng cách này, trình biên dịch có thể được chạy một lần để biến đổi ứng dụng, sau đó nó có thể được gỡ bỏ.
154
+ * Cho biết liệu các thành phần có nên được lưu sau khi được chuyển đổi hay không.
155
+ * Bằng cách đó, trình biên dịch có thể được chạy một lần duy nhất để chuyển đổi ứng dụng, sau đó nó có thể được gỡ bỏ.
148
156
  */
149
157
  saveComponents: false,
150
158
  },
@@ -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: Phát hành lần đầu
@@ -125,23 +128,28 @@ const config: IntlayerConfig = {
125
128
  },
126
129
  compiler: {
127
130
  /**
128
- * Cho biết liệu trình biên dịch có nên được bật hay không.
131
+ * Cho biết trình biên dịch có nên được bật hay không.
129
132
  */
130
133
  enabled: true,
131
134
 
132
135
  /**
133
- * Thư mục đầu ra cho các từ điển đã được tối ưu hóa.
136
+ * Thư mục đầu ra cho các từ điển được tối ưu hóa.
134
137
  */
135
- outputDir: "compiler",
138
+ output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
139
+
140
+ /**
141
+ * Chỉ chèn nội dung vào tệp đã tạo, không có khóa.
142
+ */
143
+ noMetadata: false,
136
144
 
137
145
  /**
138
146
  * Tiền tố khóa từ điển
139
147
  */
140
- dictionaryKeyPrefix: "", // Xóa tiền tố cơ bản
148
+ dictionaryKeyPrefix: "", // Remove base prefix
141
149
 
142
150
  /**
143
- * Cho biết liệu các thành phần có nên được lưu lại sau khi được biến đổi hay không.
144
- * Bằng cách này, trình biên dịch có thể được chạy một lần để biến đổi ứng dụng, sau đó nó có thể được gỡ bỏ.
151
+ * Cho biết liệu các thành phần có nên được lưu sau khi được chuyển đổi hay không.
152
+ * Bằng cách đó, trình biên dịch có thể được chạy một lần duy nhất để chuyển đổi ứng dụng, sau đó nó có thể được gỡ bỏ.
145
153
  */
146
154
  saveComponents: false,
147
155
  },
@@ -128,7 +128,7 @@ const config: IntlayerConfig = {
128
128
  export default config;
129
129
  ```
130
130
 
131
- Sử dụng cấu hình này, tất cả các tệp theo từng locale sẽ được tạo với locale mặc định được đặt là tiếng Anh. Nó cũng bao gồm việc tạo các tệp `.content` bằng cách sử dụng lệnh `extract` và compiler. (Xem [Compiler](https://intlayer.org/doc/compiler) hoặc [Extract](https://intlayer.org/doc/concept/cli/extract) để biết thêm thông tin.)
131
+ Sử dụng cấu hình này, tất cả các tệp theo từng locale sẽ được tạo với locale mặc định được đặt là tiếng Anh. Nó cũng bao gồm việc tạo các tệp `.content` bằng cách sử dụng lệnh `extract` và compiler. (Xem [Compiler](https://intlayer.org/doc/compiler) hoặc [Extract](https://github.com/aymericzip/intlayer/edit/main/docs/docs/en/cli/extract.md) để biết thêm thông tin.)
132
132
 
133
133
  ## Định dạng theo từng locale
134
134
 
@@ -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-10
4
4
  title: 配置
5
5
  description: 了解如何为您的应用程序配置 Intlayer。了解各种设置和选项,以根据您的需求自定义 Intlayer。
6
6
  keywords:
@@ -14,6 +14,9 @@ slugs:
14
14
  - concept
15
15
  - configuration
16
16
  history:
17
+ - version: 8.2.0
18
+ date: 2026-03-10
19
+ changes: Update compiler options, add 'output' and 'noMetadata' support
17
20
  - version: 8.1.7
18
21
  date: 2026-02-25
19
22
  changes: 更新编译器选项
@@ -422,7 +425,7 @@ const config: IntlayerConfig = {
422
425
  */
423
426
  compiler: {
424
427
  /**
425
- * Indicates if the compiler should be enabled.
428
+ * 指示是否应启用编译器。
426
429
  */
427
430
  enabled: true,
428
431
 
@@ -440,18 +443,23 @@ const config: IntlayerConfig = {
440
443
  excludePattern: ["**/node_modules/**"],
441
444
 
442
445
  /**
443
- * Output directory for the optimized dictionaries.
446
+ * 优化字典的输出目录。
444
447
  */
445
- outputDir: "compiler",
448
+ output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
446
449
 
447
450
  /**
448
- * Dictionary key prefix
451
+ * 仅在生成的文件中插入内容,不含键。
452
+ */
453
+ noMetadata: false,
454
+
455
+ /**
456
+ * 字典键前缀
449
457
  */
450
458
  dictionaryKeyPrefix: "", // Remove base prefix
451
459
 
452
460
  /**
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.
461
+ * 指示转换后是否应保存组件。
462
+ * 这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
455
463
  */
456
464
  saveComponents: false,
457
465
  },
@@ -707,7 +715,7 @@ export default config;
707
715
  #### 属性
708
716
 
709
717
  - **autoFill**:
710
- - _类型_:`boolean | string | { [key in Locales]?: string }`
718
+ - _类型_:`boolean | string | FilePathPattern | { [key in Locales]?: string }`
711
719
  - _默认值_:`undefined`
712
720
  - _描述_:指示内容应如何使用 AI 自动填充。可以在 `intlayer.config.ts` 文件中全局声明。
713
721
  - _示例_:true
@@ -823,11 +831,11 @@ export default config;
823
831
  - **locale**
824
832
  - **location**
825
833
  - **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'`
834
+ - _注意_: **Deprecated**: Use `dictionary.importMode` instead.
835
+ - _类型_: `'static' | 'dynamic' | 'fetch'`
836
+ - _默认值_: `'static'`
837
+ - _描述_: Controls how dictionaries are imported.
838
+ - _示例_: `'dynamic'`
831
839
  - **priority**
832
840
  - **live**
833
841
  - **schema**
@@ -959,10 +967,10 @@ Intlayer 支持多个 AI 提供商,以增强灵活性和选择。目前支持
959
967
  - _注意_:可用于禁用字典构建,例如当应避免在 Node.js 环境中执行时。
960
968
 
961
969
  - **checkTypes**:
962
- - _Type_: `boolean`
963
- - _Default_: `false`
964
- - _Description_: 指示构建是否应检查 TypeScript 类型并记录错误。
965
- - _Note_: 这可能会减慢构建速度。
970
+ - _类型_: `boolean`
971
+ - _默认值_: `false`
972
+ - _描述_: 指示构建是否应检查 TypeScript 类型并记录错误。
973
+ - _注意_: 这可能会减慢构建速度。
966
974
 
967
975
  - **optimize**:
968
976
  - _类型_:`boolean`
@@ -975,7 +983,7 @@ Intlayer 支持多个 AI 提供商,以增强灵活性和选择。目前支持
975
983
  - _注意_: 确保所有键在 `useIntlayer` 调用中是静态声明的。例如 `useIntlayer('navbar')`。
976
984
 
977
985
  - **importMode**:
978
- - _Note_: **Deprecated**: Use `dictionary.importMode` instead.
986
+ - _注意_: **Deprecated**: Use `dictionary.importMode` instead.
979
987
  - _类型_: `'static' | 'dynamic' | 'fetch'`
980
988
  - _默认值_: `'static'`
981
989
  - _描述_: 控制字典的导入方式。
@@ -1054,3 +1062,31 @@ Intlayer 支持多个 AI 提供商,以增强灵活性和选择。目前支持
1054
1062
  - _类型_:`string`
1055
1063
  - _默认值_: `'compiler'`
1056
1064
  - _描述_:存储提取字典的目录,相对于您的项目基准路径。
1065
+
1066
+ - **output**:
1067
+ - _类型_: `FilePathPattern`
1068
+ - _默认值_: `({ key }) => 'compiler/${key}.content.json'`
1069
+ - _描述_: 定义输出文件路径。替换 `outputDir`。处理动态变量,如 `{{locale}}`、`{{key}}`、`{{fileName}}`、`{{extension}}`、`{{format}}`、`{{dirPath}}`、`{{componentFileName}}`、`{{componentExtension}}`、`{{componentFormat}}`。可以设置为字符串(使用 `'my/{{var}}/path'` 格式)或函数。
1070
+ - _注意_: `./**/*` 路径相对于组件解析。`/**/*` 路径相对于 Intlayer 的 `baseDir` 解析。
1071
+ - _示例_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
1072
+
1073
+ - **noMetadata**:
1074
+ - _类型_: `boolean`
1075
+ - _默认值_: `false`
1076
+ - _描述_: 指示是否应在文件中保存元数据。如果为 true,编译器将不会保存字典的元数据(键、内容包装器)。
1077
+ - _注意_: 如果与 `loadJSON` 插件一起使用,则非常有用。
1078
+ - _示例_: 如果为 `true`:
1079
+ ```json
1080
+ {
1081
+ "key": "value"
1082
+ }
1083
+ ```
1084
+ 如果为 `false`:
1085
+ ```json
1086
+ {
1087
+ "key": "value",
1088
+ "content": {
1089
+ "key": "value"
1090
+ }
1091
+ }
1092
+ ```
@@ -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
  },