@intlayer/docs 5.8.1-canary.0 → 6.0.0-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 (378) hide show
  1. package/blog/ar/rag_powered_documentation_assistant.md +282 -0
  2. package/blog/de/rag_powered_documentation_assistant.md +282 -0
  3. package/blog/en/rag_powered_documentation_assistant.md +289 -0
  4. package/blog/en-GB/rag_powered_documentation_assistant.md +284 -0
  5. package/blog/es/rag_powered_documentation_assistant.md +308 -0
  6. package/blog/fr/rag_powered_documentation_assistant.md +308 -0
  7. package/blog/hi/rag_powered_documentation_assistant.md +284 -0
  8. package/blog/it/rag_powered_documentation_assistant.md +284 -0
  9. package/blog/ja/rag_powered_documentation_assistant.md +284 -0
  10. package/blog/ko/rag_powered_documentation_assistant.md +283 -0
  11. package/blog/pt/rag_powered_documentation_assistant.md +284 -0
  12. package/blog/ru/rag_powered_documentation_assistant.md +284 -0
  13. package/blog/tr/index.md +69 -0
  14. package/blog/tr/internationalization_and_SEO.md +273 -0
  15. package/blog/tr/intlayer_with_i18next.md +162 -0
  16. package/blog/tr/intlayer_with_next-i18next.md +367 -0
  17. package/blog/tr/intlayer_with_next-intl.md +392 -0
  18. package/blog/tr/intlayer_with_react-i18next.md +346 -0
  19. package/blog/tr/intlayer_with_react-intl.md +345 -0
  20. package/blog/tr/list_i18n_technologies/CMS/drupal.md +143 -0
  21. package/blog/tr/list_i18n_technologies/CMS/wix.md +167 -0
  22. package/blog/tr/list_i18n_technologies/CMS/wordpress.md +188 -0
  23. package/blog/tr/list_i18n_technologies/frameworks/angular.md +125 -0
  24. package/blog/tr/list_i18n_technologies/frameworks/flutter.md +150 -0
  25. package/blog/tr/list_i18n_technologies/frameworks/react-native.md +217 -0
  26. package/blog/tr/list_i18n_technologies/frameworks/react.md +155 -0
  27. package/blog/tr/list_i18n_technologies/frameworks/svelte.md +129 -0
  28. package/blog/tr/list_i18n_technologies/frameworks/vue.md +130 -0
  29. package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +170 -0
  30. package/blog/tr/rag_powered_documentation_assistant.md +284 -0
  31. package/blog/tr/react-i18next_vs_react-intl_vs_intlayer.md +162 -0
  32. package/blog/tr/vue-i18n_vs_intlayer.md +276 -0
  33. package/blog/tr/what_is_internationalization.md +166 -0
  34. package/blog/zh/rag_powered_documentation_assistant.md +284 -0
  35. package/dist/cjs/generated/blog.entry.cjs +212 -0
  36. package/dist/cjs/generated/blog.entry.cjs.map +1 -1
  37. package/dist/cjs/generated/docs.entry.cjs +660 -132
  38. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  39. package/dist/cjs/generated/frequentQuestions.entry.cjs +84 -0
  40. package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
  41. package/dist/cjs/generated/legal.entry.cjs +6 -0
  42. package/dist/cjs/generated/legal.entry.cjs.map +1 -1
  43. package/dist/esm/generated/blog.entry.mjs +212 -0
  44. package/dist/esm/generated/blog.entry.mjs.map +1 -1
  45. package/dist/esm/generated/docs.entry.mjs +660 -132
  46. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  47. package/dist/esm/generated/frequentQuestions.entry.mjs +84 -0
  48. package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
  49. package/dist/esm/generated/legal.entry.mjs +6 -0
  50. package/dist/esm/generated/legal.entry.mjs.map +1 -1
  51. package/dist/types/generated/blog.entry.d.ts +1 -0
  52. package/dist/types/generated/blog.entry.d.ts.map +1 -1
  53. package/dist/types/generated/docs.entry.d.ts +5 -2
  54. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  55. package/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
  56. package/dist/types/generated/legal.entry.d.ts.map +1 -1
  57. package/docs/ar/autoFill.md +41 -40
  58. package/docs/ar/configuration.md +202 -199
  59. package/docs/ar/dictionary/content_file.md +1059 -0
  60. package/docs/ar/intlayer_CMS.md +4 -4
  61. package/docs/ar/intlayer_with_nestjs.md +271 -0
  62. package/docs/ar/intlayer_with_nextjs_page_router.md +1 -1
  63. package/docs/ar/intlayer_with_react_router_v7.md +533 -0
  64. package/docs/ar/intlayer_with_tanstack.md +465 -299
  65. package/docs/ar/intlayer_with_vite+preact.md +7 -7
  66. package/docs/ar/intlayer_with_vite+react.md +7 -7
  67. package/docs/ar/intlayer_with_vite+vue.md +9 -9
  68. package/docs/ar/packages/vite-intlayer/index.md +3 -3
  69. package/docs/ar/readme.md +261 -0
  70. package/docs/ar/testing.md +199 -0
  71. package/docs/de/autoFill.md +42 -19
  72. package/docs/de/configuration.md +155 -147
  73. package/docs/de/dictionary/content_file.md +1059 -0
  74. package/docs/de/intlayer_CMS.md +4 -5
  75. package/docs/de/intlayer_with_nestjs.md +270 -0
  76. package/docs/de/intlayer_with_nextjs_page_router.md +1 -1
  77. package/docs/de/intlayer_with_react_router_v7.md +537 -0
  78. package/docs/de/intlayer_with_tanstack.md +469 -302
  79. package/docs/de/intlayer_with_vite+preact.md +7 -7
  80. package/docs/de/intlayer_with_vite+react.md +7 -7
  81. package/docs/de/intlayer_with_vite+vue.md +9 -9
  82. package/docs/de/packages/vite-intlayer/index.md +3 -3
  83. package/docs/de/readme.md +261 -0
  84. package/docs/de/testing.md +200 -0
  85. package/docs/en/CI_CD.md +4 -6
  86. package/docs/en/autoFill.md +25 -5
  87. package/docs/en/configuration.md +45 -54
  88. package/docs/en/dictionary/content_file.md +1054 -0
  89. package/docs/en/intlayer_CMS.md +8 -7
  90. package/docs/en/intlayer_cli.md +112 -5
  91. package/docs/en/intlayer_with_nestjs.md +268 -0
  92. package/docs/en/intlayer_with_nextjs_page_router.md +1 -1
  93. package/docs/en/intlayer_with_react_router_v7.md +531 -0
  94. package/docs/en/intlayer_with_tanstack.md +463 -294
  95. package/docs/en/intlayer_with_vite+preact.md +8 -8
  96. package/docs/en/intlayer_with_vite+react.md +8 -8
  97. package/docs/en/intlayer_with_vite+vue.md +8 -8
  98. package/docs/en/packages/intlayer/getLocalizedUrl.md +102 -25
  99. package/docs/en/packages/vite-intlayer/index.md +3 -3
  100. package/docs/en/readme.md +261 -0
  101. package/docs/en/testing.md +200 -0
  102. package/docs/en-GB/autoFill.md +29 -6
  103. package/docs/en-GB/configuration.md +79 -71
  104. package/docs/en-GB/dictionary/content_file.md +1084 -0
  105. package/docs/en-GB/intlayer_CMS.md +4 -5
  106. package/docs/en-GB/intlayer_with_nestjs.md +268 -0
  107. package/docs/en-GB/intlayer_with_nextjs_page_router.md +1 -1
  108. package/docs/en-GB/intlayer_with_react_router_v7.md +533 -0
  109. package/docs/en-GB/intlayer_with_tanstack.md +466 -299
  110. package/docs/en-GB/intlayer_with_vite+preact.md +7 -7
  111. package/docs/en-GB/intlayer_with_vite+react.md +7 -7
  112. package/docs/en-GB/intlayer_with_vite+vue.md +9 -9
  113. package/docs/en-GB/packages/vite-intlayer/index.md +3 -3
  114. package/docs/en-GB/readme.md +261 -0
  115. package/docs/en-GB/testing.md +200 -0
  116. package/docs/es/autoFill.md +45 -23
  117. package/docs/es/configuration.md +171 -167
  118. package/docs/es/dictionary/content_file.md +1088 -0
  119. package/docs/es/intlayer_CMS.md +4 -5
  120. package/docs/es/intlayer_with_nestjs.md +268 -0
  121. package/docs/es/intlayer_with_nextjs_page_router.md +1 -1
  122. package/docs/es/intlayer_with_react_router_v7.md +533 -0
  123. package/docs/es/intlayer_with_tanstack.md +469 -280
  124. package/docs/es/intlayer_with_vite+preact.md +7 -7
  125. package/docs/es/intlayer_with_vite+react.md +7 -7
  126. package/docs/es/intlayer_with_vite+vue.md +9 -9
  127. package/docs/es/packages/vite-intlayer/index.md +3 -3
  128. package/docs/es/readme.md +261 -0
  129. package/docs/es/testing.md +200 -0
  130. package/docs/fr/autoFill.md +47 -24
  131. package/docs/fr/configuration.md +213 -198
  132. package/docs/fr/dictionary/content_file.md +1054 -0
  133. package/docs/fr/intlayer_CMS.md +4 -5
  134. package/docs/fr/intlayer_with_nestjs.md +268 -0
  135. package/docs/fr/intlayer_with_nextjs_page_router.md +1 -1
  136. package/docs/fr/intlayer_with_react_router_v7.md +549 -0
  137. package/docs/fr/intlayer_with_tanstack.md +465 -279
  138. package/docs/fr/intlayer_with_vite+preact.md +7 -7
  139. package/docs/fr/intlayer_with_vite+react.md +7 -7
  140. package/docs/fr/intlayer_with_vite+vue.md +9 -9
  141. package/docs/fr/packages/vite-intlayer/index.md +3 -3
  142. package/docs/fr/readme.md +261 -0
  143. package/docs/fr/testing.md +200 -0
  144. package/docs/hi/autoFill.md +47 -25
  145. package/docs/hi/configuration.md +194 -189
  146. package/docs/hi/dictionary/content_file.md +1056 -0
  147. package/docs/hi/intlayer_CMS.md +4 -5
  148. package/docs/hi/intlayer_with_nestjs.md +269 -0
  149. package/docs/hi/intlayer_with_nextjs_page_router.md +1 -1
  150. package/docs/hi/intlayer_with_react_router_v7.md +533 -0
  151. package/docs/hi/intlayer_with_tanstack.md +467 -282
  152. package/docs/hi/intlayer_with_vite+preact.md +7 -7
  153. package/docs/hi/intlayer_with_vite+react.md +7 -7
  154. package/docs/hi/intlayer_with_vite+vue.md +9 -9
  155. package/docs/hi/packages/vite-intlayer/index.md +3 -3
  156. package/docs/hi/readme.md +261 -0
  157. package/docs/hi/testing.md +200 -0
  158. package/docs/it/autoFill.md +46 -24
  159. package/docs/it/configuration.md +169 -161
  160. package/docs/it/dictionary/content_file.md +1061 -0
  161. package/docs/it/intlayer_CMS.md +4 -5
  162. package/docs/it/intlayer_with_nestjs.md +268 -0
  163. package/docs/it/intlayer_with_nextjs_page_router.md +1 -1
  164. package/docs/it/intlayer_with_react_router_v7.md +535 -0
  165. package/docs/it/intlayer_with_tanstack.md +467 -301
  166. package/docs/it/intlayer_with_vite+preact.md +7 -7
  167. package/docs/it/intlayer_with_vite+react.md +7 -7
  168. package/docs/it/intlayer_with_vite+vue.md +9 -9
  169. package/docs/it/packages/vite-intlayer/index.md +3 -3
  170. package/docs/it/readme.md +261 -0
  171. package/docs/it/testing.md +200 -0
  172. package/docs/ja/autoFill.md +45 -23
  173. package/docs/ja/configuration.md +243 -204
  174. package/docs/ja/dictionary/content_file.md +1064 -0
  175. package/docs/ja/intlayer_CMS.md +4 -5
  176. package/docs/ja/intlayer_with_nestjs.md +268 -0
  177. package/docs/ja/intlayer_with_nextjs_page_router.md +1 -1
  178. package/docs/ja/intlayer_with_react_router_v7.md +534 -0
  179. package/docs/ja/intlayer_with_tanstack.md +467 -303
  180. package/docs/ja/intlayer_with_vite+preact.md +7 -7
  181. package/docs/ja/intlayer_with_vite+react.md +7 -7
  182. package/docs/ja/intlayer_with_vite+vue.md +9 -9
  183. package/docs/ja/packages/vite-intlayer/index.md +3 -3
  184. package/docs/ja/readme.md +263 -0
  185. package/docs/ja/testing.md +200 -0
  186. package/docs/ko/autoFill.md +39 -16
  187. package/docs/ko/configuration.md +217 -197
  188. package/docs/ko/dictionary/content_file.md +1060 -0
  189. package/docs/ko/intlayer_CMS.md +4 -5
  190. package/docs/ko/intlayer_with_nestjs.md +268 -0
  191. package/docs/ko/intlayer_with_nextjs_page_router.md +1 -1
  192. package/docs/ko/intlayer_with_react_router_v7.md +540 -0
  193. package/docs/ko/intlayer_with_tanstack.md +466 -302
  194. package/docs/ko/intlayer_with_vite+preact.md +7 -7
  195. package/docs/ko/intlayer_with_vite+react.md +7 -7
  196. package/docs/ko/intlayer_with_vite+vue.md +9 -9
  197. package/docs/ko/packages/vite-intlayer/index.md +3 -3
  198. package/docs/ko/readme.md +261 -0
  199. package/docs/ko/testing.md +200 -0
  200. package/docs/pt/autoFill.md +39 -15
  201. package/docs/pt/configuration.md +165 -147
  202. package/docs/pt/dictionary/content_file.md +1062 -0
  203. package/docs/pt/intlayer_CMS.md +4 -5
  204. package/docs/pt/intlayer_with_nestjs.md +271 -0
  205. package/docs/pt/intlayer_with_nextjs_page_router.md +1 -1
  206. package/docs/pt/intlayer_with_react_router_v7.md +535 -0
  207. package/docs/pt/intlayer_with_tanstack.md +469 -300
  208. package/docs/pt/intlayer_with_vite+preact.md +7 -7
  209. package/docs/pt/intlayer_with_vite+react.md +7 -7
  210. package/docs/pt/intlayer_with_vite+vue.md +9 -9
  211. package/docs/pt/packages/vite-intlayer/index.md +3 -3
  212. package/docs/pt/readme.md +261 -0
  213. package/docs/pt/testing.md +200 -0
  214. package/docs/ru/autoFill.md +52 -30
  215. package/docs/ru/configuration.md +164 -117
  216. package/docs/ru/dictionary/content_file.md +1064 -0
  217. package/docs/ru/intlayer_CMS.md +4 -4
  218. package/docs/ru/intlayer_with_nestjs.md +270 -0
  219. package/docs/ru/intlayer_with_nextjs_page_router.md +1 -1
  220. package/docs/ru/intlayer_with_react_router_v7.md +534 -0
  221. package/docs/ru/intlayer_with_tanstack.md +470 -305
  222. package/docs/ru/intlayer_with_vite+preact.md +7 -7
  223. package/docs/ru/intlayer_with_vite+react.md +7 -7
  224. package/docs/ru/intlayer_with_vite+vue.md +9 -9
  225. package/docs/ru/packages/vite-intlayer/index.md +3 -3
  226. package/docs/ru/readme.md +261 -0
  227. package/docs/ru/testing.md +202 -0
  228. package/docs/tr/CI_CD.md +198 -0
  229. package/docs/tr/autoFill.md +201 -0
  230. package/docs/tr/configuration.md +585 -0
  231. package/docs/tr/dictionary/condition.md +243 -0
  232. package/docs/tr/dictionary/content_file.md +1055 -0
  233. package/docs/tr/dictionary/enumeration.md +251 -0
  234. package/docs/tr/dictionary/file.md +228 -0
  235. package/docs/tr/dictionary/function_fetching.md +218 -0
  236. package/docs/tr/dictionary/gender.md +279 -0
  237. package/docs/tr/dictionary/insertion.md +191 -0
  238. package/docs/tr/dictionary/markdown.md +385 -0
  239. package/docs/tr/dictionary/nesting.md +279 -0
  240. package/docs/tr/dictionary/translation.md +315 -0
  241. package/docs/tr/formatters.md +618 -0
  242. package/docs/tr/how_works_intlayer.md +254 -0
  243. package/docs/tr/index.md +168 -0
  244. package/docs/tr/interest_of_intlayer.md +288 -0
  245. package/docs/tr/intlayer_CMS.md +347 -0
  246. package/docs/tr/intlayer_cli.md +570 -0
  247. package/docs/tr/intlayer_visual_editor.md +269 -0
  248. package/docs/tr/intlayer_with_angular.md +694 -0
  249. package/docs/tr/intlayer_with_create_react_app.md +1218 -0
  250. package/docs/tr/intlayer_with_express.md +415 -0
  251. package/docs/tr/intlayer_with_lynx+react.md +511 -0
  252. package/docs/tr/intlayer_with_nestjs.md +268 -0
  253. package/docs/tr/intlayer_with_nextjs_14.md +1029 -0
  254. package/docs/tr/intlayer_with_nextjs_15.md +1506 -0
  255. package/docs/tr/intlayer_with_nextjs_page_router.md +1484 -0
  256. package/docs/tr/intlayer_with_nuxt.md +773 -0
  257. package/docs/tr/intlayer_with_react_native+expo.md +660 -0
  258. package/docs/tr/intlayer_with_react_router_v7.md +531 -0
  259. package/docs/tr/intlayer_with_tanstack.md +452 -0
  260. package/docs/tr/intlayer_with_vite+preact.md +1673 -0
  261. package/docs/tr/intlayer_with_vite+react.md +1632 -0
  262. package/docs/tr/intlayer_with_vite+solid.md +288 -0
  263. package/docs/tr/intlayer_with_vite+svelte.md +288 -0
  264. package/docs/tr/intlayer_with_vite+vue.md +1042 -0
  265. package/docs/tr/introduction.md +209 -0
  266. package/docs/tr/locale_mapper.md +244 -0
  267. package/docs/tr/mcp_server.md +207 -0
  268. package/docs/tr/packages/@intlayer/api/index.md +58 -0
  269. package/docs/tr/packages/@intlayer/chokidar/index.md +57 -0
  270. package/docs/tr/packages/@intlayer/cli/index.md +47 -0
  271. package/docs/tr/packages/@intlayer/config/index.md +142 -0
  272. package/docs/tr/packages/@intlayer/core/index.md +51 -0
  273. package/docs/tr/packages/@intlayer/design-system/index.md +47 -0
  274. package/docs/tr/packages/@intlayer/dictionary-entry/index.md +53 -0
  275. package/docs/tr/packages/@intlayer/editor/index.md +47 -0
  276. package/docs/tr/packages/@intlayer/editor-react/index.md +47 -0
  277. package/docs/tr/packages/@intlayer/webpack/index.md +61 -0
  278. package/docs/tr/packages/angular-intlayer/index.md +59 -0
  279. package/docs/tr/packages/express-intlayer/index.md +258 -0
  280. package/docs/tr/packages/express-intlayer/t.md +459 -0
  281. package/docs/tr/packages/intlayer/getConfiguration.md +151 -0
  282. package/docs/tr/packages/intlayer/getEnumeration.md +165 -0
  283. package/docs/tr/packages/intlayer/getHTMLTextDir.md +127 -0
  284. package/docs/tr/packages/intlayer/getLocaleLang.md +87 -0
  285. package/docs/tr/packages/intlayer/getLocaleName.md +124 -0
  286. package/docs/tr/packages/intlayer/getLocalizedUrl.md +324 -0
  287. package/docs/tr/packages/intlayer/getMultilingualUrls.md +225 -0
  288. package/docs/tr/packages/intlayer/getPathWithoutLocale.md +81 -0
  289. package/docs/tr/packages/intlayer/getTranslation.md +196 -0
  290. package/docs/tr/packages/intlayer/getTranslationContent.md +195 -0
  291. package/docs/tr/packages/intlayer/index.md +505 -0
  292. package/docs/tr/packages/intlayer-cli/index.md +71 -0
  293. package/docs/tr/packages/intlayer-editor/index.md +139 -0
  294. package/docs/tr/packages/lynx-intlayer/index.md +85 -0
  295. package/docs/tr/packages/next-intlayer/index.md +154 -0
  296. package/docs/tr/packages/next-intlayer/t.md +354 -0
  297. package/docs/tr/packages/next-intlayer/useDictionary.md +270 -0
  298. package/docs/tr/packages/next-intlayer/useIntlayer.md +265 -0
  299. package/docs/tr/packages/next-intlayer/useLocale.md +133 -0
  300. package/docs/tr/packages/nuxt-intlayer/index.md +59 -0
  301. package/docs/tr/packages/preact-intlayer/index.md +55 -0
  302. package/docs/tr/packages/react-intlayer/index.md +148 -0
  303. package/docs/tr/packages/react-intlayer/t.md +304 -0
  304. package/docs/tr/packages/react-intlayer/useDictionary.md +554 -0
  305. package/docs/tr/packages/react-intlayer/useI18n.md +478 -0
  306. package/docs/tr/packages/react-intlayer/useIntlayer.md +253 -0
  307. package/docs/tr/packages/react-intlayer/useLocale.md +212 -0
  308. package/docs/tr/packages/react-native-intlayer/index.md +85 -0
  309. package/docs/tr/packages/react-scripts-intlayer/index.md +82 -0
  310. package/docs/tr/packages/solid-intlayer/index.md +56 -0
  311. package/docs/tr/packages/svelte-intlayer/index.md +55 -0
  312. package/docs/tr/packages/vite-intlayer/index.md +82 -0
  313. package/docs/tr/packages/vue-intlayer/index.md +59 -0
  314. package/docs/tr/per_locale_file.md +321 -0
  315. package/docs/tr/readme.md +261 -0
  316. package/docs/tr/roadmap.md +338 -0
  317. package/docs/tr/testing.md +200 -0
  318. package/docs/tr/vs_code_extension.md +154 -0
  319. package/docs/zh/autoFill.md +40 -18
  320. package/docs/zh/configuration.md +245 -226
  321. package/docs/zh/dictionary/content_file.md +1064 -0
  322. package/docs/zh/intlayer_CMS.md +4 -5
  323. package/docs/zh/intlayer_with_nestjs.md +268 -0
  324. package/docs/zh/intlayer_with_nextjs_page_router.md +1 -1
  325. package/docs/zh/intlayer_with_react_router_v7.md +535 -0
  326. package/docs/zh/intlayer_with_tanstack.md +468 -278
  327. package/docs/zh/intlayer_with_vite+preact.md +7 -7
  328. package/docs/zh/intlayer_with_vite+react.md +7 -7
  329. package/docs/zh/intlayer_with_vite+vue.md +7 -7
  330. package/docs/zh/packages/vite-intlayer/index.md +3 -3
  331. package/docs/zh/readme.md +261 -0
  332. package/docs/zh/testing.md +198 -0
  333. package/frequent_questions/tr/SSR_Next_no_[locale].md +105 -0
  334. package/frequent_questions/tr/array_as_content_declaration.md +72 -0
  335. package/frequent_questions/tr/build_dictionaries.md +59 -0
  336. package/frequent_questions/tr/build_error_CI_CD.md +75 -0
  337. package/frequent_questions/tr/customized_locale_list.md +65 -0
  338. package/frequent_questions/tr/domain_routing.md +114 -0
  339. package/frequent_questions/tr/esbuild_error.md +30 -0
  340. package/frequent_questions/tr/get_locale_cookie.md +142 -0
  341. package/frequent_questions/tr/intlayer_command_undefined.md +156 -0
  342. package/frequent_questions/tr/locale_incorect_in_url.md +74 -0
  343. package/frequent_questions/tr/static_rendering.md +45 -0
  344. package/frequent_questions/tr/translated_path_url.md +56 -0
  345. package/frequent_questions/tr/unknown_command.md +98 -0
  346. package/legal/tr/privacy_notice.md +83 -0
  347. package/legal/tr/terms_of_service.md +55 -0
  348. package/package.json +13 -13
  349. package/src/generated/blog.entry.ts +212 -0
  350. package/src/generated/docs.entry.ts +663 -135
  351. package/src/generated/frequentQuestions.entry.ts +85 -1
  352. package/src/generated/legal.entry.ts +7 -1
  353. package/docs/ar/dictionary/content_extention_customization.md +0 -100
  354. package/docs/ar/dictionary/get_started.md +0 -527
  355. package/docs/de/dictionary/content_extention_customization.md +0 -100
  356. package/docs/de/dictionary/get_started.md +0 -531
  357. package/docs/en/dictionary/content_extention_customization.md +0 -102
  358. package/docs/en/dictionary/get_started.md +0 -529
  359. package/docs/en-GB/dictionary/content_extention_customization.md +0 -100
  360. package/docs/en-GB/dictionary/get_started.md +0 -591
  361. package/docs/es/dictionary/content_extention_customization.md +0 -100
  362. package/docs/es/dictionary/get_started.md +0 -527
  363. package/docs/fr/dictionary/content_extention_customization.md +0 -100
  364. package/docs/fr/dictionary/get_started.md +0 -527
  365. package/docs/hi/dictionary/content_extention_customization.md +0 -100
  366. package/docs/hi/dictionary/get_started.md +0 -527
  367. package/docs/it/dictionary/content_extention_customization.md +0 -113
  368. package/docs/it/dictionary/get_started.md +0 -573
  369. package/docs/ja/dictionary/content_extention_customization.md +0 -113
  370. package/docs/ja/dictionary/get_started.md +0 -576
  371. package/docs/ko/dictionary/content_extention_customization.md +0 -100
  372. package/docs/ko/dictionary/get_started.md +0 -530
  373. package/docs/pt/dictionary/content_extention_customization.md +0 -100
  374. package/docs/pt/dictionary/get_started.md +0 -532
  375. package/docs/ru/dictionary/content_extention_customization.md +0 -100
  376. package/docs/ru/dictionary/get_started.md +0 -575
  377. package/docs/zh/dictionary/content_extention_customization.md +0 -117
  378. package/docs/zh/dictionary/get_started.md +0 -533
