@intlayer/docs 8.2.4 → 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.
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/cjs/blog.cjs.map +1 -1
- package/dist/cjs/common.cjs +1 -1
- package/dist/cjs/common.cjs.map +1 -1
- package/dist/cjs/doc.cjs.map +1 -1
- package/dist/cjs/frequentQuestions.cjs.map +1 -1
- package/dist/cjs/generated/blog.entry.cjs +1 -1
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +1 -1
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +1 -1
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/cjs/legal.cjs.map +1 -1
- package/dist/esm/blog.mjs.map +1 -1
- package/dist/esm/common.mjs +1 -1
- package/dist/esm/common.mjs.map +1 -1
- package/dist/esm/doc.mjs.map +1 -1
- package/dist/esm/frequentQuestions.mjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
- package/dist/esm/generated/legal.entry.mjs.map +1 -1
- package/dist/esm/legal.mjs.map +1 -1
- package/dist/types/blog.d.ts +1 -1
- package/dist/types/common.d.ts +1 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/doc.d.ts +1 -1
- package/dist/types/frequentQuestions.d.ts +1 -1
- package/dist/types/generated/blog.entry.d.ts +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -1
- package/dist/types/generated/frequentQuestions.entry.d.ts +1 -1
- package/dist/types/generated/legal.entry.d.ts +1 -1
- package/dist/types/legal.d.ts +1 -1
- package/docs/ar/compiler.md +73 -8
- package/docs/ar/configuration.md +53 -17
- package/docs/ar/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/ar/intlayer_with_vite+react_compiler.md +13 -5
- package/docs/de/compiler.md +74 -9
- package/docs/de/configuration.md +49 -13
- package/docs/de/intlayer_with_nextjs_compiler.md +12 -4
- package/docs/de/intlayer_with_vite+react_compiler.md +12 -4
- package/docs/en/compiler.md +79 -1
- package/docs/en/configuration.md +39 -1
- package/docs/en/intlayer_with_nextjs_compiler.md +9 -1
- package/docs/en/intlayer_with_vite+react_compiler.md +9 -1
- package/docs/en-GB/compiler.md +72 -6
- package/docs/en-GB/configuration.md +39 -2
- package/docs/en-GB/intlayer_with_nextjs_compiler.md +22 -3
- package/docs/en-GB/intlayer_with_vite+react_compiler.md +22 -3
- package/docs/es/compiler.md +71 -6
- package/docs/es/configuration.md +52 -16
- package/docs/es/intlayer_with_nextjs_compiler.md +9 -1
- package/docs/es/intlayer_with_vite+react_compiler.md +9 -1
- package/docs/fr/compiler.md +69 -4
- package/docs/fr/configuration.md +50 -14
- package/docs/fr/intlayer_with_nextjs_compiler.md +9 -1
- package/docs/fr/intlayer_with_vite+react_compiler.md +9 -1
- package/docs/hi/compiler.md +74 -9
- package/docs/hi/configuration.md +49 -13
- package/docs/hi/intlayer_with_nextjs_compiler.md +15 -7
- package/docs/hi/intlayer_with_vite+react_compiler.md +15 -7
- package/docs/id/compiler.md +73 -8
- package/docs/id/configuration.md +46 -10
- package/docs/id/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/id/intlayer_with_vite+react_compiler.md +13 -5
- package/docs/it/compiler.md +73 -8
- package/docs/it/configuration.md +54 -18
- package/docs/it/intlayer_with_nextjs_compiler.md +12 -4
- package/docs/it/intlayer_with_vite+react_compiler.md +12 -4
- package/docs/ja/compiler.md +75 -10
- package/docs/ja/configuration.md +50 -14
- package/docs/ja/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/ja/intlayer_with_vite+react_compiler.md +13 -5
- package/docs/ko/compiler.md +75 -10
- package/docs/ko/configuration.md +50 -14
- package/docs/ko/intlayer_with_nextjs_compiler.md +22 -3
- package/docs/ko/intlayer_with_vite+react_compiler.md +22 -3
- package/docs/pl/compiler.md +73 -8
- package/docs/pl/configuration.md +47 -11
- package/docs/pl/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/pl/intlayer_with_vite+react_compiler.md +13 -5
- package/docs/pt/compiler.md +74 -9
- package/docs/pt/configuration.md +50 -14
- package/docs/pt/intlayer_with_nextjs_compiler.md +12 -4
- package/docs/pt/intlayer_with_vite+react_compiler.md +12 -4
- package/docs/ru/compiler.md +74 -9
- package/docs/ru/configuration.md +49 -13
- package/docs/ru/intlayer_with_nextjs_compiler.md +11 -3
- package/docs/ru/intlayer_with_vite+react_compiler.md +11 -3
- package/docs/tr/compiler.md +73 -8
- package/docs/tr/configuration.md +53 -17
- package/docs/tr/intlayer_with_nextjs_compiler.md +11 -3
- package/docs/tr/intlayer_with_vite+react_compiler.md +11 -3
- package/docs/uk/compiler.md +74 -9
- package/docs/uk/configuration.md +183 -147
- package/docs/uk/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/uk/intlayer_with_vite+react_compiler.md +13 -5
- package/docs/vi/compiler.md +75 -10
- package/docs/vi/configuration.md +47 -11
- package/docs/vi/intlayer_with_nextjs_compiler.md +14 -6
- package/docs/vi/intlayer_with_vite+react_compiler.md +14 -6
- package/docs/zh/compiler.md +75 -10
- package/docs/zh/configuration.md +54 -18
- package/docs/zh/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/zh/intlayer_with_vite+react_compiler.md +13 -5
- package/package.json +16 -16
- package/src/blog.ts +1 -1
- package/src/common.ts +2 -1
- package/src/doc.ts +1 -1
- package/src/frequentQuestions.ts +1 -1
- package/src/generated/blog.entry.ts +1 -1
- package/src/generated/docs.entry.ts +1 -1
- package/src/generated/frequentQuestions.entry.ts +1 -1
- package/src/generated/legal.entry.ts +1 -1
- package/src/legal.ts +1 -1
package/docs/vi/compiler.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-09
|
|
3
|
-
updatedAt: 2026-
|
|
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
|
-
*
|
|
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
|
-
* Thư mục đầu ra cho các từ điển
|
|
181
|
+
* Thư mục đầu ra cho các từ điển được tối ưu hóa.
|
|
180
182
|
*/
|
|
181
|
-
|
|
183
|
+
output: ({ key }) => `compiler/${key}.content.json`,
|
|
182
184
|
|
|
183
185
|
/**
|
|
184
|
-
*
|
|
186
|
+
* Chỉ chèn nội dung vào tệp đã tạo, không có khóa.
|
|
185
187
|
*/
|
|
186
|
-
|
|
188
|
+
noMetadata: false,
|
|
187
189
|
|
|
188
190
|
/**
|
|
189
|
-
*
|
|
190
|
-
|
|
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.
|
package/docs/vi/configuration.md
CHANGED
|
@@ -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
|
-
*
|
|
443
|
+
* Cho biết trình biên dịch có 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
|
-
*
|
|
461
|
+
* Thư mục đầu ra cho các từ điển được tối ưu hóa.
|
|
459
462
|
*/
|
|
460
|
-
|
|
463
|
+
output: ({ key }) => `compiler/${key}.content.json`,
|
|
461
464
|
|
|
462
465
|
/**
|
|
463
|
-
*
|
|
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
|
-
*
|
|
469
|
-
*
|
|
476
|
+
* 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.
|
|
477
|
+
* 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ỏ.
|
|
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
|
-
-
|
|
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
|
-
-
|
|
1095
|
-
-
|
|
1096
|
-
-
|
|
1097
|
-
-
|
|
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
|
|
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
|
|
139
|
+
* Thư mục đầu ra cho các từ điển được tối ưu hóa.
|
|
137
140
|
*/
|
|
138
|
-
|
|
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: "", //
|
|
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
|
|
147
|
-
* Bằng cách
|
|
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, và 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
|
|
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
|
|
136
|
+
* Thư mục đầu ra cho các từ điển được tối ưu hóa.
|
|
134
137
|
*/
|
|
135
|
-
|
|
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: "", //
|
|
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
|
|
144
|
-
* Bằng cách
|
|
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, và sau đó nó có thể được gỡ bỏ.
|
|
145
153
|
*/
|
|
146
154
|
saveComponents: false,
|
|
147
155
|
},
|
package/docs/zh/compiler.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-09
|
|
3
|
-
updatedAt: 2026-
|
|
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
|
-
|
|
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
|
+
- _描述_: 指示转换后是否应保存组件。
|
package/docs/zh/configuration.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2024-08-13
|
|
3
|
-
updatedAt: 2026-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
446
|
+
* 优化字典的输出目录。
|
|
444
447
|
*/
|
|
445
|
-
|
|
448
|
+
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
446
449
|
|
|
447
450
|
/**
|
|
448
|
-
*
|
|
451
|
+
* 仅在生成的文件中插入内容,不含键。
|
|
452
|
+
*/
|
|
453
|
+
noMetadata: false,
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* 字典键前缀
|
|
449
457
|
*/
|
|
450
458
|
dictionaryKeyPrefix: "", // Remove base prefix
|
|
451
459
|
|
|
452
460
|
/**
|
|
453
|
-
*
|
|
454
|
-
*
|
|
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
|
-
-
|
|
827
|
-
-
|
|
828
|
-
-
|
|
829
|
-
-
|
|
830
|
-
-
|
|
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
|
-
-
|
|
963
|
-
-
|
|
964
|
-
-
|
|
965
|
-
-
|
|
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
|
-
-
|
|
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
|
-
|
|
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
|
},
|