@intlayer/docs 8.3.0-canary.4 → 8.3.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 (240) hide show
  1. package/docs/ar/compiler.md +84 -49
  2. package/docs/ar/configuration.md +80 -37
  3. package/docs/ar/intlayer_with_nextjs_16.md +174 -1
  4. package/docs/ar/intlayer_with_nextjs_compiler.md +174 -1
  5. package/docs/ar/intlayer_with_react_router_v7.md +224 -1
  6. package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +225 -1
  7. package/docs/ar/intlayer_with_svelte_kit.md +175 -2
  8. package/docs/ar/intlayer_with_tanstack.md +176 -1
  9. package/docs/ar/intlayer_with_vite+preact.md +174 -1
  10. package/docs/ar/intlayer_with_vite+react.md +174 -1
  11. package/docs/ar/intlayer_with_vite+solid.md +174 -1
  12. package/docs/ar/intlayer_with_vite+svelte.md +174 -1
  13. package/docs/ar/intlayer_with_vite+vue.md +174 -1
  14. package/docs/de/compiler.md +83 -48
  15. package/docs/de/configuration.md +434 -212
  16. package/docs/de/intlayer_with_nextjs_16.md +176 -1
  17. package/docs/de/intlayer_with_nextjs_compiler.md +106 -349
  18. package/docs/de/intlayer_with_react_router_v7.md +225 -2
  19. package/docs/de/intlayer_with_react_router_v7_fs_routes.md +221 -79
  20. package/docs/de/intlayer_with_svelte_kit.md +158 -2
  21. package/docs/de/intlayer_with_tanstack.md +159 -1
  22. package/docs/de/intlayer_with_vite+preact.md +157 -1
  23. package/docs/de/intlayer_with_vite+react.md +157 -1
  24. package/docs/de/intlayer_with_vite+solid.md +159 -3
  25. package/docs/de/intlayer_with_vite+svelte.md +157 -1
  26. package/docs/de/intlayer_with_vite+vue.md +157 -1
  27. package/docs/en/compiler.md +60 -33
  28. package/docs/en/configuration.md +80 -57
  29. package/docs/en/intlayer_with_nextjs_16.md +176 -0
  30. package/docs/en/intlayer_with_nextjs_compiler.md +179 -1
  31. package/docs/en/intlayer_with_react_router_v7.md +159 -0
  32. package/docs/en/intlayer_with_react_router_v7_fs_routes.md +159 -0
  33. package/docs/en/intlayer_with_svelte_kit.md +159 -0
  34. package/docs/en/intlayer_with_tanstack.md +160 -1
  35. package/docs/en/intlayer_with_vite+preact.md +159 -0
  36. package/docs/en/intlayer_with_vite+react.md +159 -0
  37. package/docs/en/intlayer_with_vite+solid.md +148 -27
  38. package/docs/en/intlayer_with_vite+svelte.md +159 -0
  39. package/docs/en/intlayer_with_vite+vue.md +142 -41
  40. package/docs/en-GB/compiler.md +66 -34
  41. package/docs/en-GB/configuration.md +78 -36
  42. package/docs/es/compiler.md +83 -48
  43. package/docs/es/configuration.md +429 -206
  44. package/docs/es/intlayer_with_adonisjs.md +1 -1
  45. package/docs/es/intlayer_with_express.md +1 -1
  46. package/docs/es/intlayer_with_fastify.md +1 -1
  47. package/docs/es/intlayer_with_hono.md +1 -1
  48. package/docs/es/intlayer_with_nestjs.md +1 -1
  49. package/docs/es/intlayer_with_nextjs_16.md +176 -3
  50. package/docs/es/intlayer_with_nextjs_compiler.md +175 -2
  51. package/docs/es/intlayer_with_nuxt.md +1 -1
  52. package/docs/es/intlayer_with_react_router_v7.md +227 -4
  53. package/docs/es/intlayer_with_react_router_v7_fs_routes.md +162 -4
  54. package/docs/es/intlayer_with_svelte_kit.md +158 -2
  55. package/docs/es/intlayer_with_tanstack.md +160 -2
  56. package/docs/es/intlayer_with_vite+preact.md +162 -6
  57. package/docs/es/intlayer_with_vite+react.md +160 -4
  58. package/docs/es/intlayer_with_vite+solid.md +163 -7
  59. package/docs/es/intlayer_with_vite+svelte.md +157 -1
  60. package/docs/es/intlayer_with_vite+vue.md +165 -9
  61. package/docs/fr/compiler.md +81 -46
  62. package/docs/fr/configuration.md +355 -134
  63. package/docs/fr/intlayer_with_adonisjs.md +1 -1
  64. package/docs/fr/intlayer_with_express.md +1 -1
  65. package/docs/fr/intlayer_with_fastify.md +1 -1
  66. package/docs/fr/intlayer_with_hono.md +1 -1
  67. package/docs/fr/intlayer_with_nestjs.md +1 -1
  68. package/docs/fr/intlayer_with_nextjs_16.md +183 -7
  69. package/docs/fr/intlayer_with_nextjs_compiler.md +179 -3
  70. package/docs/fr/intlayer_with_react_router_v7.md +229 -3
  71. package/docs/fr/intlayer_with_react_router_v7_fs_routes.md +237 -6
  72. package/docs/fr/intlayer_with_svelte_kit.md +158 -2
  73. package/docs/fr/intlayer_with_tanstack.md +159 -1
  74. package/docs/fr/intlayer_with_vite+preact.md +164 -8
  75. package/docs/fr/intlayer_with_vite+react.md +162 -6
  76. package/docs/fr/intlayer_with_vite+solid.md +163 -7
  77. package/docs/fr/intlayer_with_vite+svelte.md +157 -1
  78. package/docs/fr/intlayer_with_vite+vue.md +164 -8
  79. package/docs/hi/compiler.md +81 -46
  80. package/docs/hi/configuration.md +87 -44
  81. package/docs/hi/intlayer_with_nextjs_16.md +174 -1
  82. package/docs/hi/intlayer_with_nextjs_compiler.md +174 -1
  83. package/docs/hi/intlayer_with_react_router_v7.md +224 -1
  84. package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +225 -1
  85. package/docs/hi/intlayer_with_svelte_kit.md +158 -2
  86. package/docs/hi/intlayer_with_tanstack.md +159 -1
  87. package/docs/hi/intlayer_with_vite+preact.md +157 -1
  88. package/docs/hi/intlayer_with_vite+react.md +157 -1
  89. package/docs/hi/intlayer_with_vite+solid.md +157 -1
  90. package/docs/hi/intlayer_with_vite+svelte.md +157 -1
  91. package/docs/hi/intlayer_with_vite+vue.md +157 -1
  92. package/docs/id/compiler.md +84 -51
  93. package/docs/id/configuration.md +83 -45
  94. package/docs/id/intlayer_with_nextjs_16.md +174 -1
  95. package/docs/id/intlayer_with_nextjs_compiler.md +174 -1
  96. package/docs/id/intlayer_with_react_router_v7.md +224 -1
  97. package/docs/id/intlayer_with_react_router_v7_fs_routes.md +225 -1
  98. package/docs/id/intlayer_with_svelte_kit.md +158 -2
  99. package/docs/id/intlayer_with_tanstack.md +159 -1
  100. package/docs/id/intlayer_with_vite+preact.md +157 -1
  101. package/docs/id/intlayer_with_vite+react.md +157 -1
  102. package/docs/id/intlayer_with_vite+solid.md +157 -1
  103. package/docs/id/intlayer_with_vite+svelte.md +157 -1
  104. package/docs/id/intlayer_with_vite+vue.md +157 -1
  105. package/docs/it/compiler.md +81 -46
  106. package/docs/it/configuration.md +426 -204
  107. package/docs/it/intlayer_with_nextjs_16.md +174 -1
  108. package/docs/it/intlayer_with_nextjs_compiler.md +174 -1
  109. package/docs/it/intlayer_with_react_router_v7.md +225 -2
  110. package/docs/it/intlayer_with_react_router_v7_fs_routes.md +226 -2
  111. package/docs/it/intlayer_with_svelte_kit.md +158 -2
  112. package/docs/it/intlayer_with_tanstack.md +159 -1
  113. package/docs/it/intlayer_with_vite+preact.md +157 -1
  114. package/docs/it/intlayer_with_vite+react.md +157 -1
  115. package/docs/it/intlayer_with_vite+solid.md +159 -3
  116. package/docs/it/intlayer_with_vite+svelte.md +157 -1
  117. package/docs/it/intlayer_with_vite+vue.md +157 -1
  118. package/docs/ja/compiler.md +94 -58
  119. package/docs/ja/configuration.md +88 -45
  120. package/docs/ja/intlayer_with_nextjs_16.md +174 -1
  121. package/docs/ja/intlayer_with_nextjs_compiler.md +174 -1
  122. package/docs/ja/intlayer_with_react_router_v7.md +184 -394
  123. package/docs/ja/intlayer_with_react_router_v7_fs_routes.md +226 -2
  124. package/docs/ja/intlayer_with_svelte_kit.md +119 -595
  125. package/docs/ja/intlayer_with_tanstack.md +131 -642
  126. package/docs/ja/intlayer_with_vite+preact.md +111 -1231
  127. package/docs/ja/intlayer_with_vite+react.md +129 -1304
  128. package/docs/ja/intlayer_with_vite+solid.md +159 -3
  129. package/docs/ja/intlayer_with_vite+svelte.md +157 -1
  130. package/docs/ja/intlayer_with_vite+vue.md +157 -1
  131. package/docs/ko/compiler.md +88 -52
  132. package/docs/ko/configuration.md +87 -44
  133. package/docs/ko/intlayer_with_nextjs_16.md +174 -1
  134. package/docs/ko/intlayer_with_nextjs_compiler.md +174 -1
  135. package/docs/ko/intlayer_with_react_router_v7.md +225 -2
  136. package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +226 -2
  137. package/docs/ko/intlayer_with_svelte_kit.md +158 -2
  138. package/docs/ko/intlayer_with_tanstack.md +159 -1
  139. package/docs/ko/intlayer_with_vite+preact.md +157 -1
  140. package/docs/ko/intlayer_with_vite+react.md +157 -1
  141. package/docs/ko/intlayer_with_vite+solid.md +159 -3
  142. package/docs/ko/intlayer_with_vite+svelte.md +157 -1
  143. package/docs/ko/intlayer_with_vite+vue.md +157 -1
  144. package/docs/pl/compiler.md +84 -51
  145. package/docs/pl/configuration.md +83 -37
  146. package/docs/pl/intlayer_with_nextjs_16.md +174 -1
  147. package/docs/pl/intlayer_with_nextjs_compiler.md +174 -1
  148. package/docs/pl/intlayer_with_react_router_v7.md +224 -1
  149. package/docs/pl/intlayer_with_react_router_v7_fs_routes.md +225 -1
  150. package/docs/pl/intlayer_with_svelte_kit.md +158 -2
  151. package/docs/pl/intlayer_with_tanstack.md +159 -1
  152. package/docs/pl/intlayer_with_vite+preact.md +157 -1
  153. package/docs/pl/intlayer_with_vite+react.md +157 -1
  154. package/docs/pl/intlayer_with_vite+solid.md +157 -1
  155. package/docs/pl/intlayer_with_vite+svelte.md +157 -1
  156. package/docs/pl/intlayer_with_vite+vue.md +157 -1
  157. package/docs/pt/compiler.md +81 -46
  158. package/docs/pt/configuration.md +404 -194
  159. package/docs/pt/intlayer_with_nextjs_16.md +174 -1
  160. package/docs/pt/intlayer_with_nextjs_compiler.md +174 -1
  161. package/docs/pt/intlayer_with_react_router_v7.md +224 -1
  162. package/docs/pt/intlayer_with_react_router_v7_fs_routes.md +225 -1
  163. package/docs/pt/intlayer_with_svelte_kit.md +158 -2
  164. package/docs/pt/intlayer_with_tanstack.md +159 -1
  165. package/docs/pt/intlayer_with_vite+preact.md +157 -1
  166. package/docs/pt/intlayer_with_vite+react.md +157 -1
  167. package/docs/pt/intlayer_with_vite+solid.md +157 -1
  168. package/docs/pt/intlayer_with_vite+svelte.md +157 -1
  169. package/docs/pt/intlayer_with_vite+vue.md +157 -1
  170. package/docs/ru/compiler.md +90 -57
  171. package/docs/ru/configuration.md +76 -46
  172. package/docs/ru/intlayer_with_nextjs_16.md +174 -1
  173. package/docs/ru/intlayer_with_nextjs_compiler.md +174 -1
  174. package/docs/ru/intlayer_with_react_router_v7.md +224 -1
  175. package/docs/ru/intlayer_with_react_router_v7_fs_routes.md +225 -1
  176. package/docs/ru/intlayer_with_svelte_kit.md +158 -2
  177. package/docs/ru/intlayer_with_tanstack.md +159 -1
  178. package/docs/ru/intlayer_with_vite+preact.md +157 -1
  179. package/docs/ru/intlayer_with_vite+react.md +157 -1
  180. package/docs/ru/intlayer_with_vite+solid.md +157 -1
  181. package/docs/ru/intlayer_with_vite+svelte.md +157 -1
  182. package/docs/ru/intlayer_with_vite+vue.md +157 -1
  183. package/docs/tr/compiler.md +85 -52
  184. package/docs/tr/configuration.md +83 -40
  185. package/docs/tr/intlayer_with_nextjs_16.md +174 -1
  186. package/docs/tr/intlayer_with_nextjs_compiler.md +174 -1
  187. package/docs/tr/intlayer_with_react_router_v7.md +224 -1
  188. package/docs/tr/intlayer_with_react_router_v7_fs_routes.md +225 -1
  189. package/docs/tr/intlayer_with_svelte_kit.md +158 -2
  190. package/docs/tr/intlayer_with_tanstack.md +159 -1
  191. package/docs/tr/intlayer_with_vite+preact.md +157 -1
  192. package/docs/tr/intlayer_with_vite+react.md +157 -1
  193. package/docs/tr/intlayer_with_vite+solid.md +157 -1
  194. package/docs/tr/intlayer_with_vite+svelte.md +157 -1
  195. package/docs/tr/intlayer_with_vite+vue.md +157 -1
  196. package/docs/uk/compiler.md +96 -61
  197. package/docs/uk/configuration.md +83 -37
  198. package/docs/uk/intlayer_with_nextjs_16.md +174 -1
  199. package/docs/uk/intlayer_with_nextjs_compiler.md +174 -1
  200. package/docs/uk/intlayer_with_react_router_v7.md +224 -1
  201. package/docs/uk/intlayer_with_react_router_v7_fs_routes.md +225 -1
  202. package/docs/uk/intlayer_with_svelte_kit.md +157 -1
  203. package/docs/uk/intlayer_with_tanstack.md +159 -1
  204. package/docs/uk/intlayer_with_vite+preact.md +157 -1
  205. package/docs/uk/intlayer_with_vite+react.md +157 -1
  206. package/docs/uk/intlayer_with_vite+solid.md +157 -1
  207. package/docs/uk/intlayer_with_vite+svelte.md +157 -1
  208. package/docs/uk/intlayer_with_vite+vue.md +157 -1
  209. package/docs/vi/compiler.md +85 -50
  210. package/docs/vi/configuration.md +85 -39
  211. package/docs/vi/intlayer_with_nextjs_16.md +174 -1
  212. package/docs/vi/intlayer_with_nextjs_compiler.md +174 -1
  213. package/docs/vi/intlayer_with_react_router_v7.md +224 -1
  214. package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +225 -1
  215. package/docs/vi/intlayer_with_svelte_kit.md +158 -2
  216. package/docs/vi/intlayer_with_tanstack.md +159 -1
  217. package/docs/vi/intlayer_with_vite+preact.md +157 -1
  218. package/docs/vi/intlayer_with_vite+react.md +157 -1
  219. package/docs/vi/intlayer_with_vite+solid.md +157 -1
  220. package/docs/vi/intlayer_with_vite+svelte.md +157 -1
  221. package/docs/vi/intlayer_with_vite+vue.md +157 -1
  222. package/docs/zh/compiler.md +84 -49
  223. package/docs/zh/configuration.md +80 -37
  224. package/docs/zh/intlayer_with_adonisjs.md +1 -1
  225. package/docs/zh/intlayer_with_express.md +1 -1
  226. package/docs/zh/intlayer_with_fastify.md +1 -1
  227. package/docs/zh/intlayer_with_hono.md +1 -1
  228. package/docs/zh/intlayer_with_nestjs.md +1 -1
  229. package/docs/zh/intlayer_with_nextjs_16.md +174 -1
  230. package/docs/zh/intlayer_with_nextjs_compiler.md +174 -1
  231. package/docs/zh/intlayer_with_react_router_v7.md +227 -4
  232. package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +228 -4
  233. package/docs/zh/intlayer_with_svelte_kit.md +158 -2
  234. package/docs/zh/intlayer_with_tanstack.md +159 -1
  235. package/docs/zh/intlayer_with_vite+preact.md +159 -3
  236. package/docs/zh/intlayer_with_vite+react.md +157 -1
  237. package/docs/zh/intlayer_with_vite+solid.md +161 -5
  238. package/docs/zh/intlayer_with_vite+svelte.md +157 -1
  239. package/docs/zh/intlayer_with_vite+vue.md +158 -2
  240. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2024-08-13
