@intlayer/docs 7.3.11 → 7.3.13

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 (90) hide show
  1. package/dist/cjs/generated/docs.entry.cjs +19 -0
  2. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  3. package/dist/esm/generated/docs.entry.mjs +19 -0
  4. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  5. package/dist/types/generated/docs.entry.d.ts +1 -0
  6. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  7. package/docs/ar/intlayer_with_nuxt.md +294 -438
  8. package/docs/ar/intlayer_with_react_router_v7.md +33 -4
  9. package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +516 -0
  10. package/docs/ar/intlayer_with_tanstack.md +2 -12
  11. package/docs/ar/intlayer_with_vite+vue.md +1 -0
  12. package/docs/de/intlayer_with_nuxt.md +284 -410
  13. package/docs/de/intlayer_with_react_router_v7.md +33 -4
  14. package/docs/de/intlayer_with_react_router_v7_fs_routes.md +573 -0
  15. package/docs/de/intlayer_with_tanstack.md +1 -0
  16. package/docs/de/intlayer_with_vite+vue.md +1 -0
  17. package/docs/en/intlayer_with_nuxt.md +237 -341
  18. package/docs/en/intlayer_with_react_router_v7.md +24 -0
  19. package/docs/en/intlayer_with_react_router_v7_fs_routes.md +570 -0
  20. package/docs/en/intlayer_with_tanstack.md +2 -12
  21. package/docs/en/intlayer_with_vite+vue.md +49 -48
  22. package/docs/en-GB/intlayer_with_nuxt.md +254 -378
  23. package/docs/en-GB/intlayer_with_react_router_v7.md +33 -4
  24. package/docs/en-GB/intlayer_with_react_router_v7_fs_routes.md +513 -0
  25. package/docs/en-GB/intlayer_with_tanstack.md +2 -12
  26. package/docs/en-GB/intlayer_with_vite+vue.md +1 -0
  27. package/docs/es/intlayer_with_nuxt.md +271 -390
  28. package/docs/es/intlayer_with_react_router_v7.md +33 -4
  29. package/docs/es/intlayer_with_react_router_v7_fs_routes.md +575 -0
  30. package/docs/es/intlayer_with_tanstack.md +1 -0
  31. package/docs/es/intlayer_with_vite+vue.md +1 -2
  32. package/docs/fr/intlayer_with_nuxt.md +278 -405
  33. package/docs/fr/intlayer_with_react_router_v7.md +34 -5
  34. package/docs/fr/intlayer_with_react_router_v7_fs_routes.md +574 -0
  35. package/docs/fr/intlayer_with_tanstack.md +1 -0
  36. package/docs/fr/intlayer_with_vite+vue.md +1 -0
  37. package/docs/hi/intlayer_with_nuxt.md +303 -447
  38. package/docs/hi/intlayer_with_react_router_v7.md +33 -4
  39. package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +518 -0
  40. package/docs/hi/intlayer_with_tanstack.md +2 -12
  41. package/docs/hi/intlayer_with_vite+vue.md +1 -0
  42. package/docs/id/intlayer_with_nuxt.md +266 -395
  43. package/docs/id/intlayer_with_react_router_v7.md +29 -4
  44. package/docs/id/intlayer_with_react_router_v7_fs_routes.md +521 -0
  45. package/docs/id/intlayer_with_tanstack.md +2 -12
  46. package/docs/id/intlayer_with_vite+vue.md +1 -0
  47. package/docs/it/intlayer_with_nuxt.md +299 -423
  48. package/docs/it/intlayer_with_react_router_v7.md +33 -4
  49. package/docs/it/intlayer_with_react_router_v7_fs_routes.md +574 -0
  50. package/docs/it/intlayer_with_tanstack.md +1 -0
  51. package/docs/ja/intlayer_with_nuxt.md +309 -432
  52. package/docs/ja/intlayer_with_react_router_v7.md +33 -4
  53. package/docs/ja/intlayer_with_react_router_v7_fs_routes.md +574 -0
  54. package/docs/ja/intlayer_with_tanstack.md +2 -12
  55. package/docs/ja/intlayer_with_vite+vue.md +1 -0
  56. package/docs/ko/intlayer_with_nuxt.md +295 -422
  57. package/docs/ko/intlayer_with_react_router_v7.md +33 -4
  58. package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +515 -0
  59. package/docs/ko/intlayer_with_tanstack.md +2 -12
  60. package/docs/ko/intlayer_with_vite+vue.md +1 -0
  61. package/docs/pl/intlayer_with_nuxt.md +273 -476
  62. package/docs/pl/intlayer_with_react_router_v7.md +32 -5
  63. package/docs/pl/intlayer_with_react_router_v7_fs_routes.md +615 -0
  64. package/docs/pl/intlayer_with_tanstack.md +2 -12
  65. package/docs/pl/intlayer_with_vite+vue.md +1 -0
  66. package/docs/pt/intlayer_with_nuxt.md +277 -420
  67. package/docs/pt/intlayer_with_react_router_v7.md +28 -0
  68. package/docs/pt/intlayer_with_tanstack.md +1 -0
  69. package/docs/ru/intlayer_with_nuxt.md +287 -425
  70. package/docs/ru/intlayer_with_react_router_v7.md +33 -4
  71. package/docs/ru/intlayer_with_react_router_v7_fs_routes.md +574 -0
  72. package/docs/ru/intlayer_with_tanstack.md +1 -0
  73. package/docs/ru/intlayer_with_vite+vue.md +1 -0
  74. package/docs/tr/intlayer_with_nuxt.md +313 -406
  75. package/docs/tr/intlayer_with_react_router_v7.md +33 -4
  76. package/docs/tr/intlayer_with_react_router_v7_fs_routes.md +572 -0
  77. package/docs/tr/intlayer_with_tanstack.md +2 -12
  78. package/docs/tr/intlayer_with_vite+vue.md +1 -0
  79. package/docs/vi/intlayer_with_nuxt.md +273 -418
  80. package/docs/vi/intlayer_with_react_router_v7.md +29 -4
  81. package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +523 -0
  82. package/docs/vi/intlayer_with_tanstack.md +2 -12
  83. package/docs/vi/intlayer_with_vite+vue.md +1 -0
  84. package/docs/zh/intlayer_with_nuxt.md +300 -461
  85. package/docs/zh/intlayer_with_react_router_v7.md +33 -4
  86. package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +516 -0
  87. package/docs/zh/intlayer_with_tanstack.md +2 -12
  88. package/docs/zh/intlayer_with_vite+vue.md +1 -0
  89. package/package.json +10 -11
  90. package/src/generated/docs.entry.ts +19 -0
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  createdAt: 2025-06-18
3
- updatedAt: 2025-06-29
4
- title: Cách dịch ứng dụng Nuxt và Vue của bạn – hướng dẫn i18n 2025
3
+ updatedAt: 2025-12-07
4
+ title: Cách dịch ứng dụng Nuxt và Vue của bạn – Hướng dẫn i18n 2025
5
5
  description: Khám phá cách làm cho trang web Nuxt và Vue 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:
7
7
  - Quốc tế hóa
@@ -14,8 +14,12 @@ slugs:
14
14
  - doc
15
15
  - environment
16
16
  - nuxt-and-vue
17
- applicationTemplate: https://github.com/aymericzip/intlayer-nuxt-template
17
+ applicationTemplate: https://github.com/aymericzip/intlayer-nuxt-4-template
18
+ youtubeVideo: https://www.youtube.com/watch?v=nhUcUAVQ6eQ
18
19
  history:
20
+ - version: 7.3.11
21
+ date: 2025-12-07
22
+ changes: Cập nhật LocaleSwitcher, SEO, metadata
19
23
  - version: 5.5.10
20
24
  date: 2025-06-29
21
25
  changes: Khởi tạo lịch sử
@@ -23,8 +27,6 @@ history:
23
27
 
24
28
  # Dịch trang web Nuxt và Vue của bạn bằng Intlayer | Quốc tế hóa (i18n)
25
29
 
26
- Xem [Application Template](https://github.com/aymericzip/intlayer-nuxt-template) trên GitHub.
27
-
28
30
  ## Mục lục
29
31
 
30
32
  <TOC/>
@@ -35,23 +37,36 @@ Xem [Application Template](https://github.com/aymericzip/intlayer-nuxt-template)
35
37
 
36
38
  Với Intlayer, bạn có thể:
37
39
 
38
- - **Dễ dàng quản lý bản dịch** bằng cách sử dụng các từ điển khai báo ở cấp độ component.
39
- - **Định vị động metadata**, các route và nội dung.
40
- - **Đảm bảo hỗ trợ TypeScript** với các kiểu tự động tạo, cải thiện tính năng tự động hoàn thành và phát hiện lỗi.
40
+ - **Quản lý bản dịch dễ dàng** bằng cách sử dụng từ điển khai báo ở cấp độ component.
41
+ - **Địa phương hóa động metadata**, các route và nội dung.
42
+ - **Đảm bảo hỗ trợ TypeScript** với các kiểu tự động tạo, cải thiện việc tự động hoàn thành và phát hiện lỗi.
41
43
  - **Tận hưởng các tính năng nâng cao**, như phát hiện và chuyển đổi locale động.
42
44
 
43
45
  ---
44
46
 
45
47
  ## Hướng dẫn từng bước để thiết lập Intlayer trong ứng dụng Nuxt
46
48
 
49
+ <Tab defaultTab="video">
50
+ <TabItem label="Video" value="video">
51
+
52
+ <iframe title="Cách dịch ứng dụng Nuxt và Vue của bạn bằng Intlayer? Khám phá Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/nhUcUAVQ6eQ?autoplay=0&amp;origin=http://intlayer.org&amp;controls=0&amp;rel=1"/>
53
+
54
+ </TabItem>
55
+ <TabItem label="Mã nguồn" value="code">
56
+
47
57
  <iframe
48
- src="https://stackblitz.com/github/aymericzip/intlayer-nuxt-template?embed=1&ctl=1&file=intlayer.config.ts"
58
+ src="https://stackblitz.com/github/aymericzip/intlayer-nuxt-4-template?embed=1&ctl=1&file=intlayer.config.ts"
49
59
  className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
50
60
  title="Demo CodeSandbox - Cách quốc tế hóa ứng dụng của bạn bằng Intlayer"
51
61
  sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
52
62
  loading="lazy"
53
63
  />
54
64
 
65
+ </TabItem>
66
+ </Tab>
67
+
68
+ Xem [Application Template](https://github.com/aymericzip/intlayer-nuxt-4-template) trên GitHub.
69
+
55
70
  ### Bước 1: Cài đặt các phụ thuộc
56
71
 
57
72
  Cài đặt các gói cần thiết bằng npm:
@@ -73,17 +88,17 @@ yarn add --save-dev nuxt-intlayer
73
88
 
74
89
  - **intlayer**
75
90
 
76
- Gói cốt lõi cung cấp các công cụ quốc tế hóa cho quản lý cấu hình, dịch thuật, [khai báo nội dung](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/dictionary/content_file.md), biên dịch lại, và [các lệnh CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_cli.md).
91
+ Gói cốt lõi cung cấp các công cụ quốc tế hóa cho quản lý cấu hình, dịch thuật, [khai báo nội dung](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/dictionary/content_file.md), biên dịch lại, và các [lệnh CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/index.md).
77
92
 
78
93
  - **vue-intlayer**
79
94
  Gói tích hợp Intlayer với ứng dụng Vue. Nó cung cấp các composables cho các component Vue.
80
95
 
81
96
  - **nuxt-intlayer**
82
- Module Nuxt tích hợp Intlayer với các ứng dụng Nuxt. Nó cung cấp thiết lập tự động, middleware để phát hiện locale, quản lý cookie, và chuyển hướng URL.
97
+ Mô-đun Nuxt tích hợp Intlayer với các ứng dụng Nuxt. Nó cung cấp thiết lập tự động, middleware để phát hiện locale, quản lý cookie, và chuyển hướng URL.
83
98
 
84
99
  ### Bước 2: Cấu hình dự án của bạn
85
100
 
86
- Tạo một file cấu hình để cấu hình các ngôn ngữ cho ứng dụng của bạn:
101
+ Tạo một file cấu hình để cấu hình các ngôn ngữ của ứng dụng của bạn:
87
102
 
88
103
  ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
89
104
  import { Locales, type IntlayerConfig } from "intlayer";
@@ -98,9 +113,6 @@ const config: IntlayerConfig = {
98
113
  ],
99
114
  defaultLocale: Locales.ENGLISH,
100
115
  },
101
- content: {
102
- contentDir: ["."], // Vì mặc định Intlayer sẽ theo dõi các file khai báo nội dung từ thư mục `./src`
103
- },
104
116
  };
105
117
 
106
118
  export default config;
@@ -120,9 +132,6 @@ const config = {
120
132
  ],
121
133
  defaultLocale: Locales.ENGLISH,
122
134
  },
123
- content: {
124
- contentDir: ["."],
125
- },
126
135
  };
127
136
 
128
137
  export default config;
@@ -142,17 +151,14 @@ const config = {
142
151
  ],
143
152
  defaultLocale: Locales.ENGLISH,
144
153
  },
145
- content: {
146
- contentDir: ["."],
147
- },
148
154
  };
149
155
 
150
156
  module.exports = config;
