@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
@@ -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
- * Вказує, чи повинні компоненти зберігатися після трансформації.
147
- * Таким чином, компілятор можна запустити один раз для трансформації додатка, після чого його можна видалити.
154
+ * Вказує, чи мають компоненти зберігатися після трансформації.
155
+ * Таким чином компілятор можна запустити лише один раз для трансформації додатка, а потім видалити.
148
156
  */
149
157
  saveComponents: false,
150
158
  },
@@ -437,12 +437,33 @@ export const Route = createFileRoute("/{-$locale}/")({
437
437
  component: RouteComponent,
438
438
  head: ({ params }) => {
439
439
  const { locale } = params;
440
+ const path = "/"; // The path for this route
441
+
440
442
  const metaContent = getIntlayer("app", locale);
441
443
 
442
444
  return {
445
+ links: [
446
+ // Canonical link: Points to the current localized page
447
+ { rel: "canonical", href: getLocalizedUrl(path, locale) },
448
+
449
+ // Hreflang: Tell Google about all localized versions
450
+ ...localeMap(({ locale: mapLocale }) => ({
451
+ rel: "alternate",
452
+ hrefLang: mapLocale,
453
+ href: getLocalizedUrl(path, mapLocale),
454
+ })),
455
+
456
+ // x-default: For users in unmatched languages
457
+ // Define the default fallback locale (usually your primary language)
458
+ {
459
+ rel: "alternate",
460
+ hrefLang: "x-default",
461
+ href: getLocalizedUrl(path, defaultLocale),
462
+ },
463
+ ],
443
464
  meta: [
444
465
  { title: metaContent.title },
445
- { content: metaContent.meta.description, name: "description" },
466
+ { name: "description", content: metaContent.meta.description },
446
467
  ],
447
468
  };
448
469
  },
@@ -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: Початковий реліз
@@ -125,23 +128,28 @@ const config: IntlayerConfig = {
125
128
  },
126
129
  compiler: {
127
130
  /**
128
- * Вказує, чи повинен бути включений компілятор.
131
+ * Вказує, чи має бути увімкнено компілятор.
129
132
  */
130
133
  enabled: true,
131
134
 
132
135
  /**
133
136
  * Вихідний каталог для оптимізованих словників.
134
137
  */
135
- outputDir: "compiler",
138
+ output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
139
+
140
+ /**
141
+ * Вставте лише вміст у згенерований файл, без ключа.
142
+ */
143
+ noMetadata: false,
136
144
 
137
145
  /**
138
146
  * Префікс ключа словника
139
147
  */
140
- dictionaryKeyPrefix: "", // Видалити базовий префікс
148
+ dictionaryKeyPrefix: "", // Remove base prefix
141
149
 
142
150
  /**
143
- * Вказує, чи повинні компоненти зберігатися після трансформації.
144
- * Таким чином, компілятор можна запустити один раз для трансформації додатка, після чого його можна видалити.
151
+ * Вказує, чи мають компоненти зберігатися після трансформації.
152
+ * Таким чином компілятор можна запустити лише один раз для трансформації додатка, а потім видалити.
145
153
  */
146
154
  saveComponents: false,
147
155
  },
@@ -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.
@@ -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: Cấu hình
5
5
  description: Tìm hiểu cách cấu hình Intlayer cho ứng dụng của bạn. Hiểu các thiết lập và tùy chọn khác nhau để tùy chỉnh Intlayer theo nhu cầu của bạn.
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: Di chuyển 'baseDir' từ cấu hình 'content' sang cấu hình 'system'
20
+ - version: 8.2.0
21
+ date: 2026-03-09
22
+ changes: Cập nhật các tùy chọn trình biên dịch, thêm hỗ trợ 'output' và 'noMetadata'
17
23
  - version: 8.1.7
18
24
  date: 2026-02-25
19
25
  changes: Cập nhật các tùy chọn trình biên dịch
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: Thêm hỗ trợ cho các nhà cung cấp 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: Thêm `dataSerialization` vào cấu hình AI
26
32
  - version: 8.0.0
27
33
  date: 2026-01-22
28
- changes: Move `importMode` build configuration to `dictionary` configuration.
34
+ changes: Di chuyển cấu hình build importMode sang cấu hình từ điển.
29
35
  - version: 8.0.0
30
36
  date: 2026-01-18
31
37
  changes: Tách cấu hình hệ thống khỏi cấu hình nội dung. Di chuyển các đường dẫn nội bộ sang thuộc tính `system`. Thêm `codeDir` để tách các tệp nội dung khỏi việc chuyển đổi mã.
@@ -437,7 +443,7 @@ const config: IntlayerConfig = {
437
443
  */
438
444
  compiler: {
439
445
  /**
440
- * Indicates if the compiler should be enabled.
446
+ * Cho biết trình biên dịch nên được bật hay không.
441
447
  */
442
448
  enabled: true,
443
449
 
@@ -455,18 +461,23 @@ const config: IntlayerConfig = {
455
461
  excludePattern: ["**/node_modules/**"],
456
462
 
457
463
  /**
458
- * Output directory for the optimized dictionaries.
464
+ * Thư mục đầu ra cho các từ điển được tối ưu hóa.
459
465
  */
460
- outputDir: "compiler",
466
+ output: ({ key }) => `compiler/${key}.content.json`,
461
467
 
462
468
  /**
463
- * Dictionary key prefix
469
+ * Chỉ chèn nội dung vào tệp đã tạo, không có khóa.
470
+ */
471
+ noMetadata: false,
472
+
473
+ /**
474
+ * Tiền tố khóa từ điển
464
475
  */
465
476
  dictionaryKeyPrefix: "", // Remove base prefix
466
477
 
467
478
  /**
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.
479
+ * 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.
480
+ * 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
481
  */
471
482
  saveComponents: false,
472
483
  },
@@ -728,6 +739,50 @@ Khi sử dụng localStorage hoặc sessionStorage:
728
739
  - **type**: Loại lưu trữ (`'localStorage' | 'sessionStorage'`)
729
740
  - **name**: Tên khóa lưu trữ (mặc định: `'INTLAYER_LOCALE'`)
730
741
 
742
+ ### Cấu hình Hệ thống
743
+
744
+ Các cài đặt liên quan đến đường dẫn nội bộ và kết quả đầu ra của Intlayer. Các cài đặt này thường mang tính nội bộ và người dùng không cần phải sửa đổi.
745
+
746
+ #### Thuộc tính
747
+
748
+ - **baseDir**:
749
+ - _Kiểu_: `string`
750
+ - _Mặc định_: `process.cwd()`
751
+ - _Mô tả_: Thư mục gốc của dự án.
752
+ - _Ví dụ_: `'/path/to/project'`
753
+ - _Lưu ý_: Được sử dụng để giải quyết tất cả các thư mục liên quan đến Intlayer.
754
+
755
+ - **dictionariesDir**:
756
+ - _Kiểu_: `string`
757
+ - _Mặc định_: `'.intlayer/dictionary'`
758
+ - _Mô tả_: Đường dẫn thư mục để lưu trữ các từ điển bản địa hóa.
759
+ - _Ví dụ_: `'translations'`
760
+
761
+ - **moduleAugmentationDir**:
762
+ - _Kiểu_: `string`
763
+ - _Mặc định_: `'.intlayer/types'`
764
+ - _Mô tả_: Thư mục dành cho việc mở rộng module, giúp IDE gợi ý và kiểm tra kiểu tốt hơn.
765
+ - _Ví dụ_: `'intlayer-types'`
766
+ - _Lưu ý_: Hãy chắc chắn bao gồm thư mục này trong `tsconfig.json`.
767
+
768
+ - **unmergedDictionariesDir**:
769
+ - _Kiểu_: `string`
770
+ - _Mặc định_: `'.intlayer/unmerged_dictionary'`
771
+ - _Mô tả_: Thư mục để lưu trữ các từ điển chưa được hợp nhất.
772
+ - _Ví dụ_: `'translations'`
773
+
774
+ - **typesDir**:
775
+ - _Kiểu_: `string`
776
+ - _Mặc định_: `'types'`
777
+ - _Mô tả_: Thư mục để lưu trữ các kiểu của từ điển.
778
+ - _Ví dụ_: `'intlayer-types'`
779
+
780
+ - **mainDir**:
781
+ - _Kiểu_: `string`
782
+ - _Mặc định_: `'main'`
783
+ - _Mô tả_: Thư mục nơi lưu trữ các tệp chính của ứng dụng.
784
+ - _Ví dụ_: `'intlayer-main'`
785
+
731
786
  #### Ví dụ cấu hình
732
787
 
733
788
  Dưới đây là một số ví dụ cấu hình phổ biến cho cấu trúc routing mới v7:
@@ -842,13 +897,6 @@ Các thiết lập liên quan đến việc xử lý nội dung trong ứng dụ
842
897
  - _Ví dụ_: `['.data.ts', '.data.js', '.data.json']`
843
898
  - _Lưu ý_: Tùy chỉnh phần mở rộng tệp có thể giúp tránh xung đột.
844
899
 
845
- - **baseDir**:
846
- - _Kiểu_: `string`
847
- - _Mặc định_: `process.cwd()`
848
- - _Mô tả_: Thư mục gốc của dự án.
849
- - _Ví dụ_: `'/path/to/project'`
850
- - _Lưu ý_: Được sử dụng để giải quyết tất cả các thư mục liên quan đến Intlayer.
851
-
852
900
  - **contentDir**:
853
901
  - _Kiểu_: `string[]`
854
902
  - _Mặc định_: `['.']`
@@ -1073,7 +1121,7 @@ Các tùy chọn build áp dụng cho các plugin `@intlayer/babel` và `@intlay
1073
1121
  - _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
1122
 
1075
1123
  - **importMode**:
1076
- - _Note_: **Deprecated**: Use `dictionary.importMode` instead.
1124
+ - _Ghi chú_: **Deprecated**: Use `dictionary.importMode` instead.
1077
1125
  - _Kiểu_: `'static' | 'dynamic' | 'fetch'`
1078
1126
  - _Mặc định_: `'static'`
1079
1127
  - _Mô tả_: Điều khiển cách các từ điển được nhập.
@@ -1091,10 +1139,10 @@ Các tùy chọn build áp dụng cho các plugin `@intlayer/babel` và `@intlay
1091
1139
  - _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
1140
  - _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
1141
  - **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.
1142
+ - _Loại_: `boolean`
1143
+ - _Mặc định_: `false`
1144
+ - _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.
1145
+ - _Ghi chú_: Điều này có thể làm chậm quá trình xây dựng.
1098
1146
 
1099
1147
  - **outputFormat**:
1100
1148
  - _Kiểu_: `'esm' | 'cjs'`
@@ -1157,3 +1205,31 @@ Các cài đặt kiểm soát trình biên dịch Intlayer, trình biên dịch
1157
1205
  - _Kiểu_: `string`
1158
1206
  - _Mặc định_: `'compiler'`
1159
1207
  - _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.
1208
+
1209
+ - **output**:
1210
+ - _Loại_: `FilePathPattern`
1211
+ - _Mặc định_: `({ key }) => 'compiler/${key}.content.json'`
1212
+ - _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.
1213
+ - _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.
1214
+ - _Ví dụ_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
1215
+
1216
+ - **noMetadata**:
1217
+ - _Loại_: `boolean`
1218
+ - _Mặc định_: `false`
1219
+ - _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).
1220
+ - _Ghi chú_: Hữu ích nếu được sử dụng với plugin `loadJSON`.
1221
+ - _Ví dụ_: Nếu `true`:
1222
+ ```json
1223
+ {
1224
+ "key": "value"
1225
+ }
1226
+ ```
1227
+ Nếu `false`:
1228
+ ```json
1229
+ {
1230
+ "key": "value",
1231
+ "content": {
1232
+ "key": "value"
1233
+ }
1234
+ }
1235
+ ```
@@ -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
  },
@@ -437,12 +437,33 @@ export const Route = createFileRoute("/{-$locale}/")({
437
437
  component: RouteComponent,
438
438
  head: ({ params }) => {
439
439
  const { locale } = params;
440
+ const path = "/"; // The path for this route
441
+
440
442
  const metaContent = getIntlayer("app", locale);
441
443
 
442
444
  return {
445
+ links: [
446
+ // Canonical link: Points to the current localized page
447
+ { rel: "canonical", href: getLocalizedUrl(path, locale) },
448
+
449
+ // Hreflang: Tell Google about all localized versions
450
+ ...localeMap(({ locale: mapLocale }) => ({
451
+ rel: "alternate",
452
+ hrefLang: mapLocale,
453
+ href: getLocalizedUrl(path, mapLocale),
454
+ })),
455
+
456
+ // x-default: For users in unmatched languages
457
+ // Define the default fallback locale (usually your primary language)
458
+ {
459
+ rel: "alternate",
460
+ hrefLang: "x-default",
461
+ href: getLocalizedUrl(path, defaultLocale),
462
+ },
463
+ ],
443
464
  meta: [
444
465
  { title: metaContent.title },
445
- { content: metaContent.meta.description, name: "description" },
466
+ { name: "description", content: metaContent.meta.description },
446
467
  ],
447
468
  };
448
469
  },
@@ -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
  },