3
- updatedAt: 2026-03-11
3
+ updatedAt: 2026-03-12
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:
@@ -15,7 +15,7 @@ slugs:
15
15
  - configuration
16
16
  history:
17
17
  - version: 8.3.0
18
- data: 2026-03-11
18
+ date: 2026-03-11
19
19
  changes: Di chuyển 'baseDir' từ cấu hình 'content' sang cấu hình 'system'
20
20
  - version: 8.2.0
21
21
  date: 2026-03-09
@@ -110,7 +110,7 @@ Intlayer chấp nhận các định dạng tệp cấu hình JSON, JS, MJS và T
110
110
 
111
111
  ## Ví dụ tệp cấu hình
112
112
 
113
- ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
113
+ ````typescript fileName="intlayer.config.ts" codeFormat="typescript"
114
114
  import { Locales, type IntlayerConfig } from "intlayer";
115
115
  import { nextjsRewrite } from "intlayer/routing";
116
116
  import { z } from "zod";
@@ -208,7 +208,7 @@ const config: IntlayerConfig = {
208
208
  * Options: 'cookie', 'localStorage', 'sessionStorage', 'header', or an array of these.
209
209
  * Default: ['cookie', 'header']
210
210
  */
211
- storage: "cookie",
211
+ storage: ["cookie", "header"],
212
212
 
213
213
  /**
214
214
  * Base path for the application URLs.
@@ -345,6 +345,17 @@ const config: IntlayerConfig = {
345
345
  * Base URL for the AI API.
346
346
  */
347
347
  baseURL: "http://localhost:3000",
348
+
349
+ /**
350
+ * Tuần tự hóa dữ liệu
351
+ *
352
+ * Tùy chọn:
353
+ * - "json": Tiêu chuẩn, đáng tin cậy; tiêu tốn nhiều token hơn.
354
+ * - "toon": Ít token hơn, kém nhất quán hơn JSON.
355
+ *
356
+ * Mặc định: "json"
357
+ */
358
+ dataSerialization: "json",
348
359
  },
