@intlayer/docs 7.0.7 → 7.0.8-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (726) hide show
  1. package/blog/ar/i18n_using_next-i18next.md +1068 -0
  2. package/blog/ar/i18n_using_next-intl.md +768 -0
  3. package/blog/ar/intlayer_with_react-intl.md +0 -4
  4. package/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md +5 -4
  5. package/blog/de/i18n_using_next-i18next.md +1107 -0
  6. package/blog/de/i18n_using_next-intl.md +760 -0
  7. package/blog/de/intlayer_with_react-intl.md +0 -4
  8. package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  9. package/blog/en/i18n_using_next-i18next.md +1073 -0
  10. package/blog/en/i18n_using_next-intl.md +757 -0
  11. package/blog/en/intlayer_with_i18next.md +71 -8
  12. package/blog/en/intlayer_with_next-i18next.md +71 -8
  13. package/blog/en/intlayer_with_next-intl.md +71 -8
  14. package/blog/en/intlayer_with_react-i18next.md +69 -8
  15. package/blog/en/intlayer_with_react-intl.md +68 -9
  16. package/blog/en/intlayer_with_vue-i18n.md +68 -7
  17. package/blog/en/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
  18. package/blog/en/vue-i18n_vs_intlayer.md +2 -0
  19. package/blog/en-GB/i18n_using_next-i18next.md +1074 -0
  20. package/blog/en-GB/i18n_using_next-intl.md +757 -0
  21. package/blog/en-GB/intlayer_with_i18next.md +15 -6
  22. package/blog/en-GB/intlayer_with_next-i18next.md +16 -6
  23. package/blog/en-GB/intlayer_with_next-intl.md +16 -6
  24. package/blog/en-GB/intlayer_with_react-i18next.md +16 -7
  25. package/blog/en-GB/intlayer_with_react-intl.md +14 -9
  26. package/blog/en-GB/intlayer_with_vue-i18n.md +16 -7
  27. package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  28. package/blog/en-GB/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
  29. package/blog/en-GB/vue-i18n_vs_intlayer.md +2 -0
  30. package/blog/es/i18n_using_next-i18next.md +1066 -0
  31. package/blog/es/i18n_using_next-intl.md +757 -0
  32. package/blog/es/intlayer_with_react-intl.md +0 -4
  33. package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  34. package/blog/fr/i18n_using_next-i18next.md +1078 -0
  35. package/blog/fr/i18n_using_next-intl.md +759 -0
  36. package/blog/fr/intlayer_with_react-intl.md +0 -4
  37. package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  38. package/blog/hi/i18n_using_next-i18next.md +1068 -0
  39. package/blog/hi/i18n_using_next-intl.md +758 -0
  40. package/blog/hi/intlayer_with_react-intl.md +0 -4
  41. package/blog/hi/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  42. package/blog/id/i18n_using_next-i18next.md +1078 -0
  43. package/blog/id/i18n_using_next-intl.md +757 -0
  44. package/blog/id/index.md +69 -0
  45. package/blog/id/internationalization_and_SEO.md +364 -0
  46. package/blog/id/intlayer_with_react-intl.md +0 -4
  47. package/blog/id/list_i18n_technologies/CMS/drupal.md +143 -0
  48. package/blog/id/list_i18n_technologies/CMS/wix.md +167 -0
  49. package/blog/id/list_i18n_technologies/CMS/wordpress.md +188 -0
  50. package/blog/id/list_i18n_technologies/frameworks/angular.md +125 -0
  51. package/blog/id/list_i18n_technologies/frameworks/flutter.md +150 -0
  52. package/blog/id/list_i18n_technologies/frameworks/react-native.md +217 -0
  53. package/blog/id/list_i18n_technologies/frameworks/react.md +155 -0
  54. package/blog/id/list_i18n_technologies/frameworks/svelte.md +131 -0
  55. package/blog/id/list_i18n_technologies/frameworks/vue.md +130 -0
  56. package/blog/id/next-i18next_vs_next-intl_vs_intlayer.md +1500 -0
  57. package/blog/id/nextjs-multilingual-seo-comparison.md +361 -0
  58. package/blog/id/rag_powered_documentation_assistant.md +288 -0
  59. package/blog/id/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
  60. package/blog/id/vue-i18n_vs_intlayer.md +278 -0
  61. package/blog/id/what_is_internationalization.md +166 -0
  62. package/blog/it/i18n_using_next-i18next.md +1078 -0
  63. package/blog/it/i18n_using_next-intl.md +758 -0
  64. package/blog/it/intlayer_with_react-intl.md +0 -4
  65. package/blog/it/react-i18next_vs_react-intl_vs_intlayer.md +4 -0
  66. package/blog/it/vue-i18n_vs_intlayer.md +2 -0
  67. package/blog/ja/i18n_using_next-i18next.md +1078 -0
  68. package/blog/ja/i18n_using_next-intl.md +758 -0
  69. package/blog/ja/intlayer_with_react-intl.md +0 -4
  70. package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  71. package/blog/ko/i18n_using_next-i18next.md +1075 -0
  72. package/blog/ko/i18n_using_next-intl.md +759 -0
  73. package/blog/ko/intlayer_with_react-intl.md +0 -4
  74. package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  75. package/blog/pl/i18n_using_next-i18next.md +1078 -0
  76. package/blog/pl/i18n_using_next-intl.md +758 -0
  77. package/blog/pl/index.md +69 -0
  78. package/blog/pl/internationalization_and_SEO.md +363 -0
  79. package/blog/pl/intlayer_with_react-intl.md +0 -4
  80. package/blog/pl/list_i18n_technologies/CMS/drupal.md +143 -0
  81. package/blog/pl/list_i18n_technologies/CMS/wix.md +167 -0
  82. package/blog/pl/list_i18n_technologies/CMS/wordpress.md +196 -0
  83. package/blog/pl/list_i18n_technologies/frameworks/angular.md +125 -0
  84. package/blog/pl/list_i18n_technologies/frameworks/flutter.md +151 -0
  85. package/blog/pl/list_i18n_technologies/frameworks/react-native.md +217 -0
  86. package/blog/pl/list_i18n_technologies/frameworks/react.md +155 -0
  87. package/blog/pl/list_i18n_technologies/frameworks/svelte.md +131 -0
  88. package/blog/pl/list_i18n_technologies/frameworks/vue.md +130 -0
  89. package/blog/pl/next-i18next_vs_next-intl_vs_intlayer.md +1501 -0
  90. package/blog/pl/nextjs-multilingual-seo-comparison.md +362 -0
  91. package/blog/pl/rag_powered_documentation_assistant.md +288 -0
  92. package/blog/pl/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
  93. package/blog/pl/vue-i18n_vs_intlayer.md +278 -0
  94. package/blog/pl/what_is_internationalization.md +167 -0
  95. package/blog/pt/i18n_using_next-i18next.md +1067 -0
  96. package/blog/pt/i18n_using_next-intl.md +760 -0
  97. package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  98. package/blog/ru/i18n_using_next-i18next.md +1106 -0
  99. package/blog/ru/i18n_using_next-intl.md +759 -0
  100. package/blog/ru/intlayer_with_react-intl.md +0 -4
  101. package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  102. package/blog/tr/i18n_using_next-i18next.md +1078 -0
  103. package/blog/tr/i18n_using_next-intl.md +760 -0
  104. package/blog/tr/intlayer_with_react-intl.md +0 -4
  105. package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  106. package/blog/tr/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
  107. package/blog/tr/vue-i18n_vs_intlayer.md +2 -0
  108. package/blog/vi/i18n_using_next-i18next.md +1080 -0
  109. package/blog/vi/i18n_using_next-intl.md +758 -0
  110. package/blog/vi/index.md +69 -0
  111. package/blog/vi/internationalization_and_SEO.md +363 -0
  112. package/blog/vi/intlayer_with_react-intl.md +0 -4
  113. package/blog/vi/list_i18n_technologies/CMS/drupal.md +143 -0
  114. package/blog/vi/list_i18n_technologies/CMS/wix.md +167 -0
  115. package/blog/vi/list_i18n_technologies/CMS/wordpress.md +188 -0
  116. package/blog/vi/list_i18n_technologies/frameworks/angular.md +125 -0
  117. package/blog/vi/list_i18n_technologies/frameworks/flutter.md +150 -0
  118. package/blog/vi/list_i18n_technologies/frameworks/react-native.md +217 -0
  119. package/blog/vi/list_i18n_technologies/frameworks/react.md +155 -0
  120. package/blog/vi/list_i18n_technologies/frameworks/svelte.md +131 -0
  121. package/blog/vi/list_i18n_technologies/frameworks/vue.md +130 -0
  122. package/blog/vi/next-i18next_vs_next-intl_vs_intlayer.md +1520 -0
  123. package/blog/vi/nextjs-multilingual-seo-comparison.md +362 -0
  124. package/blog/vi/rag_powered_documentation_assistant.md +288 -0
  125. package/blog/vi/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
  126. package/blog/vi/vue-i18n_vs_intlayer.md +278 -0
  127. package/blog/vi/what_is_internationalization.md +168 -0
  128. package/blog/zh/i18n_using_next-i18next.md +1105 -0
  129. package/blog/zh/i18n_using_next-intl.md +758 -0
  130. package/blog/zh/intlayer_with_react-intl.md +0 -4
  131. package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  132. package/blog/zh/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
  133. package/dist/cjs/common.cjs +0 -4
  134. package/dist/cjs/common.cjs.map +1 -1
  135. package/dist/cjs/generated/blog.entry.cjs +38 -6
  136. package/dist/cjs/generated/blog.entry.cjs.map +1 -1
  137. package/dist/cjs/generated/docs.entry.cjs +0 -6
  138. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  139. package/dist/cjs/generated/frequentQuestions.entry.cjs +0 -6
  140. package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
  141. package/dist/cjs/generated/legal.entry.cjs +0 -6
  142. package/dist/cjs/generated/legal.entry.cjs.map +1 -1
  143. package/dist/esm/generated/blog.entry.mjs +38 -0
  144. package/dist/esm/generated/blog.entry.mjs.map +1 -1
  145. package/dist/types/generated/blog.entry.d.ts +2 -0
  146. package/dist/types/generated/blog.entry.d.ts.map +1 -1
  147. package/docs/ar/component_i18n.md +1 -1
  148. package/docs/ar/configuration.md +6 -0
  149. package/docs/ar/intlayer_cli.md +8 -3
  150. package/docs/ar/intlayer_with_next-i18next.md +619 -0
  151. package/docs/ar/intlayer_with_next-intl.md +446 -0
  152. package/docs/ar/intlayer_with_nextjs_16.md +21 -0
  153. package/docs/ar/intlayer_with_tanstack.md +4 -0
  154. package/docs/ar/intlayer_with_vite+react.md +4 -0
  155. package/docs/de/component_i18n.md +1 -1
  156. package/docs/de/configuration.md +6 -0
  157. package/docs/de/intlayer_cli.md +8 -3
  158. package/docs/de/intlayer_with_next-i18next.md +627 -0
  159. package/docs/de/intlayer_with_next-intl.md +451 -0
  160. package/docs/de/intlayer_with_nextjs_16.md +21 -0
  161. package/docs/de/intlayer_with_tanstack.md +4 -0
  162. package/docs/de/intlayer_with_vite+react.md +4 -0
  163. package/docs/en/component_i18n.md +1 -1
  164. package/docs/en/intlayer_cli.md +8 -1
  165. package/docs/en/intlayer_with_astro.md +10 -2
  166. package/docs/en/intlayer_with_create_react_app.md +8 -0
  167. package/docs/en/intlayer_with_lynx+react.md +8 -0
  168. package/docs/en/intlayer_with_nestjs.md +10 -0
  169. package/docs/en/intlayer_with_nextjs_14.md +10 -2
  170. package/docs/en/intlayer_with_nextjs_15.md +21 -4
  171. package/docs/en/intlayer_with_nextjs_16.md +17 -0
  172. package/docs/en/intlayer_with_nuxt.md +8 -0
  173. package/docs/en/intlayer_with_react_native+expo.md +10 -2
  174. package/docs/en/intlayer_with_react_router_v7.md +8 -0
  175. package/docs/en/intlayer_with_tanstack.md +10 -0
  176. package/docs/en/intlayer_with_vite+preact.md +10 -2
  177. package/docs/en/intlayer_with_vite+react.md +21 -4
  178. package/docs/en/intlayer_with_vite+vue.md +10 -2
  179. package/docs/en-GB/component_i18n.md +1 -1
  180. package/docs/en-GB/configuration.md +6 -0
  181. package/docs/en-GB/intlayer_cli.md +8 -3
  182. package/docs/en-GB/intlayer_with_angular.md +4 -4
  183. package/docs/en-GB/intlayer_with_express.md +4 -4
  184. package/docs/en-GB/intlayer_with_lynx+react.md +12 -12
  185. package/{blog/en/_intlayer_with_next-i18next.md → docs/en-GB/intlayer_with_next-i18next.md} +241 -42
  186. package/{blog/en/_intlayer_with_next-intl.md → docs/en-GB/intlayer_with_next-intl.md} +144 -29
  187. package/docs/en-GB/intlayer_with_nextjs_16.md +21 -0
  188. package/docs/en-GB/intlayer_with_tanstack.md +5 -1
  189. package/docs/en-GB/intlayer_with_vite+react.md +4 -0
  190. package/docs/en-GB/packages/next-intlayer/t.md +2 -2
  191. package/docs/es/component_i18n.md +1 -1
  192. package/docs/es/configuration.md +6 -0
  193. package/docs/es/intlayer_cli.md +8 -3
  194. package/docs/es/intlayer_with_next-i18next.md +628 -0
  195. package/docs/es/intlayer_with_next-intl.md +446 -0
  196. package/docs/es/intlayer_with_nextjs_16.md +21 -0
  197. package/docs/es/intlayer_with_tanstack.md +4 -0
  198. package/docs/es/intlayer_with_vite+react.md +4 -0
  199. package/docs/fr/configuration.md +6 -0
  200. package/docs/fr/intlayer_cli.md +8 -3
  201. package/docs/fr/intlayer_with_next-i18next.md +628 -0
  202. package/docs/fr/intlayer_with_next-intl.md +446 -0
  203. package/docs/fr/intlayer_with_nextjs_16.md +23 -2
  204. package/docs/fr/intlayer_with_tanstack.md +4 -0
  205. package/docs/fr/intlayer_with_vite+react.md +4 -0
  206. package/docs/hi/component_i18n.md +1 -1
  207. package/docs/hi/configuration.md +6 -0
  208. package/docs/hi/intlayer_cli.md +8 -0
  209. package/docs/hi/intlayer_with_next-i18next.md +628 -0
  210. package/docs/hi/intlayer_with_next-intl.md +446 -0
  211. package/docs/hi/intlayer_with_nextjs_16.md +21 -0
  212. package/docs/hi/intlayer_with_tanstack.md +4 -0
  213. package/docs/hi/intlayer_with_vite+react.md +4 -0
  214. package/docs/id/CI_CD.md +198 -0
  215. package/docs/id/autoFill.md +284 -0
  216. package/docs/id/component_i18n.md +186 -0
  217. package/docs/id/configuration.md +710 -0
  218. package/docs/id/dictionary/condition.md +231 -0
  219. package/docs/id/dictionary/content_file.md +1092 -0
  220. package/docs/id/dictionary/enumeration.md +245 -0
  221. package/docs/id/dictionary/file.md +237 -0
  222. package/docs/id/dictionary/function_fetching.md +214 -0
  223. package/docs/id/dictionary/gender.md +273 -0
  224. package/docs/id/dictionary/insertion.md +192 -0
  225. package/docs/id/dictionary/markdown.md +381 -0
  226. package/docs/id/dictionary/nesting.md +273 -0
  227. package/docs/id/dictionary/translation.md +310 -0
  228. package/docs/id/formatters.md +596 -0
  229. package/docs/id/how_works_intlayer.md +256 -0
  230. package/docs/id/index.md +176 -0
  231. package/docs/id/interest_of_intlayer.md +293 -0
  232. package/docs/id/intlayer_CMS.md +549 -0
  233. package/docs/id/intlayer_cli.md +850 -0
  234. package/docs/id/intlayer_visual_editor.md +288 -0
  235. package/docs/id/intlayer_with_angular.md +694 -0
  236. package/docs/id/intlayer_with_astro.md +252 -0
  237. package/docs/id/intlayer_with_create_react_app.md +1233 -0
  238. package/docs/id/intlayer_with_express.md +411 -0
  239. package/docs/id/intlayer_with_lynx+react.md +518 -0
  240. package/docs/id/intlayer_with_nestjs.md +272 -0
  241. package/docs/id/intlayer_with_next-i18next.md +628 -0
  242. package/docs/id/intlayer_with_next-intl.md +446 -0
  243. package/docs/id/intlayer_with_nextjs_14.md +1617 -0
  244. package/docs/id/intlayer_with_nextjs_15.md +1698 -0
  245. package/docs/id/intlayer_with_nextjs_16.md +21 -0
  246. package/docs/id/intlayer_with_nextjs_page_router.md +1478 -0
  247. package/docs/id/intlayer_with_nuxt.md +808 -0
  248. package/docs/id/intlayer_with_react_native+expo.md +699 -0
  249. package/docs/id/intlayer_with_react_router_v7.md +496 -0
  250. package/docs/id/intlayer_with_tanstack.md +564 -0
  251. package/docs/id/intlayer_with_vite+preact.md +1737 -0
  252. package/docs/id/intlayer_with_vite+react.md +1413 -0
  253. package/docs/id/intlayer_with_vite+solid.md +289 -0
  254. package/docs/id/intlayer_with_vite+svelte.md +289 -0
  255. package/docs/id/intlayer_with_vite+vue.md +1088 -0
  256. package/docs/id/introduction.md +218 -0
  257. package/docs/id/locale_mapper.md +242 -0
  258. package/docs/id/mcp_server.md +211 -0
  259. package/docs/id/packages/express-intlayer/t.md +458 -0
  260. package/docs/id/packages/intlayer/getConfiguration.md +145 -0
  261. package/docs/id/packages/intlayer/getEnumeration.md +159 -0
  262. package/docs/id/packages/intlayer/getHTMLTextDir.md +122 -0
  263. package/docs/id/packages/intlayer/getLocaleLang.md +81 -0
  264. package/docs/id/packages/intlayer/getLocaleName.md +119 -0
  265. package/docs/id/packages/intlayer/getLocalizedUrl.md +309 -0
  266. package/docs/id/packages/intlayer/getMultilingualUrls.md +223 -0
  267. package/docs/id/packages/intlayer/getPathWithoutLocale.md +75 -0
  268. package/docs/id/packages/intlayer/getTranslation.md +190 -0
  269. package/docs/id/packages/intlayer/getTranslationContent.md +188 -0
  270. package/docs/id/packages/next-intlayer/t.md +352 -0
  271. package/docs/id/packages/next-intlayer/useDictionary.md +271 -0
  272. package/docs/id/packages/next-intlayer/useIntlayer.md +264 -0
  273. package/docs/id/packages/next-intlayer/useLocale.md +166 -0
  274. package/docs/id/packages/react-intlayer/t.md +303 -0
  275. package/docs/id/packages/react-intlayer/useDictionary.md +287 -0
  276. package/docs/id/packages/react-intlayer/useI18n.md +267 -0
  277. package/docs/id/packages/react-intlayer/useIntlayer.md +254 -0
  278. package/docs/id/packages/react-intlayer/useLocale.md +210 -0
  279. package/docs/id/per_locale_file.md +323 -0
  280. package/docs/id/readme.md +261 -0
  281. package/docs/id/releases/v6.md +305 -0
  282. package/docs/id/roadmap.md +362 -0
  283. package/docs/id/testing.md +202 -0
  284. package/docs/id/vs_code_extension.md +126 -0
  285. package/docs/it/component_i18n.md +1 -1
  286. package/docs/it/configuration.md +6 -0
  287. package/docs/it/intlayer_cli.md +8 -3
  288. package/docs/it/intlayer_with_next-i18next.md +628 -0
  289. package/docs/it/intlayer_with_next-intl.md +446 -0
  290. package/docs/it/intlayer_with_nextjs_16.md +21 -0
  291. package/docs/it/intlayer_with_tanstack.md +4 -0
  292. package/docs/it/intlayer_with_vite+react.md +4 -0
  293. package/docs/ja/component_i18n.md +1 -1
  294. package/docs/ja/configuration.md +6 -0
  295. package/docs/ja/intlayer_cli.md +8 -3
  296. package/docs/ja/intlayer_with_next-i18next.md +627 -0
  297. package/docs/ja/intlayer_with_next-intl.md +446 -0
  298. package/docs/ja/intlayer_with_nextjs_16.md +21 -0
  299. package/docs/ja/intlayer_with_tanstack.md +4 -0
  300. package/docs/ja/intlayer_with_vite+react.md +4 -0
  301. package/docs/ko/configuration.md +6 -0
  302. package/docs/ko/intlayer_cli.md +8 -3
  303. package/docs/ko/intlayer_with_next-i18next.md +627 -0
  304. package/docs/ko/intlayer_with_next-intl.md +446 -0
  305. package/docs/ko/intlayer_with_nextjs_16.md +21 -0
  306. package/docs/ko/intlayer_with_tanstack.md +4 -0
  307. package/docs/ko/intlayer_with_vite+react.md +4 -0
  308. package/docs/pl/CI_CD.md +198 -0
  309. package/docs/pl/autoFill.md +284 -0
  310. package/docs/pl/component_i18n.md +186 -0
  311. package/docs/pl/configuration.md +710 -0
  312. package/docs/pl/dictionary/condition.md +232 -0
  313. package/docs/pl/dictionary/content_file.md +1130 -0
  314. package/docs/pl/dictionary/enumeration.md +245 -0
  315. package/docs/pl/dictionary/file.md +234 -0
  316. package/docs/pl/dictionary/function_fetching.md +214 -0
  317. package/docs/pl/dictionary/gender.md +276 -0
  318. package/docs/pl/dictionary/insertion.md +188 -0
  319. package/docs/pl/dictionary/markdown.md +408 -0
  320. package/docs/pl/dictionary/nesting.md +273 -0
  321. package/docs/pl/dictionary/translation.md +310 -0
  322. package/docs/pl/formatters.md +596 -0
  323. package/docs/pl/how_works_intlayer.md +256 -0
  324. package/docs/pl/index.md +176 -0
  325. package/docs/pl/interest_of_intlayer.md +291 -0
  326. package/docs/pl/intlayer_CMS.md +549 -0
  327. package/docs/pl/intlayer_cli.md +857 -0
  328. package/docs/pl/intlayer_visual_editor.md +288 -0
  329. package/docs/pl/intlayer_with_angular.md +690 -0
  330. package/docs/pl/intlayer_with_astro.md +280 -0
  331. package/docs/pl/intlayer_with_create_react_app.md +1235 -0
  332. package/docs/pl/intlayer_with_express.md +411 -0
  333. package/docs/pl/intlayer_with_lynx+react.md +518 -0
  334. package/docs/pl/intlayer_with_nestjs.md +272 -0
  335. package/docs/pl/intlayer_with_next-i18next.md +628 -0
  336. package/docs/pl/intlayer_with_next-intl.md +446 -0
  337. package/docs/pl/intlayer_with_nextjs_14.md +1594 -0
  338. package/docs/pl/intlayer_with_nextjs_15.md +1701 -0
  339. package/docs/pl/intlayer_with_nextjs_16.md +21 -0
  340. package/docs/pl/intlayer_with_nextjs_page_router.md +1513 -0
  341. package/docs/pl/intlayer_with_nuxt.md +885 -0
  342. package/docs/pl/intlayer_with_react_native+expo.md +698 -0
  343. package/docs/pl/intlayer_with_react_router_v7.md +503 -0
  344. package/docs/pl/intlayer_with_tanstack.md +562 -0
  345. package/docs/pl/intlayer_with_vite+preact.md +1736 -0
  346. package/docs/pl/intlayer_with_vite+react.md +1438 -0
  347. package/docs/pl/intlayer_with_vite+solid.md +290 -0
  348. package/docs/pl/intlayer_with_vite+svelte.md +289 -0
  349. package/docs/pl/intlayer_with_vite+vue.md +1116 -0
  350. package/docs/pl/introduction.md +209 -0
  351. package/docs/pl/locale_mapper.md +242 -0
  352. package/docs/pl/mcp_server.md +211 -0
  353. package/docs/pl/packages/express-intlayer/t.md +458 -0
  354. package/docs/pl/packages/intlayer/getConfiguration.md +146 -0
  355. package/docs/pl/packages/intlayer/getEnumeration.md +160 -0
  356. package/docs/pl/packages/intlayer/getHTMLTextDir.md +121 -0
  357. package/docs/pl/packages/intlayer/getLocaleLang.md +81 -0
  358. package/docs/pl/packages/intlayer/getLocaleName.md +118 -0
  359. package/docs/pl/packages/intlayer/getLocalizedUrl.md +300 -0
  360. package/docs/pl/packages/intlayer/getMultilingualUrls.md +221 -0
  361. package/docs/pl/packages/intlayer/getPathWithoutLocale.md +75 -0
  362. package/docs/pl/packages/intlayer/getTranslation.md +190 -0
  363. package/docs/pl/packages/intlayer/getTranslationContent.md +189 -0
  364. package/docs/pl/packages/next-intlayer/t.md +353 -0
  365. package/docs/pl/packages/next-intlayer/useDictionary.md +270 -0
  366. package/docs/pl/packages/next-intlayer/useIntlayer.md +263 -0
  367. package/docs/pl/packages/next-intlayer/useLocale.md +166 -0
  368. package/docs/pl/packages/react-intlayer/t.md +303 -0
  369. package/docs/pl/packages/react-intlayer/useDictionary.md +289 -0
  370. package/docs/pl/packages/react-intlayer/useI18n.md +249 -0
  371. package/docs/pl/packages/react-intlayer/useIntlayer.md +256 -0
  372. package/docs/pl/packages/react-intlayer/useLocale.md +210 -0
  373. package/docs/pl/per_locale_file.md +321 -0
  374. package/docs/pl/readme.md +261 -0
  375. package/docs/pl/releases/v6.md +305 -0
  376. package/docs/pl/roadmap.md +362 -0
  377. package/docs/pl/testing.md +202 -0
  378. package/docs/pl/vs_code_extension.md +126 -0
  379. package/docs/pt/component_i18n.md +1 -1
  380. package/docs/pt/configuration.md +6 -0
  381. package/docs/pt/intlayer_cli.md +8 -3
  382. package/docs/pt/intlayer_with_next-i18next.md +627 -0
  383. package/docs/pt/intlayer_with_next-intl.md +446 -0
  384. package/docs/pt/intlayer_with_nextjs_16.md +21 -0
  385. package/docs/pt/intlayer_with_tanstack.md +4 -0
  386. package/docs/pt/intlayer_with_vite+react.md +4 -0
  387. package/docs/ru/component_i18n.md +1 -1
  388. package/docs/ru/configuration.md +6 -0
  389. package/docs/ru/intlayer_cli.md +301 -22
  390. package/docs/ru/intlayer_with_next-i18next.md +629 -0
  391. package/docs/ru/intlayer_with_next-intl.md +448 -0
  392. package/docs/ru/intlayer_with_nextjs_16.md +21 -0
  393. package/docs/ru/intlayer_with_tanstack.md +4 -0
  394. package/docs/ru/intlayer_with_vite+react.md +4 -0
  395. package/docs/tr/component_i18n.md +1 -1
  396. package/docs/tr/configuration.md +6 -0
  397. package/docs/tr/intlayer_cli.md +8 -0
  398. package/docs/tr/intlayer_with_next-i18next.md +627 -0
  399. package/docs/tr/intlayer_with_next-intl.md +446 -0
  400. package/docs/tr/intlayer_with_nextjs_16.md +21 -0
  401. package/docs/tr/intlayer_with_tanstack.md +4 -0
  402. package/docs/tr/intlayer_with_vite+react.md +4 -0
  403. package/docs/vi/CI_CD.md +198 -0
  404. package/docs/vi/autoFill.md +284 -0
  405. package/docs/vi/component_i18n.md +186 -0
  406. package/docs/vi/configuration.md +710 -0
  407. package/docs/vi/dictionary/condition.md +237 -0
  408. package/docs/vi/dictionary/content_file.md +1115 -0
  409. package/docs/vi/dictionary/enumeration.md +255 -0
  410. package/docs/vi/dictionary/file.md +234 -0
  411. package/docs/vi/dictionary/function_fetching.md +212 -0
  412. package/docs/vi/dictionary/gender.md +275 -0
  413. package/docs/vi/dictionary/insertion.md +191 -0
  414. package/docs/vi/dictionary/markdown.md +381 -0
  415. package/docs/vi/dictionary/nesting.md +273 -0
  416. package/docs/vi/dictionary/translation.md +309 -0
  417. package/docs/vi/formatters.md +595 -0
  418. package/docs/vi/how_works_intlayer.md +256 -0
  419. package/docs/vi/index.md +174 -0
  420. package/docs/vi/interest_of_intlayer.md +292 -0
  421. package/docs/vi/intlayer_CMS.md +549 -0
  422. package/docs/vi/intlayer_cli.md +850 -0
  423. package/docs/vi/intlayer_visual_editor.md +288 -0
  424. package/docs/vi/intlayer_with_angular.md +692 -0
  425. package/docs/vi/intlayer_with_astro.md +252 -0
  426. package/docs/vi/intlayer_with_create_react_app.md +1230 -0
  427. package/docs/vi/intlayer_with_express.md +409 -0
  428. package/docs/vi/intlayer_with_lynx+react.md +520 -0
  429. package/docs/vi/intlayer_with_nestjs.md +272 -0
  430. package/docs/vi/intlayer_with_next-i18next.md +628 -0
  431. package/docs/vi/intlayer_with_next-intl.md +446 -0
  432. package/docs/vi/intlayer_with_nextjs_14.md +1584 -0
  433. package/docs/vi/intlayer_with_nextjs_15.md +1738 -0
  434. package/docs/vi/intlayer_with_nextjs_16.md +21 -0
  435. package/docs/vi/intlayer_with_nextjs_page_router.md +1504 -0
  436. package/docs/vi/intlayer_with_nuxt.md +821 -0
  437. package/docs/vi/intlayer_with_react_native+expo.md +700 -0
  438. package/docs/vi/intlayer_with_react_router_v7.md +498 -0
  439. package/docs/vi/intlayer_with_tanstack.md +562 -0
  440. package/docs/vi/intlayer_with_vite+preact.md +1722 -0
  441. package/docs/vi/intlayer_with_vite+react.md +1407 -0
  442. package/docs/vi/intlayer_with_vite+solid.md +287 -0
  443. package/docs/vi/intlayer_with_vite+svelte.md +289 -0
  444. package/docs/vi/intlayer_with_vite+vue.md +1071 -0
  445. package/docs/vi/introduction.md +215 -0
  446. package/docs/vi/locale_mapper.md +242 -0
  447. package/docs/vi/mcp_server.md +211 -0
  448. package/docs/vi/packages/express-intlayer/t.md +457 -0
  449. package/docs/vi/packages/intlayer/getConfiguration.md +145 -0
  450. package/docs/vi/packages/intlayer/getEnumeration.md +162 -0
  451. package/docs/vi/packages/intlayer/getHTMLTextDir.md +121 -0
  452. package/docs/vi/packages/intlayer/getLocaleLang.md +81 -0
  453. package/docs/vi/packages/intlayer/getLocaleName.md +129 -0
  454. package/docs/vi/packages/intlayer/getLocalizedUrl.md +309 -0
  455. package/docs/vi/packages/intlayer/getMultilingualUrls.md +221 -0
  456. package/docs/vi/packages/intlayer/getPathWithoutLocale.md +75 -0
  457. package/docs/vi/packages/intlayer/getTranslation.md +201 -0
  458. package/docs/vi/packages/intlayer/getTranslationContent.md +188 -0
  459. package/docs/vi/packages/next-intlayer/t.md +352 -0
  460. package/docs/vi/packages/next-intlayer/useDictionary.md +273 -0
  461. package/docs/vi/packages/next-intlayer/useIntlayer.md +264 -0
  462. package/docs/vi/packages/next-intlayer/useLocale.md +166 -0
  463. package/docs/vi/packages/react-intlayer/t.md +304 -0
  464. package/docs/vi/packages/react-intlayer/useDictionary.md +288 -0
  465. package/docs/vi/packages/react-intlayer/useI18n.md +295 -0
  466. package/docs/vi/packages/react-intlayer/useIntlayer.md +256 -0
  467. package/docs/vi/packages/react-intlayer/useLocale.md +210 -0
  468. package/docs/vi/per_locale_file.md +326 -0
  469. package/docs/vi/readme.md +261 -0
  470. package/docs/vi/releases/v6.md +305 -0
  471. package/docs/vi/roadmap.md +346 -0
  472. package/docs/vi/testing.md +202 -0
  473. package/docs/vi/vs_code_extension.md +126 -0
  474. package/docs/zh/configuration.md +6 -0
  475. package/docs/zh/intlayer_cli.md +8 -3
  476. package/docs/zh/intlayer_with_next-i18next.md +628 -0
  477. package/docs/zh/intlayer_with_next-intl.md +448 -0
  478. package/docs/zh/intlayer_with_nextjs_16.md +21 -0
  479. package/docs/zh/intlayer_with_tanstack.md +4 -0
  480. package/docs/zh/intlayer_with_vite+react.md +4 -0
  481. package/frequent_questions/ar/SSR_Next_no_[locale].md +1 -2
  482. package/frequent_questions/ar/array_as_content_declaration.md +1 -2
  483. package/frequent_questions/ar/build_dictionaries.md +1 -2
  484. package/frequent_questions/ar/build_error_CI_CD.md +1 -2
  485. package/frequent_questions/ar/bun_set_up.md +1 -2
  486. package/frequent_questions/ar/customized_locale_list.md +1 -2
  487. package/frequent_questions/ar/domain_routing.md +1 -2
  488. package/frequent_questions/ar/esbuild_error.md +1 -2
  489. package/frequent_questions/ar/get_locale_cookie.md +1 -2
  490. package/frequent_questions/ar/intlayer_command_undefined.md +1 -2
  491. package/frequent_questions/ar/locale_incorect_in_url.md +1 -2
  492. package/frequent_questions/ar/static_rendering.md +1 -3
  493. package/frequent_questions/ar/translated_path_url.md +1 -2
  494. package/frequent_questions/ar/unknown_command.md +1 -2
  495. package/frequent_questions/de/SSR_Next_no_[locale].md +1 -2
  496. package/frequent_questions/de/array_as_content_declaration.md +1 -2
  497. package/frequent_questions/de/build_dictionaries.md +1 -2
  498. package/frequent_questions/de/build_error_CI_CD.md +1 -2
  499. package/frequent_questions/de/bun_set_up.md +1 -2
  500. package/frequent_questions/de/customized_locale_list.md +1 -2
  501. package/frequent_questions/de/domain_routing.md +1 -2
  502. package/frequent_questions/de/esbuild_error.md +1 -2
  503. package/frequent_questions/de/get_locale_cookie.md +1 -2
  504. package/frequent_questions/de/intlayer_command_undefined.md +1 -2
  505. package/frequent_questions/de/locale_incorect_in_url.md +1 -2
  506. package/frequent_questions/de/static_rendering.md +1 -3
  507. package/frequent_questions/de/translated_path_url.md +1 -2
  508. package/frequent_questions/de/unknown_command.md +1 -2
  509. package/frequent_questions/en/SSR_Next_no_[locale].md +1 -2
  510. package/frequent_questions/en/array_as_content_declaration.md +1 -2
  511. package/frequent_questions/en/build_dictionaries.md +1 -2
  512. package/frequent_questions/en/build_error_CI_CD.md +1 -2
  513. package/frequent_questions/en/bun_set_up.md +1 -2
  514. package/frequent_questions/en/customized_locale_list.md +1 -2
  515. package/frequent_questions/en/domain_routing.md +1 -2
  516. package/frequent_questions/en/esbuild_error.md +1 -2
  517. package/frequent_questions/en/get_locale_cookie.md +1 -2
  518. package/frequent_questions/en/intlayer_command_undefined.md +1 -2
  519. package/frequent_questions/en/locale_incorect_in_url.md +1 -2
  520. package/frequent_questions/en/static_rendering.md +1 -3
  521. package/frequent_questions/en/translated_path_url.md +1 -2
  522. package/frequent_questions/en/unknown_command.md +1 -2
  523. package/frequent_questions/en-GB/SSR_Next_no_[locale].md +1 -2
  524. package/frequent_questions/en-GB/array_as_content_declaration.md +1 -2
  525. package/frequent_questions/en-GB/build_dictionaries.md +1 -2
  526. package/frequent_questions/en-GB/build_error_CI_CD.md +1 -2
  527. package/frequent_questions/en-GB/bun_set_up.md +1 -2
  528. package/frequent_questions/en-GB/customized_locale_list.md +1 -2
  529. package/frequent_questions/en-GB/domain_routing.md +1 -2
  530. package/frequent_questions/en-GB/esbuild_error.md +1 -2
  531. package/frequent_questions/en-GB/get_locale_cookie.md +1 -2
  532. package/frequent_questions/en-GB/intlayer_command_undefined.md +1 -2
  533. package/frequent_questions/en-GB/locale_incorect_in_url.md +1 -2
  534. package/frequent_questions/en-GB/static_rendering.md +1 -3
  535. package/frequent_questions/en-GB/translated_path_url.md +1 -2
  536. package/frequent_questions/en-GB/unknown_command.md +1 -2
  537. package/frequent_questions/es/SSR_Next_no_[locale].md +1 -2
  538. package/frequent_questions/es/array_as_content_declaration.md +1 -2
  539. package/frequent_questions/es/build_dictionaries.md +1 -2
  540. package/frequent_questions/es/build_error_CI_CD.md +1 -2
  541. package/frequent_questions/es/bun_set_up.md +1 -2
  542. package/frequent_questions/es/customized_locale_list.md +1 -2
  543. package/frequent_questions/es/domain_routing.md +1 -2
  544. package/frequent_questions/es/esbuild_error.md +1 -2
  545. package/frequent_questions/es/get_locale_cookie.md +1 -2
  546. package/frequent_questions/es/intlayer_command_undefined.md +1 -2
  547. package/frequent_questions/es/locale_incorect_in_url.md +1 -2
  548. package/frequent_questions/es/static_rendering.md +1 -3
  549. package/frequent_questions/es/translated_path_url.md +1 -2
  550. package/frequent_questions/es/unknown_command.md +1 -2
  551. package/frequent_questions/fr/SSR_Next_no_[locale].md +1 -2
  552. package/frequent_questions/fr/array_as_content_declaration.md +1 -2
  553. package/frequent_questions/fr/build_dictionaries.md +1 -2
  554. package/frequent_questions/fr/build_error_CI_CD.md +1 -2
  555. package/frequent_questions/fr/bun_set_up.md +1 -2
  556. package/frequent_questions/fr/customized_locale_list.md +1 -2
  557. package/frequent_questions/fr/domain_routing.md +1 -2
  558. package/frequent_questions/fr/esbuild_error.md +1 -2
  559. package/frequent_questions/fr/get_locale_cookie.md +1 -2
  560. package/frequent_questions/fr/intlayer_command_undefined.md +1 -2
  561. package/frequent_questions/fr/locale_incorect_in_url.md +1 -2
  562. package/frequent_questions/fr/static_rendering.md +1 -3
  563. package/frequent_questions/fr/translated_path_url.md +1 -2
  564. package/frequent_questions/fr/unknown_command.md +1 -2
  565. package/frequent_questions/hi/SSR_Next_no_[locale].md +1 -2
  566. package/frequent_questions/hi/array_as_content_declaration.md +1 -2
  567. package/frequent_questions/hi/build_dictionaries.md +1 -2
  568. package/frequent_questions/hi/build_error_CI_CD.md +1 -2
  569. package/frequent_questions/hi/bun_set_up.md +1 -2
  570. package/frequent_questions/hi/customized_locale_list.md +1 -2
  571. package/frequent_questions/hi/domain_routing.md +1 -2
  572. package/frequent_questions/hi/esbuild_error.md +1 -2
  573. package/frequent_questions/hi/get_locale_cookie.md +1 -2
  574. package/frequent_questions/hi/intlayer_command_undefined.md +1 -2
  575. package/frequent_questions/hi/locale_incorect_in_url.md +1 -2
  576. package/frequent_questions/hi/static_rendering.md +1 -3
  577. package/frequent_questions/hi/translated_path_url.md +1 -2
  578. package/frequent_questions/hi/unknown_command.md +1 -2
  579. package/frequent_questions/id/SSR_Next_no_[locale].md +104 -0
  580. package/frequent_questions/id/array_as_content_declaration.md +71 -0
  581. package/frequent_questions/id/build_dictionaries.md +58 -0
  582. package/frequent_questions/id/build_error_CI_CD.md +74 -0
  583. package/frequent_questions/id/bun_set_up.md +53 -0
  584. package/frequent_questions/id/customized_locale_list.md +64 -0
  585. package/frequent_questions/id/domain_routing.md +113 -0
  586. package/frequent_questions/id/esbuild_error.md +29 -0
  587. package/frequent_questions/id/get_locale_cookie.md +142 -0
  588. package/frequent_questions/id/intlayer_command_undefined.md +155 -0
  589. package/frequent_questions/id/locale_incorect_in_url.md +73 -0
  590. package/frequent_questions/id/static_rendering.md +44 -0
  591. package/frequent_questions/id/translated_path_url.md +55 -0
  592. package/frequent_questions/id/unknown_command.md +97 -0
  593. package/frequent_questions/it/SSR_Next_no_[locale].md +1 -2
  594. package/frequent_questions/it/array_as_content_declaration.md +1 -2
  595. package/frequent_questions/it/build_dictionaries.md +1 -2
  596. package/frequent_questions/it/build_error_CI_CD.md +1 -2
  597. package/frequent_questions/it/bun_set_up.md +1 -2
  598. package/frequent_questions/it/customized_locale_list.md +1 -2
  599. package/frequent_questions/it/domain_routing.md +1 -2
  600. package/frequent_questions/it/esbuild_error.md +1 -2
  601. package/frequent_questions/it/get_locale_cookie.md +1 -2
  602. package/frequent_questions/it/intlayer_command_undefined.md +1 -2
  603. package/frequent_questions/it/locale_incorect_in_url.md +1 -2
  604. package/frequent_questions/it/static_rendering.md +1 -3
  605. package/frequent_questions/it/translated_path_url.md +1 -2
  606. package/frequent_questions/it/unknown_command.md +1 -2
  607. package/frequent_questions/ja/SSR_Next_no_[locale].md +1 -2
  608. package/frequent_questions/ja/array_as_content_declaration.md +1 -2
  609. package/frequent_questions/ja/build_dictionaries.md +1 -2
  610. package/frequent_questions/ja/build_error_CI_CD.md +1 -2
  611. package/frequent_questions/ja/bun_set_up.md +1 -2
  612. package/frequent_questions/ja/customized_locale_list.md +1 -2
  613. package/frequent_questions/ja/domain_routing.md +1 -2
  614. package/frequent_questions/ja/esbuild_error.md +1 -2
  615. package/frequent_questions/ja/get_locale_cookie.md +1 -2
  616. package/frequent_questions/ja/intlayer_command_undefined.md +1 -2
  617. package/frequent_questions/ja/locale_incorect_in_url.md +1 -2
  618. package/frequent_questions/ja/static_rendering.md +1 -3
  619. package/frequent_questions/ja/translated_path_url.md +1 -2
  620. package/frequent_questions/ja/unknown_command.md +1 -2
  621. package/frequent_questions/ko/SSR_Next_no_[locale].md +1 -2
  622. package/frequent_questions/ko/array_as_content_declaration.md +1 -2
  623. package/frequent_questions/ko/build_dictionaries.md +1 -2
  624. package/frequent_questions/ko/build_error_CI_CD.md +1 -2
  625. package/frequent_questions/ko/bun_set_up.md +1 -2
  626. package/frequent_questions/ko/customized_locale_list.md +1 -2
  627. package/frequent_questions/ko/domain_routing.md +1 -2
  628. package/frequent_questions/ko/esbuild_error.md +1 -2
  629. package/frequent_questions/ko/get_locale_cookie.md +1 -2
  630. package/frequent_questions/ko/intlayer_command_undefined.md +1 -2
  631. package/frequent_questions/ko/locale_incorect_in_url.md +1 -2
  632. package/frequent_questions/ko/static_rendering.md +1 -3
  633. package/frequent_questions/ko/translated_path_url.md +1 -2
  634. package/frequent_questions/ko/unknown_command.md +1 -2
  635. package/frequent_questions/pl/SSR_Next_no_[locale].md +104 -0
  636. package/frequent_questions/pl/array_as_content_declaration.md +71 -0
  637. package/frequent_questions/pl/build_dictionaries.md +58 -0
  638. package/frequent_questions/pl/build_error_CI_CD.md +74 -0
  639. package/frequent_questions/pl/bun_set_up.md +54 -0
  640. package/frequent_questions/pl/customized_locale_list.md +64 -0
  641. package/frequent_questions/pl/domain_routing.md +113 -0
  642. package/frequent_questions/pl/esbuild_error.md +29 -0
  643. package/frequent_questions/pl/get_locale_cookie.md +142 -0
  644. package/frequent_questions/pl/intlayer_command_undefined.md +155 -0
  645. package/frequent_questions/pl/locale_incorect_in_url.md +73 -0
  646. package/frequent_questions/pl/static_rendering.md +44 -0
  647. package/frequent_questions/pl/translated_path_url.md +55 -0
  648. package/frequent_questions/pl/unknown_command.md +97 -0
  649. package/frequent_questions/pt/SSR_Next_no_[locale].md +1 -2
  650. package/frequent_questions/pt/array_as_content_declaration.md +1 -2
  651. package/frequent_questions/pt/build_dictionaries.md +1 -2
  652. package/frequent_questions/pt/build_error_CI_CD.md +1 -2
  653. package/frequent_questions/pt/bun_set_up.md +1 -2
  654. package/frequent_questions/pt/customized_locale_list.md +1 -2
  655. package/frequent_questions/pt/domain_routing.md +1 -2
  656. package/frequent_questions/pt/esbuild_error.md +1 -2
  657. package/frequent_questions/pt/get_locale_cookie.md +1 -2
  658. package/frequent_questions/pt/intlayer_command_undefined.md +1 -2
  659. package/frequent_questions/pt/locale_incorect_in_url.md +1 -2
  660. package/frequent_questions/pt/static_rendering.md +1 -3
  661. package/frequent_questions/pt/translated_path_url.md +1 -2
  662. package/frequent_questions/pt/unknown_command.md +1 -2
  663. package/frequent_questions/ru/SSR_Next_no_[locale].md +1 -2
  664. package/frequent_questions/ru/array_as_content_declaration.md +1 -2
  665. package/frequent_questions/ru/build_dictionaries.md +1 -2
  666. package/frequent_questions/ru/build_error_CI_CD.md +1 -2
  667. package/frequent_questions/ru/bun_set_up.md +1 -2
  668. package/frequent_questions/ru/customized_locale_list.md +1 -2
  669. package/frequent_questions/ru/domain_routing.md +1 -2
  670. package/frequent_questions/ru/esbuild_error.md +1 -2
  671. package/frequent_questions/ru/get_locale_cookie.md +1 -2
  672. package/frequent_questions/ru/intlayer_command_undefined.md +1 -2
  673. package/frequent_questions/ru/locale_incorect_in_url.md +1 -2
  674. package/frequent_questions/ru/static_rendering.md +1 -2
  675. package/frequent_questions/ru/translated_path_url.md +1 -2
  676. package/frequent_questions/ru/unknown_command.md +1 -2
  677. package/frequent_questions/tr/SSR_Next_no_[locale].md +1 -2
  678. package/frequent_questions/tr/array_as_content_declaration.md +1 -2
  679. package/frequent_questions/tr/build_dictionaries.md +1 -2
  680. package/frequent_questions/tr/build_error_CI_CD.md +1 -2
  681. package/frequent_questions/tr/bun_set_up.md +1 -2
  682. package/frequent_questions/tr/customized_locale_list.md +1 -2
  683. package/frequent_questions/tr/domain_routing.md +1 -2
  684. package/frequent_questions/tr/esbuild_error.md +1 -2
  685. package/frequent_questions/tr/get_locale_cookie.md +1 -2
  686. package/frequent_questions/tr/intlayer_command_undefined.md +1 -2
  687. package/frequent_questions/tr/locale_incorect_in_url.md +1 -2
  688. package/frequent_questions/tr/static_rendering.md +1 -2
  689. package/frequent_questions/tr/translated_path_url.md +1 -2
  690. package/frequent_questions/tr/unknown_command.md +1 -2
  691. package/frequent_questions/vi/SSR_Next_no_[locale].md +106 -0
  692. package/frequent_questions/vi/array_as_content_declaration.md +71 -0
  693. package/frequent_questions/vi/build_dictionaries.md +58 -0
  694. package/frequent_questions/vi/build_error_CI_CD.md +74 -0
  695. package/frequent_questions/vi/bun_set_up.md +53 -0
  696. package/frequent_questions/vi/customized_locale_list.md +64 -0
  697. package/frequent_questions/vi/domain_routing.md +113 -0
  698. package/frequent_questions/vi/esbuild_error.md +29 -0
  699. package/frequent_questions/vi/get_locale_cookie.md +142 -0
  700. package/frequent_questions/vi/intlayer_command_undefined.md +155 -0
  701. package/frequent_questions/vi/locale_incorect_in_url.md +73 -0
  702. package/frequent_questions/vi/static_rendering.md +44 -0
  703. package/frequent_questions/vi/translated_path_url.md +55 -0
  704. package/frequent_questions/vi/unknown_command.md +97 -0
  705. package/frequent_questions/zh/SSR_Next_no_[locale].md +1 -2
  706. package/frequent_questions/zh/array_as_content_declaration.md +1 -2
  707. package/frequent_questions/zh/build_dictionaries.md +1 -2
  708. package/frequent_questions/zh/build_error_CI_CD.md +1 -2
  709. package/frequent_questions/zh/bun_set_up.md +1 -2
  710. package/frequent_questions/zh/customized_locale_list.md +1 -2
  711. package/frequent_questions/zh/domain_routing.md +1 -2
  712. package/frequent_questions/zh/esbuild_error.md +1 -2
  713. package/frequent_questions/zh/get_locale_cookie.md +1 -2
  714. package/frequent_questions/zh/intlayer_command_undefined.md +1 -2
  715. package/frequent_questions/zh/locale_incorect_in_url.md +1 -2
  716. package/frequent_questions/zh/static_rendering.md +1 -3
  717. package/frequent_questions/zh/translated_path_url.md +1 -2
  718. package/frequent_questions/zh/unknown_command.md +1 -2
  719. package/legal/id/privacy_notice.md +83 -0
  720. package/legal/id/terms_of_service.md +55 -0
  721. package/legal/pl/privacy_notice.md +83 -0
  722. package/legal/pl/terms_of_service.md +55 -0
  723. package/legal/vi/privacy_notice.md +83 -0
  724. package/legal/vi/terms_of_service.md +55 -0
  725. package/package.json +19 -18
  726. package/src/generated/blog.entry.ts +38 -0