151
157
  ```
152
158
 
153
- > Thông qua tệp cấu hình này, bạn có thể thiết lập URL theo ngôn ngữ, chuyển hướng middleware, tên cookie, vị trí và phần mở rộng của khai báo nội dung, tắt các log của Intlayer trên console, và nhiều hơn nữa. Để xem danh sách đầy đủ các tham số có sẵn, hãy tham khảo [tài liệu cấu hình](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/configuration.md).
159
+ > Thông qua tệp cấu hình này, bạn có thể thiết lập các URL địa phương hóa, chuyển hướng middleware, tên cookie, vị trí và phần mở rộng của các khai báo nội dung của bạn, tắt các log của Intlayer trên console, và nhiều hơn nữa. Để xem danh sách đầy đủ các tham số có sẵn, hãy tham khảo [tài liệu cấu hình](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/configuration.md).
154
160
 
155
- ### Bước 3: Tích hợp Intlayer vào Cấu hình Nuxt của bạn
161
+ ### Bước 3: Tích hợp Intlayer vào cấu hình Nuxt của bạn
156
162
 
157
163
  Thêm module intlayer vào cấu hình Nuxt của bạn:
158
164
 
@@ -165,221 +171,37 @@ export default defineNuxtConfig({
165
171
  });
166
172
  ```
167
173
 
168
- > Module `nuxt-intlayer` tự động xử lý việc tích hợp Intlayer với Nuxt. Nó thiết lập việc xây dựng khai báo nội dung, theo dõi các tệp trong chế độ phát triển, cung cấp middleware để phát hiện locale, và quản lý định tuyến theo locale.
174
+ > Module `nuxt-intlayer` tự động xử lý việc tích hợp Intlayer với Nuxt. Nó thiết lập việc xây dựng khai báo nội dung, giám sát các tệp trong chế độ phát triển, cung cấp middleware để phát hiện locale, và quản lý định tuyến theo locale.
169
175
 
170
176
  ### Bước 4: Khai báo Nội dung của Bạn
171
177
 
172
- Tạo và quản lý các khai báo nội dung để lưu trữ các bản dịch:
178
+ Tạo và quản lý các khai báo nội dung để lưu trữ bản dịch:
173
179
 
174
- ```tsx fileName="components/helloWorld.content.ts" contentDeclarationFormat="typescript"
175
- import { t, type Dictionary } from "intlayer";
180
+ ```tsx fileName="content/home-page.content.ts" contentDeclarationFormat="typescript"
181
+ import { type Dictionary, t } from "intlayer";
176
182
 