349
360
 
350
361
  /**
@@ -444,42 +455,70 @@ const config: IntlayerConfig = {
444
455
  compiler: {
445
456
  /**
446
457
  * Cho biết trình biên dịch có nên được bật hay không.
458
+ *
459
+ * - false : Vô hiệu hóa trình biên dịch.
460
+ * - true : Kích hoạt trình biên dịch.
461
+ * - "build-only" : Bỏ qua trình biên dịch trong quá trình phát triển để tăng tốc thời gian khởi động.
462
+ *
463
+ * Giá trị mặc định : false
447
464
  */
448
465
  enabled: true,
449
466
 
450
467
  /**
451
- * Pattern to traverse the code to optimize.
452
- */
453
- transformPattern: [
454
- "**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}",
455
- "!**/node_modules/**",
456
- ],
457
-
458
- /**
459
- * Pattern to exclude from the optimization.
468
+ * Xác định đường dẫn tệp đầu ra. Thay thế `outputDir`.
469
+ *
470
+ * - Các đường dẫn bắt đầu bằng `./` được giải quyết tương đối so với thư mục component.
471
+ * - Các đường dẫn bắt đầu bằng `/` được giải quyết tương đối so với thư mục gốc của dự án (`baseDir`).
472
+ *
473
+ * - Việc bao gồm biến `{{locale}}` trong đường dẫn sẽ cho phép tạo các từ điển được tách biệt theo ngôn ngữ.
474
+ *
475
+ * Ví dụ:
476
+ * ```ts
477
+ * {
478
+ * // Tạo tệp .content.ts đa ngôn ngữ bên cạnh component
479
+ * output: ({ fileName, extension }) => `./${fileName}${extension}`,
480
+ *
481
+ * // output: './{{fileName}}{{extension}}', // Cách viết tương đương bằng template string
482
+ * }
483
+ * ```
484
+ *
485
+ * ```ts
486
+ * {
487
+ * // Tạo tệp JSON tập trung theo ngôn ngữ trong thư mục gốc của dự án
488
+ * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
489
+ *
490
+ * // output: '/locales/{{locale}}/{{key}}.content.json', // Cách viết tương đương bằng template string
491
+ * }
492
+ * ```
493
+ *
494
+ * Danh sách biến:
495
+ * - `fileName`: Tên tệp.
496
+ * - `key`: Khóa nội dung.
497
+ * - `locale`: Ngôn ngữ nội dung.
498
+ * - `extension`: Phần mở rộng tệp.
499
+ * - `componentFileName`: Tên tệp component.
500
+ * - `componentExtension`: Phần mở rộng tệp component.
501
+ * - `format`: Định dạng từ điển.
502
+ * - `componentFormat`: Định dạng từ điển component.
503
+ * - `componentDirPath`: Đường dẫn thư mục component.
460
504
  */