@@ -0,0 +1,1504 @@
1
+ ---
2
+ createdAt: 2024-12-07
3
+ updatedAt: 2025-06-29
4
+ title: Cách dịch ứng dụng Next.js và Page Router của bạn – Hướng dẫn i18n 2025
5
+ description: Khám phá cách làm cho trang web Next.js sử dụng Page Router 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
+ keywords:
7
+ - Quốc tế hóa
8
+ - Tài liệu
9
+ - Intlayer
10
+ - Page Router
11
+ - Next.js
12
+ - JavaScript
13
+ - React
14
+ slugs:
15
+ - doc
16
+ - environment
17
+ - nextjs
18
+ - next-with-page-router
19
+ history:
20
+ - version: 5.6.0
21
+ date: 2025-07-06
22
+ changes: Chuyển hàm `withIntlayer()` thành hàm dựa trên promise
23
+ - version: 5.5.10
24
+ date: 2025-06-29
25
+ changes: Khởi tạo lịch sử
26
+ ---
27
+
28
+ # Dịch trang web Next.js và Page Router của bạn bằng Intlayer | Quốc tế hóa (i18n)
29
+
30
+ ## Mục lục
31
+
32
+ <TOC/>
33
+
34
+ ## Intlayer là gì?
35
+
36
+ **Intlayer** là một thư viện quốc tế hóa (i18n) mã nguồn mở, sáng tạo, được thiết kế để đơn giản hóa việc hỗ trợ đa ngôn ngữ trong các ứng dụng web hiện đại. Intlayer tích hợp liền mạch với framework **Next.js** mới nhất, bao gồm cả **Page Router** truyền thống của nó.
37
+
38
+ Với Intlayer, bạn có thể:
39
+
40
+ - **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.
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 được 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.
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.
44
+
45
+ > Intlayer tương thích với Next.js 12, 13, 14 và 15. Nếu bạn đang sử dụng Next.js App Router, hãy tham khảo [hướng dẫn App Router](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_with_nextjs_14.md). Đối với Next.js 15, hãy theo dõi [hướng dẫn này](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_with_nextjs_15.md).
46
+
47
+ ---
48
+
49
+ ## Hướng Dẫn Từng Bước Để Cài Đặt Intlayer Trong Ứng Dụng Next.js Sử Dụng Page Router
50
+
51
+ ### Bước 1: Cài Đặt Các Phụ Thuộc
52
+
53
+ Cài đặt các gói cần thiết bằng trình quản lý gói bạn ưa thích:
54
+
55
+ ```bash packageManager="npm"
56
+ npm install intlayer next-intlayer
57
+ ```
58
+
59
+ ```bash packageManager="pnpm"
60
+ pnpm add intlayer next-intlayer
61
+ ```
62
+
63
+ ```bash packageManager="yarn"
64
+ yarn add intlayer next-intlayer
65
+ ```
66
+
67
+ - **intlayer**
68
+
69
+ 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).
70
+
71
+ - **next-intlayer**
72
+
73
+ Gói tích hợp Intlayer với Next.js. Nó cung cấp các context provider và hook cho quốc tế hóa trong Next.js. Ngoài ra, nó bao gồm plugin Next.js để tích hợp Intlayer với [Webpack](https://webpack.js.org/) hoặc [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack), cũng như middleware để phát hiện ngôn ngữ ưu tiên của người dùng, quản lý cookie, và xử lý chuyển hướng URL.
74
+
75
+ ### Bước 2: Cấu hình Dự án của Bạn
76
+
77
+ Tạo một tệp cấu hình để định nghĩa các ngôn ngữ được ứng dụng của bạn hỗ trợ:
78
+
79
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
80
+ import { Locales, type IntlayerConfig } from "intlayer";
81
+
82
+ const config: IntlayerConfig = {
83
+ internationalization: {
84
+ locales: [
85
+ Locales.ENGLISH,
86
+ Locales.FRENCH,
87
+ Locales.SPANISH,
88
+ // Thêm các ngôn ngữ khác của bạn ở đây
89
+ ],
90
+ defaultLocale: Locales.ENGLISH,
91
+ },
92
+ };
93
+
94
+ export default config;
95
+ ```
96
+
97
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
98
+ import { Locales } from "intlayer";
99
+
100
+ /** @type {import('intlayer').IntlayerConfig} */
101
+ const config = {
102
+ internationalization: {
103
+ locales: [
104
+ Locales.ENGLISH,
105
+ Locales.FRENCH,
106
+ Locales.SPANISH,
107
+ // Thêm các ngôn ngữ khác của bạn ở đây
108
+ ],
109
+ defaultLocale: Locales.ENGLISH,
110
+ },
111
+ };
112
+
113
+ export default config;
114
+ ```
115
+
116
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
117
+ const { Locales } = require("intlayer");
118
+
119
+ /** @type {import('intlayer').IntlayerConfig} */
120
+ const config = {
121
+ internationalization: {
122
+ locales: [
123
+ Locales.ENGLISH,
124
+ Locales.FRENCH,
125
+ Locales.SPANISH,
126
+ // Thêm các ngôn ngữ khác của bạn ở đây
127
+ ],
128
+ defaultLocale: Locales.ENGLISH,
129
+ },
130
+ };
131
+
132
+ module.exports = config;
133
+ ```
134
+
135
+ > 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 bản ghi Intlayer trong bảng điều khiển, 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).
136
+
137
+ ### Bước 3: Tích hợp Intlayer với cấu hình Next.js
138
+
139
+ Chỉnh sửa cấu hình Next.js của bạn để tích hợp Intlayer:
140
+
141
+ ```typescript fileName="next.config.mjs"
142
+ import { withIntlayer } from "next-intlayer/server";
143
+
144
+ /** @type {import('next').NextConfig} */
145
+ const nextConfig = {
146
+ // Cấu hình Next.js hiện có của bạn
147
+ };
148
+
149
+ export default withIntlayer(nextConfig);
150
+ ```
151
+
152
+ > Plugin Next.js `withIntlayer()` được sử dụng để tích hợp Intlayer với Next.js. Nó đảm bảo việc xây dựng các tệp khai báo nội dung và giám sát chúng trong chế độ phát triển. Nó định nghĩa các biến môi trường Intlayer trong môi trường [Webpack](https://webpack.js.org/) hoặc [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack). Ngoài ra, nó cung cấp các bí danh để tối ưu hiệu suất và đảm bảo tương thích với các thành phần server.
153
+
154
+ > Hàm `withIntlayer()` là một hàm promise. Nếu bạn muốn sử dụng nó cùng với các plugin khác, bạn có thể sử dụng await. Ví dụ:
155
+ >
156
+ > ```tsx
157
+ > const nextConfig = await withIntlayer(nextConfig);
158
+ > const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
159
+ >
160
+ > export default nextConfigWithOtherPlugins;
161
+ > ```
162
+
163
+ ### Bước 4: Cấu hình Middleware để Phát hiện Ngôn ngữ
164
+
165
+ Thiết lập middleware để tự động phát hiện và xử lý ngôn ngữ ưu tiên của người dùng:
166
+
167
+ ```typescript fileName="src/middleware.ts" codeFormat="typescript"
168
+ export { intlayerMiddleware as middleware } from "next-intlayer/middleware";
169
+
170
+ export const config = {
171
+ matcher:
172
+ "/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
173
+ };
174
+ ```
175
+
176
+ ```javascript fileName="src/middleware.mjs" codeFormat="esm"
177
+ export { intlayerMiddleware as middleware } from "next-intlayer/middleware";
178
+
179
+ export const config = {
180
+ matcher:
181
+ "/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
182
+ };
183
+ ```
184
+
185
+ ```javascript fileName="src/middleware.cjs" codeFormat="commonjs"
186
+ const { intlayerMiddleware } = require("next-intlayer/middleware");
187
+
188
+ const config = {
189
+ matcher:
190
+ "/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
191
+ };
192
+
193
+ module.exports = { middleware: intlayerMiddleware, config };
194
+ ```
195
+
196
+ > Điều chỉnh tham số `matcher` để phù hợp với các route của ứng dụng bạn. Để biết thêm chi tiết, tham khảo tài liệu [Next.js về cấu hình matcher](https://nextjs.org/docs/app/building-your-application/routing/middleware).
197
+
198
+ ### Bước 5: Định nghĩa các Route Địa phương Động
199
+
200
+ Triển khai routing động để phục vụ nội dung được địa phương hóa dựa trên ngôn ngữ của người dùng.
201
+
202
+ 1. **Tạo các Trang theo Ngôn ngữ Cụ thể:**
203
+
204
+ Đổi tên file trang chính của bạn để bao gồm phân đoạn động `[locale]`.
205
+
206
+ ```bash
207
+ mv src/pages/index.tsx src/pages/[locale]/index.tsx
208
+ ```
209
+
210
+ 2. **Cập nhật `_app.tsx` để Xử lý Đa ngôn ngữ:**
211
+
212
+ Sửa đổi `_app.tsx` của bạn để bao gồm các provider của Intlayer.
213
+
214
+ ```tsx fileName="src/pages/_app.tsx" codeFormat="typescript"
215
+ import type { FC } from "react";
216
+ import type { AppProps } from "next/app";
217
+ import { IntlayerClientProvider } from "next-intlayer";
218
+
219
+ const App = FC<AppProps>({ Component, pageProps }) => {
220
+ const { locale } = pageProps;
221
+
222
+ return (
223
+ <IntlayerClientProvider locale={locale}>
224
+ <Component {...pageProps} />
225
+ </IntlayerClientProvider>
226
+ );
227
+ }
228
+
229
+ export default MyApp;
230
+ ```
231
+
232
+ ```jsx fileName="src/pages/_app.mjx" codeFormat="esm"
233
+ import { IntlayerClientProvider } from "next-intlayer";
234
+
235
+ const App = ({ Component, pageProps }) => (
236
+ <IntlayerClientProvider locale={locale}>
237
+ <Component {...pageProps} />
238
+ </IntlayerClientProvider>
239
+ );
240
+
241
+ export default App;
242
+ ```
243
+
244
+ ```jsx fileName="src/pages/_app.csx" codeFormat="commonjs"
245
+ const { IntlayerClientProvider } = require("next-intlayer");
246
+
247
+ const App = ({ Component, pageProps }) => (
248
+ <IntlayerClientProvider locale={locale}>
249
+ <Component {...pageProps} />
250
+ </IntlayerClientProvider>
251
+ );
252
+
253
+ module.exports = App;
254
+ ```
255
+
256
+ 3. **Thiết Lập `getStaticPaths` và `getStaticProps`:**
257
+
258
+ Trong file `[locale]/index.tsx` của bạn, định nghĩa các đường dẫn và props để xử lý các locale khác nhau.
259
+
260
+ ```tsx fileName="src/pages/[locale]/index.tsx" codeFormat="typescript"
261
+ import type { GetStaticPaths, GetStaticProps } from "next";
262
+ import { getConfiguration } from "intlayer";
263
+
264
+ const HomePage = () => <div>{/* Nội dung của bạn ở đây */}</div>;
265
+
266
+ export const getStaticPaths: GetStaticPaths = async () => {
267
+ const { internationalization } = getConfiguration();
268
+ const { locales } = internationalization;
269
+
270
+ const paths = locales.map((locale: string) => ({
271
+ params: { locale },
272
+ }));
273
+
274
+ return { paths, fallback: false };
275
+ };
276
+
277
+ export const getStaticProps: GetStaticProps = async ({ params }) => {
278
+ const locale = params?.locale;
279
+
280
+ return {
281
+ props: {
282
+ locale,
283
+ },
284
+ };
285
+ };
286
+
287
+ export default HomePage;
288
+ ```
289
+
290
+ ```jsx fileName="src/pages/[locale]/index.mjx" codeFormat="esm"
291
+ import { getConfiguration } from "intlayer";
292
+ import { ComponentExample } from "@components/ComponentExample";
293
+
294
+ const HomePage = () => <div>{/* Nội dung của bạn ở đây */}</div>;
295
+
296
+ export const getStaticPaths = () => {
297
+ const { internationalization } = getConfiguration();
298
+ const { locales } = internationalization;
299
+
300
+ const paths = locales.map((locale) => ({
301
+ params: { locale },
302
+ }));
303
+
304
+ return { paths, fallback: false };
305
+ };
306
+
307
+ export const getStaticProps = ({ params }) => {
308
+ const locale = params?.locale;
309
+
310
+ return {
311
+ props: {
312
+ locale,
313
+ },
314
+ };
315
+ };
316
+ ```
317
+
318
+ ```jsx fileName="src/pages/[locale]/index.csx" codeFormat="commonjs"
319
+ const { getConfiguration } = require("intlayer");
320
+ const { ComponentExample } = require("@components/ComponentExample");
321
+
322
+ const HomePage = () => <div>{/* Nội dung của bạn ở đây */}</div>;
323
+
324
+ const getStaticPaths = async () => {
325
+ const { internationalization } = getConfiguration();
326
+ const { locales } = internationalization;
327
+
328
+ const paths = locales.map((locale) => ({
329
+ params: { locale },
330
+ }));
331
+
332
+ return { paths, fallback: false };
333
+ };
334
+
335
+ const getStaticProps = async ({ params }) => {
336
+ const locale = params?.locale;
337
+
338
+ return {
339
+ props: {
340
+ locale,
341
+ },
342
+ };
343
+ };
344
+
345
+ module.exports = {
346
+ getStaticProps,
347
+ getStaticPaths,
348
+ default: HomePage,
349
+ };
350
+ ```
351
+
352
+ > `getStaticPaths` và `getStaticProps` đảm bảo rằng ứng dụng của bạn sẽ xây dựng trước các trang cần thiết cho tất cả các locale trong Next.js Page Router. Cách tiếp cận này giảm thiểu tính toán khi chạy và mang lại trải nghiệm người dùng tốt hơn. Để biết thêm chi tiết, hãy tham khảo tài liệu Next.js về [`getStaticPaths`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-static-paths) và [`getStaticProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-static-props).
353
+
354
+ ### Bước 6: Khai báo Nội dung của Bạn
355
+
356
+ Tạo và quản lý các khai báo nội dung để lưu trữ các bản dịch.
357
+
358
+ ```tsx fileName="src/pages/[locale]/home.content.ts" contentDeclarationFormat="typescript"
359
+ import { t, type Dictionary } from "intlayer";
360
+
361
+ const homeContent = {
362
+ key: "home",
363
+ content: {
364
+ title: t({
365
+ en: "Welcome to My Website",
366
+ fr: "Bienvenue sur mon site Web",
367
+ es: "Bienvenido a mi sitio web",
368
+ }),
369
+ description: t({
370
+ en: "Bắt đầu bằng cách chỉnh sửa trang này.",
371
+ fr: "Commencez par éditer cette page.",
372
+ es: "Comience por editar esta página.",
373
+ }),
374
+ },
375
+ } satisfies Dictionary;
376
+
377
+ export default homeContent;
378
+ ```
379
+
380
+ ```javascript fileName="src/pages/[locale]/home.content.mjs" contentDeclarationFormat="esm"
381
+ import { t } from "intlayer";
382
+
383
+ /** @type {import('intlayer').Dictionary} */
384
+ const homeContent = {
385
+ key: "home",
386
+ content: {
387
+ getStarted: {
388
+ main: t({
389
+ en: "Bắt đầu bằng cách chỉnh sửa trang này.",
390
+ fr: "Commencez par éditer cette page.",
391
+ es: "Comience por editar esta página.",
392
+ }),
393
+ pageLink: "src/app/page.tsx",
394
+ },
395
+ },
396
+ };
397
+
398
+ export default homeContent;
399
+ ```
400
+
401
+ ```javascript fileName="src/pages/[locale]/home.content.cjs" contentDeclarationFormat="commonjs"
402
+ const { t } = require("intlayer");
403
+
404
+ /** @type {import('intlayer').Dictionary} */
405
+ const homeContent = {
406
+ key: "home",
407
+ content: {
408
+ getStarted: {
409
+ main: t({
410
+ en: "Bắt đầu bằng cách chỉnh sửa trang này.",
411
+ fr: "Commencez par éditer cette page.",
412
+ es: "Comience por editar esta página.",
413
+ }),
414
+ pageLink: "src/app/page.tsx",
415
+ },
416
+ },
417
+ };
418
+
419
+ module.exports = homeContent;
420
+ ```
421
+
422
+ ```json fileName="src/pages/[locale]/home.content.json" contentDeclarationFormat="json"
423
+ {
424
+ "$schema": "https://intlayer.org/schema.json",
425
+ "key": "home",
426
+ "content": {
427
+ "getStarted": {
428
+ "nodeType": "translation",
429
+ "translation": {
430
+ "vi": "Bắt đầu bằng cách chỉnh sửa trang này.",
431
+ "en": "Get started by editing this page.",
432
+ "fr": "Commencez par éditer cette page.",
433
+ "es": "Comience por editar esta página."
434
+ }
435
+ },
436
+ "pageLink": {
437
+ "nodeType": "translation",
438
+ "translation": {
439
+ "vi": "src/app/page.tsx",
440
+ "en": "src/app/page.tsx",
441
+ "fr": "src/app/page.tsx",
442
+ "es": "src/app/page.tsx"
443
+ }
444
+ }
445
+ }
446
+ }
447
+ ```
448
+
449
+ Để biết thêm thông tin về cách khai báo nội dung, hãy tham khảo [hướng dẫn khai báo nội dung](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/dictionary/content_file.md).
450
+
451
+ ### Bước 7: Sử dụng Nội dung trong Mã của Bạn
452
+
453
+ Truy cập các từ điển nội dung của bạn trong toàn bộ ứng dụng để hiển thị nội dung đã được dịch.
454
+
455
+ ```tsx {2,6} fileName="src/pages/[locale]/index.tsx" codeFormat="typescript"
456
+ import type { FC } from "react";
457
+ import { useIntlayer } from "next-intlayer";
458
+ import { ComponentExample } from "@components/ComponentExample";
459
+
460
+ const HomePage: FC = () => {
461
+ const content = useIntlayer("home");
462
+
463
+ return (
464
+ <div>
465
+ <h1>{content.title}</h1>
466
+ <p>{content.description}</p>
467
+ <ComponentExample />
468
+ {/* Các thành phần bổ sung */}
469
+ </div>
470
+ );
471
+ };
472
+
473
+ // ... Phần còn lại của mã, bao gồm getStaticPaths và getStaticProps
474
+
475
+ export default HomePage;
476
+ ```
477
+
478
+ ```jsx {1,5} fileName="src/pages/[locale]/index.mjx" codeFormat="esm"
479
+ import { useIntlayer } from "next-intlayer";
480
+ import { ComponentExample } from "@components/ComponentExample";
481
+
482
+ const HomePage = () => {
483
+ const content = useIntlayer("home");
484
+
485
+ return (
486
+ <div>
487
+ <h1>{content.getStarted.main}</h1>
488
+ <code>{content.getStarted.pageLink}</code>
489
+
490
+ <ComponentExample />
491
+ {/* Các thành phần bổ sung */}
492
+ </div>
493
+ );
494
+ };
495
+
496
+ // ... Phần còn lại của mã, bao gồm getStaticPaths và getStaticProps
497
+
498
+ export default HomePage;
499
+ ```
500
+
501
+ ```jsx {1,5} fileName="src/pages/[locale]/index.csx" codeFormat="commonjs"
502
+ const { useIntlayer } = require("next-intlayer");
503
+ const { ComponentExample } = require("@components/ComponentExample");
504
+
505
+ const HomePage = () => {
506
+ const content = useIntlayer("home");
507
+
508
+ return (
509
+ <div>
510
+ <h1>{content.getStarted.main}</h1>
511
+ <code>{content.getStarted.pageLink}</code>
512
+
513
+ <ComponentExample />
514
+ {/* Các thành phần bổ sung */}
515
+ </div>
516
+ );
517
+ };
518
+
519
+ // ... Phần còn lại của mã, bao gồm getStaticPaths và getStaticProps
520
+ ```
521
+
522
+ ```tsx fileName="src/components/ComponentExample.tsx" codeFormat="typescript"
523
+ import type { FC } from "react";
524
+ import { useIntlayer } from "next-intlayer";
525
+
526
+ export const ComponentExample: FC = () => {
527
+ const content = useIntlayer("component-example"); // Đảm bảo bạn có khai báo nội dung tương ứng
528
+
529
+ return (
530
+ <div>
531
+ <h2>{content.title}</h2>
532
+ <p>{content.content}</p>
533
+ </div>
534
+ );
535
+ };
536
+ ```
537
+
538
+ ```jsx fileName="src/components/ComponentExample.mjx" codeFormat="esm"
539
+ import { useIntlayer } from "next-intlayer";
540
+
541
+ const ComponentExample = () => {
542
+ const content = useIntlayer("component-example"); // Đảm bảo bạn có khai báo nội dung tương ứng
543
+
544
+ return (
545
+ <div>
546
+ <h2>{content.title}</h2>
547
+ <p>{content.content}</p>
548
+ </div>
549
+ );
550
+ };
551
+ ```
552
+
553
+ ```jsx fileName="src/components/ComponentExample.csx" codeFormat="commonjs"
554
+ const { useIntlayer } = require("next-intlayer");
555
+
556
+ const ComponentExample = () => {
557
+ const content = useIntlayer("component-example"); // Đảm bảo bạn có khai báo nội dung tương ứng
558
+
559
+ return (
560
+ <div>
561
+ <h2>{content.title}</h2>
562
+ <p>{content.content}</p>
563
+ </div>
564
+ );
565
+ };
566
+ ```
567
+
568
+ > Khi sử dụng bản dịch trong các thuộc tính `string` (ví dụ: `alt`, `title`, `href`, `aria-label`), hãy gọi
569
+
570
+ > giá trị của hàm như sau:
571
+
572
+ > ```jsx
573
+ > <img src={content.image.src.value} alt={content.image.value} />
574
+ > ```
575
+
576
+ > Để tìm hiểu thêm về hook `useIntlayer`, hãy tham khảo [tài liệu](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/packages/next-intlayer/useIntlayer.md).
577
+
578
+ ### (Tùy chọn) Bước 8: Quốc tế hóa metadata của bạn
579
+
580
+ Trong trường hợp bạn muốn quốc tế hóa metadata, chẳng hạn như tiêu đề của trang, bạn có thể sử dụng hàm `getStaticProps` do Next.js Page Router cung cấp. Bên trong, bạn có thể lấy nội dung từ hàm `getIntlayer` để dịch metadata của bạn.
581
+
582
+ ```typescript fileName="src/pages/[locale]/metadata.content.ts" contentDeclarationFormat="typescript"
583
+ import { type Dictionary, t } from "intlayer";
584
+ import { type Metadata } from "next";
585
+
586
+ const metadataContent = {
587
+ key: "page-metadata",
588
+ content: {
589
+ title: t({
590
+ en: "Create Next App",
591
+ fr: "Créer une application Next.js",
592
+ es: "Crear una aplicación Next.js",
593
+ }),
594
+ description: t({
595
+ en: "Generated by create next app",
596
+ fr: "Généré par create next app",
597
+ es: "Generado por create next app",
598
+ }),
599
+ },
600
+ } satisfies Dictionary<Metadata>;
601
+
602
+ export default metadataContent;
603
+ ```
604
+
605
+ ```javascript fileName="src/pages/[locale]/metadata.content.mjs" contentDeclarationFormat="esm"
606
+ import { t } from "intlayer";
607
+
608
+ /** @type {import('intlayer').Dictionary<import('next').Metadata>} */
609
+ const metadataContent = {
610
+ key: "page-metadata",
611
+ content: {
612
+ title: t({
613
+ en: "Create Next App",
614
+ fr: "Créer une application Next.js",
615
+ es: "Crear una aplicación Next.js",
616
+ }),
617
+ description: t({
618
+ en: "Generated by create next app",
619
+ fr: "Généré par create next app",
620
+ es: "Generado por create next app",
621
+ }),
622
+ },
623
+ };
624
+
625
+ export default metadataContent;
626
+ ```
627
+
628
+ ```javascript fileName="src/pages/[locale]/metadata.content.cjs" contentDeclarationFormat="commonjs"
629
+ const { t } = require("intlayer");
630
+
631
+ /** @type {import('intlayer').Dictionary<import('next').Metadata>} */
632
+ const metadataContent = {
633
+ key: "page-metadata",
634
+ content: {
635
+ title: t({
636
+ en: "Create Next App",
637
+ fr: "Créer une application Next.js",
638
+ es: "Crear una aplicación Next.js",
639
+ vi: "Tạo ứng dụng Next",
640
+ }),
641
+ description: t({
642
+ en: "Generated by create next app",
643
+ fr: "Généré par create next app",
644
+ es: "Generado por create next app",
645
+ vi: "Được tạo bởi create next app",
646
+ }),
647
+ },
648
+ };
649
+
650
+ module.exports = metadataContent;
651
+ ```
652
+
653
+ ```json fileName="src/pages/[locale]/metadata.content.json" contentDeclarationFormat="json"
654
+ {
655
+ "key": "page-metadata",
656
+ "content": {
657
+ "title": {
658
+ "nodeType": "translation",
659
+ "translation": {
660
+ "en": "Preact logo",
661
+ "fr": "Logo Preact",
662
+ "es": "Logo Preact",
663
+ "vi": "Logo Preact"
664
+ },
665
+ },
666
+ "description": {
667
+ "nodeType": "translation",
668
+ "translation": {
669
+ "en": "Generated by create next app",
670
+ "fr": "Généré par create next app",
671
+ "es": "Generado por create next app",
672
+ "vi": "Được tạo bởi create next app"
673
+ },
674
+ },
675
+ },
676
+ };
677
+ ```
678
+
679
+ ````tsx fileName="src/pages/[locale]/index.tsx" codeFormat="typescript"
680
+ import { GetStaticPaths, GetStaticProps } from "next";
681
+ import { getIntlayer, getMultilingualUrls } from "intlayer";
682
+ import { useIntlayer } from "next-intlayer";
683
+ import Head from "next/head";
684
+ import type { FC } from "react";
685
+
686
+ interface HomePageProps {
687
+ locale: string;
688
+ metadata: {
689
+ title: string;
690
+ description: string;
691
+ };
692
+ multilingualUrls: Record<string, string>;
693
+ }
694
+
695
+ const HomePage: FC<HomePageProps> = ({
696
+ metadata,
697
+ multilingualUrls,
698
+ locale,
699
+ }) => {
700
+ const content = useIntlayer("page");
701
+
702
+ return (
703
+ <div>
704
+ <Head>
705
+ <title>{metadata.title}</title>
706
+ <meta name="description" content={metadata.description} />
707
+ {/* Tạo các thẻ hreflang cho SEO */}
708
+ {Object.entries(multilingualUrls).map(([lang, url]) => (
709
+ <link key={lang} rel="alternate" hrefLang={lang} href={url} />
710
+ ))}
711
+ <link rel="canonical" href={multilingualUrls[locale]} />
712
+ </Head>
713
+
714
+ {/* Nội dung trang */}
715
+ <main>{/* Nội dung trang của bạn ở đây */}</main>
716
+ </div>
717
+ );
718
+ };
719
+
720
+ export const getStaticProps: GetStaticProps<HomePageProps> = async ({
721
+ params,
722
+ }) => {
723
+ const locale = params?.locale as string;
724
+
725
+ const metadata = getIntlayer("page-metadata", locale);
726
+
727
+ /**
728
+ * Tạo một đối tượng chứa tất cả các url cho mỗi locale.
729
+ *
730
+ * Ví dụ:
731
+ * ```ts
732
+ * getMultilingualUrls('/about');
733
+ *
734
+ * // Trả về
735
+ * // {
736
+ * // en: '/about',
737
+ * // fr: '/fr/about',
738
+ * // es: '/es/about',
739
+ * // }
740
+ * ```
741
+ */
742
+ const multilingualUrls = getMultilingualUrls("/");
743
+
744
+ return {
745
+ props: {
746
+ locale,
747
+ metadata,
748
+ multilingualUrls,
749
+ },
750
+ };
751
+ };
752
+
753
+ export default HomePage;
754
+
755
+ // ... Phần còn lại của code bao gồm getStaticPaths
756
+ ````
757
+
758
+ ````jsx fileName="src/pages/[locale]/index.mjx" codeFormat="esm"
759
+ import { getIntlayer, getMultilingualUrls } from "intlayer";
760
+ import { useIntlayer } from "next-intlayer";
761
+ import Head from "next/head";
762
+
763
+ const HomePage = ({ metadata, multilingualUrls, locale }) => {
764
+ const content = useIntlayer("page");
765
+
766
+ return (
767
+ <div>
768
+ <Head>
769
+ <title>{metadata.title}</title>
770
+ <meta name="description" content={metadata.description} />
771
+ {/* Tạo các thẻ hreflang cho SEO */}
772
+ {Object.entries(multilingualUrls).map(([lang, url]) => (
773
+ <link key={lang} rel="alternate" hrefLang={lang} href={url} />
774
+ ))}
775
+ <link rel="canonical" href={multilingualUrls[locale]} />
776
+ </Head>
777
+
778
+ {/* Nội dung trang */}
779
+ <main>{/* Nội dung trang của bạn ở đây */}</main>
780
+ </div>
781
+ );
782
+ };
783
+
784
+ export const getStaticProps = async ({ params }) => {
785
+ const locale = params?.locale;
786
+
787
+ const metadata = getIntlayer("page-metadata", locale);
788
+
789
+ /**
790
+ * Tạo một đối tượng chứa tất cả các url cho mỗi locale.
791
+ *
792
+ * Ví dụ:
793
+ * ```ts
794
+ * getMultilingualUrls('/about');
795
+ *
796
+ * // Trả về
797
+ * // {
798
+ * // en: '/about',
799
+ * // fr: '/fr/about',
800
+ * // es: '/es/about',
801
+ * // }
802
+ * ```
803
+ */
804
+ const multilingualUrls = getMultilingualUrls("/");
805
+
806
+ return {
807
+ props: {
808
+ locale,
809
+ metadata,
810
+ multilingualUrls,
811
+ },
812
+ };
813
+ };
814
+
815
+ export default HomePage;
816
+
817
+ // ... Phần còn lại của code bao gồm getStaticPaths
818
+ ````
819
+
820
+ ````jsx fileName="src/pages/[locale]/index.csx" codeFormat="commonjs"
821
+ const { getIntlayer, getMultilingualUrls } = require("intlayer");
822
+ const { useIntlayer } = require("next-intlayer");
823
+ const Head = require("next/head");
824
+
825
+ const HomePage = ({ metadata, multilingualUrls, locale }) => {
826
+ const content = useIntlayer("page");
827
+
828
+ return (
829
+ <div>
830
+ <Head>
831
+ <title>{metadata.title}</title>
832
+ <meta name="description" content={metadata.description} />
833
+ {/* Tạo các thẻ hreflang cho SEO */}
834
+ {Object.entries(multilingualUrls).map(([lang, url]) => (
835
+ <link key={lang} rel="alternate" hrefLang={lang} href={url} />
836
+ ))}
837
+ <link rel="canonical" href={multilingualUrls[locale]} />
838
+ </Head>
839
+
840
+ {/* Nội dung trang */}
841
+ <main>{/* Nội dung trang của bạn ở đây */}</main>
842
+ </div>
843
+ );
844
+ };
845
+
846
+ const getStaticProps = async ({ params }) => {
847
+ const locale = params?.locale;
848
+
849
+ const metadata = getIntlayer("page-metadata", locale);
850
+
851
+ /**
852
+ * Tạo một đối tượng chứa tất cả các url cho mỗi locale.
853
+ *
854
+ * Ví dụ:
855
+ * ```ts
856
+ * getMultilingualUrls('/about');
857
+ *
858
+ * // Trả về
859
+ * // {
860
+ * // en: '/about',
861
+ * // fr: '/fr/about',
862
+ * // es: '/es/about',
863
+ * // }
864
+ * ```
865
+ */
866
+ const multilingualUrls = getMultilingualUrls("/");
867
+
868
+ return {
869
+ props: {
870
+ locale,
871
+ metadata,
872
+ multilingualUrls,
873
+ },
874
+ };
875
+ };
876
+
877
+ module.exports = {
878
+ getStaticProps,
879
+ getStaticPaths,
880
+ default: HomePage,
881
+ };
882
+ ````
883
+
884
+ // ... Phần còn lại của code bao gồm getStaticPaths
885
+
886
+ > Lưu ý rằng hàm `getIntlayer` được nhập từ `next-intlayer` trả về nội dung của bạn được bao bọc trong một `IntlayerNode`, cho phép tích hợp với trình soạn thảo trực quan. Ngược lại, hàm `getIntlayer` được nhập từ `intlayer` trả về nội dung của bạn trực tiếp mà không có thuộc tính bổ sung.
887
+
888
+ Ngoài ra, bạn có thể sử dụng hàm `getTranslation` để khai báo metadata của bạn. Tuy nhiên, việc sử dụng các tệp khai báo nội dung được khuyến nghị để tự động hóa việc dịch metadata và ngoại hóa nội dung vào một thời điểm nào đó.
889
+
890
+ ```tsx fileName="src/pages/[locale]/index.tsx" codeFormat="typescript"
891
+ import { GetStaticPaths, GetStaticProps } from "next";
892
+ import { getTranslation, getMultilingualUrls } from "intlayer";
893
+ import { useIntlayer } from "next-intlayer";
894
+ import Head from "next/head";
895
+ import type { FC } from "react";
896
+
897
+ type Metadata = {
898
+ title: string;
899
+ description: string;
900
+ };
901
+
902
+ interface HomePageProps {
903
+ locale: string;
904
+ metadata: Metadata;
905
+ multilingualUrls: Record<string, string>;
906
+ }
907
+
908
+ const HomePage: FC<HomePageProps> = ({
909
+ metadata,
910
+ multilingualUrls,
911
+ locale,
912
+ }) => {
913
+ const content = useIntlayer("page");
914
+
915
+ return (
916
+ <div>
917
+ <Head>
918
+ <title>{metadata.title}</title>
919
+ <meta name="description" content={metadata.description} />
920
+ {/* Tạo các thẻ hreflang cho SEO */}
921
+ {Object.entries(multilingualUrls).map(([lang, url]) => (
922
+ <link key={lang} rel="alternate" hrefLang={lang} href={url} />
923
+ ))}
924
+ <link rel="canonical" href={multilingualUrls[locale]} />
925
+ </Head>
926
+
927
+ {/* Nội dung trang */}
928
+ <main>{/* Nội dung trang của bạn ở đây */}</main>
929
+ </div>
930
+ );
931
+ };
932
+
933
+ export const getStaticProps: GetStaticProps<HomePageProps> = async ({
934
+ params,
935
+ }) => {
936
+ const locale = params?.locale as string;
937
+ const t = (content: Record<string, string>) =>
938
+ getTranslation(content, locale);
939
+
940
+ const metadata: Metadata = {
941
+ title: t({
942
+ en: "My title",
943
+ fr: "Mon titre",
944
+ es: "Mi título",
945
+ }),
946
+ description: t({
947
+ en: "My description",
948
+ fr: "Ma description",
949
+ es: "Mi descripción",
950
+ }),
951
+ };
952
+
953
+ const multilingualUrls = getMultilingualUrls("/");
954
+
955
+ return {
956
+ props: {
957
+ locale,
958
+ metadata,
959
+ multilingualUrls,
960
+ },
961
+ };
962
+ };
963
+
964
+ export default HomePage;
965
+
966
+ // ... Phần còn lại của mã bao gồm getStaticPaths
967
+ ```
968
+
969
+ ```jsx fileName="src/pages/[locale]/index.mjx" codeFormat="esm"
970
+ import { getTranslation, getMultilingualUrls } from "intlayer";
971
+ import { useIntlayer } from "next-intlayer";
972
+ import Head from "next/head";
973
+
974
+ const HomePage = ({ metadata, multilingualUrls, locale }) => {
975
+ const content = useIntlayer("page");
976
+
977
+ return (
978
+ <div>
979
+ <Head>
980
+ <title>{metadata.title}</title>
981
+ <meta name="description" content={metadata.description} />
982
+ {/* Tạo các thẻ hreflang cho SEO */}
983
+ {Object.entries(multilingualUrls).map(([lang, url]) => (
984
+ <link key={lang} rel="alternate" hrefLang={lang} href={url} />
985
+ ))}
986
+ <link rel="canonical" href={multilingualUrls[locale]} />
987
+ </Head>
988
+
989
+ {/* Nội dung trang */}
990
+ <main>{/* Nội dung trang của bạn ở đây */}</main>
991
+ </div>
992
+ );
993
+ };
994
+
995
+ export const getStaticProps = async ({ params }) => {
996
+ const locale = params?.locale;
997
+ const t = (content) => getTranslation(content, locale);
998
+
999
+ const metadata = {
1000
+ title: t({
1001
+ en: "My title",
1002
+ fr: "Mon titre",
1003
+ es: "Mi título",
1004
+ }),
1005
+ description: t({
1006
+ en: "My description",
1007
+ fr: "Ma description",
1008
+ es: "Mi descripción",
1009
+ }),
1010
+ };
1011
+
1012
+ const multilingualUrls = getMultilingualUrls("/");
1013
+
1014
+ return {
1015
+ props: {
1016
+ locale,
1017
+ metadata,
1018
+ multilingualUrls,
1019
+ },
1020
+ };
1021
+ };
1022
+
1023
+ export default HomePage;
1024
+
1025
+ // ... Phần còn lại của mã bao gồm getStaticPaths
1026
+ ```
1027
+
1028
+ ```jsx fileName="src/pages/[locale]/index.csx" codeFormat="commonjs"
1029
+ const { getTranslation, getMultilingualUrls } = require("intlayer");
1030
+ const { useIntlayer } = require("next-intlayer");
1031
+ const Head = require("next/head");
1032
+
1033
+ const HomePage = ({ metadata, multilingualUrls, locale }) => {
1034
+ const content = useIntlayer("page");
1035
+
1036
+ return (
1037
+ <div>
1038
+ <Head>
1039
+ <title>{metadata.title}</title>
1040
+ <meta name="description" content={metadata.description} />
1041
+ {/* Tạo các thẻ hreflang cho SEO */}
1042
+ {Object.entries(multilingualUrls).map(([lang, url]) => (
1043
+ <link key={lang} rel="alternate" hrefLang={lang} href={url} />
1044
+ ))}
1045
+ <link rel="canonical" href={multilingualUrls[locale]} />
1046
+ </Head>
1047
+
1048
+ {/* Nội dung trang */}
1049
+ <main>{/* Nội dung trang của bạn ở đây */}</main>
1050
+ </div>
1051
+ );
1052
+ };
1053
+
1054
+ const getStaticProps = async ({ params }) => {
1055
+ const locale = params?.locale;
1056
+ const t = (content) => getTranslation(content, locale);
1057
+
1058
+ const metadata = {
1059
+ title: t({
1060
+ en: "My title",
1061
+ fr: "Mon titre",
1062
+ es: "Mi título",
1063
+ }),
1064
+ description: t({
1065
+ en: "My description",
1066
+ fr: "Ma description",
1067
+ es: "Mi descripción",
1068
+ }),
1069
+ };
1070
+
1071
+ const multilingualUrls = getMultilingualUrls("/");
1072
+
1073
+ return {
1074
+ props: {
1075
+ locale,
1076
+ metadata,
1077
+ multilingualUrls,
1078
+ },
1079
+ };
1080
+ };
1081
+
1082
+ module.exports = {
1083
+ getStaticProps,
1084
+ getStaticPaths,
1085
+ default: HomePage,
1086
+ };
1087
+
1088
+ // ... Phần còn lại của mã bao gồm getStaticPaths
1089
+ ```
1090
+
1091
+ > Tìm hiểu thêm về tối ưu hóa metadata [trong tài liệu chính thức của Next.js](https://nextjs.org/docs/pages/building-your-application/optimizing/metadata).
1092
+
1093
+ ### (Tùy chọn) Bước 9: Thay đổi ngôn ngữ nội dung của bạn
1094
+
1095
+ Để thay đổi ngôn ngữ nội dung trong Next.js, cách được khuyến nghị là sử dụng component `Link` để chuyển hướng người dùng đến trang được địa phương hóa phù hợp. Component `Link` cho phép tải trước trang, giúp tránh tải lại toàn bộ trang.
1096
+
1097
+ ```tsx fileName="src/components/LanguageSwitcher.tsx" codeFormat="typescript"
1098
+ import {
1099
+ Locales,
1100
+ getHTMLTextDir,
1101
+ getLocaleName,
1102
+ getLocalizedUrl,
1103
+ } from "intlayer";
1104
+ import { useLocalePageRouter } from "next-intlayer";
1105
+ import { type FC } from "react";
1106
+ import Link from "next/link";
1107
+
1108
+ const LocaleSwitcher: FC = () => {
1109
+ const { locale, pathWithoutLocale, availableLocales } = useLocalePageRouter();
1110
+ const { setLocaleCookie } = useLocaleCookie();
1111
+
1112
+ return (
1113
+ <div>
1114
+ <button popoverTarget="localePopover">{getLocaleName(locale)}</button>
1115
+ <div id="localePopover" popover="auto">
1116
+ {availableLocales.map((localeItem) => (
1117
+ <Link
1118
+ href={getLocalizedUrl(pathWithoutLocale, localeItem)}
1119
+ hrefLang={localeItem}
1120
+ key={localeItem}
1121
+ aria-current={locale === localeItem ? "page" : undefined}
1122
+ onClick={() => setLocaleCookie(localeItem)}
1123
+ >
1124
+ <span>
1125
+ {/* Ngôn ngữ địa phương - ví dụ: FR */}
1126
+ {localeItem}
1127
+ </span>
1128
+ <span>
1129
+ {/* Ngôn ngữ trong chính ngôn ngữ đó - ví dụ: Français */}
1130
+ {getLocaleName(localeItem, locale)}
1131
+ </span>
1132
+ <span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
1133
+ {/* Ngôn ngữ trong Locale hiện tại - ví dụ: Francés với locale hiện tại được đặt thành Locales.SPANISH */}
1134
+ {getLocaleName(localeItem)}
1135
+ </span>
1136
+ <span dir="ltr" lang={Locales.ENGLISH}>
1137
+ {/* Ngôn ngữ bằng tiếng Anh - ví dụ: French */}
1138
+ {getLocaleName(localeItem, Locales.ENGLISH)}
1139
+ </span>
1140
+ </Link>
1141
+ ))}
1142
+ </div>
1143
+ </div>
1144
+ );
1145
+ };
1146
+ ```
1147
+
1148
+ ```jsx fileName="src/components/LanguageSwitcher.msx" codeFormat="esm"
1149
+ import {
1150
+ Locales,
1151
+ getHTMLTextDir,
1152
+ getLocaleName,
1153
+ getLocalizedUrl,
1154
+ } from "intlayer";
1155
+ import { useLocalePageRouter } from "next-intlayer";
1156
+ import Link from "next/link";
1157
+
1158
+ const LocaleSwitcher = () => {
1159
+ const { locale, pathWithoutLocale, availableLocales } = useLocalePageRouter();
1160
+ const { setLocaleCookie } = useLocaleCookie();
1161
+
1162
+ return (
1163
+ <div>
1164
+ <button popoverTarget="localePopover">{getLocaleName(locale)}</button>
1165
+ <div id="localePopover" popover="auto">
1166
+ {availableLocales.map((localeItem) => (
1167
+ <Link
1168
+ href={getLocalizedUrl(pathWithoutLocale, localeItem)}
1169
+ hrefLang={localeItem}
1170
+ key={localeItem}
1171
+ aria-current={locale === localeItem ? "page" : undefined}
1172
+ onClick={() => setLocaleCookie(localeItem)}
1173
+ >
1174
+ <span>
1175
+ {/* Locale - ví dụ: FR */}
1176
+ {localeItem}
1177
+ </span>
1178
+ <span>
1179
+ {/* Ngôn ngữ trong Locale riêng của nó - ví dụ: Français */}
1180
+ {getLocaleName(localeItem, locale)}
1181
+ </span>
1182
+ <span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
1183
+ {/* Ngôn ngữ trong Locale hiện tại - ví dụ: Francés với locale hiện tại được đặt thành Locales.SPANISH */}
1184
+ {getLocaleName(localeItem)}
1185
+ </span>
1186
+ <span dir="ltr" lang={Locales.ENGLISH}>
1187
+ {/* Ngôn ngữ bằng tiếng Anh - ví dụ: French */}
1188
+ {getLocaleName(localeItem, Locales.ENGLISH)}
1189
+ </span>
1190
+ </Link>
1191
+ ))}
1192
+ </div>
1193
+ </div>
1194
+ );
1195
+ };
1196
+ ```
1197
+
1198
+ ```jsx fileName="src/components/LanguageSwitcher.msx" codeFormat="commonjs"
1199
+ const {
1200
+ Locales,
1201
+ getHTMLTextDir,
1202
+ getLocaleName,
1203
+ getLocalizedUrl,
1204
+ } = require("intlayer");
1205
+ const { useLocalePageRouter } = require("next-intlayer");
1206
+ const Link = require("next/link");
1207
+
1208
+ const LocaleSwitcher = () => {
1209
+ const { locale, pathWithoutLocale, availableLocales } = useLocalePageRouter();
1210
+ const { setLocaleCookie } = useLocaleCookie();
1211
+
1212
+ return (
1213
+ <select>
1214
+ {availableLocales.map((localeItem) => (
1215
+ <option value={localeItem} key={localeItem}>
1216
+ <Link
1217
+ href={getLocalizedUrl(pathWithoutLocale, localeItem)}
1218
+ hrefLang={localeItem}
1219
+ aria-current={locale === localeItem ? "page" : undefined}
1220
+ onClick={() => setLocaleCookie(localeItem)}
1221
+ >
1222
+ <span>
1223
+ {/* Locale - ví dụ: FR */}
1224
+ {localeItem}
1225
+ </span>
1226
+ <span>
1227
+ {/* Ngôn ngữ trong Locale của chính nó - ví dụ: Français */}
1228
+ {getLocaleName(localeItem, locale)}
1229
+ </span>
1230
+ <span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
1231
+ {/* Ngôn ngữ trong Locale hiện tại - ví dụ: Francés khi locale hiện tại được đặt là Locales.SPANISH */}
1232
+ {getLocaleName(localeItem)}
1233
+ </span>
1234
+ <span dir="ltr" lang={Locales.ENGLISH}>
1235
+ {/* Ngôn ngữ bằng tiếng Anh - ví dụ: French */}
1236
+ {getLocaleName(localeItem, Locales.ENGLISH)}
1237
+ </span>
1238
+ </Link>
1239
+ </option>
1240
+ ))}
1241
+ </select>
1242
+ );
1243
+ };
1244
+ ```
1245
+
1246
+ > Một cách thay thế là sử dụng hàm `setLocale` được cung cấp bởi hook `useLocale`. Hàm này sẽ không cho phép tải trước trang và sẽ tải lại trang.
1247
+
1248
+ > Trong trường hợp này, không sử dụng chuyển hướng với `router.push`, chỉ có mã phía server của bạn sẽ thay đổi locale của nội dung.
1249
+
1250
+ ```tsx fileName="src/components/LocaleSwitcher.tsx" codeFormat="typescript"
1251
+ "use client";
1252
+
1253
+ import { useRouter } from "next/navigation";
1254
+ import { useLocale } from "next-intlayer";
1255
+ import { getLocalizedUrl } from "intlayer";
1256
+
1257
+ // ... Phần còn lại của mã
1258
+
1259
+ const router = useRouter();
1260
+ const { setLocale } = useLocale({
1261
+ onLocaleChange: (locale) => {
1262
+ router.push(getLocalizedUrl(pathWithoutLocale, locale));
1263
+ },
1264
+ });
1265
+
1266
+ return (
1267
+ <button onClick={() => setLocale(Locales.FRENCH)}>
1268
+ Chuyển sang tiếng Pháp
1269
+ </button>
1270
+ );
1271
+ ```
1272
+
1273
+ > API `useLocalePageRouter` giống với `useLocale`. Để tìm hiểu thêm về hook `useLocale`, hãy tham khảo [tài liệu](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/packages/next-intlayer/useLocale.md).
1274
+
1275
+ > Tham khảo tài liệu:
1276
+ >
1277
+ > - [hook `getLocaleName`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/packages/intlayer/getLocaleName.md)
1278
+ > - [hook `getLocalizedUrl`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/packages/intlayer/getLocalizedUrl.md)
1279
+ > - [hook `getHTMLTextDir`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/packages/intlayer/getHTMLTextDir.md)
1280
+ > - [thuộc tính `hrefLang`](https://developers.google.com/search/docs/specialty/international/localized-versions?hl=fr)
1281
+ > - [`thuộc tính lang`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang)
1282
+ > - [`thuộc tính dir`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir)
1283
+ > - [`thuộc tính aria-current`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)
1284
+
1285
+ ### (Tùy chọn) Bước 10: Tạo một Thành phần Link Đa ngôn ngữ
1286
+
1287
+ Để đảm bảo rằng điều hướng trong ứng dụng của bạn tôn trọng locale hiện tại, bạn có thể tạo một thành phần `Link` tùy chỉnh. 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ộ, ví dụ, khi một người dùng nói tiếng Pháp nhấp vào liên kết đến trang "About", họ sẽ được chuyển hướng đến `/fr/about` thay vì `/about`.
1288
+
1289
+ Hành vi này hữu ích vì một số lý do:
1290
+
1291
+ - **SEO và Trải nghiệm Người dùng**: URL đa ngôn ngữ giúp các công cụ tìm kiếm lập chỉ mục chính xác các trang theo ngôn ngữ cụ thể và cung cấp nội dung cho người dùng theo ngôn ngữ ưu tiên của họ.
1292
+ - **Tính nhất quán**: Bằng cách sử dụng liên kết đa ngôn ngữ trong toàn bộ ứng dụng của bạn, bạn đảm bảo rằng điều hướng luôn nằm trong locale hiện tại, ngăn chặn việc chuyển đổi ngôn ngữ không mong muốn.
1293
+ - **Dễ bảo trì**: Tập trung logic đa ngôn ngữ vào một thành phần duy nhất giúp đơn giản hóa việc quản lý URL, làm cho codebase của bạn dễ bảo trì và mở rộng khi ứng dụng phát triển.
1294
+
1295
+ Dưới đây là triển khai của một thành phần `Link` đa ngôn ngữ bằng TypeScript:
1296
+
1297
+ ```tsx fileName="src/components/Link.tsx" codeFormat="typescript"
1298
+ "use client";
1299
+
1300
+ import { getLocalizedUrl } from "intlayer";
1301
+ import NextLink, { type LinkProps as NextLinkProps } from "next/link";
1302
+ import { useLocale } from "next-intlayer";
1303
+ import { forwardRef, PropsWithChildren, type ForwardedRef } from "react";
1304
+
1305
+ /**
1306
+ * Hàm tiện ích để kiểm tra xem một URL có phải là liên kết ngoài hay không.
1307
+ * Nếu URL bắt đầu bằng http:// hoặc https://, nó được coi là liên kết ngoài.
1308
+ */
1309
+ export const checkIsExternalLink = (href?: string): boolean =>
1310
+ /^https?:\/\//.test(href ?? "");
1311
+
1312
+ /**
1313
+ * Một thành phần Link tùy chỉnh điều chỉnh thuộc tính href dựa trên locale hiện tại.
1314
+ * Đối với các liên kết nội bộ, nó sử dụng `getLocalizedUrl` để thêm tiền tố locale vào URL (ví dụ: /fr/about).
1315
+ * Điều này đảm bảo điều hướng luôn nằm trong cùng ngữ cảnh locale.
1316
+ */
1317
+ export const Link = forwardRef<
1318
+ HTMLAnchorElement,
1319
+ PropsWithChildren<NextLinkProps>
1320
+ >(({ href, children, ...props }, ref: ForwardedRef<HTMLAnchorElement>) => {
1321
+ const { locale } = useLocale();
1322
+ const isExternalLink = checkIsExternalLink(href.toString());
1323
+
1324
+ // Nếu liên kết là nội bộ và href hợp lệ được cung cấp, lấy URL đã được địa phương hóa.
1325
+ const hrefI18n: NextLinkProps["href"] =
1326
+ href && !isExternalLink ? getLocalizedUrl(href.toString(), locale) : href;
1327
+
1328
+ return (
1329
+ <NextLink href={hrefI18n} ref={ref} {...props}>
1330
+ {children}
1331
+ </NextLink>
1332
+ );
1333
+ });
1334
+
1335
+ Link.displayName = "Link";
1336
+ ```
1337
+
1338
+ ```jsx fileName="src/components/Link.mjx" codeFormat="esm"
1339
+ 'use client';
1340
+
1341
+ import { getLocalizedUrl } from 'intlayer';
1342
+ import NextLink, { type LinkProps as NextLinkProps } from 'next/link';
1343
+ import { useLocale } from 'next-intlayer';
1344
+ import { forwardRef, PropsWithChildren, type ForwardedRef } from 'react';
1345
+
1346
+ /**
1347
+ * Hàm tiện ích để kiểm tra xem một URL có phải là liên kết ngoài hay không.
1348
+ * Nếu URL bắt đầu bằng http:// hoặc https://, nó được coi là liên kết ngoài.
1349
+ */
1350
+ export const checkIsExternalLink = (href) =>
1351
+ /^https?:\/\//.test(href ?? '');
1352
+
1353
+ /**
1354
+ * Một component Link tùy chỉnh điều chỉnh thuộc tính href dựa trên locale hiện tại.
1355
+ * Đối với các liên kết nội bộ, nó sử dụng `getLocalizedUrl` để thêm tiền tố locale vào URL (ví dụ: /fr/about).
1356
+ * Điều này đảm bảo việc điều hướng luôn giữ trong cùng một ngữ cảnh locale.
1357
+ */
1358
+ export const Link = forwardRef(({ href, children, ...props }, ref) => {
1359
+ const { locale } = useLocale();
1360
+ const isExternalLink = checkIsExternalLink(href.toString());
1361
+
1362
+ // Nếu liên kết là nội bộ và href hợp lệ được cung cấp, lấy URL đã được địa phương hóa.
1363
+ const hrefI18n =
1364
+ href && !isExternalLink ? getLocalizedUrl(href.toString(), locale) : href;
1365
+
1366
+ return (
1367
+ <NextLink href={hrefI18n} ref={ref} {...props}>
1368
+ {children}
1369
+ </NextLink>
1370
+ );
1371
+ });
1372
+
1373
+ Link.displayName = 'Link';
1374
+ ```
1375
+
1376
+ ```jsx fileName="src/components/Link.csx" codeFormat="commonjs"
1377
+ 'use client';
1378
+
1379
+ const { getLocalizedUrl } = require("intlayer");
1380
+ const NextLink = require("next/link");
1381
+ const { useLocale } = require("next-intlayer");
1382
+ const { forwardRef } = require("react");
1383
+
1384
+ /**
1385
+ * Hàm tiện ích để kiểm tra xem một URL có phải là liên kết ngoài hay không.
1386
+ * Nếu URL bắt đầu bằng http:// hoặc https://, nó được coi là liên kết ngoài.
1387
+ */
1388
+ const checkIsExternalLink = (href) =>
1389
+ /^https?:\/\//.test(href ?? '');
1390
+
1391
+
1392
+ const Link = forwardRef(({ href, children, ...props }, ref) => {
1393
+ const { locale } = useLocale();
1394
+ const isExternalLink = checkIsExternalLink(href.toString());
1395
+
1396
+ // Nếu liên kết là nội bộ và href hợp lệ được cung cấp, lấy URL đã được địa phương hóa.
1397
+ const hrefI18n: NextLinkProps['href'] =
1398
+ href && !isExternalLink ? getLocalizedUrl(href.toString(), locale) : href;
1399
+
1400
+ return (
1401
+ <NextLink href={hrefI18n} ref={ref} {...props}>
1402
+ {children}
1403
+ </NextLink>
1404
+ );
1405
+ });
1406
+
1407
+ Link.displayName = 'Link';
1408
+ ```
1409
+
1410
+ #### Cách Hoạt Động
1411
+
1412
+ - **Phát hiện Liên kết Ngoài**:
1413
+ Hàm trợ giúp `checkIsExternalLink` xác định xem một URL có phải là liên kết ngoài hay không. Các liên kết ngoài được giữ nguyên vì chúng không cần được địa phương hóa.
1414
+
1415
+ - **Lấy Ngôn ngữ Hiện tại**:
1416
+ // Hook useLocale cung cấp locale hiện tại (ví dụ: `fr` cho tiếng Pháp).
1417
+
1418
+ - **Địa phương hóa URL**:
1419
+ Đối với các liên kết nội bộ (tức là không phải liên kết ngoài), `getLocalizedUrl` được sử dụng để tự động thêm tiền tố locale hiện tại vào URL. Điều này có nghĩa là nếu người dùng của bạn đang ở chế độ tiếng Pháp, việc truyền `/about` làm `href` sẽ chuyển thành `/fr/about`.
1420
+
1421
+ - **Trả về Liên kết**:
1422
+ Component trả về một phần tử `<a>` với URL đã được địa phương hóa, đảm bảo điều hướng nhất quán với locale.
1423
+
1424
+ Bằng cách tích hợp component `Link` này trong toàn bộ ứng dụng của bạn, bạn duy trì trải nghiệm người dùng nhất quán và nhận biết ngôn ngữ đồng thời cải thiện SEO và khả năng sử dụng.
1425
+
1426
+ ### (Tùy chọn) Bước 11: Tối ưu kích thước bundle của bạn
1427
+
1428
+ Khi sử dụng `next-intlayer`, các từ điển được bao gồm trong bundle cho mỗi trang theo mặc định. Để tối ưu kích thước bundle, Intlayer cung cấp một plugin SWC tùy chọn thay thế thông minh các lệnh gọi `useIntlayer` bằng cách sử dụng macro. Điều này đảm bảo các từ điển chỉ được bao gồm trong bundle của những trang thực sự sử dụng chúng.
1429
+
1430
+ Để kích hoạt tối ưu hóa này, hãy cài đặt gói `@intlayer/swc`. Khi đã cài đặt, `next-intlayer` sẽ tự động phát hiện và sử dụng plugin:
1431
+
1432
+ ```bash packageManager="npm"
1433
+ npm install @intlayer/swc --save-dev
1434
+ ```
1435
+
1436
+ ```bash packageManager="pnpm"
1437
+ pnpm add @intlayer/swc --save-dev
1438
+ ```
1439
+
1440
+ ```bash packageManager="yarn"
1441
+ yarn add @intlayer/swc --save-dev
1442
+ ```
1443
+
1444
+ > Lưu ý: Tối ưu hóa này chỉ có sẵn cho Next.js 13 trở lên.
1445
+
1446
+ > Lưu ý: Gói này không được cài đặt mặc định vì các plugin SWC vẫn đang trong giai đoạn thử nghiệm trên Next.js. Điều này có thể thay đổi trong tương lai.
1447
+
1448
+ ### Cấu hình TypeScript
1449
+
1450
+ 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.
1451
+
1452
+ ![Tự động hoàn thành](https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true)
1453
+
1454
+ ![Lỗi dịch thuật](https://github.com/aymericzip/intlayer/blob/main/docs/assets/translation_error.png?raw=true)
1455
+
1456
+ Đảm bảo cấu hình TypeScript của bạn bao gồm các kiểu được tạo tự động.
1457
+
1458
+ ```json5 fileName="tsconfig.json"
1459
+ {
1460
+ // ... Các cấu hình TypeScript hiện có của bạn
1461
+ "include": [
1462
+ // ... Các cấu hình TypeScript hiện có của bạn
1463
+ ".intlayer/**/*.ts", // Bao gồm các kiểu được tạo tự động
1464
+ ],
1465
+ }
1466
+ ```
1467
+
1468
+ ### Cấu hình Git
1469
+
1470
+ Để giữ cho kho lưu trữ của bạn sạch sẽ và tránh việc commit các file được tạo tự động, bạn nên bỏ qua các file do Intlayer tạo ra.
1471
+
1472
+ Thêm các dòng sau vào file `.gitignore` của bạn:
1473
+
1474
+ ```plaintext fileName=".gitignore"
1475
+ # Bỏ qua các file được tạo bởi Intlayer
1476
+ .intlayer
1477
+ ```
1478
+
1479
+ ### Tiện ích mở rộng VS Code
1480
+
1481
+ Để 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.
1482
+
1483
+ [Cài đặt từ VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
1484
+
1485
+ Tiện ích mở rộng này cung cấp:
1486
+
1487
+ - **Tự động hoàn thành** cho các khóa dịch.
1488
+ - **Phát hiện lỗi thời gian thực** cho các bản dịch bị thiếu.
1489
+ - **Xem trước nội dung dịch ngay trong dòng**.
1490
+ - **Hành động nhanh** để dễ dàng tạo và cập nhật các bản dịch.
1491
+
1492
+ Để 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).
1493
+
1494
+ ## Tài nguyên bổ sung
1495
+
1496
+ - **Tài liệu Intlayer:** [Kho GitHub](https://github.com/aymericzip/intlayer)
1497
+ - **Hướng dẫn Từ điển:** [Từ điển](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/dictionary/content_file.md)
1498
+ - **Tài liệu Cấu hình:** [Hướng dẫn Cấu hình](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/configuration.md)
1499
+
1500
+ Bằng cách làm theo hướng dẫn này, bạn có thể tích hợp hiệu quả Intlayer vào ứng dụng Next.js của mình sử dụng Page Router, cho phép hỗ trợ quốc tế hóa mạnh mẽ và có khả năng mở rộng cho các dự án web của bạn.
1501
+
1502
+ ### Tiến xa hơn
1503
+
1504
+ Để đ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).