@intlayer/docs 9.1.3 → 9.3.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 (482) hide show
  1. package/blog/ar/index.md +1 -1
  2. package/blog/ar/rag_powered_documentation_assistant.md +7 -0
  3. package/blog/de/index.md +1 -1
  4. package/blog/de/rag_powered_documentation_assistant.md +6 -0
  5. package/blog/en/index.md +1 -1
  6. package/blog/en-GB/index.md +1 -1
  7. package/blog/en-GB/rag_powered_documentation_assistant.md +6 -0
  8. package/blog/es/index.md +1 -1
  9. package/blog/es/rag_powered_documentation_assistant.md +7 -0
  10. package/blog/fr/i18n_meaning.md +7 -1
  11. package/blog/fr/index.md +1 -1
  12. package/blog/fr/list_i18n_technologies/frameworks/angular.md +5 -1
  13. package/blog/fr/rag_powered_documentation_assistant.md +6 -0
  14. package/blog/hi/index.md +1 -1
  15. package/blog/hi/next-i18next_vs_next-intl_vs_intlayer.md +119 -42
  16. package/blog/hi/rag_powered_documentation_assistant.md +7 -0
  17. package/blog/id/index.md +1 -1
  18. package/blog/id/rag_powered_documentation_assistant.md +6 -0
  19. package/blog/it/index.md +1 -1
  20. package/blog/it/rag_powered_documentation_assistant.md +6 -0
  21. package/blog/ja/index.md +1 -1
  22. package/blog/ja/rag_powered_documentation_assistant.md +7 -0
  23. package/blog/ko/index.md +1 -1
  24. package/blog/ko/list_i18n_technologies/frameworks/react.md +7 -7
  25. package/blog/ko/rag_powered_documentation_assistant.md +6 -0
  26. package/blog/pl/index.md +1 -1
  27. package/blog/pl/rag_powered_documentation_assistant.md +6 -0
  28. package/blog/pt/index.md +1 -1
  29. package/blog/pt/rag_powered_documentation_assistant.md +6 -0
  30. package/blog/ru/index.md +1 -1
  31. package/blog/ru/rag_powered_documentation_assistant.md +7 -0
  32. package/blog/tr/intlayer_with_react-intl.md +3 -1
  33. package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +175 -42
  34. package/blog/tr/rag_powered_documentation_assistant.md +6 -0
  35. package/blog/uk/index.md +1 -1
  36. package/blog/uk/rag_powered_documentation_assistant.md +6 -0
  37. package/blog/vi/index.md +1 -1
  38. package/blog/vi/rag_powered_documentation_assistant.md +6 -0
  39. package/blog/zh/index.md +1 -1
  40. package/blog/zh/intlayer_with_i18next.md +87 -28
  41. package/blog/zh/intlayer_with_next-i18next.md +86 -29
  42. package/blog/zh/intlayer_with_next-intl.md +88 -28
  43. package/blog/zh/intlayer_with_react-i18next.md +87 -28
  44. package/blog/zh/intlayer_with_react-intl.md +88 -27
  45. package/blog/zh/intlayer_with_vue-i18n.md +117 -8
  46. package/blog/zh/rag_powered_documentation_assistant.md +6 -0
  47. package/dist/cjs/common.cjs +24 -1
  48. package/dist/cjs/common.cjs.map +1 -1
  49. package/dist/cjs/generated/blog.entry.cjs +58 -31
  50. package/dist/cjs/generated/blog.entry.cjs.map +1 -1
  51. package/dist/cjs/generated/docs.entry.cjs +265 -218
  52. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  53. package/dist/cjs/generated/frequentQuestions.entry.cjs +48 -21
  54. package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
  55. package/dist/cjs/generated/legal.entry.cjs +33 -6
  56. package/dist/cjs/generated/legal.entry.cjs.map +1 -1
  57. package/dist/esm/common.mjs +24 -1
  58. package/dist/esm/common.mjs.map +1 -1
  59. package/dist/esm/generated/blog.entry.mjs +58 -31
  60. package/dist/esm/generated/blog.entry.mjs.map +1 -1
  61. package/dist/esm/generated/docs.entry.mjs +265 -218
  62. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  63. package/dist/esm/generated/frequentQuestions.entry.mjs +48 -21
  64. package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
  65. package/dist/esm/generated/legal.entry.mjs +33 -6
  66. package/dist/esm/generated/legal.entry.mjs.map +1 -1
  67. package/dist/types/common.d.ts.map +1 -1
  68. package/dist/types/generated/blog.entry.d.ts.map +1 -1
  69. package/dist/types/generated/docs.entry.d.ts +1 -0
  70. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  71. package/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
  72. package/dist/types/generated/legal.entry.d.ts.map +1 -1
  73. package/docs/ar/analytics.md +222 -0
  74. package/docs/ar/autoFill.md +28 -9
  75. package/docs/ar/bundle_optimization.md +58 -25
  76. package/docs/ar/configuration.md +25 -8
  77. package/docs/ar/dictionary/file.md +3 -1
  78. package/docs/ar/dictionary/nesting.md +47 -30
  79. package/docs/ar/formatters.md +148 -193
  80. package/docs/ar/intlayer_CMS.md +152 -0
  81. package/docs/ar/intlayer_with_angular_21.md +9 -9
  82. package/docs/ar/intlayer_with_nextjs_14.md +1 -28
  83. package/docs/ar/intlayer_with_nextjs_15.md +1 -33
  84. package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +40 -83
  85. package/docs/ar/intlayer_with_solid_start.md +1078 -0
  86. package/docs/ar/intlayer_with_vite+vue.md +1 -3
  87. package/docs/ar/live-sync.md +4 -0
  88. package/docs/ar/packages/intlayer/getLocalizedUrl.md +26 -24
  89. package/docs/ar/packages/intlayer/getMultilingualUrls.md +4 -18
  90. package/docs/ar/packages/react-intlayer/useDictionary.md +4 -21
  91. package/docs/ar/packages/react-intlayer/useIntlayer.md +2 -2
  92. package/docs/ar/packages/vite-intlayer/exports.md +15 -0
  93. package/docs/ar/packages/vite-intlayer/intlayer.md +121 -6
  94. package/docs/ar/packages/vite-intlayer/intlayerPrune.md +70 -3
  95. package/docs/ar/releases/v9.md +0 -37
  96. package/docs/ar/self_hosting.md +46 -49
  97. package/docs/bn/bundle_optimization.md +58 -25
  98. package/docs/bn/configuration.md +25 -8
  99. package/docs/bn/intlayer_with_angular_21.md +9 -9
  100. package/docs/cs/bundle_optimization.md +58 -25
  101. package/docs/cs/configuration.md +25 -8
  102. package/docs/cs/intlayer_with_angular_21.md +9 -9
  103. package/docs/de/analytics.md +222 -0
  104. package/docs/de/autoFill.md +28 -9
  105. package/docs/de/bundle_optimization.md +58 -25
  106. package/docs/de/configuration.md +25 -8
  107. package/docs/de/dictionary/file.md +3 -1
  108. package/docs/de/dictionary/nesting.md +47 -31
  109. package/docs/de/formatters.md +208 -334
  110. package/docs/de/intlayer_CMS.md +66 -15
  111. package/docs/de/intlayer_with_angular_21.md +9 -9
  112. package/docs/de/intlayer_with_nestjs.md +11 -7
  113. package/docs/de/intlayer_with_nextjs_14.md +1 -28
  114. package/docs/de/intlayer_with_nextjs_15.md +1 -33
  115. package/docs/de/intlayer_with_solid_start.md +1078 -0
  116. package/docs/de/intlayer_with_vite+vue.md +1 -3
  117. package/docs/de/live-sync.md +4 -0
  118. package/docs/de/packages/intlayer/getLocalizedUrl.md +33 -25
  119. package/docs/de/packages/intlayer/getMultilingualUrls.md +4 -18
  120. package/docs/de/packages/react-intlayer/useDictionary.md +2 -5
  121. package/docs/de/packages/vite-intlayer/exports.md +15 -0
  122. package/docs/de/packages/vite-intlayer/intlayer.md +121 -6
  123. package/docs/de/packages/vite-intlayer/intlayerPrune.md +77 -4
  124. package/docs/de/releases/v9.md +0 -15
  125. package/docs/de/self_hosting.md +46 -50
  126. package/docs/en/bundle_optimization.md +51 -23
  127. package/docs/en/cli/doc-review.md +13 -2
  128. package/docs/en/configuration.md +24 -15
  129. package/docs/en/intlayer_with_angular_21.md +9 -9
  130. package/docs/en/intlayer_with_solid_start.md +1091 -0
  131. package/docs/en/intlayer_with_vite+solid.md +12 -0
  132. package/docs/en/live-sync.md +4 -0
  133. package/docs/en-GB/analytics.md +222 -0
  134. package/docs/en-GB/autoFill.md +26 -7
  135. package/docs/en-GB/bundle_optimization.md +58 -25
  136. package/docs/en-GB/configuration.md +25 -8
  137. package/docs/en-GB/dictionary/file.md +2 -0
  138. package/docs/en-GB/dictionary/nesting.md +64 -205
  139. package/docs/en-GB/formatters.md +146 -181
  140. package/docs/en-GB/intlayer_CMS.md +152 -0
  141. package/docs/en-GB/intlayer_with_angular_21.md +9 -9
  142. package/docs/en-GB/intlayer_with_nestjs.md +6 -2
  143. package/docs/en-GB/intlayer_with_nextjs_14.md +0 -27
  144. package/docs/en-GB/intlayer_with_nextjs_15.md +1 -33
  145. package/docs/en-GB/intlayer_with_react_router_v7_fs_routes.md +40 -82
  146. package/docs/en-GB/intlayer_with_solid_start.md +1078 -0
  147. package/docs/en-GB/intlayer_with_vite+vue.md +1 -3
  148. package/docs/en-GB/live-sync.md +4 -0
  149. package/docs/en-GB/packages/intlayer/getLocalizedUrl.md +30 -22
  150. package/docs/en-GB/packages/intlayer/getMultilingualUrls.md +16 -48
  151. package/docs/en-GB/packages/vite-intlayer/exports.md +15 -0
  152. package/docs/en-GB/packages/vite-intlayer/intlayer.md +121 -6
  153. package/docs/en-GB/packages/vite-intlayer/intlayerPrune.md +77 -4
  154. package/docs/en-GB/self_hosting.md +60 -49
  155. package/docs/es/analytics.md +222 -0
  156. package/docs/es/autoFill.md +28 -9
  157. package/docs/es/bundle_optimization.md +58 -25
  158. package/docs/es/configuration.md +24 -7
  159. package/docs/es/dictionary/file.md +3 -1
  160. package/docs/es/dictionary/nesting.md +47 -30
  161. package/docs/es/formatters.md +114 -168
  162. package/docs/es/intlayer_CMS.md +35 -10
  163. package/docs/es/intlayer_with_angular_21.md +9 -9
  164. package/docs/es/intlayer_with_nextjs_14.md +1 -28
  165. package/docs/es/intlayer_with_nextjs_15.md +1 -33
  166. package/docs/es/intlayer_with_solid_start.md +1078 -0
  167. package/docs/es/live-sync.md +4 -0
  168. package/docs/es/packages/intlayer/getLocalizedUrl.md +31 -23
  169. package/docs/es/packages/intlayer/getMultilingualUrls.md +4 -18
  170. package/docs/es/packages/vite-intlayer/exports.md +15 -0
  171. package/docs/es/packages/vite-intlayer/intlayer.md +121 -6
  172. package/docs/es/packages/vite-intlayer/intlayerPrune.md +69 -2
  173. package/docs/es/releases/v9.md +0 -15
  174. package/docs/es/self_hosting.md +46 -49
  175. package/docs/fr/analytics.md +222 -0
  176. package/docs/fr/autoFill.md +27 -8
  177. package/docs/fr/bundle_optimization.md +58 -25
  178. package/docs/fr/configuration.md +25 -8
  179. package/docs/fr/dictionary/file.md +2 -0
  180. package/docs/fr/dictionary/nesting.md +37 -184
  181. package/docs/fr/formatters.md +95 -236
  182. package/docs/fr/intlayer_CMS.md +66 -15
  183. package/docs/fr/intlayer_with_angular_21.md +9 -9
  184. package/docs/fr/intlayer_with_nextjs_14.md +1 -28
  185. package/docs/fr/intlayer_with_nextjs_15.md +1 -33
  186. package/docs/fr/intlayer_with_solid_start.md +1078 -0
  187. package/docs/fr/live-sync.md +4 -0
  188. package/docs/fr/packages/intlayer/getLocalizedUrl.md +37 -27
  189. package/docs/fr/packages/intlayer/getMultilingualUrls.md +18 -20
  190. package/docs/fr/packages/vite-intlayer/exports.md +15 -0
  191. package/docs/fr/packages/vite-intlayer/intlayer.md +121 -6
  192. package/docs/fr/packages/vite-intlayer/intlayerPrune.md +77 -4
  193. package/docs/fr/releases/v9.md +0 -15
  194. package/docs/fr/self_hosting.md +46 -49
  195. package/docs/hi/analytics.md +222 -0
  196. package/docs/hi/autoFill.md +28 -9
  197. package/docs/hi/bundle_optimization.md +58 -25
  198. package/docs/hi/configuration.md +25 -8
  199. package/docs/hi/dictionary/file.md +3 -1
  200. package/docs/hi/dictionary/nesting.md +47 -30
  201. package/docs/hi/formatters.md +233 -334
  202. package/docs/hi/how_works_intlayer.md +3 -1
  203. package/docs/hi/intlayer_CMS.md +152 -0
  204. package/docs/hi/intlayer_with_angular_21.md +9 -9
  205. package/docs/hi/intlayer_with_nestjs.md +11 -7
  206. package/docs/hi/intlayer_with_nextjs_14.md +1 -28
  207. package/docs/hi/intlayer_with_nextjs_15.md +1 -33
  208. package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +40 -83
  209. package/docs/hi/intlayer_with_solid_start.md +1077 -0
  210. package/docs/hi/intlayer_with_vite+preact.md +56 -49
  211. package/docs/hi/intlayer_with_vite+react.md +48 -41
  212. package/docs/hi/intlayer_with_vite+solid.md +32 -41
  213. package/docs/hi/intlayer_with_vite+vue.md +49 -44
  214. package/docs/hi/live-sync.md +4 -0
  215. package/docs/hi/packages/intlayer/getLocalizedUrl.md +26 -24
  216. package/docs/hi/packages/intlayer/getMultilingualUrls.md +4 -18
  217. package/docs/hi/packages/next-intlayer/t.md +33 -1
  218. package/docs/hi/packages/react-intlayer/useDictionary.md +4 -21
  219. package/docs/hi/packages/vite-intlayer/exports.md +15 -0
  220. package/docs/hi/packages/vite-intlayer/intlayer.md +121 -6
  221. package/docs/hi/packages/vite-intlayer/intlayerPrune.md +78 -5
  222. package/docs/hi/plugins/sync-json.md +9 -9
  223. package/docs/hi/releases/v9.md +0 -15
  224. package/docs/hi/self_hosting.md +38 -51
  225. package/docs/id/analytics.md +223 -0
  226. package/docs/id/bundle_optimization.md +58 -25
  227. package/docs/id/configuration.md +25 -8
  228. package/docs/id/dictionary/nesting.md +37 -184
  229. package/docs/id/formatters.md +208 -305
  230. package/docs/id/intlayer_CMS.md +164 -0
  231. package/docs/id/intlayer_with_angular_21.md +9 -9
  232. package/docs/id/intlayer_with_nextjs_14.md +1 -26
  233. package/docs/id/intlayer_with_react_router_v7_fs_routes.md +70 -63
  234. package/docs/id/intlayer_with_solid_start.md +1078 -0
  235. package/docs/id/live-sync.md +4 -0
  236. package/docs/id/packages/intlayer/getMultilingualUrls.md +4 -18
  237. package/docs/id/packages/react-intlayer/useIntlayer.md +2 -2
  238. package/docs/id/packages/vite-intlayer/exports.md +15 -0
  239. package/docs/id/packages/vite-intlayer/intlayer.md +121 -6
  240. package/docs/id/packages/vite-intlayer/intlayerPrune.md +78 -5
  241. package/docs/id/releases/v9.md +12 -0
  242. package/docs/id/self_hosting.md +61 -50
  243. package/docs/it/analytics.md +222 -0
  244. package/docs/it/autoFill.md +27 -8
  245. package/docs/it/bundle_optimization.md +58 -25
  246. package/docs/it/configuration.md +25 -8
  247. package/docs/it/dictionary/file.md +3 -1
  248. package/docs/it/dictionary/nesting.md +47 -30
  249. package/docs/it/formatters.md +114 -168
  250. package/docs/it/intlayer_CMS.md +66 -15
  251. package/docs/it/intlayer_with_angular_21.md +9 -9
  252. package/docs/it/intlayer_with_nestjs.md +11 -7
  253. package/docs/it/intlayer_with_nextjs_14.md +1 -28
  254. package/docs/it/intlayer_with_nextjs_15.md +1 -33
  255. package/docs/it/intlayer_with_solid_start.md +1078 -0
  256. package/docs/it/intlayer_with_vite+vue.md +1 -3
  257. package/docs/it/live-sync.md +4 -0
  258. package/docs/it/packages/intlayer/getLocalizedUrl.md +34 -26
  259. package/docs/it/packages/intlayer/getMultilingualUrls.md +4 -18
  260. package/docs/it/packages/react-intlayer/useDictionary.md +4 -21
  261. package/docs/it/packages/vite-intlayer/exports.md +15 -0
  262. package/docs/it/packages/vite-intlayer/intlayer.md +121 -6
  263. package/docs/it/packages/vite-intlayer/intlayerPrune.md +77 -4
  264. package/docs/it/releases/v9.md +0 -15
  265. package/docs/it/self_hosting.md +60 -49
  266. package/docs/ja/analytics.md +222 -0
  267. package/docs/ja/autoFill.md +28 -9
  268. package/docs/ja/bundle_optimization.md +58 -25
  269. package/docs/ja/configuration.md +25 -8
  270. package/docs/ja/dictionary/content_file.md +15 -7
  271. package/docs/ja/dictionary/file.md +3 -1
  272. package/docs/ja/dictionary/nesting.md +47 -30
  273. package/docs/ja/formatters.md +133 -187
  274. package/docs/ja/intlayer_visual_editor.md +3 -1
  275. package/docs/ja/intlayer_with_angular_21.md +6 -6
  276. package/docs/ja/intlayer_with_nestjs.md +2 -12
  277. package/docs/ja/intlayer_with_nextjs_14.md +1 -28
  278. package/docs/ja/intlayer_with_nextjs_15.md +1 -33
  279. package/docs/ja/intlayer_with_react_router_v7.md +456 -20
  280. package/docs/ja/intlayer_with_solid_start.md +1078 -0
  281. package/docs/ja/intlayer_with_vite+preact.md +73 -41
  282. package/docs/ja/intlayer_with_vite+vue.md +1 -3
  283. package/docs/ja/live-sync.md +4 -0
  284. package/docs/ja/mcp_server.md +3 -9
  285. package/docs/ja/packages/intlayer/getLocalizedUrl.md +26 -24
  286. package/docs/ja/packages/intlayer/getMultilingualUrls.md +3 -17
  287. package/docs/ja/packages/vite-intlayer/exports.md +15 -0
  288. package/docs/ja/packages/vite-intlayer/intlayer.md +121 -6
  289. package/docs/ja/packages/vite-intlayer/intlayerPrune.md +79 -6
  290. package/docs/ja/releases/v9.md +12 -0
  291. package/docs/ja/self_hosting.md +46 -50
  292. package/docs/ko/analytics.md +222 -0
  293. package/docs/ko/autoFill.md +28 -9
  294. package/docs/ko/bundle_optimization.md +58 -25
  295. package/docs/ko/configuration.md +25 -8
  296. package/docs/ko/dictionary/file.md +3 -1
  297. package/docs/ko/dictionary/nesting.md +47 -30
  298. package/docs/ko/formatters.md +133 -187
  299. package/docs/ko/intlayer_with_angular_21.md +9 -9
  300. package/docs/ko/intlayer_with_lynx+react.md +133 -39
  301. package/docs/ko/intlayer_with_nextjs_14.md +1 -28
  302. package/docs/ko/intlayer_with_nextjs_15.md +1 -33
  303. package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +40 -188
  304. package/docs/ko/intlayer_with_solid_start.md +1078 -0
  305. package/docs/ko/intlayer_with_vite+preact.md +57 -23
  306. package/docs/ko/intlayer_with_vite+vue.md +1 -3
  307. package/docs/ko/live-sync.md +4 -0
  308. package/docs/ko/packages/intlayer/getLocalizedUrl.md +26 -24
  309. package/docs/ko/packages/intlayer/getMultilingualUrls.md +4 -18
  310. package/docs/ko/packages/vite-intlayer/exports.md +15 -0
  311. package/docs/ko/packages/vite-intlayer/intlayer.md +121 -6
  312. package/docs/ko/packages/vite-intlayer/intlayerPrune.md +79 -6
  313. package/docs/ko/releases/v9.md +12 -0
  314. package/docs/ko/self_hosting.md +60 -49
  315. package/docs/nl/bundle_optimization.md +58 -25
  316. package/docs/nl/configuration.md +25 -8
  317. package/docs/nl/intlayer_with_angular_21.md +9 -9
  318. package/docs/pl/analytics.md +220 -0
  319. package/docs/pl/bundle_optimization.md +58 -25
  320. package/docs/pl/configuration.md +25 -8
  321. package/docs/pl/dictionary/nesting.md +47 -30
  322. package/docs/pl/formatters.md +208 -305
  323. package/docs/pl/intlayer_CMS.md +152 -0
  324. package/docs/pl/intlayer_with_angular_21.md +9 -9
  325. package/docs/pl/intlayer_with_nextjs_14.md +1 -26
  326. package/docs/pl/intlayer_with_solid_start.md +1078 -0
  327. package/docs/pl/live-sync.md +4 -0
  328. package/docs/pl/packages/intlayer/getMultilingualUrls.md +4 -18
  329. package/docs/pl/packages/react-intlayer/useDictionary.md +2 -19
  330. package/docs/pl/packages/vite-intlayer/exports.md +15 -0
  331. package/docs/pl/packages/vite-intlayer/intlayer.md +121 -6
  332. package/docs/pl/packages/vite-intlayer/intlayerPrune.md +77 -4
  333. package/docs/pl/releases/v9.md +0 -15
  334. package/docs/pl/self_hosting.md +60 -49
  335. package/docs/pt/analytics.md +222 -0
  336. package/docs/pt/bundle_optimization.md +58 -24
  337. package/docs/pt/configuration.md +25 -8
  338. package/docs/pt/dictionary/file.md +3 -1
  339. package/docs/pt/dictionary/nesting.md +47 -30
  340. package/docs/pt/formatters.md +112 -168
  341. package/docs/pt/intlayer_CMS.md +66 -15
  342. package/docs/pt/intlayer_with_angular_21.md +9 -9
  343. package/docs/pt/intlayer_with_astro_lit.md +26 -1
  344. package/docs/pt/intlayer_with_nextjs_14.md +1 -28
  345. package/docs/pt/intlayer_with_nextjs_15.md +1 -33
  346. package/docs/pt/intlayer_with_solid_start.md +1078 -0
  347. package/docs/pt/intlayer_with_vite+vue.md +1 -3
  348. package/docs/pt/live-sync.md +4 -0
  349. package/docs/pt/packages/intlayer/getLocalizedUrl.md +34 -26
  350. package/docs/pt/packages/intlayer/getMultilingualUrls.md +4 -18
  351. package/docs/pt/packages/vite-intlayer/exports.md +15 -0
  352. package/docs/pt/packages/vite-intlayer/intlayer.md +121 -6
  353. package/docs/pt/packages/vite-intlayer/intlayerPrune.md +78 -6
  354. package/docs/pt/releases/v9.md +0 -15
  355. package/docs/pt/self_hosting.md +60 -49
  356. package/docs/ru/analytics.md +222 -0
  357. package/docs/ru/autoFill.md +27 -8
  358. package/docs/ru/bundle_optimization.md +58 -25
  359. package/docs/ru/configuration.md +25 -8
  360. package/docs/ru/dictionary/file.md +3 -1
  361. package/docs/ru/dictionary/nesting.md +64 -205
  362. package/docs/ru/formatters.md +108 -128
  363. package/docs/ru/intlayer_with_angular_21.md +9 -9
  364. package/docs/ru/intlayer_with_nextjs_14.md +1 -28
  365. package/docs/ru/intlayer_with_nextjs_15.md +1 -33
  366. package/docs/ru/intlayer_with_solid_start.md +1078 -0
  367. package/docs/ru/intlayer_with_vite+vue.md +1 -3
  368. package/docs/ru/live-sync.md +4 -0
  369. package/docs/ru/packages/intlayer/getLocalizedUrl.md +34 -26
  370. package/docs/ru/packages/intlayer/getMultilingualUrls.md +4 -18
  371. package/docs/ru/packages/react-intlayer/useDictionary.md +4 -21
  372. package/docs/ru/packages/vite-intlayer/exports.md +15 -0
  373. package/docs/ru/packages/vite-intlayer/intlayer.md +121 -6
  374. package/docs/ru/packages/vite-intlayer/intlayerPrune.md +77 -4
  375. package/docs/ru/releases/v9.md +0 -15
  376. package/docs/ru/self_hosting.md +60 -49
  377. package/docs/tr/analytics.md +222 -0
  378. package/docs/tr/autoFill.md +28 -9
  379. package/docs/tr/bundle_optimization.md +58 -25
  380. package/docs/tr/configuration.md +25 -8
  381. package/docs/tr/dictionary/file.md +2 -0
  382. package/docs/tr/dictionary/nesting.md +47 -30
  383. package/docs/tr/formatters.md +144 -190
  384. package/docs/tr/intlayer_CMS.md +152 -0
  385. package/docs/tr/intlayer_with_angular_21.md +9 -9
  386. package/docs/tr/intlayer_with_nestjs.md +2 -12
  387. package/docs/tr/intlayer_with_nextjs_15.md +1 -33
  388. package/docs/tr/intlayer_with_solid_start.md +1078 -0
  389. package/docs/tr/intlayer_with_vite+vue.md +1 -3
  390. package/docs/tr/live-sync.md +4 -0
  391. package/docs/tr/packages/intlayer/getMultilingualUrls.md +4 -18
  392. package/docs/tr/packages/vite-intlayer/exports.md +15 -0
  393. package/docs/tr/packages/vite-intlayer/intlayer.md +121 -6
  394. package/docs/tr/packages/vite-intlayer/intlayerPrune.md +77 -4
  395. package/docs/tr/self_hosting.md +47 -50
  396. package/docs/uk/analytics.md +222 -0
  397. package/docs/uk/bundle_optimization.md +58 -25
  398. package/docs/uk/configuration.md +25 -8
  399. package/docs/uk/dictionary/nesting.md +47 -30
  400. package/docs/uk/formatters.md +128 -185
  401. package/docs/uk/intlayer_CMS.md +152 -0
  402. package/docs/uk/intlayer_with_angular_21.md +9 -9
  403. package/docs/uk/intlayer_with_nextjs_14.md +1 -26
  404. package/docs/uk/intlayer_with_solid_start.md +1078 -0
  405. package/docs/uk/live-sync.md +4 -0
  406. package/docs/uk/packages/react-intlayer/useDictionary.md +2 -19
  407. package/docs/uk/packages/vite-intlayer/exports.md +15 -0
  408. package/docs/uk/packages/vite-intlayer/intlayer.md +121 -6
  409. package/docs/uk/packages/vite-intlayer/intlayerPrune.md +77 -4
  410. package/docs/uk/releases/v9.md +0 -15
  411. package/docs/uk/self_hosting.md +60 -50
  412. package/docs/ur/bundle_optimization.md +58 -25
  413. package/docs/ur/configuration.md +25 -8
  414. package/docs/ur/intlayer_with_angular_21.md +9 -9
  415. package/docs/vi/analytics.md +222 -0
  416. package/docs/vi/bundle_optimization.md +58 -25
  417. package/docs/vi/configuration.md +24 -8
  418. package/docs/vi/dictionary/nesting.md +37 -184
  419. package/docs/vi/formatters.md +208 -309
  420. package/docs/vi/intlayer_CMS.md +164 -0
  421. package/docs/vi/intlayer_with_angular_21.md +9 -9
  422. package/docs/vi/intlayer_with_nextjs_14.md +0 -25
  423. package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +70 -63
  424. package/docs/vi/intlayer_with_solid_start.md +1078 -0
  425. package/docs/vi/live-sync.md +4 -0
  426. package/docs/vi/packages/intlayer/getMultilingualUrls.md +4 -18
  427. package/docs/vi/packages/react-intlayer/useIntlayer.md +2 -2
  428. package/docs/vi/packages/vite-intlayer/exports.md +15 -0
  429. package/docs/vi/packages/vite-intlayer/intlayer.md +121 -6
  430. package/docs/vi/packages/vite-intlayer/intlayerPrune.md +77 -4
  431. package/docs/vi/plugins/sync-json.md +6 -6
  432. package/docs/vi/releases/v9.md +12 -0
  433. package/docs/vi/self_hosting.md +61 -50
  434. package/docs/zh/CI_CD.md +4 -0
  435. package/docs/zh/analytics.md +222 -0
  436. package/docs/zh/autoFill.md +28 -9
  437. package/docs/zh/bundle_optimization.md +58 -25
  438. package/docs/zh/configuration.md +24 -8
  439. package/docs/zh/dictionary/file.md +2 -0
  440. package/docs/zh/dictionary/nesting.md +47 -30
  441. package/docs/zh/formatters.md +140 -188
  442. package/docs/zh/intlayer_CMS.md +164 -0
  443. package/docs/zh/intlayer_with_analog.md +193 -3
  444. package/docs/zh/intlayer_with_angular_19.md +272 -3
  445. package/docs/zh/intlayer_with_angular_21.md +7 -7
  446. package/docs/zh/intlayer_with_create_react_app.md +348 -26
  447. package/docs/zh/intlayer_with_lynx+react.md +263 -4
  448. package/docs/zh/intlayer_with_nextjs_14.md +1 -28
  449. package/docs/zh/intlayer_with_nextjs_15.md +1 -33
  450. package/docs/zh/intlayer_with_nextjs_no_locale_path.md +558 -1
  451. package/docs/zh/intlayer_with_nuxt.md +182 -7
  452. package/docs/zh/intlayer_with_react_router_v7.md +183 -25
  453. package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +306 -42
  454. package/docs/zh/intlayer_with_solid_start.md +1077 -0
  455. package/docs/zh/intlayer_with_storybook.md +260 -3
  456. package/docs/zh/intlayer_with_svelte_kit.md +428 -48
  457. package/docs/zh/intlayer_with_tanstack+solid.md +713 -13
  458. package/docs/zh/intlayer_with_tanstack.md +731 -20
  459. package/docs/zh/intlayer_with_vanilla.md +314 -4
  460. package/docs/zh/intlayer_with_vite+lit.md +465 -4
  461. package/docs/zh/intlayer_with_vite+preact.md +422 -116
  462. package/docs/zh/intlayer_with_vite+react.md +324 -45
  463. package/docs/zh/intlayer_with_vite+react_compiler.md +228 -13
  464. package/docs/zh/intlayer_with_vite+solid.md +462 -32
  465. package/docs/zh/intlayer_with_vite+vanilla.md +497 -4
  466. package/docs/zh/live-sync.md +4 -0
  467. package/docs/zh/mcp_server.md +3 -9
  468. package/docs/zh/packages/intlayer/getLocalizedUrl.md +26 -24
  469. package/docs/zh/packages/intlayer/getMultilingualUrls.md +4 -18
  470. package/docs/zh/packages/vite-intlayer/exports.md +29 -0
  471. package/docs/zh/packages/vite-intlayer/intlayer.md +121 -6
  472. package/docs/zh/packages/vite-intlayer/intlayerPrune.md +79 -6
  473. package/docs/zh/releases/v9.md +12 -0
  474. package/docs/zh/self_hosting.md +60 -50
  475. package/docs/zh-TW/bundle_optimization.md +58 -25
  476. package/docs/zh-TW/intlayer_with_angular_21.md +7 -7
  477. package/package.json +7 -7
  478. package/src/common.ts +39 -2
  479. package/src/generated/blog.entry.ts +66 -34
  480. package/src/generated/docs.entry.ts +273 -221
  481. package/src/generated/frequentQuestions.entry.ts +56 -24
  482. package/src/generated/legal.entry.ts +41 -9
