@intlayer/docs 8.1.2 → 8.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/blog/de/per-component_vs_centralized_i18n.md +1 -1
- package/blog/en/__per-component_vs_centralized_i18n.md +1 -1
- package/blog/en/per-component_vs_centralized_i18n.md +1 -1
- package/blog/en-GB/per-component_vs_centralized_i18n.md +1 -1
- package/blog/es/per-component_vs_centralized_i18n.md +1 -1
- package/blog/fr/per-component_vs_centralized_i18n.md +1 -1
- package/blog/pt/per-component_vs_centralized_i18n.md +1 -1
- package/dist/cjs/blog.cjs +1 -21
- package/dist/cjs/blog.cjs.map +1 -1
- package/dist/cjs/common.cjs +1 -77
- package/dist/cjs/common.cjs.map +1 -1
- package/dist/cjs/doc.cjs +1 -21
- package/dist/cjs/doc.cjs.map +1 -1
- package/dist/cjs/frequentQuestions.cjs +1 -21
- package/dist/cjs/frequentQuestions.cjs.map +1 -1
- package/dist/cjs/generated/blog.entry.cjs +1 -551
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +1 -2971
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +1 -351
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +1 -71
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -34
- package/dist/cjs/legal.cjs +1 -21
- package/dist/cjs/legal.cjs.map +1 -1
- package/dist/esm/blog.mjs +1 -14
- package/dist/esm/blog.mjs.map +1 -1
- package/dist/esm/common.mjs +1 -66
- package/dist/esm/common.mjs.map +1 -1
- package/dist/esm/doc.mjs +1 -14
- package/dist/esm/doc.mjs.map +1 -1
- package/dist/esm/frequentQuestions.mjs +1 -14
- package/dist/esm/frequentQuestions.mjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +1 -550
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +1 -2970
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/esm/generated/frequentQuestions.entry.mjs +1 -350
- package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
- package/dist/esm/generated/legal.entry.mjs +1 -70
- package/dist/esm/generated/legal.entry.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -6
- package/dist/esm/legal.mjs +1 -14
- package/dist/esm/legal.mjs.map +1 -1
- package/dist/types/common.d.ts.map +1 -1
- package/docs/ar/agent_skills.md +1 -1
- package/docs/ar/cli/build.md +8 -0
- package/docs/ar/cli/index.md +1 -1
- package/docs/ar/compiler.md +1 -1
- package/docs/ar/configuration.md +34 -17
- package/docs/de/agent_skills.md +1 -1
- package/docs/de/cli/build.md +8 -0
- package/docs/de/cli/index.md +1 -1
- package/docs/de/compiler.md +1 -1
- package/docs/de/configuration.md +34 -17
- package/docs/en/agent_skills.md +1 -1
- package/docs/en/cli/build.md +8 -0
- package/docs/en/compiler.md +1 -1
- package/docs/en/configuration.md +79 -11
- package/docs/en-GB/agent_skills.md +1 -1
- package/docs/en-GB/cli/build.md +8 -0
- package/docs/en-GB/cli/index.md +1 -1
- package/docs/en-GB/compiler.md +1 -1
- package/docs/en-GB/configuration.md +34 -17
- package/docs/es/agent_skills.md +1 -1
- package/docs/es/cli/build.md +8 -0
- package/docs/es/cli/index.md +1 -1
- package/docs/es/compiler.md +1 -1
- package/docs/es/configuration.md +34 -17
- package/docs/fr/agent_skills.md +1 -1
- package/docs/fr/cli/build.md +8 -0
- package/docs/fr/cli/index.md +1 -1
- package/docs/fr/compiler.md +1 -1
- package/docs/fr/configuration.md +34 -17
- package/docs/hi/agent_skills.md +1 -1
- package/docs/hi/cli/build.md +8 -0
- package/docs/hi/cli/index.md +1 -1
- package/docs/hi/compiler.md +1 -1
- package/docs/hi/configuration.md +34 -17
- package/docs/id/agent_skills.md +1 -1
- package/docs/id/cli/build.md +8 -0
- package/docs/id/cli/index.md +1 -1
- package/docs/id/compiler.md +1 -1
- package/docs/id/configuration.md +34 -17
- package/docs/it/agent_skills.md +1 -1
- package/docs/it/cli/build.md +8 -0
- package/docs/it/cli/index.md +1 -1
- package/docs/it/compiler.md +1 -1
- package/docs/it/configuration.md +34 -17
- package/docs/ja/agent_skills.md +1 -1
- package/docs/ja/cli/build.md +8 -0
- package/docs/ja/cli/index.md +1 -1
- package/docs/ja/compiler.md +1 -1
- package/docs/ja/configuration.md +34 -17
- package/docs/ko/agent_skills.md +1 -1
- package/docs/ko/cli/build.md +8 -0
- package/docs/ko/cli/index.md +1 -1
- package/docs/ko/compiler.md +1 -1
- package/docs/ko/configuration.md +34 -17
- package/docs/pl/agent_skills.md +1 -1
- package/docs/pl/cli/build.md +8 -0
- package/docs/pl/cli/index.md +1 -1
- package/docs/pl/compiler.md +1 -1
- package/docs/pl/configuration.md +34 -17
- package/docs/pt/agent_skills.md +1 -1
- package/docs/pt/cli/build.md +8 -0
- package/docs/pt/cli/index.md +1 -1
- package/docs/pt/compiler.md +1 -1
- package/docs/pt/configuration.md +34 -17
- package/docs/ru/agent_skills.md +1 -1
- package/docs/ru/cli/build.md +8 -0
- package/docs/ru/cli/index.md +1 -1
- package/docs/ru/compiler.md +1 -1
- package/docs/ru/configuration.md +34 -17
- package/docs/tr/agent_skills.md +1 -1
- package/docs/tr/cli/build.md +8 -0
- package/docs/tr/cli/index.md +1 -1
- package/docs/tr/compiler.md +1 -1
- package/docs/tr/configuration.md +34 -17
- package/docs/uk/agent_skills.md +1 -1
- package/docs/uk/cli/build.md +8 -0
- package/docs/uk/cli/index.md +1 -1
- package/docs/uk/compiler.md +1 -1
- package/docs/uk/configuration.md +52 -6
- package/docs/vi/agent_skills.md +1 -1
- package/docs/vi/cli/build.md +8 -0
- package/docs/vi/cli/index.md +1 -1
- package/docs/vi/compiler.md +1 -1
- package/docs/vi/configuration.md +34 -17
- package/docs/zh/agent_skills.md +1 -1
- package/docs/zh/cli/build.md +8 -0
- package/docs/zh/cli/index.md +1 -1
- package/docs/zh/compiler.md +1 -1
- package/docs/zh/configuration.md +34 -17
- package/package.json +10 -11
- package/src/common.ts +2 -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/docs/uk/configuration.md
CHANGED
|
@@ -103,6 +103,7 @@ Intlayer підтримує формати файлів конфігурації
|
|
|
103
103
|
|
|
104
104
|
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
105
105
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
106
|
+
import { nextjsRewrite } from "intlayer/routing";
|
|
106
107
|
import { z } from "zod";
|
|
107
108
|
|
|
108
109
|
/**
|
|
@@ -209,12 +210,12 @@ const config: IntlayerConfig = {
|
|
|
209
210
|
/**
|
|
210
211
|
* Custom URL rewriting rules for locale-specific paths.
|
|
211
212
|
*/
|
|
212
|
-
rewrite: {
|
|
213
|
-
"/about": {
|
|
214
|
-
en: "/about",
|
|
215
|
-
fr: "/a-propos",
|
|
213
|
+
rewrite: nextjsRewrite({
|
|
214
|
+
"/[locale]/about": {
|
|
215
|
+
en: "/[locale]/about",
|
|
216
|
+
fr: "/[locale]/a-propos",
|
|
216
217
|
},
|
|
217
|
-
},
|
|
218
|
+
}),
|
|
218
219
|
},
|
|
219
220
|
|
|
220
221
|
/**
|
|
@@ -360,6 +361,12 @@ const config: IntlayerConfig = {
|
|
|
360
361
|
* Default: ['esm', 'cjs']
|
|
361
362
|
*/
|
|
362
363
|
outputFormat: ["esm"],
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Indicates if the build should check TypeScript types.
|
|
367
|
+
* Default: false
|
|
368
|
+
*/
|
|
369
|
+
checkTypes: false,
|
|
363
370
|
},
|
|
364
371
|
|
|
365
372
|
/**
|
|
@@ -434,7 +441,10 @@ const config: IntlayerConfig = {
|
|
|
434
441
|
/**
|
|
435
442
|
* Pattern to traverse the code to optimize.
|
|
436
443
|
*/
|
|
437
|
-
transformPattern: [
|
|
444
|
+
transformPattern: [
|
|
445
|
+
"**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}",
|
|
446
|
+
"!**/node_modules/**",
|
|
447
|
+
],
|
|
438
448
|
|
|
439
449
|
/**
|
|
440
450
|
* Pattern to exclude from the optimization.
|
|
@@ -655,6 +665,36 @@ export default config;
|
|
|
655
665
|
- URL буде `https://example.com/my-app/en`
|
|
656
666
|
- Якщо базовий шлях не встановлено, URL буде `https://example.com/en`
|
|
657
667
|
|
|
668
|
+
- **rewrite**:
|
|
669
|
+
- _Тип_: `Record<string, StrictModeLocaleMap<string>>`
|
|
670
|
+
- _За замовчуванням_: `undefined`
|
|
671
|
+
- _Опис_: Користувацькі правила перезапису URL, які перевизначають режим маршрутизації за замовчуванням для певних шляхів. Дозволяє визначати специфічні для локалі шляхи, які відрізняються від стандартної поведінки маршрутизації. Підтримує динамічні параметри маршруту з використанням синтаксису `[param]`.
|
|
672
|
+
- _Приклад_:
|
|
673
|
+
```typescript
|
|
674
|
+
routing: {
|
|
675
|
+
mode: "prefix-no-default", // Стратегія відкату
|
|
676
|
+
rewrite: nextjsRewrite({
|
|
677
|
+
"/[locale]/about": {
|
|
678
|
+
en: "/[locale]/about",
|
|
679
|
+
fr: "/[locale]/a-propos",
|
|
680
|
+
},
|
|
681
|
+
"/[locale]/product/[slug]": {
|
|
682
|
+
en: "/[locale]/product/[slug]",
|
|
683
|
+
fr: "/[locale]/produit/[slug]",
|
|
684
|
+
},
|
|
685
|
+
"/[locale]/blog/[category]/[id]": {
|
|
686
|
+
en: "/[locale]/blog/[category]/[id]",
|
|
687
|
+
fr: "/[locale]/journal/[category]/[id]",
|
|
688
|
+
},
|
|
689
|
+
}),
|
|
690
|
+
}
|
|
691
|
+
```
|
|
692
|
+
- _Примітка_: Правила перезапису мають пріоритет над поведінкою `mode` за замовчуванням. Якщо шлях відповідає правилу перезапису, буде використано локалізований шлях з конфігурації перезапису замість стандартного префікса локалі.
|
|
693
|
+
- _Примітка_: Динамічні параметри маршруту підтримуються з використанням нотації в квадратних дужках (наприклад, `[slug]`, `[id]`). Значення параметрів автоматично витягуються з URL та інтерполюються в перезаписаний шлях.
|
|
694
|
+
- _Примітка_: Працює з додатками Next.js та Vite. Middleware/proxy автоматично перезапише вхідні запити, щоб відповідати внутрішній структурі маршруту.
|
|
695
|
+
- _Примітка_: При генерації URL за допомогою `getLocalizedUrl()` правила перезапису автоматично застосовуються, якщо вони відповідають наданому шляху.
|
|
696
|
+
- _Посилання_: Для отримання додаткової інформації див. [Користувацьке перезаписування URL](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/custom_url_rewrites.md).
|
|
697
|
+
|
|
658
698
|
#### Атрибути cookie
|
|
659
699
|
|
|
660
700
|
При використанні зберігання в cookie ви можете налаштувати додаткові атрибути cookie:
|
|
@@ -1045,6 +1085,12 @@ Intlayer підтримує кількох постачальників ШІ д
|
|
|
1045
1085
|
- _Note_: Якщо встановлено в "live", лише ті словники, які містять віддалений контент і позначені прапорцем "live", будуть перетворені у live-режим. Інші будуть імпортовані динамічно як режим "dynamic" для оптимізації кількості запитів і швидкості завантаження.
|
|
1046
1086
|
- _Note_: У режимі live буде використовуватися Live Sync API для отримання словників. Якщо виклик API завершиться невдачею, словники будуть імпортовані динамічно в режимі "dynamic".
|
|
1047
1087
|
- _Note_: Ця опція не вплине на функції `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` та `useDictionaryDynamic`.
|
|
1088
|
+
- **checkTypes**:
|
|
1089
|
+
- _Type_: `boolean`
|
|
1090
|
+
- _Default_: `false`
|
|
1091
|
+
- _Description_: Вказує, чи повинна збірка перевіряти типи TypeScript та реєструвати помилки.
|
|
1092
|
+
- _Note_: Це може уповільнити процес збірки.
|
|
1093
|
+
|
|
1048
1094
|
- **outputFormat**:
|
|
1049
1095
|
- _Type_: `'esm' | 'cjs'`
|
|
1050
1096
|
- _Default_: `'esm'`
|
package/docs/vi/agent_skills.md
CHANGED
|
@@ -36,7 +36,7 @@ Khi bạn chạy lệnh này, nó sẽ:
|
|
|
36
36
|
|
|
37
37
|
1. Phát hiện framework mà bạn đang sử dụng (ví dụ: Next.js, React, Vite).
|
|
38
38
|
2. Hỏi bạn muốn cài kỹ năng cho nền tảng nào (Cursor, Windsurf, VS Code, OpenCode, Claude Code, GitHub Copilot Workspace, v.v.).
|
|
39
|
-
3. Tạo các tệp cấu hình cần thiết (chẳng hạn `.cursor/skills/
|
|
39
|
+
3. Tạo các tệp cấu hình cần thiết (chẳng hạn `.cursor/skills/intlayer-next-js/SKILL.md`, `.windsurf/skills/intlayer-next-js/SKILL.md`, `.opencode/skills/intlayer-next-js/SKILL.md`, `.vscode/mcp.json`, v.v.).
|
|
40
40
|
|
|
41
41
|
## Các nền tảng được hỗ trợ
|
|
42
42
|
|
package/docs/vi/cli/build.md
CHANGED
|
@@ -13,6 +13,10 @@ slugs:
|
|
|
13
13
|
- concept
|
|
14
14
|
- cli
|
|
15
15
|
- build
|
|
16
|
+
history:
|
|
17
|
+
- version: 8.1.5
|
|
18
|
+
date: 2026-02-23
|
|
19
|
+
changes: Thêm tùy chọn checkTypes
|
|
16
20
|
---
|
|
17
21
|
|
|
18
22
|
# Xây dựng Từ điển
|
|
@@ -62,3 +66,7 @@ Lệnh này sẽ tìm các tệp khai báo nội dung của bạn theo mặc đ
|
|
|
62
66
|
- **`--no-cache`**: Vô hiệu hóa bộ nhớ đệm.
|
|
63
67
|
|
|
64
68
|
> Ví dụ: `npx intlayer build --no-cache`
|
|
69
|
+
|
|
70
|
+
- **`--check-types`**: Kiểm tra các kiểu của tệp khai báo nội dung.
|
|
71
|
+
|
|
72
|
+
> Ví dụ: `npx intlayer build --check-types`
|
package/docs/vi/cli/index.md
CHANGED
|
@@ -135,7 +135,7 @@ Intlayer chấp nhận nhiều định dạng tệp cấu hình:
|
|
|
135
135
|
|
|
136
136
|
### Quản lý Thành phần
|
|
137
137
|
|
|
138
|
-
- **[Chuyển đổi Thành phần](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/
|
|
138
|
+
- **[Chuyển đổi Thành phần](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/extract.md)** - Chuyển đổi các thành phần hiện có để sử dụng Intlayer
|
|
139
139
|
|
|
140
140
|
### Cấu hình
|
|
141
141
|
|
package/docs/vi/compiler.md
CHANGED
|
@@ -49,7 +49,7 @@ Mặc dù trình biên dịch mang lại trải nghiệm "hoạt động ngay" t
|
|
|
49
49
|
|
|
50
50
|
Để có so sánh kiến trúc sâu hơn, xem bài viết blog [Compiler vs. Declarative i18n](https://github.com/aymericzip/intlayer/blob/main/docs/blog/vi/compiler_vs_declarative_i18n.md).
|
|
51
51
|
|
|
52
|
-
Như một giải pháp thay thế, để tự động hóa quy trình i18n của bạn trong khi vẫn giữ quyền kiểm soát hoàn toàn đối với nội dung của bạn, Intlayer cũng cung cấp lệnh tự động trích xuất `intlayer
|
|
52
|
+
Như một giải pháp thay thế, để tự động hóa quy trình i18n của bạn trong khi vẫn giữ quyền kiểm soát hoàn toàn đối với nội dung của bạn, Intlayer cũng cung cấp lệnh tự động trích xuất `intlayer extract` (xem [tài liệu CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/extract.md)), hoặc lệnh `Intlayer: extract content to Dictionary` từ tiện ích mở rộng Intlayer VS Code (xem [tài liệu tiện ích mở rộng VS Code](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/vs_code_extension.md)).
|
|
53
53
|
|
|
54
54
|
## Cách sử dụng
|
|
55
55
|
|
package/docs/vi/configuration.md
CHANGED
|
@@ -103,6 +103,7 @@ Intlayer chấp nhận các định dạng tệp cấu hình JSON, JS, MJS và T
|
|
|
103
103
|
|
|
104
104
|
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
105
105
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
106
|
+
import { nextjsRewrite } from "intlayer/routing";
|
|
106
107
|
import { z } from "zod";
|
|
107
108
|
|
|
108
109
|
/**
|
|
@@ -209,12 +210,12 @@ const config: IntlayerConfig = {
|
|
|
209
210
|
/**
|
|
210
211
|
* Custom URL rewriting rules for locale-specific paths.
|
|
211
212
|
*/
|
|
212
|
-
rewrite: {
|
|
213
|
-
"/about": {
|
|
214
|
-
en: "/about",
|
|
215
|
-
fr: "/a-propos",
|
|
213
|
+
rewrite: nextjsRewrite({
|
|
214
|
+
"/[locale]/about": {
|
|
215
|
+
en: "/[locale]/about",
|
|
216
|
+
fr: "/[locale]/a-propos",
|
|
216
217
|
},
|
|
217
|
-
},
|
|
218
|
+
}),
|
|
218
219
|
},
|
|
219
220
|
|
|
220
221
|
/**
|
|
@@ -360,6 +361,12 @@ const config: IntlayerConfig = {
|
|
|
360
361
|
* Default: ['esm', 'cjs']
|
|
361
362
|
*/
|
|
362
363
|
outputFormat: ["esm"],
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Indicates if the build should check TypeScript types.
|
|
367
|
+
* Default: false
|
|
368
|
+
*/
|
|
369
|
+
checkTypes: false,
|
|
363
370
|
},
|
|
364
371
|
|
|
365
372
|
/**
|
|
@@ -434,7 +441,10 @@ const config: IntlayerConfig = {
|
|
|
434
441
|
/**
|
|
435
442
|
* Pattern to traverse the code to optimize.
|
|
436
443
|
*/
|
|
437
|
-
transformPattern: [
|
|
444
|
+
transformPattern: [
|
|
445
|
+
"**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}",
|
|
446
|
+
"!**/node_modules/**",
|
|
447
|
+
],
|
|
438
448
|
|
|
439
449
|
/**
|
|
440
450
|
* Pattern to exclude from the optimization.
|
|
@@ -663,26 +673,27 @@ Các thiết lập kiểm soát hành vi routing, bao gồm cấu trúc URL, lư
|
|
|
663
673
|
```typescript
|
|
664
674
|
routing: {
|
|
665
675
|
mode: "prefix-no-default", // Chiến lược dự phòng
|
|
666
|
-
rewrite: {
|
|
667
|
-
"/about": {
|
|
668
|
-
en: "/about",
|
|
669
|
-
fr: "/a-propos",
|
|
676
|
+
rewrite: nextjsRewrite({
|
|
677
|
+
"/[locale]/about": {
|
|
678
|
+
en: "/[locale]/about",
|
|
679
|
+
fr: "/[locale]/a-propos",
|
|
670
680
|
},
|
|
671
|
-
"/product/[slug]": {
|
|
672
|
-
en: "/product/[slug]",
|
|
673
|
-
fr: "/produit/[slug]",
|
|
681
|
+
"/[locale]/product/[slug]": {
|
|
682
|
+
en: "/[locale]/product/[slug]",
|
|
683
|
+
fr: "/[locale]/produit/[slug]",
|
|
674
684
|
},
|
|
675
|
-
"/blog/[category]/[id]": {
|
|
676
|
-
en: "/blog/[category]/[id]",
|
|
677
|
-
fr: "/journal/[category]/[id]",
|
|
685
|
+
"/[locale]/blog/[category]/[id]": {
|
|
686
|
+
en: "/[locale]/blog/[category]/[id]",
|
|
687
|
+
fr: "/[locale]/journal/[category]/[id]",
|
|
678
688
|
},
|
|
679
|
-
},
|
|
689
|
+
}),
|
|
680
690
|
}
|
|
681
691
|
```
|
|
682
692
|
- _Lưu ý_: Các quy tắc viết lại có ưu tiên cao hơn hành vi `mode` mặc định. Nếu một đường dẫn khớp với quy tắc viết lại, đường dẫn đã được bản địa hóa từ cấu hình viết lại sẽ được sử dụng thay vì tiền tố ngôn ngữ tiêu chuẩn.
|
|
683
693
|
- _Lưu ý_: Tham số tuyến động được hỗ trợ bằng cách sử dụng ký hiệu ngoặc vuông (ví dụ: `[slug]`, `[id]`). Giá trị tham số được tự động trích xuất từ URL và nội suy vào đường dẫn đã viết lại.
|
|
684
694
|
- _Lưu ý_: Hoạt động với ứng dụng Next.js và Vite. Middleware/proxy sẽ tự động viết lại các yêu cầu đến để khớp với cấu trúc tuyến nội bộ.
|
|
685
695
|
- _Lưu ý_: Khi tạo URL bằng `getLocalizedUrl()`, các quy tắc viết lại được áp dụng tự động nếu chúng khớp với đường dẫn được cung cấp.
|
|
696
|
+
- _Tham khảo_: Để biết thêm thông tin, xem [Viết lại URL tùy chỉnh](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/custom_url_rewrites.md).
|
|
686
697
|
|
|
687
698
|
#### Thuộc tính Cookie
|
|
688
699
|
|
|
@@ -1062,6 +1073,12 @@ Các tùy chọn build áp dụng cho các plugin `@intlayer/babel` và `@intlay
|
|
|
1062
1073
|
- _Lưu ý_: Nếu được đặt thành "live", chỉ những từ điển bao gồm nội dung từ xa và được đánh dấu là "live" mới được chuyển đổi sang chế độ live. Các từ điển khác sẽ được nhập động dưới dạng chế độ "dynamic" để tối ưu số lượng truy vấn fetch và hiệu suất tải.
|
|
1063
1074
|
- _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".
|
|
1064
1075
|
- _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`.
|
|
1076
|
+
- **checkTypes**:
|
|
1077
|
+
- _Type_: `boolean`
|
|
1078
|
+
- _Default_: `false`
|
|
1079
|
+
- _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.
|
|
1080
|
+
- _Note_: Điều này có thể làm chậm quá trình xây dựng.
|
|
1081
|
+
|
|
1065
1082
|
- **outputFormat**:
|
|
1066
1083
|
- _Kiểu_: `'esm' | 'cjs'`
|
|
1067
1084
|
- _Mặc định_: `'esm'`
|
package/docs/zh/agent_skills.md
CHANGED
|
@@ -36,7 +36,7 @@ npx skills add aymericzip/intlayer-skills
|
|
|
36
36
|
|
|
37
37
|
1. 检测您正在使用的框架(例如 Next.js、React、Vite)。
|
|
38
38
|
2. 询问您要为哪些平台安装技能(Cursor、Windsurf、VS Code、OpenCode、Claude Code、GitHub Copilot Workspace 等)。
|
|
39
|
-
3. 生成所需的配置文件(例如 `.cursor/skills/
|
|
39
|
+
3. 生成所需的配置文件(例如 `.cursor/skills/intlayer-next-js/SKILL.md`、`.windsurf/skills/intlayer-next-js/SKILL.md`、`.opencode/skills/intlayer-next-js/SKILL.md`、`.vscode/mcp.json` 等)。
|
|
40
40
|
|
|
41
41
|
## 支持的平台
|
|
42
42
|
|
package/docs/zh/cli/build.md
CHANGED
|
@@ -13,6 +13,10 @@ slugs:
|
|
|
13
13
|
- concept
|
|
14
14
|
- cli
|
|
15
15
|
- build
|
|
16
|
+
history:
|
|
17
|
+
- version: 8.1.5
|
|
18
|
+
date: 2026-02-23
|
|
19
|
+
changes: 添加 checkTypes 选项
|
|
16
20
|
---
|
|
17
21
|
|
|
18
22
|
# 构建字典
|
|
@@ -62,3 +66,7 @@ npx intlayer build --watch
|
|
|
62
66
|
- **`--no-cache`**:禁用缓存。
|
|
63
67
|
|
|
64
68
|
> 示例:`npx intlayer build --no-cache`
|
|
69
|
+
|
|
70
|
+
- **`--check-types`**: 检查内容声明文件的类型。
|
|
71
|
+
|
|
72
|
+
> 示例: `npx intlayer build --check-types`
|
package/docs/zh/cli/index.md
CHANGED
|
@@ -134,7 +134,7 @@ Intlayer 支持多种配置文件格式:
|
|
|
134
134
|
|
|
135
135
|
### 组件管理
|
|
136
136
|
|
|
137
|
-
- **[转换组件](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/cli/
|
|
137
|
+
- **[转换组件](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/cli/extract.md)** - 转换现有组件以使用 Intlayer
|
|
138
138
|
|
|
139
139
|
### 配置
|
|
140
140
|
|
package/docs/zh/compiler.md
CHANGED
|
@@ -49,7 +49,7 @@ history:
|
|
|
49
49
|
|
|
50
50
|
有关更深入的架构比较,请参阅博客文章[Compiler vs. Declarative i18n](https://github.com/aymericzip/intlayer/blob/main/docs/blog/zh/compiler_vs_declarative_i18n.md)。
|
|
51
51
|
|
|
52
|
-
作为替代方案,为了在保持对内容的完全控制的同时自动化您的 i18n 流程,Intlayer 还提供了自动提取命令 `intlayer
|
|
52
|
+
作为替代方案,为了在保持对内容的完全控制的同时自动化您的 i18n 流程,Intlayer 还提供了自动提取命令 `intlayer extract`(请参阅[CLI 文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/cli/extract.md)),或 Intlayer VS Code 扩展的 `Intlayer: extract content to Dictionary` 命令(请参阅[VS Code 扩展文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/vs_code_extension.md))。
|
|
53
53
|
|
|
54
54
|
## 使用方法
|
|
55
55
|
|
package/docs/zh/configuration.md
CHANGED
|
@@ -88,6 +88,7 @@ Intlayer 支持 JSON、JS、MJS 和 TS 配置文件格式:
|
|
|
88
88
|
|
|
89
89
|
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
90
90
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
91
|
+
import { nextjsRewrite } from "intlayer/routing";
|
|
91
92
|
import { z } from "zod";
|
|
92
93
|
|
|
93
94
|
/**
|
|
@@ -194,12 +195,12 @@ const config: IntlayerConfig = {
|
|
|
194
195
|
/**
|
|
195
196
|
* Custom URL rewriting rules for locale-specific paths.
|
|
196
197
|
*/
|
|
197
|
-
rewrite: {
|
|
198
|
-
"/about": {
|
|
199
|
-
en: "/about",
|
|
200
|
-
fr: "/a-propos",
|
|
198
|
+
rewrite: nextjsRewrite({
|
|
199
|
+
"/[locale]/about": {
|
|
200
|
+
en: "/[locale]/about",
|
|
201
|
+
fr: "/[locale]/a-propos",
|
|
201
202
|
},
|
|
202
|
-
},
|
|
203
|
+
}),
|
|
203
204
|
},
|
|
204
205
|
|
|
205
206
|
/**
|
|
@@ -345,6 +346,12 @@ const config: IntlayerConfig = {
|
|
|
345
346
|
* Default: ['esm', 'cjs']
|
|
346
347
|
*/
|
|
347
348
|
outputFormat: ["esm"],
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Indicates if the build should check TypeScript types.
|
|
352
|
+
* Default: false
|
|
353
|
+
*/
|
|
354
|
+
checkTypes: false,
|
|
348
355
|
},
|
|
349
356
|
|
|
350
357
|
/**
|
|
@@ -419,7 +426,10 @@ const config: IntlayerConfig = {
|
|
|
419
426
|
/**
|
|
420
427
|
* Pattern to traverse the code to optimize.
|
|
421
428
|
*/
|
|
422
|
-
transformPattern: [
|
|
429
|
+
transformPattern: [
|
|
430
|
+
"**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}",
|
|
431
|
+
"!**/node_modules/**",
|
|
432
|
+
],
|
|
423
433
|
|
|
424
434
|
/**
|
|
425
435
|
* Pattern to exclude from the optimization.
|
|
@@ -632,26 +642,27 @@ export default config;
|
|
|
632
642
|
```typescript
|
|
633
643
|
routing: {
|
|
634
644
|
mode: "prefix-no-default", // 回退策略
|
|
635
|
-
rewrite: {
|
|
636
|
-
"/about": {
|
|
637
|
-
en: "/about",
|
|
638
|
-
fr: "/a-propos",
|
|
645
|
+
rewrite: nextjsRewrite({
|
|
646
|
+
"/[locale]/about": {
|
|
647
|
+
en: "/[locale]/about",
|
|
648
|
+
fr: "/[locale]/a-propos",
|
|
639
649
|
},
|
|
640
|
-
"/product/[slug]": {
|
|
641
|
-
en: "/product/[slug]",
|
|
642
|
-
fr: "/produit/[slug]",
|
|
650
|
+
"/[locale]/product/[slug]": {
|
|
651
|
+
en: "/[locale]/product/[slug]",
|
|
652
|
+
fr: "/[locale]/produit/[slug]",
|
|
643
653
|
},
|
|
644
|
-
"/blog/[category]/[id]": {
|
|
645
|
-
en: "/blog/[category]/[id]",
|
|
646
|
-
fr: "/journal/[category]/[id]",
|
|
654
|
+
"/[locale]/blog/[category]/[id]": {
|
|
655
|
+
en: "/[locale]/blog/[category]/[id]",
|
|
656
|
+
fr: "/[locale]/journal/[category]/[id]",
|
|
647
657
|
},
|
|
648
|
-
},
|
|
658
|
+
}),
|
|
649
659
|
}
|
|
650
660
|
```
|
|
651
661
|
- _说明_: 重写规则优先于默认的 `mode` 行为。如果路径匹配重写规则,将使用重写配置中的本地化路径,而不是标准语言前缀。
|
|
652
662
|
- _说明_: 支持使用方括号表示法的动态路由参数(例如 `[slug]`、`[id]`)。参数值会自动从 URL 中提取并插入到重写的路径中。
|
|
653
663
|
- _说明_: 适用于 Next.js 和 Vite 应用程序。中间件/代理会自动重写传入的请求以匹配内部路由结构。
|
|
654
664
|
- _说明_: 使用 `getLocalizedUrl()` 生成 URL 时,如果重写规则与提供的路径匹配,将自动应用这些规则。
|
|
665
|
+
- _参考_: 有关更多信息,请参阅 [自定义 URL 重写](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/custom_url_rewrites.md)。
|
|
655
666
|
|
|
656
667
|
- **serverSetCookie**:
|
|
657
668
|
- _类型_:`string`
|
|
@@ -933,6 +944,12 @@ Intlayer 支持多个 AI 提供商,以增强灵活性和选择。目前支持
|
|
|
933
944
|
- _注意_:如果为 'manual',构建仅在执行构建命令时设置。
|
|
934
945
|
- _注意_:可用于禁用字典构建,例如当应避免在 Node.js 环境中执行时。
|
|
935
946
|
|
|
947
|
+
- **checkTypes**:
|
|
948
|
+
- _Type_: `boolean`
|
|
949
|
+
- _Default_: `false`
|
|
950
|
+
- _Description_: 指示构建是否应检查 TypeScript 类型并记录错误。
|
|
951
|
+
- _Note_: 这可能会减慢构建速度。
|
|
952
|
+
|
|
936
953
|
- **optimize**:
|
|
937
954
|
- _类型_:`boolean`
|
|
938
955
|
- _默认值_:`process.env.NODE_ENV === 'production'`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/docs",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Intlayer documentation",
|
|
6
6
|
"keywords": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"scripts": {
|
|
51
51
|
"_prepublish": "cp -f ../README.md ./README.md",
|
|
52
|
-
"prebuild": "
|
|
52
|
+
"prebuild": "bun tools/generateEntry.ts",
|
|
53
53
|
"build": "tsdown --config tsdown.config.ts",
|
|
54
54
|
"build:ci": "tsdown --config tsdown.config.ts",
|
|
55
55
|
"clean": "rimraf ./dist .turbo",
|
|
@@ -65,29 +65,28 @@
|
|
|
65
65
|
"review": "bun tools/review.ts",
|
|
66
66
|
"serve": "webpack serve --config ./webpack.config.ts",
|
|
67
67
|
"test": "vitest run",
|
|
68
|
-
"test:markdown": "
|
|
68
|
+
"test:markdown": "bun tools/markdownFormatting.ts",
|
|
69
69
|
"test:watch": "vitest",
|
|
70
|
-
"translate": "
|
|
70
|
+
"translate": "bun tools/translate.ts",
|
|
71
71
|
"transpile": "webpack --config ./webpack.config.ts",
|
|
72
72
|
"typecheck": "tsc --noEmit --project tsconfig.types.json",
|
|
73
73
|
"watch": "webpack --config ./webpack.config.ts --watch"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@intlayer/config": "8.1.
|
|
77
|
-
"@intlayer/core": "8.1.
|
|
78
|
-
"@intlayer/types": "8.1.
|
|
76
|
+
"@intlayer/config": "8.1.6",
|
|
77
|
+
"@intlayer/core": "8.1.6",
|
|
78
|
+
"@intlayer/types": "8.1.6"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@intlayer/api": "8.1.
|
|
82
|
-
"@intlayer/cli": "8.1.
|
|
83
|
-
"@types/node": "25.
|
|
81
|
+
"@intlayer/api": "8.1.6",
|
|
82
|
+
"@intlayer/cli": "8.1.6",
|
|
83
|
+
"@types/node": "25.3.0",
|
|
84
84
|
"@utils/ts-config": "1.0.4",
|
|
85
85
|
"@utils/ts-config-types": "1.0.4",
|
|
86
86
|
"@utils/tsdown-config": "1.0.4",
|
|
87
87
|
"fast-glob": "3.3.3",
|
|
88
88
|
"rimraf": "6.1.3",
|
|
89
89
|
"tsdown": "0.20.3",
|
|
90
|
-
"tsx": "4.20.6",
|
|
91
90
|
"typescript": "5.9.3",
|
|
92
91
|
"vitest": "4.0.18"
|
|
93
92
|
},
|
package/src/common.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
|
-
import { getLocalizedUrl
|
|
2
|
+
import { getLocalizedUrl } from '@intlayer/core/localization';
|
|
3
|
+
import { getMarkdownMetadata } from '@intlayer/core/transpiler';
|
|
3
4
|
import { Locales, type LocalesValues } from '@intlayer/types';
|
|
4
5
|
|
|
5
6
|
export const defaultLocale = Locales.ENGLISH;
|
|
@@ -4,7 +4,7 @@ import { existsSync } from 'node:fs';
|
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
5
|
import { join, dirname as pathDirname } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { getPackageJsonPath, getProjectRequire } from '@intlayer/config';
|
|
7
|
+
import { getPackageJsonPath, getProjectRequire } from '@intlayer/config/utils';
|
|
8
8
|
import type { LocalesValues } from '@intlayer/types';
|
|
9
9
|
|
|
10
10
|
// Robustly resolve the base directory of the @intlayer/docs package in both
|
|
@@ -4,7 +4,7 @@ import { existsSync } from 'node:fs';
|
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
5
|
import { join, dirname as pathDirname } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { getPackageJsonPath, getProjectRequire } from '@intlayer/config';
|
|
7
|
+
import { getPackageJsonPath, getProjectRequire } from '@intlayer/config/utils';
|
|
8
8
|
import type { LocalesValues } from '@intlayer/types';
|
|
9
9
|
|
|
10
10
|
// Robustly resolve the base directory of the @intlayer/docs package in both
|
|
@@ -4,7 +4,7 @@ import { existsSync } from 'node:fs';
|
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
5
|
import { join, dirname as pathDirname } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { getPackageJsonPath, getProjectRequire } from '@intlayer/config';
|
|
7
|
+
import { getPackageJsonPath, getProjectRequire } from '@intlayer/config/utils';
|
|
8
8
|
import type { LocalesValues } from '@intlayer/types';
|
|
9
9
|
|
|
10
10
|
// Robustly resolve the base directory of the @intlayer/docs package in both
|
|
@@ -4,7 +4,7 @@ import { existsSync } from 'node:fs';
|
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
5
|
import { join, dirname as pathDirname } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { getPackageJsonPath, getProjectRequire } from '@intlayer/config';
|
|
7
|
+
import { getPackageJsonPath, getProjectRequire } from '@intlayer/config/utils';
|
|
8
8
|
import type { LocalesValues } from '@intlayer/types';
|
|
9
9
|
|
|
10
10
|
// Robustly resolve the base directory of the @intlayer/docs package in both
|