@@ -0,0 +1,1064 @@
1
+ ---
2
+ createdAt: 2025-02-07
3
+ updatedAt: 2025-09-20
4
+ title: 内容文件
5
+ description: 学习如何自定义内容声明文件的扩展。按照本指南高效地在项目中实现条件。
6
+ keywords:
7
+ - 内容文件
8
+ - 文档
9
+ - Intlayer
10
+ slugs:
11
+ - doc
12
+ - concept
13
+ - content
14
+ ---
15
+
16
+ # 内容文件
17
+
18
+ <iframe title="i18n,Markdown,JSON……一站式管理解决方案 | Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/1VHgSY_j9_I?autoplay=0&amp;origin=http://intlayer.org&amp;controls=0&amp;rel=1"/>
19
+
20
+ ## 什么是内容文件?
21
+
22
+ Intlayer 中的内容文件是包含字典定义的文件。
23
+ 这些文件声明了您的应用程序的文本内容、翻译和资源。
24
+ 内容文件由 Intlayer 处理以生成字典。
25
+
26
+ 字典将是您的应用程序通过 `useIntlayer` 钩子导入的最终结果。
27
+
28
+ ### 关键概念
29
+
30
+ #### 字典
31
+
32
+ 字典是按键组织的结构化内容集合。每个字典包含:
33
+
34
+ - **键**:字典的唯一标识符
35
+ - **内容**:实际的内容值(文本、数字、对象等)
36
+ - **元数据**:附加信息,如标题、描述、标签等
37
+
38
+ #### 内容文件
39
+
40
+ 内容文件示例:
41
+
42
+ ```tsx fileName="src/example.content.tsx" contentDeclarationFormat="typescript"
43
+ import { type ReactNode } from "react";
44
+ import {
45
+ t,
46
+ enu,
47
+ cond,
48
+ nest,
49
+ md,
50
+ insert,
51
+ file,
52
+ type Dictionary,
53
+ } from "intlayer";
54
+
55
+ interface Content {
56
+ imbricatedContent: {
57
+ imbricatedContent2: {
58
+ stringContent: string; // 字符串内容
59
+ numberContent: number; // 数字内容
60
+ booleanContent: boolean; // 布尔内容
61
+ javaScriptContent: string; // JavaScript 内容
62
+ };
63
+ };
64
+ multilingualContent: string; // 多语言内容
65
+ quantityContent: string; // 数量内容
66
+ conditionalContent: string; // 条件内容
67
+ markdownContent: never; // Markdown 内容
68
+ externalContent: string; // 外部内容
69
+ insertionContent: string; // 插入内容
70
+ nestedContent: string; // 嵌套内容
71
+ fileContent: string; // 文件内容
72
+ jsxContent: ReactNode; // JSX 内容
73
+ }
74
+
75
+ export default {
76
+ key: "page",
77
+ content: {
78
+ imbricatedContent: {
79
+ imbricatedContent2: {
80
+ stringContent: "Hello World",
81
+ numberContent: 123,
82
+ booleanContent: true,
83
+ javaScriptContent: `${process.env.NODE_ENV}`, // JavaScript 内容
84
+ },
85
+ },
86
+ multilingualContent: t({
87
+ zh: "中文内容",
88
+ en: "English content",
89
+ "en-GB": "English content (UK)",
90
+ fr: "French content",
91
+ es: "Spanish content",
92
+ }), // 多语言内容
93
+ quantityContent: enu({
94
+ "<-1": "少于负一辆车",
95
+ "-1": "负一辆车",
96
+ "0": "没有车",
97
+ "1": "一辆车",
98
+ ">5": "几辆车",
99
+ ">19": "许多车",
100
+ }), // 数量内容
101
+ conditionalContent: cond({
102
+ true: "验证已启用",
103
+ false: "验证已禁用",
104
+ }), // 条件内容
105
+ insertionContent: insert("你好 {{name}}!"), // 插入内容
106
+ nestedContent: nest(
107
+ "navbar", // 要嵌套的字典键
108
+ "login.button" // [可选] 要嵌套的内容路径
109
+ ), // 嵌套内容
110
+ fileContent: file("./path/to/file.txt"), // 文件内容
111
+ externalContent: fetch("https://example.com").then((res) => res.json()), // 外部内容
112
+ markdownContent: md("# Markdown 示例"), // Markdown 内容
113
+
114
+ /*
115
+ * 仅在使用 `react-intlayer` 或 `next-intlayer` 时可用
116
+ */
117
+ jsxContent: <h1>我的标题</h1>, // JSX 内容
118
+ },
119
+ } satisfies Dictionary<Content>; // [可选] Dictionary 是泛型,允许您加强字典的格式化
120
+ ```
121
+
122
+ ```javascript fileName="src/example.content.mjx" contentDeclarationFormat="esm"
123
+ import { t, enu, cond, nest, md, insert, file } from "intlayer";
124
+
125
+ /** @type {import('intlayer').Dictionary} */
126
+ export default {
127
+ key: "page",
128
+ content: {
129
+ imbricatedContent: {
130
+ imbricatedContent2: {
131
+ stringContent: "Hello World",
132
+ numberContent: 123,
133
+ booleanContent: true,
134
+ javaScriptContent: `${process.env.NODE_ENV}`,
135
+ },
136
+ imbricatedArray: [1, 2, 3],
137
+ },
138
+ multilingualContent: t({
139
+ en: "English content",
140
+ "en-GB": "English content (UK)",
141
+ fr: "French content",
142
+ es: "Spanish content",
143
+ }),
144
+ quantityContent: enu({
145
+ "<-1": "少于负一辆车",
146
+ "-1": "负一辆车",
147
+ "0": "没有车",
148
+ "1": "一辆车",
149
+ ">5": "几辆车",
150
+ ">19": "很多车",
151
+ }),
152
+ conditionalContent: cond({
153
+ true: "验证已启用",
154
+ false: "验证已禁用",
155
+ }),
156
+ insertionContent: insert("你好 {{name}}!"),
157
+ nestedContent: nest(
158
+ "navbar", // 要嵌套的字典键
159
+ "login.button" // [可选] 要嵌套的内容路径
160
+ ),
161
+ markdownContent: md("# Markdown 示例"),
162
+ fileContent: file("./path/to/file.txt"),
163
+ externalContent: fetch("https://example.com").then((res) => res.json())
164
+
165
+ // 仅在使用 `react-intlayer` 或 `next-intlayer` 时可用
166
+ jsxContent: <h1>我的标题</h1>,
167
+ },
168
+ };
169
+ ```
170
+
171
+ ```javascript fileName="src/example.content.cjx" contentDeclarationFormat="commonjs"
172
+ const { t, enu, cond, nest, md, insert, file } = require("intlayer");
173
+
174
+ /** @type {import('intlayer').Dictionary} */
175
+ module.exports = {
176
+ key: "page",
177
+ content: {
178
+ imbricatedContent: {
179
+ imbricatedContent2: {
180
+ stringContent: "Hello World",
181
+ numberContent: 123,
182
+ booleanContent: true,
183
+ javaScriptContent: `${process.env.NODE_ENV}`,
184
+ },
185
+ imbricatedArray: [1, 2, 3],
186
+ },
187
+ multilingualContent: t({
188
+ zh: "中文内容",
189
+ en: "English content",
190
+ "en-GB": "English content (UK)",
191
+ fr: "French content",
192
+ es: "Spanish content",
193
+ }),
194
+ quantityContent: enu({
195
+ "<-1": "少于负一辆车",
196
+ "-1": "负一辆车",
197
+ "0": "没有车",
198
+ "1": "一辆车",
199
+ ">5": "一些车",
200
+ ">19": "许多车",
201
+ }),
202
+ conditionalContent: cond({
203
+ true: "验证已启用",
204
+ false: "验证已禁用",
205
+ }),
206
+ insertionContent: insert("你好 {{name}}!"),
207
+ nestedContent: nest(
208
+ "navbar", // 要嵌套的字典键
209
+ "login.button" // [可选] 要嵌套的内容路径
210
+ ),
211
+ markdownContent: md("# Markdown 示例"),
212
+ fileContent: file("./path/to/file.txt"),
213
+ externalContent: fetch("https://example.com").then((res) => res.json())
214
+
215
+ // 仅在使用 `react-intlayer` 或 `next-intlayer` 时可用
216
+ jsxContent: <h1>我的标题</h1>,
217
+ },
218
+ };
219
+ ```
220
+
221
+ ```json5 fileName="src/example.content.json" contentDeclarationFormat="json"
222
+ {
223
+ "$schema": "https://intlayer.org/schema.json",
224
+ "key": "page",
225
+ "content": {
226
+ "imbricatedContent": {
227
+ "imbricatedContent2": {
228
+ "stringContent": "你好,世界",
229
+ "numberContent": 123,
230
+ "booleanContent": true,
231
+ },
232
+ "imbricatedArray": [1, 2, 3],
233
+ },
234
+ "multilingualContent": {
235
+ "nodeType": "translation",
236
+ "translation": {
237
+ "en": "English content",
238
+ "en-GB": "English content (UK)",
239
+ "fr": "French content",
240
+ "es": "Spanish content",
241
+ },
242
+ },
243
+ "quantityContent": {
244
+ "nodeType": "enumeration",
245
+ "enumeration": {
246
+ "0": "没有汽车",
247
+ "1": "一辆汽车",
248
+ "<-1": "少于负一辆汽车",
249
+ "-1": "负一辆汽车",
250
+ ">5": "一些汽车",
251
+ ">19": "许多汽车",
252
+ },
253
+ },
254
+ "conditionalContent": {
255
+ "nodeType": "condition",
256
+ "condition": {
257
+ "true": "验证已启用",
258
+ "false": "验证已禁用",
259
+ },
260
+ },
261
+ "insertionContent": {
262
+ "nodeType": "insertion",
263
+ "insertion": "你好 {{name}}!",
264
+ },
265
+ "nestedContent": {
266
+ "nodeType": "nested",
267
+ "nested": { "dictionaryKey": "app" },
268
+ },
269
+ "markdownContent": {
270
+ "nodeType": "markdown",
271
+ "markdown": "# Markdown 示例",
272
+ },
273
+ "fileContent": {
274
+ "nodeType": "file",
275
+ "file": "./path/to/file.txt",
276
+ },
277
+ "jsxContent": {
278
+ "type": "h1",
279
+ "key": null,
280
+ "ref": null,
281
+ "props": {
282
+ "children": ["我的标题"],
283
+ },
284
+ },
285
+ },
286
+ }
287
+ ```
288
+
289
+ #### 内容节点
290
+
291
+ 内容节点是字典内容的构建块。它们可以是:
292
+
293
+ - **原始值**:字符串、数字、布尔值、null、undefined
294
+ - **类型化节点**:特殊内容类型,如翻译、条件、Markdown 等
295
+ - **函数**:可在运行时计算的动态内容 [参见函数获取](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/function_fetching.md)
296
+ - **嵌套内容**:对其他字典的引用
297
+
298
+ #### 内容类型
299
+
300
+ Intlayer 通过类型化节点支持多种内容类型:
301
+
302
+ - **翻译内容**:具有特定语言环境值的多语言文本 [参见 翻译内容](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/translation_content.md)
303
+ - **条件内容**:基于布尔表达式的条件内容 [参见 条件内容](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/condition_content.md)
304
+ - **枚举内容**:基于枚举值变化的内容 [参见 枚举内容](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/enumeration_content.md)
305
+ - **插入内容**:可以插入到其他内容中的内容 [参见 插入内容](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/insertion_content.md)
306
+ - **Markdown 内容**:以 Markdown 格式的富文本内容 [参见 Markdown 内容](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/markdown_content.md)
307
+ - **嵌套内容**:对其他字典的引用 [参见 嵌套内容](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/nested_content.md)
308
+ - **性别内容**:基于性别变化的内容 [参见 性别内容](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/gender_content.md)
309
+ - **文件内容**:对外部文件的引用 [参见 文件内容](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/file_content.md)
310
+
311
+ ## 字典结构
312
+
313
+ Intlayer 中的字典由 `Dictionary` 类型定义,包含多个控制其行为的属性:
314
+
315
+ ### 必需属性
316
+
317
+ #### `key`(字符串)
318
+
319
+ 字典的标识符。如果多个字典具有相同的 key,Intlayer 会自动合并它们。
320
+
321
+ > 使用 kebab-case 命名规范(例如,`"about-page-meta"`)。
322
+
323
+ #### Content(字符串 | 数字 | 布尔值 | 对象 | 数组 | 函数)
324
+
325
+ `content` 属性包含实际的字典数据,支持:
326
+
327
+ - **原始值**:字符串、数字、布尔值、null、undefined
328
+ - **类型化节点**:使用 Intlayer 辅助函数的特殊内容类型
329
+ - **嵌套对象**:复杂的数据结构
330
+ - **数组**:内容集合
331
+ - **函数**:动态内容计算
332
+
333
+ ### 可选属性
334
+
335
+ #### `title`(字符串)
336
+
337
+ 字典的人类可读标题,有助于在编辑器和内容管理系统中识别字典。当管理大量字典或使用内容管理界面时,这一点尤其有用。
338
+
339
+ **示例:**
340
+
341
+ ```typescript
342
+ {
343
+ key: "about-page-meta",
344
+ title: "关于页面元数据",
345
+ content: { /* ... */ }
346
+ }
347
+ ```
348
+
349
+ #### `description`(字符串)
350
+
351
+ 详细描述字典的用途、使用指南及任何特殊注意事项。此描述也用作 AI 驱动的翻译生成的上下文,有助于保持翻译质量和一致性。
352
+
353
+ **示例:**
354
+
355
+ ```typescript
356
+ {
357
+ key: "about-page-meta",
358
+ description: [
359
+ "该字典管理关于页面的元数据",
360
+ "考虑SEO的最佳实践:",
361
+ "- 标题应在50到60个字符之间",
362
+ "- 描述应在150到160个字符之间",
363
+ ].join('\n'),
364
+ content: { /* ... */ }
365
+ }
366
+ ```
367
+
368
+ #### `tags` (string[])
369
+
370
+ 用于对字典进行分类和组织的字符串数组。标签提供了额外的上下文信息,可用于在编辑器和内容管理系统中进行过滤、搜索或组织字典。
371
+
372
+ **示例:**
373
+
374
+ ```typescript
375
+ {
376
+ key: "about-page-meta",
377
+ tags: ["metadata", "about-page", "seo"],
378
+ content: { /* ... */ }
379
+ }
380
+ ```
381
+
382
+ #### `locale` (LocalesValues)
383
+
384
+ 将字典转换为按语言区域划分的字典,其中内容中声明的每个字段将自动转换为翻译节点。当设置此属性时:
385
+
386
+ - 该字典被视为单一语言环境字典
387
+ - 每个字段都会成为该特定语言环境的翻译节点
388
+ - 使用此属性时,内容中不应使用翻译节点(`t()`)
389
+ - 如果缺失,该字典将被视为多语言字典
390
+
391
+ > 更多信息请参见 [Intlayer 中的按语言环境内容声明](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/per_locale_file.md)。
392
+
393
+ **示例:**
394
+
395
+ ```json
396
+ // 按语言环境字典
397
+ {
398
+ "key": "about-page",
399
+ "locale": "en",
400
+ "content": {
401
+ "title": "关于我们", // 这将成为 'en' 的翻译节点
402
+ "description": "了解更多关于我们公司的信息"
403
+ }
404
+ }
405
+ ```
406
+
407
+ #### `autoFill` (AutoFill)
408
+
409
+ 自动从外部来源自动填充字典内容的说明。此功能可以在 `intlayer.config.ts` 中全局配置,也可以针对每个字典单独配置。支持多种格式:
410
+
411
+ - **`true`**:为所有语言启用自动填充
412
+ - **`string`**:单个文件路径或带变量的模板路径
413
+ - **`object`**:按语言的文件路径配置
414
+
415
+ **示例:**
416
+
417
+ ```json
418
+ // 为所有语言启用
419
+ {
420
+ "autoFill": true
421
+ }
422
+ // 单个文件
423
+ {
424
+ "autoFill": "./translations/aboutPage.content.json"
425
+ }
426
+ // 带变量的模板
427
+ {
428
+ "autoFill": "/messages/{{locale}}/{{key}}/{{fileName}}.content.json"
429
+ }
430
+ // 细粒度的按语言配置
431
+ {
432
+ "autoFill": {
433
+ "en": "./translations/en/aboutPage.content.json",
434
+ "fr": "./translations/fr/aboutPage.content.json",
435
+ "es": "./translations/es/aboutPage.content.json"
436
+ }
437
+ }
438
+ ```
439
+
440
+ **可用变量:**
441
+
442
+ - `{{locale}}` – 语言代码(例如 `fr`,`es`)
443
+ - `{{fileName}}` – 文件名(例如 `example`)
444
+ - `{{key}}` – 词典键(例如 `example`)
445
+
446
+ > 更多信息请参见 [Intlayer 中的自动填充配置](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/autoFill.md)。
447
+
448
+ ##### `priority`(数字)
449
+
450
+ 表示词典在冲突解决中的优先级。当多个词典包含相同键时,优先级数字最高的词典将覆盖其他词典。这对于管理内容层级和覆盖非常有用。
451
+
452
+ **示例:**
453
+
454
+ ```typescript
455
+ // 基础词典
456
+ {
457
+ key: "welcome-message",
458
+ priority: 1,
459
+ content: { message: "欢迎!" }
460
+ }
461
+
462
+ // 覆盖词典
463
+ {
464
+ key: "welcome-message",
465
+ priority: 10,
466
+ content: { message: "欢迎使用我们的高级服务!" }
467
+ }
468
+ // 这将覆盖基础字典
469
+ ```
470
+
471
+ ### CMS 属性
472
+
473
+ ##### `version`(字符串)
474
+
475
+ 远程字典的版本标识符。帮助跟踪当前使用的字典版本,尤其在使用远程内容管理系统时非常有用。
476
+
477
+ ##### `live`(布尔值)
478
+
479
+ 对于远程字典,指示字典是否应在运行时实时获取。启用时:
480
+
481
+ - 需要在 `intlayer.config.ts` 中将 `importMode` 设置为 "live"
482
+ - 需要有一个实时服务器在运行
483
+ - 字典将在运行时通过实时同步 API 获取
484
+ - 如果启用实时但获取失败,则回退到动态值
485
+ - 如果未启用实时,字典将在构建时转换以获得最佳性能
486
+
487
+ ### 系统属性(自动生成)
488
+
489
+ 这些属性由 Intlayer 自动生成,不应手动修改:
490
+
491
+ ##### `$schema`(字符串)
492
+
493
+ 用于验证字典结构的 JSON 模式。由 Intlayer 自动添加,以确保字典的完整性。
494
+
495
+ ##### `id`(字符串)
496
+
497
+ 对于远程字典,这是远程服务器中字典的唯一标识符。用于获取和管理远程内容。
498
+
499
+ ##### `localId`(LocalDictionaryId)
500
+
501
+ 本地字典的唯一标识符。由 Intlayer 自动生成,用于帮助识别字典并确定其是本地还是远程,以及其位置。
502
+
503
+ ##### `localIds`(LocalDictionaryId[])
504
+
505
+ 对于合并的字典,此数组包含所有被合并字典的 ID。对于追踪合并内容的来源非常有用。
506
+
507
+ ##### `filePath` (string)
508
+
509
+ 本地字典的文件路径,指示该字典是从哪个 `.content` 文件生成的。便于调试和源头追踪。
510
+
511
+ ##### `versions` (string[])
512
+
513
+ 对于远程字典,此数组包含字典的所有可用版本。帮助跟踪可用的版本。
514
+
515
+ ##### `autoFilled` (true)
516
+
517
+ 指示字典是否已从外部来源自动填充。在发生冲突时,基础字典将覆盖自动填充的字典。
518
+
519
+ ##### `location` ('distant' | 'locale')
520
+
521
+ 指示字典的位置:
522
+
523
+ - `'locale'`:本地字典(来自内容文件)
524
+ - `'distant'`:远程字典(来自外部来源)
525
+
526
+ ## 内容节点类型
527
+
528
+ Intlayer 提供了几种扩展基本原始值的专用内容节点类型:
529
+
530
+ ### 翻译内容 (`t`)
531
+
532
+ 根据语言环境变化的多语言内容:
533
+
534
+ ```typescript
535
+ import { t } from "intlayer";
536
+
537
+ // TypeScript/JavaScript
538
+ multilingualContent: t({
539
+ en: "Welcome to our website",
540
+ fr: "Bienvenue sur notre site web",
541
+ es: "Bienvenido a nuestro sitio web",
542
+ });
543
+ ```
544
+
545
+ ### 条件内容 (`cond`)
546
+
547
+ 基于布尔条件变化的内容:
548
+
549
+ ```typescript
550
+ import { cond } from "intlayer";
551
+
552
+ conditionalContent: cond({
553
+ true: "User is logged in",
554
+ false: "Please log in to continue",
555
+ });
556
+ ```
557
+
558
+ ### 枚举内容 (`enu`)
559
+
560
+ 基于枚举值变化的内容:
561
+
562
+ ```typescript
563
+ import { enu } from "intlayer";
564
+
565
+ statusContent: enu({
566
+ pending: "您的请求正在处理中",
567
+ approved: "您的请求已被批准",
568
+ rejected: "您的请求已被拒绝",
569
+ });
570
+ ```
571
+
572
+ ### 插入内容 (`insert`)
573
+
574
+ 可以插入到其他内容中的内容:
575
+
576
+ ```typescript
577
+ import { insert } from "intlayer";
578
+
579
+ insertionContent: insert("这段文本可以插入到任何地方");
580
+ ```
581
+
582
+ ### 嵌套内容 (`nest`)
583
+
584
+ 引用其他字典:
585
+
586
+ ```typescript
587
+ import { nest } from "intlayer";
588
+
589
+ nestedContent: nest("about-page");
590
+ ```
591
+
592
+ ### Markdown 内容 (`md`)
593
+
594
+ Markdown 格式的富文本内容:
595
+
596
+ ```typescript
597
+ import { md } from "intlayer";
598
+
599
+ markdownContent: md(
600
+ "# 欢迎\n\n这是带有[链接](https://example.com)的**加粗**文本"
601
+ );
602
+ ```
603
+
604
+ ### 性别内容 (`gender`)
605
+
606
+ 根据性别变化的内容:
607
+
608
+ ```typescript
609
+ import { gender } from "intlayer";
610
+
611
+ genderContent: gender({
612
+ male: "他是一名开发者",
613
+ female: "她是一名开发者",
614
+ other: "他们是一名开发者",
615
+ });
616
+ ```
617
+
618
+ ### 文件内容 (`file`)
619
+
620
+ 引用外部文件:
621
+
622
+ ```typescript
623
+ import { file } from "intlayer";
624
+
625
+ fileContent: file("./path/to/content.txt");
626
+ ```
627
+
628
+ ## 创建内容文件
629
+
630
+ ### 基本内容文件结构
631
+
632
+ 内容文件导出一个满足 `Dictionary` 类型的默认对象:
633
+
634
+ ```typescript
635
+ // example.content.ts
636
+ import { t, cond, nest, md, insert, file } from "intlayer";
637
+
638
+ export default {
639
+ key: "welcome-page",
640
+ title: "欢迎页面内容",
641
+ description: "主欢迎页面的内容,包括主视觉区域和功能",
642
+ tags: ["页面", "欢迎", "主页"],
643
+ content: {
644
+ hero: {
645
+ title: t({
646
+ zh: "欢迎来到我们的平台",
647
+ en: "Welcome to Our Platform",
648
+ fr: "Bienvenue sur Notre Plateforme",
649
+ es: "Bienvenido a Nuestra Plataforma",
650
+ }),
651
+ subtitle: t({
652
+ zh: "轻松构建惊人的应用程序",
653
+ en: "Build amazing applications with ease",
654
+ fr: "Construisez des applications incroyables avec facilité",
655
+ es: "Construye aplicaciones increíbles con facilidad",
656
+ }),
657
+ cta: cond({
658
+ true: t({
659
+ zh: "开始使用",
660
+ en: "Get Started",
661
+ fr: "Commencer",
662
+ es: "Comenzar",
663
+ }),
664
+ false: t({
665
+ zh: "注册",
666
+ en: "Sign Up",
667
+ fr: "S'inscrire",
668
+ es: "Registrarse",
669
+ }),
670
+ }),
671
+ },
672
+ features: [
673
+ {
674
+ title: t({
675
+ zh: "易于使用",
676
+ en: "Easy to Use",
677
+ fr: "Facile à Utiliser",
678
+ es: "Fácil de Usar",
679
+ }),
680
+ description: t({
681
+ zh: "适合所有技能水平的直观界面",
682
+ en: "Intuitive interface for all skill levels",
683
+ fr: "Interface intuitive pour tous les niveaux",
684
+ es: "Interfaz intuitiva para todos los niveles",
685
+ }),
686
+ },
687
+ ],
688
+ documentation: nest("documentation"),
689
+ readme: file("./README.md"),
690
+ },
691
+ } satisfies Dictionary;
692
+ ```
693
+
694
+ ### JSON 内容文件
695
+
696
+ 您也可以创建 JSON 格式的内容文件:
697
+
698
+ ```json
699
+ {
700
+ "key": "welcome-page",
701
+ "title": "欢迎页面内容",
702
+ "description": "主欢迎页面的内容",
703
+ "tags": ["页面", "欢迎"],
704
+ "content": {
705
+ "hero": {
706
+ "title": {
707
+ "nodeType": "translation",
708
+ "translation": {
709
+ "en": "欢迎来到我们的平台",
710
+ "fr": "Bienvenue sur Notre Plateforme"
711
+ }
712
+ },
713
+ "subtitle": {
714
+ "nodeType": "translation",
715
+ "translation": {
716
+ "en": "轻松构建惊人的应用程序",
717
+ "fr": "Construisez des applications incroyables avec facilité"
718
+ }
719
+ }
720
+ }
721
+ }
722
+ }
723
+ ```
724
+
725
+ ### 每语言内容文件
726
+
727
+ 对于每语言字典,指定 `locale` 属性:
728
+
729
+ ```typescript
730
+ // welcome-page.en.content.ts
731
+ export default {
732
+ key: "welcome-page",
733
+ locale: "en",
734
+ content: {
735
+ hero: {
736
+ title: "欢迎来到我们的平台",
737
+ subtitle: "轻松构建惊人的应用程序",
738
+ },
739
+ },
740
+ } satisfies Dictionary;
741
+ ```
742
+
743
+ ```typescript
744
+ // welcome-page.fr.content.ts
745
+ export default {
746
+ key: "welcome-page",
747
+ locale: "fr",
748
+ content: {
749
+ hero: {
750
+ title: "欢迎使用我们的平台",
751
+ subtitle: "轻松构建惊人的应用程序",
752
+ },
753
+ },
754
+ } satisfies Dictionary;
755
+ ```
756
+
757
+ ## 内容文件扩展名
758
+
759
+ Intlayer 允许您自定义内容声明文件的扩展名。此自定义功能为管理大型项目提供了灵活性,并有助于避免与其他模块的冲突。
760
+
761
+ ### 默认扩展名
762
+
763
+ 默认情况下,Intlayer 会监视所有具有以下扩展名的文件作为内容声明:
764
+
765
+ - `.content.json`
766
+ - `.content.ts`
767
+ - `.content.tsx`
768
+ - `.content.js`
769
+ - `.content.jsx`
770
+ - `.content.mjs`
771
+ - `.content.mjx`
772
+ - `.content.cjs`
773
+ - `.content.cjx`
774
+
775
+ 这些默认的扩展名适用于大多数应用程序。然而,当您有特定需求时,可以定义自定义扩展名,以简化构建过程并减少与其他组件冲突的风险。
776
+
777
+ > 要自定义 Intlayer 用于识别内容声明文件的文件扩展名,您可以在 Intlayer 配置文件中指定它们。这种方法对于大型项目非常有用,因为限制监视过程的范围可以提升构建性能。
778
+
779
+ ## 高级概念
780
+
781
+ ### 字典合并
782
+
783
+ 当多个字典具有相同的键时,Intlayer 会自动合并它们。合并行为取决于多个因素:
784
+
785
+ - **优先级**:具有更高 `priority` 值的字典会覆盖优先级较低的字典
786
+ - **自动填充与基础**:基础字典会覆盖自动填充的字典
787
+ - **位置**:本地字典会覆盖远程字典(当优先级相同时)
788
+
789
+ ### 类型安全
790
+
791
+ Intlayer 为内容文件提供完整的 TypeScript 支持:
792
+
793
+ ```typescript
794
+ // 定义你的内容类型
795
+ interface WelcomePageContent {
796
+ hero: {
797
+ title: string;
798
+ subtitle: string;
799
+ cta: string;
800
+ };
801
+ features: Array<{
802
+ title: string;
803
+ description: string;
804
+ }>;
805
+ }
806
+
807
+ // 在字典中使用它
808
+ export default {
809
+ key: "welcome-page",
810
+ content: {
811
+ // TypeScript 将提供自动补全和类型检查
812
+ hero: {
813
+ title: "欢迎",
814
+ subtitle: "构建惊人的应用",
815
+ cta: "开始使用",
816
+ },
817
+ },
818
+ } satisfies Dictionary<WelcomePageContent>;
819
+ ```
820
+
821
+ ### 节点嵌套
822
+
823
+ 你可以毫无问题地将函数嵌套到其他函数中。
824
+
825
+ 示例:
826
+
827
+ ```javascript fileName="src/example.content.tsx" contentDeclarationFormat="typescript"
828
+ import { t, enu, cond, nest, md, type Dictionary } from "intlayer";
829
+
830
+ const getName = async () => "John Doe";
831
+
832
+ export default {
833
+ key: "page",
834
+ content: {
835
+ // `getIntlayer('page','en').hiMessage` 返回 `['Hi', ' ', 'John Doe']`
836
+ hiMessage: [
837
+ t({
838
+ en: "Hi",
839
+ fr: "Salut",
840
+ es: "Hola",
841
+ }),
842
+ " ",
843
+ getName(),
844
+ ],
845
+ // 复合内容,嵌套条件、枚举和多语言内容
846
+ // `getIntlayer('page','en').advancedContent(true)(10)` 返回 'Multiple items found'
847
+ advancedContent: cond({
848
+ true: enu({
849
+ "0": t({
850
+ en: "No items found",
851
+ fr: "Aucun article trouvé",
852
+ es: "No se encontraron artículos",
853
+ }),
854
+ "1": t({
855
+ en: "One item found",
856
+ fr: "Un article trouvé",
857
+ es: "Se encontró un artículo",
858
+ }),
859
+ ">1": t({
860
+ en: "Multiple items found",
861
+ fr: "Plusieurs articles trouvés",
862
+ es: "Se encontraron múltiples artículos",
863
+ }),
864
+ }),
865
+ false: t({
866
+ en: "No valid data available",
867
+ fr: "Aucune donnée valide disponible",
868
+ es: "No hay datos válidos disponibles",
869
+ }),
870
+ }),
871
+ },
872
+ } satisfies Dictionary;
873
+ ```
874
+
875
+ ```javascript fileName="src/example.content.mjx" contentDeclarationFormat="esm"
876
+ import { t, enu, cond, nest, md } from "intlayer";
877
+
878
+ const getName = async () => "John Doe";
879
+
880
+ /** @type {import('intlayer').Dictionary} */
881
+ export default {
882
+ key: "page",
883
+ content: {
884
+ // `getIntlayer('page','en').hiMessage` 返回 `['Hi', ' ', 'John Doe']`
885
+ hiMessage: [
886
+ t({
887
+ en: "Hi",
888
+ fr: "Salut",
889
+ es: "Hola",
890
+ }),
891
+ " ",
892
+ getName(),
893
+ ],
894
+ // 复合内容,嵌套条件、枚举和多语言内容
895
+ // `getIntlayer('page','en').advancedContent(true)(10)` 返回 'Multiple items found'
896
+ advancedContent: cond({
897
+ true: enu({
898
+ "0": t({
899
+ en: "No items found",
900
+ fr: "Aucun article trouvé",
901
+ es: "No se encontraron artículos",
902
+ }),
903
+ "1": t({
904
+ en: "One item found",
905
+ fr: "Un article trouvé",
906
+ es: "Se encontró un artículo",
907
+ }),
908
+ ">1": t({
909
+ en: "Multiple items found",
910
+ fr: "Plusieurs articles trouvés",
911
+ es: "Se encontraron múltiples artículos",
912
+ }),
913
+ }),
914
+ false: t({
915
+ en: "No valid data available",
916
+ fr: "Aucune donnée valide disponible",
917
+ es: "No hay datos válidos disponibles",
918
+ }),
919
+ }),
920
+ },
921
+ };
922
+ ```
923
+
924
+ ```javascript fileName="src/example.content.cjx" contentDeclarationFormat="commonjs"
925
+ const { t, enu, cond, nest, md } = require("intlayer");
926
+
927
+ const getName = async () => "John Doe";
928
+
929
+ /** @type {import('intlayer').Dictionary} */
930
+ module.exports = {
931
+ key: "page",
932
+ content: {
933
+ // `getIntlayer('page','en').hiMessage` 返回 `['Hi', ' ', 'John Doe']`
934
+ hiMessage: [
935
+ t({
936
+ en: "Hi",
937
+ fr: "Salut",
938
+ es: "Hola",
939
+ }),
940
+ " ",
941
+ getName(),
942
+ ],
943
+ // 复合内容,结合条件、枚举和多语言内容
944
+ // `getIntlayer('page','en').advancedContent(true)(10)` 返回 'Multiple items found'
945
+ advancedContent: cond({
946
+ true: enu({
947
+ "0": t({
948
+ en: "No items found",
949
+ fr: "Aucun article trouvé",
950
+ es: "No se encontraron artículos",
951
+ }),
952
+ "1": t({
953
+ en: "One item found",
954
+ fr: "Un article trouvé",
955
+ es: "Se encontró un artículo",
956
+ }),
957
+ ">1": t({
958
+ en: "Multiple items found",
959
+ fr: "Plusieurs articles trouvés",
960
+ es: "Se encontraron múltiples artículos",
961
+ }),
962
+ }),
963
+ false: t({
964
+ en: "No valid data available",
965
+ fr: "Aucune donnée valide disponible",
966
+ es: "No hay datos válidos disponibles",
967
+ }),
968
+ }),
969
+ },
970
+ };
971
+ ```
972
+
973
+ ```json5 fileName="src/example.content.json" contentDeclarationFormat="json"
974
+ {
975
+ "$schema": "https://intlayer.org/schema.json",
976
+ "key": "page",
977
+ "content": {
978
+ "hiMessage": {
979
+ "nodeType": "composite",
980
+ "composite": [
981
+ {
982
+ "nodeType": "translation",
983
+ "translation": {
984
+ en: "Hi", // 英文问候语
985
+ fr: "Salut",
986
+ es: "Hola",
987
+ },
988
+ },
989
+ " ",
990
+ "John Doe",
991
+ ],
992
+ },
993
+ "advancedContent": {
994
+ "nodeType": "condition",
995
+ "condition": {
996
+ "true": {
997
+ "nodeType": "enumeration",
998
+ "enumeration": {
999
+ "0": {
1000
+ "nodeType": "translation",
1001
+ "translation": {
1002
+ "en": "No items found",
1003
+ "fr": "Aucun article trouvé",
1004
+ "es": "No se encontraron artículos",
1005
+ "zh": "未找到任何项目",
1006
+ },
1007
+ },
1008
+ "1": {
1009
+ "nodeType": "translation",
1010
+ "translation": {
1011
+ "en": "One item found",
1012
+ "fr": "Un article trouvé",
1013
+ "es": "Se encontró un artículo",
1014
+ "zh": "找到一个项目",
1015
+ },
1016
+ },
1017
+ ">1": {
1018
+ "nodeType": "translation",
1019
+ "translation": {
1020
+ "en": "Multiple items found",
1021
+ "fr": "Plusieurs articles trouvés",
1022
+ "es": "Se encontraron múltiples artículos",
1023
+ "zh": "找到多个项目",
1024
+ },
1025
+ },
1026
+ },
1027
+ },
1028
+ "false": {
1029
+ "nodeType": "translation",
1030
+ "translation": {
1031
+ "en": "无有效数据可用",
1032
+ "fr": "Aucune donnée valide disponible",
1033
+ "es": "No hay datos válidos disponibles",
1034
+ },
1035
+ },
1036
+ },
1037
+ },
1038
+ },
1039
+ }
1040
+ ```
1041
+
1042
+ ### 最佳实践
1043
+
1044
+ 1. **命名规范**:
1045
+ - 对字典键使用kebab-case(例如 `"about-page-meta"`)
1046
+ - 将相关内容归类到相同的键前缀下
1047
+
1048
+ 2. **内容组织**:
1049
+ - 将相关内容保存在同一个字典中
1050
+ - 使用嵌套对象来组织复杂的内容结构
1051
+ - 利用标签进行分类
1052
+ - 使用 `autoFill` 自动填充缺失的翻译
1053
+
1054
+ 3. **性能**:
1055
+ - 调整内容配置以限制监视文件的范围
1056
+ - 仅在需要实时更新时使用实时字典(例如 A/B 测试等)
1057
+ - 确保启用构建转换插件(`@intlayer/swc` 或 `@intlayer/babel`)以在构建时优化字典
1058
+
1059
+ ## 文档历史
1060
+
1061
+ | 版本 | 日期 | 变更说明 |
1062
+ | ------ | ---------- | ------------ |
1063
+ | 6.0.0 | 2025-09-20 | 添加字段文档 |
1064
+ | 5.5.10 | 2025-06-29 | 初始化历史 |