@@ -92,7 +92,564 @@ Intlayer 不仅仅是一个 i18n 解决方案,还提供了一个**自托管的
92
92
 
93
93
  ---
94
94
 
95
- ## 在 Next.js 应用中设置 Intlayer 的逐步指南
95
+ ## 在 Next.js 应用中逐步设置 Intlayer 的指南
96
+
97
+ <Steps>
98
+
99
+ <Step number={1} title="安装依赖">
100
+
101
+ 使用 npm 安装必要的包:
102
+
103
+ ```bash packageManager="npm"
104
+ npx intlayer init --interactive
105
+ ```
106
+
107
+ ```bash packageManager="pnpm"
108
+ pnpm dlx intlayer@canary init --interactive
109
+ ```
110
+
111
+ ```bash packageManager="yarn"
112
+ yarn dlx intlayer@canary init --interactive
113
+ ```
114
+
115
+ ```bash packageManager="bun"
116
+ bunx intlayer@canary init --interactive
117
+ ```
118
+
119
+ > `--interactive` 标志是可选的。如果你是 AI agent,请使用 `intlayer-cli init`。
120
+
121
+ > 此命令将检测你的环境并安装所需的包。例如:
122
+
123
+ ```bash packageManager="npm"
124
+ npm install intlayer next-intlayer
125
+ ```
126
+
127
+ ```bash packageManager="pnpm"
128
+ pnpm add intlayer next-intlayer
129
+ ```
130
+
131
+ ```bash packageManager="yarn"
132
+ yarn add intlayer next-intlayer
133
+ ```
134
+
135
+ ```bash packageManager="bun"
136
+ bun add intlayer next-intlayer
137
+ ```
138
+
139
+ - **intlayer**
140
+
141
+ 核心包,提供国际化工具,用于配置管理、翻译、[内容声明](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/content_file.md)、转换以及 [CLI 命令](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/cli/index.md)。
142
+
143
+ - **next-intlayer**
144
+
145
+ 将 Intlayer 与 Next.js 集成的包。它为 Next.js 国际化提供上下文提供者和 hooks。此外,它还包括用于将 Intlayer 与 [Webpack](https://webpack.js.org/) 或 [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack) 集成的 Next.js 插件,以及用于检测用户首选语言、管理 cookies 和处理 URL 重定向的代理。
146
+
147
+ </Step>
148
+
149
+ <Step number={2} title="配置你的项目">
150
+
151
+ 以下是我们将创建的最终结构:
152
+
153
+ ```bash
154
+ .
155
+ ├── src
156
+ │ ├── app
157
+ │ │ ├── layout.tsx
158
+ │ │ ├── page.content.ts
159
+ │ │ └── page.tsx
160
+ │ ├── components
161
+ │ │ ├── clientComponentExample
162
+ │ │ │ ├── client-component-example.content.ts
163
+ │ │ │ └── ClientComponentExample.tsx
164
+ │ │ ├── localeSwitcher
165
+ │ │ │ ├── localeSwitcher.content.ts
166
+ │ │ │ └── LocaleSwitcher.tsx
167
+ │ │ └── serverComponentExample
168
+ │ │ ├── server-component-example.content.ts
169
+ │ │ └── ServerComponentExample.tsx
170
+ │ └── proxy.ts
171
+ ├── intlayer.config.ts
172
+ ├── next.config.ts
173
+ ├── package.json
174
+ └── tsconfig.json
175
+ ```
176
+
177
+ > 如果你不想要语言路由,intlayer 可以作为一个简单的提供者 / hook 使用。详见[此指南](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_nextjs_no_locale_path.md)。
178
+
179
+ 创建一个配置文件来配置你的应用程序的语言:
180
+
181
+ ```typescript fileName="intlayer.config.ts" codeFormat={["typescript", "esm", "commonjs"]}
182
+ import { Locales, type IntlayerConfig } from "intlayer";
183
+
184
+ const config: IntlayerConfig = {
185
+ internationalization: {
186
+ locales: [
187
+ Locales.ENGLISH,
188
+ Locales.FRENCH,
189
+ Locales.SPANISH,
190
+ // 你的其他语言
191
+ ],
192
+ defaultLocale: Locales.ENGLISH,
193
+ },
194
+ routing: {
195
+ mode: "search-params", // 或 `no-prefix` - 用于中间件检测
196
+ },
197
+ };
198
+
199
+ export default config;
200
+ ```
201
+
202
+ > 通过此配置文件,你可以设置本地化 URL、代理重定向、cookie 名称、内容声明的位置和扩展名、禁用 Intlayer 的控制台日志等。如需完整的可用参数列表,请参考[配置文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/configuration.md)。
203
+
204
+ </Step>
205
+
206
+ <Step number={3} title="在 Next.js 配置中集成 Intlayer">
207
+
208
+ 配置你的 Next.js 设置以使用 Intlayer:
209
+
210
+ ```typescript fileName="next.config.ts" codeFormat={["typescript", "esm", "commonjs"]}
211
+ import type { NextConfig } from "next";
212
+ import { withIntlayer } from "next-intlayer/server";
213
+
214
+ const nextConfig: NextConfig = {/* 配置选项在这里 */};
215
+
216
+ export default withIntlayer(nextConfig);
217
+ ```
218
+
219
+ > `withIntlayer()` Next.js 插件用于将 Intlayer 与 Next.js 集成。它确保构建内容声明文件,并在开发模式下监视它们。它在 [Webpack](https://webpack.js.org/) 或 [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack) 环境中定义 Intlayer 环境变量。此外,它提供别名以优化性能并确保与服务器组件的兼容性。
220
+
221
+ > `withIntlayer()` 函数是一个 promise 函数。它允许在构建开始之前准备 intlayer 字典。如果你想将其与其他插件一起使用,你可以等待它。例如:
222
+ >
223
+ > ```ts
224
+ > const nextConfig = await withIntlayer(nextConfig);
225
+ > const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
226
+ >
227
+ > export default nextConfigWithOtherPlugins;
228
+ > ```
229
+ >
230
+ > 如果你想同步使用它,可以使用 `withIntlayerSync()` 函数。例如:
231
+ >
232
+ > ```ts
233
+ > const nextConfig = withIntlayerSync(nextConfig);
234
+ > const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
235
+ >
236
+ > export default nextConfigWithOtherPlugins;
237
+ > ```
238
+
239
+ > Intlayer 根据命令行标志 `--webpack`、`--turbo` 或 `--turbopack`,以及你当前的 **Next.js 版本**,自动检测你的项目是否使用 **webpack** 或 **Turbopack**。
240
+ >
241
+ > 自 `next>=16` 起,如果你使用 **Rspack**,必须通过禁用 Turbopack 显式强制 Intlayer 使用 webpack 配置:
242
+ >
243
+ > ```ts
244
+ > withRspack(withIntlayer(nextConfig, { enableTurbopack: false }));
245
+ > ```
246
+
247
+ </Step>
248
+
249
+ <Step number={4} title="定义动态语言路由">
250
+
251
+ 从 `RootLayout` 中删除所有内容,然后用以下代码替换:
252
+
253
+ ```tsx {3} fileName="src/app/layout.tsx" codeFormat={["typescript", "esm"]}
254
+ import type { Metadata } from "next";
255
+ import type { ReactNode } from "react";
256
+ import "./globals.css";
257
+ import { IntlayerClientProvider, LocalPromiseParams } from "next-intlayer";
258
+ import { getHTMLTextDir, getIntlayer } from "intlayer";
259
+ import { getLocale } from "next-intlayer/server";
260
+ export { generateStaticParams } from "next-intlayer";
261
+
262
+ export const generateMetadata = async (): Promise<Metadata> => {
263
+ const locale = await getLocale();
264
+ const { title, description, keywords } = getIntlayer("metadata", locale);
265
+
266
+ return {
267
+ title,
268
+ description,
269
+ keywords,
270
+ };
271
+ };
272
+
273
+ const RootLayout = async ({
274
+ children,
275
+ }: Readonly<{
276
+ children: ReactNode;
277
+ }>) => {
278
+ const locale = await getLocale();
279
+
280
+ return (
281
+ <html lang={locale} dir={getHTMLTextDir(locale)}>
282
+ <IntlayerClientProvider defaultLocale={locale}>
283
+ <body>{children}</body>
284
+ </IntlayerClientProvider>
285
+ </html>
286
+ );
287
+ };
288
+
289
+ export default RootLayout;
290
+ ```
291
+
292
+ </Step>
293
+
294
+ <Step number={5} title="声明你的内容">
295
+
296
+ 创建和管理你的内容声明以存储翻译:
297
+
298
+ ```tsx fileName="src/app/metadata.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
299
+ import { t, type Dictionary } from "intlayer";
300
+ import { Metadata } from "next";
301
+
302
+ const metadataContent = {
303
+ key: "metadata",
304
+ content: {
305
+ title: t({
306
+ zh: "我的项目标题",
307
+ en: "My Project Title",
308
+ fr: "Le Titre de mon Projet",
309
+ es: "El Título de mi Proyecto",
310
+ }),
311
+
312
+ description: t({
313
+ zh: "发现我们为简化工作流程和提高生产力而设计的创新平台。",
314
+ en: "Discover our innovative platform designed to streamline your workflow and boost productivity.",
315
+ fr: "Découvrez notre plateforme innovante conçue pour simplifier votre flux de travail et booster votre productivité.",
316
+ es: "Descubra nuestra plataforma innovadora diseñada para simplificar su flujo de trabajo y aumentar su productividad.",
317
+ }),
318
+
319
+ keywords: t({
320
+ zh: ["创新", "生产力", "工作流程", "SaaS"],
321
+ en: ["innovation", "productivity", "workflow", "SaaS"],
322
+ fr: ["innovation", "productivité", "flux de travail", "SaaS"],
323
+ es: ["innovación", "productividad", "flujo de trabajo", "SaaS"],
324
+ }),
325
+ },
326
+ } as Dictionary<Metadata>;
327
+
328
+ export default metadataContent;
329
+ ```
330
+
331
+ ```json fileName="src/app/metadata.content.json" contentDeclarationFormat="json"
332
+ {
333
+ "key": "metadata",
334
+ "content": {
335
+ "title": {
336
+ "nodeType": "translation",
337
+ "translation": {
338
+ "zh": "我的项目标题",
339
+ "en": "My Project Title",
340
+ "fr": "Le Titre de mon Projet",
341
+ "es": "El Título de mi Proyecto"
342
+ }
343
+ },
344
+ "description": {
345
+ "nodeType": "translation",
346
+ "translation": {
347
+ "zh": "发现我们为简化工作流程和提高生产力而设计的创新平台。",
348
+ "en": "Discover our innovative platform designed to streamline your workflow and boost productivity.",
349
+ "fr": "Découvrez notre plateforme innovante conçue pour simplifier votre flux de travail et booster votre productivité.",
350
+ "es": "Descubra nuestra plataforma innovadora diseñada para simplificar su flujo de trabajo y aumentar su productividad."
351
+ }
352
+ },
353
+ "keywords": {
354
+ "nodeType": "translation",
355
+ "translation": {
356
+ "zh": ["创新", "生产力", "工作流程", "SaaS"],
357
+ "en": ["innovation", "productivity", "workflow", "SaaS"],
358
+ "fr": ["innovation", "productivité", "flux de travail", "SaaS"],
359
+ "es": ["innovación", "productividad", "flujo de trabajo", "SaaS"]
360
+ }
361
+ }
362
+ }
363
+ }
364
+ ```
365
+
366
+ ```tsx fileName="src/app/page.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
367
+ import { t, type Dictionary } from "intlayer";
368
+
369
+ const pageContent = {
370
+ key: "page",
371
+ content: {
372
+ getStarted: {
373
+ main: t({
374
+ zh: "通过编辑开始",
375
+ en: "Get started by editing",
376
+ fr: "Commencez par éditer",
377
+ es: "Comience por editar",
378
+ }),
379
+ pageLink: "src/app/page.tsx",
380
+ },
381
+ },
382
+ } satisfies Dictionary;
383
+
384
+ export default pageContent;
385
+ ```
386
+
387
+ ```json fileName="src/app/page.content.json" contentDeclarationFormat="json"
388
+ {
389
+ "$schema": "https://intlayer.org/schema.json",
390
+ "key": "page",
391
+ "content": {
392
+ "getStarted": {
393
+ "nodeType": "translation",
394
+ "translation": {
395
+ "zh": "通过编辑开始",
396
+ "en": "Get started by editing",
397
+ "fr": "Commencez par éditer",
398
+ "es": "Comience por editar"
399
+ }
400
+ },
401
+ "pageLink": "src/app/page.tsx"
402
+ }
403
+ }
404
+ ```
405
+
406
+ > 你的内容声明可以在应用程序的任何地方定义,只要它们包含在 `contentDir` 目录中(默认为 `./src`)且匹配内容声明文件扩展名(默认为 `.content.{json,ts,tsx,js,jsx,mjs,cjs,md,mdx,yaml,yml}`)。
407
+
408
+ > 更多详情,请参考[内容声明文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/content_file.md)。
409
+
410
+ </Step>
411
+
412
+ <Step number={6} title="在代码中使用内容">
413
+
414
+ 在整个应用程序中访问你的内容字典:
415
+
416
+ ```tsx fileName="src/app/page.tsx" codeFormat={["typescript", "esm"]}
417
+ import type { FC } from "react";
418
+ import { ClientComponentExample } from "@components/clientComponentExample/ClientComponentExample";
419
+ import { ServerComponentExample } from "@components/serverComponentExample/ServerComponentExample";
420
+ import {
421
+ IntlayerServerProvider,
422
+ useIntlayer,
423
+ getLocale,
424
+ } from "next-intlayer/server";
425
+ import { NextPage } from "next";
426
+ import { headers, cookies } from "next/headers";
427
+
428
+ const PageContent: FC = () => {
429
+ const content = useIntlayer("page");
430
+
431
+ return (
432
+ <>
433
+ <p>{content.getStarted.main}</p>
434
+ <code>{content.getStarted.pageLink}</code>
435
+ </>
436
+ );
437
+ };
438
+
439
+ const Page: NextPage = async () => {
440
+ const locale = await getLocale();
441
+
442
+ return (
443
+ <IntlayerServerProvider locale={locale}>
444
+ <PageContent />
445
+ <ServerComponentExample />
446
+ <ClientComponentExample />
447
+ </IntlayerServerProvider>
448
+ );
449
+ };
450
+
451
+ export default Page;
452
+ ```
453
+
454
+ - **`IntlayerClientProvider`** 用于向客户端组件提供语言设置。它可以放在任何父组件中,包括布局。但是,建议将其放在布局中,因为 Next.js 在页面中共享布局代码,这样更有效。通过在布局中使用 `IntlayerClientProvider`,你可以避免为每个页面重新初始化它,改进性能并在整个应用程序中维持一致的本地化上下文。
455
+ - **`IntlayerServerProvider`** 用于向服务器子组件提供语言设置。它不能在布局中设置。
456
+
457
+ > 布局和页面不能共享一个通用的服务器上下文,因为服务器上下文系统基于每个请求的数据存储(通过 [React's cache](https://react.dev/reference/react/cache) 机制),导致每个"上下文"为应用程序的不同段重新创建。在共享布局中放置提供者会破坏这种隔离,防止服务器上下文值正确传播到你的服务器组件。
458
+
459
+ ```tsx {4,7} fileName="src/components/clientComponentExample/ClientComponentExample.tsx" codeFormat={["typescript", "esm"]}
460
+ "use client";
461
+
462
+ import type { FC } from "react";
463
+ import { useIntlayer } from "next-intlayer";
464
+
465
+ export const ClientComponentExample: FC = () => {
466
+ const content = useIntlayer("client-component-example"); // 创建相关的内容声明
467
+
468
+ return (
469
+ <div>
470
+ <h2>{content.title}</h2>
471
+ <p>{content.content}</p>
472
+ </div>
473
+ );
474
+ };
475
+ ```
476
+
477
+ ```tsx {2} fileName="src/components/serverComponentExample/ServerComponentExample.tsx" codeFormat={["typescript", "esm"]}
478
+ import type { FC } from "react";
479
+ import { useIntlayer } from "next-intlayer/server";
480
+
481
+ export const ServerComponentExample: FC = () => {
482
+ const content = useIntlayer("server-component-example"); // 创建相关的内容声明
483
+
484
+ return (
485
+ <div>
486
+ <h2>{content.title}</h2>
487
+ <p>{content.content}</p>
488
+ </div>
489
+ );
490
+ };
491
+ ```
492
+
493
+ > 如果你想在 `string` 属性(如 `alt`、`title`、`href`、`aria-label` 等)中使用你的内容,你可以使用函数的值,如:
494
+
495
+ > ```html
496
+ > <img src="{content.image.src.value}" alt="{content.image.value}" />
497
+ > <img src="{content.image.src.toString()}" alt="{content.image.toString()}" />
498
+ > <img src="{String(content.image.src)}" alt="{String(content.image)}" />
499
+ > ```
500
+
501
+ > 要了解更多关于 `useIntlayer` hook 的信息,请参考[文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/packages/next-intlayer/useIntlayer.md)。
502
+
503
+ </Step>
504
+
505
+ <Step number={7} title="配置代理以进行语言检测" isOptional={true}>
506
+
507
+ 设置代理以检测用户的首选语言:
508
+
509
+ ```typescript fileName="src/proxy.ts" codeFormat={["typescript", "esm", "commonjs"]}
510
+ export { intlayerProxy as proxy } from "next-intlayer/proxy";
511
+
512
+ export const config = {
513
+ matcher:
514
+ "/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
515
+ };
516
+ ```
517
+
518
+ > `intlayerProxy` 用于检测用户的首选语言并根据[配置](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/configuration.md)中指定的内容将其重定向到适当的 URL。此外,它能够将用户的首选语言保存在 cookie 中。
519
+
520
+ > 自 Intlayer v9 起,此中间件遵守 `routing.enableProxy` 选项(默认为 `true`)。在你的配置中设置 `routing.enableProxy: false` 以将其转为通过模式,而不移除此文件。详见 [v9 发行说明](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/releases/v9.md)。
521
+
522
+ > 如果你需要将多个代理链接在一起(例如,`intlayerProxy` 与认证或自定义代理),Intlayer 现在提供一个称为 `multipleProxies` 的辅助函数。
523
+
524
+ ```ts
525
+ import { multipleProxies, intlayerProxy } from "next-intlayer/proxy";
526
+ import { customProxy } from "@utils/customProxy";
527
+
528
+ export const proxy = multipleProxies([intlayerProxy, customProxy]);
529
+ ```
530
+
531
+ </Step>
532
+
533
+ <Step number={8} title="改变内容的语言" isOptional={true}>
534
+
535
+ 要在 Next.js 中改变内容的语言,推荐的方式是使用 `Link` 组件将用户重定向到适当的本地化页面。`Link` 组件支持页面预获取,这有助于避免完整的页面重新加载。
536
+
537
+ ```tsx fileName="src/components/localeSwitcher/LocaleSwitcher.tsx" codeFormat={["typescript", "esm"]}
538
+ "use client";
539
+
540
+ import type { FC } from "react";
541
+ import { Locales, getHTMLTextDir, getLocaleName } from "intlayer";
542
+ import { useLocale } from "next-intlayer";
543
+
544
+ export const LocaleSwitcher: FC = () => {
545
+ const { locale, availableLocales, setLocale } = useLocale();
546
+
547
+ return (
548
+ <div>
549
+ <button popoverTarget="localePopover">{getLocaleName(locale)}</button>
550
+ <div id="localePopover" popover="auto">
551
+ {availableLocales.map((localeItem) => (
552
+ <button
553
+ key={localeItem}
554
+ aria-current={locale === localeItem ? "page" : undefined}
555
+ onClick={() => setLocale(localeItem)}
556
+ >
557
+ <span>
558
+ {/* 语言代码 - 例如 FR */}
559
+ {localeItem}
560
+ </span>
561
+ <span>
562
+ {/* 该语言用其自身语言表示 - 例如 Français */}
563
+ {getLocaleName(localeItem, locale)}
564
+ </span>
565
+ <span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
566
+ {/* 该语言用当前语言表示 - 例如当前语言设置为 Locales.SPANISH 时为 Francés */}
567
+ {getLocaleName(localeItem)}
568
+ </span>
569
+ <span dir="ltr" lang={Locales.ENGLISH}>
570
+ {/* 英语中的语言 - 例如 French */}
571
+ {getLocaleName(localeItem, Locales.ENGLISH)}
572
+ </span>
573
+ </button>
574
+ ))}
575
+ </div>
576
+ </div>
577
+ );
578
+ };
579
+ ```
580
+
581
+ > 另一种方式是使用 `useLocale` hook 提供的 `setLocale` 函数。此函数不允许预获取页面。详见 [`useLocale` hook 文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/packages/next-intlayer/useLocale.md)以了解更多详情。
582
+
583
+ > 文档参考:
584
+ >
585
+ > - [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/packages/next-intlayer/useLocale.md)
586
+ > - [`getLocaleName` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/packages/intlayer/getLocaleName.md)
587
+ > - [`getLocalizedUrl` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/packages/intlayer/getLocalizedUrl.md)
588
+ > - [`getHTMLTextDir` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/packages/intlayer/getHTMLTextDir.md)
589
+ > - [`hrefLang` 属性](https://developers.google.com/search/docs/specialty/international/localized-versions?hl=fr)
590
+ > - [`lang` 属性](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang)
591
+ > - [`dir` 属性](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir)
592
+ > - [`aria-current` 属性](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)
593
+
594
+ </Step>
595
+
596
+ <Step number={9} title="在 Server Actions 中获取当前语言" isOptional={true}>
597
+
598
+ 如果你需要在 Server Action 中使用活动语言(例如,本地化电子邮件或运行与语言相关的逻辑),请从 `next-intlayer/server` 调用 `getLocale`:
599
+
600
+ ```tsx fileName="src/app/actions/getLocale.ts" codeFormat="typescript"
601
+ "use server";
602
+
603
+ import { getLocale } from "next-intlayer/server";
604
+
605
+ export const myServerAction = async () => {
606
+ const locale = await getLocale();
607
+
608
+ // 使用语言做一些操作
609
+ };
610
+ ```
611
+
612
+ > `getLocale` 函数遵循级联策略来确定用户的语言:
613
+ >
614
+ > 1. 首先,它检查请求标头中的语言值,该值可能已由代理设置
615
+ > 2. 如果在标头中找不到语言,它会查找存储在 cookies 中的语言
616
+ > 3. 如果找不到 cookie,它会尝试检测用户浏览器设置中的首选语言
617
+ > 4. 作为最后的手段,它会回退到应用程序配置的默认语言
618
+ >
619
+ > 这确保根据可用的上下文选择最合适的语言。
620
+
621
+ </Step>
622
+
623
+ <Step number={10} title="优化你的 bundle 大小" isOptional={true}>
624
+
625
+ 在使用 `next-intlayer` 时,默认情况下字典被包含在每个页面的 bundle 中。要优化 bundle 大小,Intlayer 提供了一个可选的 SWC 插件,它可以智能地替换使用宏的 `useIntlayer` 调用。这确保字典仅被包含在实际使用它们的页面的 bundle 中。
626
+
627
+ 要启用此优化,请安装 `@intlayer/swc` 包。安装后,`next-intlayer` 将自动检测并使用该插件:
628
+
629
+ ```bash packageManager="npm"
630
+ npm install @intlayer/swc --save-dev
631
+ ```
632
+
633
+ ```bash packageManager="pnpm"
634
+ pnpm add @intlayer/swc --save-dev
635
+ ```
636
+
637
+ ```bash packageManager="yarn"
638
+ yarn add @intlayer/swc --save-dev
639
+ ```
640
+
641
+ ```bash packageManager="bun"
642
+ bun add @intlayer/swc --dev
643
+ ```
644
+
645
+ > 注意:此优化仅适用于 Next.js 13 及以上版本。
646
+
647
+ > 注意:此包默认未安装,因为 SWC 插件在 Next.js 中仍是实验性的。它可能会在未来发生变化。
648
+
649
+ > 注意:如果你将选项设置为 `importMode: 'dynamic'` 或 `importMode: 'fetch'`(在 `dictionary` 配置中),它将依赖于 Suspense,因此你需要将你的 `useIntlayer` 调用包装在 `Suspense` 边界中。这意味着你将不能在你的 Page / Layout 组件的顶层直接使用 `useIntlayer`。
650
+ > </Step>
651
+
652
+ </Steps>
96
653
 
97
654
  ### 第一步:安装依赖
98
655