177
- const helloWorldContent = {
178
- key: "helloworld",
183
+ const content = {
184
+ key: "home-page",
179
185
  content: {
180
- count: t({ en: "count is ", fr: "le compte est ", es: "el recuento es " }),
181
- edit: t({
182
- en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
183
- fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
184
- es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
185
- }),
186
- checkOut: t({ en: "Check out ", fr: "Vérifiez ", es: "Compruebe " }),
187
- nuxtIntlayer: t({
188
- en: "Nuxt Intlayer documentation",
189
- fr: "Documentation de Nuxt Intlayer",
190
- es: "Documentación de Nuxt Intlayer",
191
- }),
192
- learnMore: t({
193
- en: "Learn more about Nuxt in the ",
194
- fr: "En savoir plus sur Nuxt dans la ",
195
- es: "Aprenda más sobre Nuxt en la ",
186
+ title: t({
187
+ en: "Hello world",
188
+ fr: "Bonjour le monde",
189
+ es: "Hola mundo",
196
190
  }),
197
- nuxtDocs: t({
198
- en: "Nuxt Documentation",
199
- fr: "Documentation Nuxt",
200
- es: "Documentación de Nuxt",
191
+ metaTitle: t({
192
+ en: "Welcome | My Application",
193
+ fr: "Bienvenue | Mon Application",
194
+ es: "Bienvenido | Mi Aplicación",
201
195
  }),
202
- readTheDocs: t({
203
- en: "Click on the Nuxt logo to learn more",
204
- // Nhấp vào logo Nuxt để tìm hiểu thêm
205
- fr: "Cliquez sur le logo Nuxt pour en savoir plus",
206
- es: "Haga clic en el logotipo de Nuxt para obtener más información",
196
+ metaDescription: t({
197
+ en: "Discover your multilingual Nuxt app homepage powered by Intlayer.",
198
+ fr: "Découvrez la page d'accueil multilingue de votre application Nuxt propulsée par Intlayer.",
199
+ es: "Descubre la página de inicio multilingüe de tu aplicación Nuxt impulsada por Intlayer.",
207
200
  }),
208
201
  },
209
202
  } satisfies Dictionary;
210
203
 
211
- export default helloWorldContent;
212
- ```
213
-
214
- ```javascript fileName="components/helloWorld.content.mjs" contentDeclarationFormat="esm"
215
- import { t } from "intlayer";
216
-
217
- /** @type {import('intlayer').Dictionary} */
218
- const helloWorldContent = {
219
- key: "helloworld",
220
- content: {
221
- count: t({
222
- en: "count is ",
223
- vi: "đếm là ",
224
- fr: "le compte est ",
225
- es: "el recuento es ",
226
- }),
227
- edit: t({
228
- en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
229
- vi: "Chỉnh sửa <code>components/HelloWorld.vue</code> và lưu để thử HMR",
230
- fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
231
- es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
232
- }),
233
- checkOut: t({
234
- en: "Check out ",
235
- vi: "Xem ",
236
- fr: "Vérifiez ",
237
- es: "Compruebe ",
238
- }),
239
- nuxtIntlayer: t({
240
- en: "Nuxt Intlayer documentation",
241
- vi: "Tài liệu Nuxt Intlayer",
242
- fr: "Documentation de Nuxt Intlayer",
243
- es: "Documentación de Nuxt Intlayer",
244
- }),
245
- learnMore: t({
246
- en: "Learn more about Nuxt in the ",
247
- vi: "Tìm hiểu thêm về Nuxt trong ",
248
- fr: "En savoir plus sur Nuxt dans la ",
249
- es: "Aprenda más sobre Nuxt en la ",
250
- }),
251
- nuxtDocs: t({
252
- en: "Nuxt Documentation",
253
- vi: "Tài liệu Nuxt",
254
- fr: "Documentation Nuxt",
255
- es: "Documentación de Nuxt",
256
- }),
257
- readTheDocs: t({
258
- en: "Click on the Nuxt logo to learn more",
259
- vi: "Nhấp vào logo Nuxt để tìm hiểu thêm",
260
- fr: "Cliquez sur le logo Nuxt pour en savoir plus",
261
- es: "Haga clic en el logotipo de Nuxt para obtener más información",
262
- }),
263
- },
264
- };
265
-
266
- export default helloWorldContent;
267
- ```
268
-
269
- ```javascript fileName="components/helloWorld.content.cjs" contentDeclarationFormat="commonjs"
270
- const { t } = require("intlayer");
271
-
272
- /** @type {import('intlayer').Dictionary} */
273
- // Nội dung cho HelloWorld component
274
- const helloWorldContent = {
275
- key: "helloworld",
276
- content: {
277
- count: t({ en: "count is ", vi: "số lượng là ", fr: "le compte est ", es: "el recuento es " }),
278
- edit: t({
279
- en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
280
- vi: "Chỉnh sửa <code>components/HelloWorld.vue</code> và lưu để thử HMR",
281
- fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
282
- es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
283
- }),
284
- checkOut: t({ en: "Check out ", vi: "Xem ", fr: "Vérifiez ", es: "Compruebe " }),
285
- nuxtIntlayer: t({
286
- en: "Nuxt Intlayer documentation",
287
- vi: "Tài liệu Nuxt Intlayer",
288
- fr: "Documentation de Nuxt Intlayer",
289
- es: "Documentación de Nuxt Intlayer",
290
- }),
291
- es: "Documentación de Nuxt Intlayer",
292
- }),
293
- learnMore: t({
294
- en: "Learn more about Nuxt in the ",
295
- vi: "Tìm hiểu thêm về Nuxt trong ",
296
- fr: "En savoir plus sur Nuxt dans la ",
297
- es: "Aprenda más sobre Nuxt en la ",
298
- }),
299
- nuxtDocs: t({
300
- en: "Nuxt Documentation",
301
- vi: "Tài liệu Nuxt",
302
- fr: "Documentation Nuxt",
303
- es: "Documentación de Nuxt",
304
- }),
305
- readTheDocs: t({
306
- en: "Click on the Nuxt logo to learn more",
307
- vi: "Nhấp vào logo Nuxt để tìm hiểu thêm",
308
- fr: "Cliquez sur le logo Nuxt pour en savoir plus",
309
- es: "Haga clic en el logotipo de Nuxt para obtener más información",
310
- }),
311
- },
312
- };
313
-
314
- module.exports = helloWorldContent;
315
- ```
316
-
317
- ```json fileName="components/helloWorld.content.json" contentDeclarationFormat="json"
318
- {
319
- "$schema": "https://intlayer.org/schema.json",
320
- "key": "helloworld",
321
- "content": {
322
- "count": {
323
- "nodeType": "translation",
324
- "translation": {
325
- "en": "count is ",
326
- "vi": "số đếm là ",
327
- "fr": "le compte est ",
328
- "es": "el recuento es "
329
- }
330
- },
331
- "edit": {
332
- "nodeType": "translation",
333
- "translation": {
334
- "en": "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
335
- "vi": "Chỉnh sửa <code>components/HelloWorld.vue</code> và lưu để thử HMR",
336
- "fr": "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
337
- "es": "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR"
338
- }
339
- },
340
- "checkOut": {
341
- "nodeType": "translation",
342
- "translation": {
343
- "en": "Check out ",
344
- "vi": "Xem ",
345
- "fr": "Vérifiez ",
346
- "es": "Compruebe "
347
- }
348
- },
349
- "nuxtIntlayer": {
350
- "nodeType": "translation",
351
- "translation": {
352
- "vi": "Tài liệu Nuxt Intlayer",
353
- "fr": "Documentation de Nuxt Intlayer",
354
- "es": "Documentación de Nuxt Intlayer"
355
- }
356
- },
357
- "learnMore": {
358
- "nodeType": "translation",
359
- "translation": {
360
- "vi": "Tìm hiểu thêm về Nuxt trong ",
361
- "fr": "En savoir plus sur Nuxt dans la ",
362
- "es": "Aprenda más sobre Nuxt en la "
363
- }
364
- },
365
- "nuxtDocs": {
366
- "nodeType": "translation",
367
- "translation": {
368
- "vi": "Tài liệu Nuxt",
369
- "fr": "Documentation Nuxt",
370
- "es": "Documentación de Nuxt"
371
- }
372
- },
373
- "readTheDocs": {
374
- "nodeType": "translation",
375
- "translation": {
376
- "vi": "Nhấp vào logo Nuxt để tìm hiểu thêm",
377
- "fr": "Cliquez sur le logo Nuxt pour en savoir plus",
378
- "vi": "Nhấp vào logo Nuxt để tìm hiểu thêm"
379
- }
380
- }
381
- }
382
- }
204
+ export default content;
383
205
  ```
384
206
 
385
207
  > Các khai báo nội dung của bạn có thể được định nghĩa ở bất kỳ đâu trong ứng dụng của bạn miễn là chúng được bao gồm trong thư mục `contentDir` (mặc định là `./src`). Và phù hợp với phần mở rộng tệp khai báo nội dung (mặc định là `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
@@ -437,12 +259,12 @@ const countRef = ref(0);
437
259
  </template>
438
260
  ```
439
261
 
440
- #### Truy cập Nội dung trong Intlayer
262
+ #### Truy cập nội dung trong Intlayer
441
263
 
442
264
  Intlayer cung cấp các API khác nhau để truy cập nội dung của bạn:
443
265
 
444
- - **Cú pháp dựa trên Component** (được khuyến nghị):
445
- Sử dụng cú pháp `<myContent />`, hoặc `<Component :is="myContent" />` để hiển thị nội dung như một Node của Intlayer. Điều này tích hợp liền mạch với [Visual Editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_visual_editor.md) và [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_CMS.md).
266
+ - **Cú pháp dựa trên component** (khuyến nghị):
267
+ Sử dụng cú pháp `<myContent />`, hoặc `<Component :is="myContent" />` để hiển thị nội dung dưới dạng một Intlayer Node. Điều này tích hợp liền mạch với [Visual Editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_visual_editor.md) và [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_CMS.md).
446
268
 
447
269
  - **Cú pháp dựa trên chuỗi**:
448
270
  Sử dụng `{{ myContent }}` để hiển thị nội dung dưới dạng văn bản thuần, không hỗ trợ Visual Editor.
@@ -451,72 +273,62 @@ Intlayer cung cấp các API khác nhau để truy cập nội dung của bạn:
451
273
  Sử dụng `<div v-html="myContent" />` để hiển thị nội dung dưới dạng HTML thô, không hỗ trợ Visual Editor.
452
274
 
453
275
  - **Cú pháp phân rã (Destructuration)**:
454
- `useIntlayer` composable trả về một Proxy chứa nội dung. Proxy này có thể được destructure để truy cập nội dung trong khi vẫn giữ được tính reactive.
455
- - Sử dụng `const content = useIntlayer("myContent");` và `{{ content.myContent }}` / `<content.myContent />`.
456
- - Hoặc sử dụng `const { myContent } = useIntlayer("myContent");` và `{{ myContent}}` / `<myContent/>` để destructure nội dung.
276
+ Composable `useIntlayer` trả về một Proxy chứa nội dung. Proxy này có thể được phân để truy cập nội dung trong khi vẫn giữ được tính phản ứng.
277
+ - Sử dụng `const content = useIntlayer("myContent");` và `{{ content.myContent }}` / `<content.myContent />`.
278
+ - Hoặc sử dụng `const { myContent } = useIntlayer("myContent");` và `{{ myContent}}` / `<myContent/>` để phân nội dung.
457
279
 
458
280
  ### (Tùy chọn) Bước 6: Thay đổi ngôn ngữ của nội dung
459
281
 
460
282
  Để thay đổi ngôn ngữ của nội dung, bạn có thể sử dụng hàm `setLocale` được cung cấp bởi composable `useLocale`. Hàm này cho phép bạn thiết lập locale của ứng dụng và cập nhật nội dung tương ứng.
461
283
 
462
- Tạo một component để chuyển đổi giữa các ngôn ngữ:
284
+ Tạo một component để chuyển đổi giữa các ngôn ngữ sử dụng `NuxtLink`. **Sử dụng các liên kết thay vì nút bấm để chuyển đổi locale là một thực hành tốt cho SEO và khả năng khám phá trang**, vì nó cho phép các công cụ tìm kiếm thu thập dữ liệu và lập chỉ mục tất cả các phiên bản địa phương hóa của trang của bạn:
463
285
 
464
286
  ```vue fileName="components/LocaleSwitcher.vue"
465
- <template>
466
- <div class="locale-switcher">
467
- <select v-model="selectedLocale" @change="changeLocale">
468
- <option v-for="loc in availableLocales" :key="loc" :value="loc">
469
- {{ getLocaleName(loc) }}
470
- </option>
471
- </select>
472
- </div>
473
- </template>
474
-
475
287
  <script setup lang="ts">
476
- import { ref, watch } from "vue";
477
- import { getLocaleName } from "intlayer";
288
+ import { getLocaleName, getLocalizedUrl } from "intlayer";
478
289
  import { useLocale } from "vue-intlayer";
479
290
 
480
- // Lấy thông tin locale và hàm setLocale
291
+ // Nuxt tự động import useRoute
292
+ const route = useRoute();
481
293
  const { locale, availableLocales, setLocale } = useLocale();
482
-
483
- // Theo dõi locale được chọn với ref
484
- const selectedLocale = ref(locale.value);
485
-
486
- // Cập nhật locale khi lựa chọn thay đổi
487
- const changeLocale = () => setLocale(selectedLocale.value);
488
-
489
- // Giữ selectedLocale đồng bộ với locale toàn cục
490
- watch(
491
- () => locale.value,
492
- (newLocale) => {
493
- selectedLocale.value = newLocale;
494
- }
495
- );
496
294
  </script>
295
+
296
+ <template>
297
+ <nav class="locale-switcher">
298
+ <NuxtLink
299
+ v-for="localeEl in availableLocales"
300
+ :key="localeEl"
301
+ :to="getLocalizedUrl(route.fullPath, localeEl)"
302
+ class="locale-link"
303
+ :class="{ 'active-locale': localeEl === locale }"
304
+ @click="setLocale(localeEl)"
305
+ >
306
+ {{ getLocaleName(localeEl) }}
307
+ </NuxtLink>
308
+ </nav>
497
309
  </template>
310
+ ```
498
311
 
499
- <style scoped>
500
- .locale-switcher {
501
- margin: 1rem 0;
502
- }
312
+ > Việc sử dụng `NuxtLink` với các thuộc tính `href` đúng cách (thông qua `getLocalizedUrl`) đảm bảo rằng các công cụ tìm kiếm có thể khám phá tất cả các biến thể ngôn ngữ của trang của bạn. Điều này ưu việt hơn so với việc chuyển đổi ngôn ngữ chỉ bằng JavaScript, mà các trình thu thập dữ liệu của công cụ tìm kiếm có thể không theo dõi được.
503
313
 
504
- select {
505
- padding: 0.5rem;
506
- border-radius: 0.25rem;
507
- border: 1px solid #ccc;
508
- }
509
- </style>
314
+ Sau đó, thiết lập `app.vue` của bạn để sử dụng layouts:
315
+
316
+ ```vue fileName="app.vue"
317
+ <template>
318
+ <NuxtLayout>
319
+ <NuxtPage />
320
+ </NuxtLayout>
321
+ </template>
510
322
  ```
511
323
 
512
- Sau đó, sử dụng component này trong các trang hoặc layout của bạn:
324
+ ### (Tùy chọn) Bước 6b: Tạo một Layout với Điều hướng
513
325
 
514
- ```vue fileName="app.vue"
326
+ Layouts của Nuxt cho phép bạn định nghĩa một cấu trúc chung cho các trang của bạn. Tạo một layout mặc định bao gồm bộ chuyển đổi ngôn ngữ và điều hướng:
327
+
328
+ ```vue fileName="layouts/default.vue"
515
329
  <script setup lang="ts">
516
- import { useIntlayer } from "vue-intlayer";
330
+ import Links from "~/components/Links.vue";
517
331
  import LocaleSwitcher from "~/components/LocaleSwitcher.vue";
518
-
519
- const content = useIntlayer("app"); // Tạo file khai báo intlayer liên quan
520
332
  </script>
521
333
 
522
334
  <template>
@@ -525,15 +337,20 @@ const content = useIntlayer("app"); // Tạo file khai báo intlayer liên quan
525
337
  <LocaleSwitcher />
526
338
  </header>
527
339
  <main>
528
- <NuxtPage />
340
+ <slot />
529
341
  </main>
342
+
343
+ <Links href="/">Trang chủ</Links>
344
+ <Links href="/about">Giới thiệu</Links>
530
345
  </div>
531
346
  </template>
532
347
  ```
533
348
 
534
- ### (Tùy chọn) Bước 7: Thêm định tuyến đa ngôn ngữ vào ứng dụng của bạn
349
+ Thành phần `Links` (được hiển thị bên dưới) đảm bảo rằng các liên kết điều hướng nội bộ được tự động địa phương hóa.
535
350
 
536
- Nuxt tự động xử định tuyến đa ngôn ngữ khi sử dụng module `nuxt-intlayer`. Điều này tạo ra các route cho mỗi ngôn ngữ một cách tự động dựa trên cấu trúc thư mục pages của bạn.
351
+ ### (Tùy chọn) Bước 7: Thêm định tuyến địa phương hóa vào ứng dụng của bạn
352
+
353
+ Nuxt tự động xử lý định tuyến địa phương hóa khi sử dụng module `nuxt-intlayer`. Điều này tạo các tuyến đường cho mỗi ngôn ngữ tự động dựa trên cấu trúc thư mục trang của bạn.
537
354
 
538
355
  Ví dụ:
539
356
 
@@ -545,277 +362,315 @@ pages/
545
362
  └── index.vue → /contact, /fr/contact, /es/contact
546
363
  ```
547
364
 
548
- Để tạo một trang đa ngôn ngữ, chỉ cần tạo các file Vue trong thư mục `pages/`:
365
+ Để tạo các trang được địa phương hóa, chỉ cần tạo các file Vue của bạn trong thư mục `pages/`. Dưới đây là hai ví dụ về các trang:
366
+
367
+ **Trang chủ (`pages/index.vue`):**
368
+
369
+ ```vue fileName="pages/index.vue"
370
+ <script setup lang="ts">
371
+ import { useIntlayer } from "vue-intlayer";
372
+
373
+ const content = useIntlayer("home-page");
374
+
375
+ useHead({
376
+ title: content.metaTitle.value,
377
+ meta: [
378
+ {
379
+ name: "description",
380
+ content: content.metaDescription.value,
381
+ },
382
+ ],
383
+ });
384
+ </script>
385
+
386
+ <template>
387
+ <h1><content.title /></h1>
388
+ </template>
389
+ ```
390
+
391
+ **Trang Giới thiệu (`pages/about.vue`):**
549
392
 
550
393
  ```vue fileName="pages/about.vue"
551
394
  <script setup lang="ts">
552
395
  import { useIntlayer } from "vue-intlayer";
553
396
 
554
- const content = useIntlayer("about");
397
+ const content = useIntlayer("about-page");
398
+
399
+ useHead({
400
+ title: content.metaTitle.raw, // Sử dụng .raw để truy cập chuỗi nguyên thủy
401
+ meta: [
402
+ {
403
+ name: "description",
404
+ content: content.metaDescription.raw, // Sử dụng .raw để truy cập chuỗi nguyên thủy
405
+ },
406
+ ],
407
+ });
555
408
  </script>
556
409
 
557
410
  <template>
558
- <div>
559
- <h1>{{ content.title }}</h1>
560
- <p>{{ content.description }}</p>
561
- </div>
411
+ <h1><content.title /></h1>
562
412
  </template>
563
413
  ```
564
414
 
415
+ > Lưu ý: `useHead` được tự động import trong Nuxt. Bạn có thể truy cập giá trị nội dung bằng cách sử dụng `.value` (phản ứng) hoặc `.raw` (chuỗi nguyên thủy) tùy theo nhu cầu của bạn.
416
+
565
417
  Module `nuxt-intlayer` sẽ tự động:
566
418
 
567
419
  - Phát hiện ngôn ngữ ưu tiên của người dùng
568
420
  - Xử lý chuyển đổi ngôn ngữ qua URL
569
- - Đặt thuộc tính `<html lang="">` phù hợp
421
+ - Thiết lập thuộc tính `<html lang="">` phù hợp
570
422
  - Quản lý cookie ngôn ngữ
571
- - Chuyển hướng người dùng đến URL đa ngôn ngữ phù hợp
423
+ - Chuyển hướng người dùng đến URL địa phương hóa phù hợp
572
424
 
573
- ### (Tùy chọn) Bước 8: Tạo thành phần Liên kết Đa ngôn ngữ
425
+ ### (Tùy chọn) Bước 8: Tạo một Component Liên kết Địa phương hóa
574
426
 
575
- Để đảm bảo điều hướng trong ứng dụng của bạn tôn trọng ngôn ngữ hiện tại, bạn có thể tạo một thành phần tùy chỉnh `LocalizedLink`. Thành phần này tự động thêm tiền tố ngôn ngữ hiện tại vào các URL nội bộ.
576
-
577
- ```vue fileName="components/LocalizedLink.vue"
578
- <template>
579
- <NuxtLink :to="localizedHref" v-bind="$attrs">
580
- <slot />
581
- </NuxtLink>
582
- </template>
427
+ Để đảm bảo điều hướng trong ứng dụng của bạn tuân thủ ngôn ngữ hiện tại, bạn có thể tạo một component `Links` tùy chỉnh. Component này tự động thêm tiền tố ngôn ngữ hiện tại vào các URL nội bộ, điều này rất quan trọng cho **SEO và khả năng tìm thấy trang**.
583
428
 
429
+ ```vue fileName="components/Links.vue"
584
430
  <script setup lang="ts">
585
- import { computed } from "vue";
586
431
  import { getLocalizedUrl } from "intlayer";
587
432
  import { useLocale } from "vue-intlayer";
588
433
 
589
- const props = defineProps({
590
- to: {
591
- type: String,
592
- required: true,
593
- },
594
- });
434
+ interface Props {
435
+ href: string;
436
+ locale?: string;
437
+ }
438
+
439
+ const props = defineProps<Props>();
440
+
441
+ const { locale: currentLocale } = useLocale();
595
442
 
596
- const { locale } = useLocale();
443
+ // Tính toán đường dẫn cuối cùng
444
+ const finalPath = computed(() => {
445
+ // 1. Kiểm tra xem liên kết có phải là liên kết ngoài không
446
+ const isExternal = /^https?:\/\//.test(props.href || "");
597
447
 
598
- // Kiểm tra xem liên kết phải liên kết ngoài không
599
- const isExternalLink = computed(() => /^https?:\/\//.test(props.to || ""));
448
+ // 2. Nếu liên kết ngoài, trả về nguyên trạng (NuxtLink xử lý việc tạo thẻ <a>)
449
+ if (isExternal) return props.href;
600
450
 
601
- // Tạo href địa phương hóa cho các liên kết nội bộ
602
- const localizedHref = computed(() =>
603
- isExternalLink.value ? props.to : getLocalizedUrl(props.to, locale.value)
604
- );
451
+ // 3. Nếu liên kết nội bộ, địa phương hóa URL
452
+ const targetLocale = props.locale || currentLocale.value;
453
+ return getLocalizedUrl(props.href, targetLocale);
454
+ });
605
455
  </script>
456
+
457
+ <template>
458
+ <NuxtLink :to="finalPath" v-bind="$attrs">
459
+ <slot />
460
+ </NuxtLink>
461
+ </template>
606
462
  ```
607
463
 
608
464
  Sau đó sử dụng component này trong toàn bộ ứng dụng của bạn:
609
465
 
610
- ```vue fileName="pages/index.vue"
466
+ ```vue fileName="layouts/default.vue"
467
+ <script setup lang="ts">
468
+ import Links from "~/components/Links.vue";
469
+ import LocaleSwitcher from "~/components/LocaleSwitcher.vue";
470
+ </script>
471
+
611
472
  <template>
612
473
  <div>
613
- <LocalizedLink to="/about">
614
- {{ content.aboutLink }}
615
- </LocalizedLink>
616
- <LocalizedLink to="/contact">
617
- {{ content.contactLink }}
618
- </LocalizedLink>
474
+ <header>
475
+ <LocaleSwitcher />
476
+ </header>
477
+ <main>
478
+ <slot />
479
+ </main>
480
+
481
+ <Links href="/">Trang chủ</Links>
482
+ <Links href="/about">Giới thiệu</Links>
619
483
  </div>
620
484
  </template>
621
-
622
- <script setup lang="ts">
623
- import { useIntlayer } from "vue-intlayer";
624
- import LocalizedLink from "~/components/LocalizedLink.vue";
625
-
626
- const content = useIntlayer("home");
627
- </script>
628
485
  ```
629
486
 
487
+ > Bằng cách sử dụng `NuxtLink` với các đường dẫn đã được địa phương hóa, bạn đảm bảo rằng:
488
+ >
489
+ > - Các công cụ tìm kiếm có thể thu thập dữ liệu và lập chỉ mục tất cả các phiên bản ngôn ngữ của trang của bạn
490
+ > - Người dùng có thể chia sẻ trực tiếp các URL đã được địa phương hóa
491
+ > - Lịch sử trình duyệt hoạt động chính xác với các URL có tiền tố ngôn ngữ
492
+
630
493
  ### (Tùy chọn) Bước 9: Xử lý Metadata và SEO
631
494
 
632
- Nuxt cung cấp các khả năng SEO tuyệt vời. Bạn có thể sử dụng Intlayer để xử lý metadata được bản địa hóa:
495
+ Nuxt cung cấp khả năng SEO tuyệt vời thông qua composable `useHead` (tự động import). Bạn có thể sử dụng Intlayer để xử lý metadata đã được địa phương hóa bằng cách sử dụng accessor `.raw` hoặc `.value` để lấy giá trị chuỗi nguyên thủy:
633
496
 
634
497
  ```vue fileName="pages/about.vue"
635
498
  <script setup lang="ts">
636
- import { useSeoMeta } from "nuxt/app";
637
- import { getIntlayer } from "intlayer";
638
- import { useLocale } from "vue-intlayer";
499
+ import { useIntlayer } from "vue-intlayer";
639
500
 
640
- const { locale } = useLocale();
641
- const content = getIntlayer("about-meta", locale.value);
501
+ // useHead được tự động import trong Nuxt
502
+ const content = useIntlayer("about-page");
642
503
 
643
- useSeoMeta({
644
- title: content.title,
645
- description: content.description,
504
+ useHead({
505
+ title: content.metaTitle.raw, // Sử dụng .raw để truy cập giá trị chuỗi nguyên thủy
506
+ meta: [
507
+ {
508
+ name: "description",
509
+ content: content.metaDescription.raw, // Sử dụng .raw để truy cập chuỗi nguyên thủy
510
+ },
511
+ ],
646
512
  });
647
513
  </script>
648
514
 
649
515
  <template>
650
- <div>
651
- <h1>{{ content.pageTitle }}</h1>
652
- <p>{{ content.pageContent }}</p>
653
- </div>
516
+ <h1><content.title /></h1>
654
517
  </template>
655
518
  ```
656
519
 
520
+ > Ngoài ra, bạn có thể sử dụng hàm `import { getIntlayer } from "intlayer"` để lấy nội dung mà không cần phản ứng của Vue.
521
+
522
+ > **Truy cập giá trị nội dung:**
523
+ >
524
+ > - Sử dụng `.raw` để lấy giá trị chuỗi nguyên thủy (không phản ứng)
525
+ > - Sử dụng `.value` để lấy giá trị phản ứng
526
+ > - Sử dụng cú pháp component `<content.key />` để hỗ trợ Visual Editor
527
+
657
528
  Tạo khai báo nội dung tương ứng:
658
529
 
659
- ```ts fileName="pages/about-meta.content.ts"
530
+ ```ts fileName="pages/about-page.content.ts" contentDeclarationFormat="typescript"
660
531
  import { t, type Dictionary } from "intlayer";
661
- import type { useSeoMeta } from "nuxt/app";
662
532
 
663
- const aboutMetaContent = {
664
- key: "about-meta",
533
+ const aboutPageContent = {
534
+ key: "about-page",
665
535
  content: {
666
- title: t({
667
- vi: "Về Chúng Tôi - Công Ty Tôi",
668
- en: "About Us - My Company",
536
+ metaTitle: t({
537
+ en: "Về Chúng Tôi - Công Ty Tôi",
669
538
  fr: "À Propos - Ma Société",
670
539
  es: "Acerca de Nosotros - Mi Empresa",
671
540
  }),
672
- description: t({
673
- vi: "Tìm hiểu thêm về công ty và sứ mệnh của chúng tôi",
674
- en: "Learn more about our company and our mission",
541
+ metaDescription: t({
542
+ en: "Tìm hiểu thêm về công ty và sứ mệnh của chúng tôi",
675
543
  fr: "En savoir plus sur notre société et notre mission",
676
544
  es: "Conozca más sobre nuestra empresa y nuestra misión",
677
545
  }),
546
+ title: t({
547
+ en: "Về Chúng Tôi",
548
+ fr: "À Propos",
549
+ es: "Acerca de Nosotros",
550
+ }),
678
551
  },
679
- } satisfies Dictionary<Parameters<typeof useSeoMeta>[0]>;
552
+ } satisfies Dictionary;
680
553
 
681
- export default aboutMetaContent;
554
+ export default aboutPageContent;
682
555
  ```
683
556
 
684
- ```typescript fileName="pages/about-meta.content.mjs" contentDeclarationFormat="esm"
557
+ ```javascript fileName="pages/about-page.content.mjs" contentDeclarationFormat="esm"
685
558
  import { t } from "intlayer";
686
559
 
687
560
  /** @type {import('intlayer').Dictionary} */
688
- const aboutMetaContent = {
689
- key: "about-meta",
561
+ const aboutPageContent = {
562
+ key: "about-page",
690
563
  content: {
691
- title: t({
692
- zh: "关于我们 - 我的公司",
693
- en: "About Us - My Company",
564
+ metaTitle: t({
565
+ en: "Về Chúng Tôi - Công Ty Tôi",
694
566
  fr: "À Propos - Ma Société",
695
567
  es: "Acerca de Nosotros - Mi Empresa",
696
- vi: "Về Chúng Tôi - Công Ty Tôi",
697
568
  }),
698
- description: t({
699
- zh: "了解更多关于我们公司和我们的使命",
700
- en: "Learn more about our company and our mission",
569
+ metaDescription: t({
570
+ en: "Tìm hiểu thêm về công ty và sứ mệnh của chúng tôi",
701
571
  fr: "En savoir plus sur notre société et notre mission",
702
572
  es: "Conozca más sobre nuestra empresa y nuestra misión",
703
- vi: "Tìm hiểu thêm về công ty và sứ mệnh của chúng tôi",
573
+ }),
574
+ title: t({
575
+ en: "Về Chúng Tôi",
576
+ fr: "À Propos",
577
+ es: "Acerca de Nosotros",
704
578
  }),
705
579
  },
706
580
  };
707
581
 
708
- export default aboutMetaContent;
582
+ export default aboutPageContent;
709
583
  ```
710
584
 
711
- ```typescript fileName="pages/about-meta.content.js" contentDeclarationFormat="cjs"
585
+ ```javascript fileName="pages/about-page.content.cjs" contentDeclarationFormat="commonjs"
712
586
  const { t } = require("intlayer");
713
587
 
714
588
  /** @type {import('intlayer').Dictionary} */
715
- const aboutMetaContent = {
716
- key: "about-meta",
589
+ const aboutPageContent = {
590
+ key: "about-page",
717
591
  content: {
718
- title: t({
719
- zh: "关于我们 - 我的公司",
720
- en: "About Us - My Company",
721
- fr: "À Propos - Ma Société",
722
- es: "Acerca de Nosotros - Mi Empresa",
723
- vi: "Về Chúng Tôi - Công Ty Tôi",
724
- }),
592
+ metaTitle: t({
593
+ en: "Về Chúng Tôi - Công Ty Tôi",
725
594
  fr: "À Propos - Ma Société",
726
595
  es: "Acerca de Nosotros - Mi Empresa",
727
596
  }),
728
- description: t({
729
- zh: "了解更多关于我们公司和我们的使命",
730
- vi: "Tìm hiểu thêm về công ty và sứ mệnh của chúng tôi",
731
- en: "Learn more about our company and our mission",
597
+ metaDescription: t({
598
+ en: "Tìm hiểu thêm về công ty và sứ mệnh của chúng tôi",
732
599
  fr: "En savoir plus sur notre société et notre mission",
733
600
  es: "Conozca más sobre nuestra empresa y nuestra misión",
734
601
  }),
602
+ title: t({
603
+ en: "Về Chúng Tôi",
604
+ fr: "À Propos",
605
+ es: "Acerca de Nosotros",
606
+ }),
735
607
  },
736
608
  };
737
609
 
738
- module.exports = aboutMetaContent;
610
+ module.exports = aboutPageContent;
739
611
  ```
740
612
 
741
- ```json fileName="pages/about-meta.content.json" contentDeclarationFormat="json"
613
+ ```json fileName="pages/about-page.content.json" contentDeclarationFormat="json"
742
614
  {
743
- "key": "about-meta",
615
+ "$schema": "https://intlayer.org/schema.json",
616
+ "key": "about-page",
744
617
  "content": {
745
- "title": {
618
+ "metaTitle": {
746
619
  "nodeType": "translation",
747
- "translations": {
748
- "zh": "关于我们 - 我的公司",
749
- "vi": "Về Chúng Tôi - Công Ty Tôi",
750
- "en": "About Us - My Company",
620
+ "translation": {
621
+ "en": "Về Chúng Tôi - Công Ty Tôi",
751
622
  "fr": "À Propos - Ma Société",
752
623
  "es": "Acerca de Nosotros - Mi Empresa"
753
624
  }
754
625
  },
755
- "description": {
626
+ "metaDescription": {
756
627
  "nodeType": "translation",
757
- "translations": {
758
- "zh": "了解更多关于我们公司和我们的使命",
759
- "en": "Learn more about our company and our mission",
628
+ "translation": {
629
+ "en": "Tìm hiểu thêm về công ty và sứ mệnh của chúng tôi",
760
630
  "fr": "En savoir plus sur notre société et notre mission",
761
- "es": "Conozca más sobre nuestra empresa y nuestra misión",
762
- "vi": "Tìm hiểu thêm về công ty và sứ mệnh của chúng tôi"
631
+ "es": "Conozca más sobre nuestra empresa y nuestra misión"
632
+ }
633
+ },
634
+ "title": {
635
+ "nodeType": "translation",
636
+ "translation": {
637
+ "en": "Về Chúng Tôi",
638
+ "fr": "À Propos",
639
+ "es": "Acerca de Nosotros"
763
640
  }
764
641
  }
765
642
  }
766
643
  }
767
644
  ```
768
645
 
769
- ### Cấu hình TypeScript
770
-
771
- Intlayer sử dụng module augmentation để tận dụng lợi ích của TypeScript và làm cho codebase của bạn mạnh mẽ hơn.
772
-
773
- ![Tự động hoàn thành](https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true)
774
-
775
- ![Lỗi dịch thuật](https://github.com/aymericzip/intlayer/blob/main/docs/assets/translation_error.png?raw=true)
776
-
777
- Đảm bảo cấu hình TypeScript của bạn bao gồm các kiểu được tạo tự động.
778
-
779
- ```json5 fileName="tsconfig.json"
780
- {
781
- // ... Các cấu hình TypeScript hiện có của bạn
782
- "include": [
783
- // ... Các cấu hình TypeScript hiện có của bạn
784
- ".intlayer/**/*.ts", // Bao gồm các kiểu được tạo tự động
785
- ],
786
- }
787
- ```
788
-
789
646
  ### Cấu hình Git
790
647
 
791
- Khuyến nghị bạn nên bỏ qua các file được tạo bởi Intlayer. Điều này giúp bạn tránh việc commit chúng vào kho Git của mình.
648
+ Khuyến nghị bỏ qua các tệp được tạo bởi Intlayer. Điều này giúp bạn tránh việc commit chúng vào kho Git của mình.
792
649
 
793
- Để làm điều này, bạn có thể thêm các hướng dẫn sau vào file `.gitignore` của bạn:
650
+ Để làm điều này, bạn có thể thêm các hướng dẫn sau vào tệp `.gitignore` của bạn:
794
651
 
795
652
  ```plaintext fileName=".gitignore"
796
- # Bỏ qua các file được tạo bởi Intlayer
653
+ # Bỏ qua các tệp được tạo bởi Intlayer
797
654
  .intlayer
798
655
  ```
799
656
 
800
657
  ### Tiện ích mở rộng VS Code
801
658
 
802
- Để cải thiện trải nghiệm phát triển với Intlayer, bạn có thể cài đặt **Tiện ích mở rộng Intlayer cho VS Code** chính thức.
659
+ Để cải thiện trải nghiệm phát triển của bạn với Intlayer, bạn có thể cài đặt **Tiện ích mở rộng Intlayer cho VS Code** chính thức.
803
660
 
804
661
  [Cài đặt từ VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
805
662
 
806
663
  Tiện ích mở rộng này cung cấp:
807
664
 
808
665
  - **Tự động hoàn thành** cho các khóa dịch.
809
- - **Phát hiện lỗi thời gian thực** cho các bản dịch còn thiếu.
666
+ - **Phát hiện lỗi thời gian thực** cho các bản dịch bị thiếu.
810
667
  - **Xem trước nội dung dịch ngay trong dòng**.
811
668
  - **Hành động nhanh** để dễ dàng tạo và cập nhật các bản dịch.
812
669
 
813
- Để 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 cho VS Code](https://intlayer.org/doc/vs-code-extension).
670
+ Để 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 cho VS Code](https://intlayer.org/doc/vs-code-extension).
814
671
 
815
672
  ---
816
673
 
817
- ### Tiến xa hơn
818
-
819
- Để tiến xa hơn, bạn có thể triển khai [trình soạn thảo trực quan](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_visual_editor.md) hoặc tách nội dung của bạn ra ngoài bằng cách sử dụng [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_CMS.md).
674
+ ### Đi xa hơn
820
675
 
821
- ---
676
+ Để đ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 tách nội dung của bạn ra bên ngoài bằng cách sử dụng [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_CMS.md).