461
- excludePattern: ["**/node_modules/**"],
505
+ output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
462
506
 
463
507
  /**
464
- * Thư mục đầu ra cho các từ điển được tối ưu hóa.
508
+ * 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.
509
+ * 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ỏ.
465
510
  */
466
- output: ({ key }) => `compiler/${key}.content.json`,
511
+ saveComponents: false,
467
512
 
468
513
  /**
469
- * Chỉ chèn nội dung vào tệp đã tạo, không khóa.
514
+ * Chỉ chèn nội dung vào tệp đã tạo. Hữu ích cho đầu ra JSON i18next hoặc ICU MessageFormat theo từng ngôn ngữ.
470
515
  */
471
516
  noMetadata: false,
472
517
 
473
518
  /**
474
519
  * Tiền tố khóa từ điển
475
520
  */
476
- dictionaryKeyPrefix: "", // Remove base prefix
477
-
478
- /**
479
- * 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.
480
- * 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ỏ.
481
- */
482
- saveComponents: false,
521
+ dictionaryKeyPrefix: "", // Thêm tiền tố tùy chọn cho các khóa từ điển được trích xuất
483
522
  },
484
523
 
485
524
  /**
@@ -498,7 +537,7 @@ const config: IntlayerConfig = {
498
537
  };
499
538
 
500
539
  export default config;
501
- ```
540
+ ````
502
541
 
503
542
  ## Tham chiếu Cấu hình
504
543
 
@@ -1177,7 +1216,7 @@ Các cài đặt kiểm soát trình biên dịch Intlayer, trình biên dịch
1177
1216
 
1178
1217
  - **dictionaryKeyPrefix**:
1179
1218
  - _Kiểu_: `string`
1180
- - _Mặc định_: `'comp-'`
1219
+ - _Mặc định_: `''`
1181
1220
  - _Mô tả_: Tiền tố cho các khóa từ điển được trích xuất.
1182
1221
  - _Ví dụ_: `'my-key-'`
1183
1222
  - _Lưu ý_: Khi từ điển được trích xuất, khóa được tạo dựa trên tên tệp. Tiền tố này được thêm vào khóa đã tạo để ngăn chặn xung đột.
@@ -1201,30 +1240,37 @@ Các cài đặt kiểm soát trình biên dịch Intlayer, trình biên dịch
1201
1240
  - _Mô tả_: Các mẫu xác định những tệp nào sẽ bị loại trừ trong quá trình tối ưu hóa.
1202
1241
  - _Ví dụ_: `['**/node_modules/**', '!**/node_modules/react/**']`
1203
1242
 
1204
- - **outputDir**:
1205
- - _Kiểu_: `string`
1206
- - _Mặc định_: `'compiler'`
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
1243
  - **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ử 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'`
1244
+ - _Kiểu_: `FilePathPattern`
1245
+ - _Mặc định_: `undefined`
1246
+ - _Mô tả_: Xác định đường dẫn tệp đầu ra. Thay thế `outputDir`. Hỗ trợ các biến động thông qua template string hoặc hàm. Các biến được hỗ trợ: `{{fileName}}`, `{{key}}`, `{{locale}}`, `{{extension}}`, `{{componentFileName}}`, `{{componentExtension}}`, `{{format}}`, `{{componentFormat}}`, và `{{componentDirPath}}`.
1247
+ - _Lưu ý_: Các đường dẫn bắt đầu bằng `./` được giải quyết tương đối so với thư mục component. Các đường dẫn bắt đầu bằng `/` được giải quyết tương đối so với thư mục gốc của dự án (`baseDir`).
1248
+ - _Lưu ý_: Việc bao gồm biến `{{locale}}` trong đường dẫn sẽ cho phép tạo các từ điển được tách biệt theo ngôn ngữ.
1249
+ - _Ví dụ_:
1250
+ - **Tạo các tệp đa ngôn ngữ bên cạnh component**:
1251
+ - Chuỗi: `'./{{fileName}}{{extension}}'`
1252
+ - Hàm: `({ fileName, extension }) => \`./${fileName}${extension}\``
1253
+
1254
+ - **Xuất các tệp JSON tập trung cho mỗi ngôn ngữ**:
1255
+ - Chuỗi: `'/locales/{{locale}}/{{key}}.content.json'`
1256
+ - Hàm: `({ key, locale }) => \`/locales/${locale}/${key}.content.json\``
1215
1257
 
1216
1258
  - **noMetadata**:
1217
- - _Loại_: `boolean`
1259
+ - _Kiểu_: `boolean`
1218
1260
  - _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).
1261
+ - _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). Hữu ích cho đầu ra JSON i18next hoặc ICU MessageFormat cho mỗi ngôn ngữ.
1220
1262
  - _Ghi chú_: Hữu ích nếu được sử dụng với plugin `loadJSON`.
1221
- - _Ví dụ_: Nếu `true`:
1263
+ - _Ví dụ_:
1264
+ Nếu `true` :
1265
+
1222
1266
  ```json
1223
1267
  {
1224
1268
  "key": "value"
1225
1269
  }
1226
1270
  ```
1271
+
1227
1272
  Nếu `false`:
1273
+
1228
1274
  ```json
1229
1275
  {
1230
1276
  "key": "value",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2024-12-06
3
- updatedAt: 2025-12-30
3
+ updatedAt: 2026-03-12
4
4
  title: Next.js i18n - Cách dịch ứng dụng Next.js 16 năm 2026
5
5
  description: Khám phá cách làm cho trang web Next.js 16 của bạn đa ngôn ngữ. Theo dõi tài liệu để quốc tế hóa (i18n) và dịch nó.
6
6
  keywords:
@@ -1695,6 +1695,179 @@ Tiện ích mở rộng này cung cấp:
1695
1695
 
1696
1696
  Để biết thêm chi tiết về cách sử dụng tiện ích mở rộng, hãy tham khảo [tài liệu Tiện ích mở rộng Intlayer VS Code](https://intlayer.org/doc/vs-code-extension).
1697
1697
 
1698
+ ### (Tùy chọn) Bước 1 : Trích xuất nội dung các thành phần của bạn
1699
+
1700
+ Nếu bạn có một cơ sở mã hiện có, việc chuyển đổi hàng nghìn tệp có thể tốn nhiều thời gian.
1701
+
1702
+ Để đơn giản hóa quy trình này, Intlayer đề xuất một [trình biên dịch](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/compiler.md) / [trình trích xuất](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/extract.md) để chuyển đổi các thành phần của bạn và trích xuất nội dung.
1703
+
1704
+ Để thiết lập, bạn có thể thêm phần `compiler` vào tệp `intlayer.config.ts` của mình:
1705
+
1706
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
1707
+ import { type IntlayerConfig } from "intlayer";
1708
+
1709
+ const config: IntlayerConfig = {
1710
+ // ... Phần còn lại của cấu hình
1711
+ compiler: {
1712
+ /**
1713
+ * Cho biết trình biên dịch có nên được bật hay không.
1714
+ */
1715
+ enabled: true,
1716
+
1717
+ /**
1718
+ * Xác định đường dẫn các tệp đầu ra
1719
+ */
1720
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
1721
+
1722
+ /**
1723
+ * Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. 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ỏ.
1724
+ */
1725
+ saveComponents: false,
1726
+
1727
+ /**
1728
+ * Tiền tố khóa từ điển
1729
+ */
1730
+ dictionaryKeyPrefix: "",
1731
+ },
1732
+ };
1733
+
1734
+ export default config;
1735
+ ```
1736
+
1737
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
1738
+ /** @type {import('intlayer').IntlayerConfig} */
1739
+ const config = {
1740
+ // ... Phần còn lại của cấu hình
1741
+ compiler: {
1742
+ /**
1743
+ * Cho biết trình biên dịch có nên được bật hay không.
1744
+ */
1745
+ enabled: true,
1746
+
1747
+ /**
1748
+ * Xác định đường dẫn các tệp đầu ra
1749
+ */
1750
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
1751
+
1752
+ /**
1753
+ * Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. 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ỏ.
1754
+ */
1755
+ saveComponents: false,
1756
+
1757
+ /**
1758
+ * Tiền tố khóa từ điển
1759
+ */
1760
+ dictionaryKeyPrefix: "",
1761
+ },
1762
+ };
1763
+
1764
+ export default config;
1765
+ ```
1766
+
1767
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
1768
+ /** @type {import('intlayer').IntlayerConfig} */
1769
+ const config = {
1770
+ // ... Phần còn lại của cấu hình
1771
+ compiler: {
1772
+ /**
1773
+ * Cho biết trình biên dịch có nên được bật hay không.
1774
+ */
1775
+ enabled: true,
1776
+
1777
+ /**
1778
+ * Xác định đường dẫn các tệp đầu ra
1779
+ */
1780
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
1781
+
1782
+ /**
1783
+ * Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. 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ỏ.
1784
+ */
1785
+ saveComponents: false,
1786
+
1787
+ /**
1788
+ * Tiền tố khóa từ điển
1789
+ */
1790
+ dictionaryKeyPrefix: "",
1791
+ },
1792
+ };
1793
+
1794
+ module.exports = config;
1795
+ ```
1796
+
1797
+ <Tabs>
1798
+ <Tab value='Lệnh trích xuất'>
1799
+
1800
+ Chạy trình trích xuất để chuyển đổi các thành phần và trích xuất nội dung
1801
+
1802
+ ```bash packageManager="npm"
1803
+ npx intlayer extract
1804
+ ```
1805
+
1806
+ ```bash packageManager="pnpm"
1807
+ pnpm intlayer extract
1808
+ ```
1809
+
1810
+ ```bash packageManager="yarn"
1811
+ yarn intlayer extract
1812
+ ```
1813
+
1814
+ ```bash packageManager="bun"
1815
+ bunx intlayer extract
1816
+ ```
1817
+
1818
+ </Tab>
1819
+ <Tab value='Trình biên dịch Babel'>
1820
+
1821
+ ```bash packageManager="npm"
1822
+ npm install @intlayer/babel --save-dev
1823
+ ```
1824
+
1825
+ ```bash packageManager="pnpm"
1826
+ pnpm add @intlayer/babel --save-dev
1827
+ ```
1828
+
1829
+ ```bash packageManager="yarn"
1830
+ yarn add @intlayer/babel --save-dev
1831
+ ```
1832
+
1833
+ ```bash packageManager="bun"
1834
+ bun add @intlayer/babel --dev
1835
+ ```
1836
+
1837
+ ```js fileName="babel.config.js"
1838
+ const {
1839
+ intlayerExtractBabelPlugin,
1840
+ getExtractPluginOptions,
1841
+ } = require("@intlayer/babel");
1842
+
1843
+ module.exports = {
1844
+ presets: ["next/babel"],
1845
+ plugins: [
1846
+ // Trích xuất nội dung từ các thành phần vào từ điển
1847
+ [intlayerExtractBabelPlugin, getExtractPluginOptions()],
1848
+ ],
1849
+ };
1850
+ ```
1851
+
1852
+ ```bash packageManager="npm"
1853
+ npm run build # Hoặc npm run dev
1854
+ ```
1855
+
1856
+ ```bash packageManager="pnpm"
1857
+ pnpm run build # Or pnpm run dev
1858
+ ```
1859
+
1860
+ ```bash packageManager="yarn"
1861
+ yarn build # Or yarn dev
1862
+ ```
1863
+
1864
+ ```bash packageManager="bun"
1865
+ bun run build # Or bun run dev
1866
+ ```
1867
+
1868
+ </Tab>
1869
+ </Tabs>
1870
+
1698
1871
  ### Đi Xa Hơn
1699
1872
 
1700
1873
  Để đi xa hơn, bạn có thể triển khai [trình chỉnh sửa trực quan](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_visual_editor.md) hoặc bên ngoài hóa nội dung của bạn bằng cách sử dụng [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_CMS.md).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2026-01-10
3
- updatedAt: 2026-01-10
3
+ updatedAt: 2026-03-12
4
4
  title: Next.js i18n - Chuyển đổi ứng dụng Next.js hiện tại thành ứng dụng đa ngôn ngữ năm 2026
5
5
  description: Khám phá cách biến ứng dụng Next.js hiện tại của bạn thành một ứng dụng đa ngôn ngữ bằng cách sử dụng Intlayer Compiler. Theo dõi tài liệu để quốc tế hóa (i18n) và dịch ứng dụng của bạn bằng AI.
6
6
  keywords:
@@ -501,6 +501,179 @@ Tiện ích mở rộng này cung cấp:
501
501
 
502
502
  Đọc [tài liệu Tiện ích mở rộng VS Code của Intlayer](https://intlayer.org/doc/vs-code-extension) để biết hướng dẫn chi tiết về cách sử dụng tiện ích mở rộng.
503
503
 
504
+ ### (Tùy chọn) Bước 1 : Trích xuất nội dung các thành phần của bạn
505
+
506
+ Nếu bạn có một cơ sở mã hiện có, việc chuyển đổi hàng nghìn tệp có thể tốn nhiều thời gian.
507
+
508
+ Để đơn giản hóa quy trình này, Intlayer đề xuất một [trình biên dịch](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/compiler.md) / [trình trích xuất](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/extract.md) để chuyển đổi các thành phần của bạn và trích xuất nội dung.
509
+
510
+ Để thiết lập, bạn có thể thêm phần `compiler` vào tệp `intlayer.config.ts` của mình:
511
+
512
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
513
+ import { type IntlayerConfig } from "intlayer";
514
+
515
+ const config: IntlayerConfig = {
516
+ // ... Phần còn lại của cấu hình
517
+ compiler: {
518
+ /**
519
+ * Cho biết trình biên dịch có nên được bật hay không.
520
+ */
521
+ enabled: true,
522
+
523
+ /**
524
+ * Xác định đường dẫn các tệp đầu ra
525
+ */
526
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
527
+
528
+ /**
529
+ * Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. 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ỏ.
530
+ */
531
+ saveComponents: false,
532
+
533
+ /**
534
+ * Tiền tố khóa từ điển
535
+ */
536
+ dictionaryKeyPrefix: "",
537
+ },
538
+ };
539
+
540
+ export default config;
541
+ ```
542
+
543
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
544
+ /** @type {import('intlayer').IntlayerConfig} */
545
+ const config = {
546
+ // ... Phần còn lại của cấu hình
547
+ compiler: {
548
+ /**
549
+ * Cho biết trình biên dịch có nên được bật hay không.
550
+ */
551
+ enabled: true,
552
+
553
+ /**
554
+ * Xác định đường dẫn các tệp đầu ra
555
+ */
556
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
557
+
558
+ /**
559
+ * Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. 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ỏ.
560
+ */
561
+ saveComponents: false,
562
+
563
+ /**
564
+ * Tiền tố khóa từ điển
565
+ */
566
+ dictionaryKeyPrefix: "",
567
+ },
568
+ };
569
+
570
+ export default config;
571
+ ```
572
+
573
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
574
+ /** @type {import('intlayer').IntlayerConfig} */
575
+ const config = {
576
+ // ... Phần còn lại của cấu hình
577
+ compiler: {
578
+ /**
579
+ * Cho biết trình biên dịch có nên được bật hay không.
580
+ */
581
+ enabled: true,
582
+
583
+ /**
584
+ * Xác định đường dẫn các tệp đầu ra
585
+ */
586
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
587
+
588
+ /**
589
+ * Cho biết các thành phần có nên được lưu sau khi chuyển đổi hay không. 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ỏ.
590
+ */
591
+ saveComponents: false,
592
+
593
+ /**
594
+ * Tiền tố khóa từ điển
595
+ */
596
+ dictionaryKeyPrefix: "",
597
+ },
598
+ };
599
+
600
+ module.exports = config;
601
+ ```
602
+
603
+ <Tabs>
604
+ <Tab value='Lệnh trích xuất'>
605
+
606
+ Chạy trình trích xuất để chuyển đổi các thành phần và trích xuất nội dung
607
+
608
+ ```bash packageManager="npm"
609
+ npx intlayer extract
610
+ ```
611
+
612
+ ```bash packageManager="pnpm"
613
+ pnpm intlayer extract
614
+ ```
615
+
616
+ ```bash packageManager="yarn"
617
+ yarn intlayer extract
618
+ ```
619
+
620
+ ```bash packageManager="bun"
621
+ bunx intlayer extract
622
+ ```
623
+
624
+ </Tab>
625
+ <Tab value='Trình biên dịch Babel'>
626
+
627
+ ```bash packageManager="npm"
628
+ npm install @intlayer/babel --save-dev
629
+ ```
630
+
631
+ ```bash packageManager="pnpm"
632
+ pnpm add @intlayer/babel --save-dev
633
+ ```
634
+
635
+ ```bash packageManager="yarn"
636
+ yarn add @intlayer/babel --save-dev
637
+ ```
638
+
639
+ ```bash packageManager="bun"
640
+ bun add @intlayer/babel --dev
641
+ ```
642
+
643
+ ```js fileName="babel.config.js"
644
+ const {
645
+ intlayerExtractBabelPlugin,
646
+ getExtractPluginOptions,
647
+ } = require("@intlayer/babel");
648
+
649
+ module.exports = {
650
+ presets: ["next/babel"],
651
+ plugins: [
652
+ // Trích xuất nội dung từ các thành phần vào từ điển
653
+ [intlayerExtractBabelPlugin, getExtractPluginOptions()],
654
+ ],
655
+ };
656
+ ```
657
+
658
+ ```bash packageManager="npm"
659
+ npm run build # Hoặc npm run dev
660
+ ```
661
+
662
+ ```bash packageManager="pnpm"
663
+ pnpm run build # Or pnpm run dev
664
+ ```
665
+
666
+ ```bash packageManager="yarn"
667
+ yarn build # Or yarn dev
668
+ ```
669
+
670
+ ```bash packageManager="bun"
671
+ bun run build # Or bun run dev
672
+ ```
673
+
674
+ </Tab>
675
+ </Tabs>
676
+
504
677
  ### Đi xa hơn
505
678
 
506
679
  Để tiến xa hơn, bạn có thể triển khai [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_visual_editor.md) hoặc ngoại hóa nội dung của mình bằng cách sử dụng [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_CMS.md).