@intlayer/docs 9.5.5 → 9.5.6

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 (447) hide show
  1. package/README.md +0 -1
  2. package/blog/ar/transform_existing_vite_react_app_using_compiler.md +4 -2
  3. package/blog/de/transform_existing_vite_react_app_using_compiler.md +4 -2
  4. package/blog/en/transform_existing_vite_react_app_using_compiler.md +4 -2
  5. package/blog/en-GB/transform_existing_vite_react_app_using_compiler.md +4 -2
  6. package/blog/es/transform_existing_vite_react_app_using_compiler.md +4 -2
  7. package/blog/fr/transform_existing_vite_react_app_using_compiler.md +4 -2
  8. package/blog/hi/transform_existing_vite_react_app_using_compiler.md +4 -2
  9. package/blog/id/transform_existing_vite_react_app_using_compiler.md +4 -2
  10. package/blog/it/transform_existing_vite_react_app_using_compiler.md +4 -2
  11. package/blog/ja/transform_existing_vite_react_app_using_compiler.md +4 -2
  12. package/blog/ko/transform_existing_vite_react_app_using_compiler.md +4 -2
  13. package/blog/pl/transform_existing_vite_react_app_using_compiler.md +4 -2
  14. package/blog/pt/transform_existing_vite_react_app_using_compiler.md +4 -2
  15. package/blog/ru/transform_existing_vite_react_app_using_compiler.md +4 -2
  16. package/blog/tr/transform_existing_vite_react_app_using_compiler.md +4 -2
  17. package/blog/uk/transform_existing_vite_react_app_using_compiler.md +4 -2
  18. package/blog/vi/transform_existing_vite_react_app_using_compiler.md +4 -2
  19. package/blog/zh/transform_existing_vite_react_app_using_compiler.md +4 -2
  20. package/docs/ar/intlayer_with_astro.md +19 -32
  21. package/docs/ar/intlayer_with_astro_lit.md +32 -36
  22. package/docs/ar/intlayer_with_astro_preact.md +32 -36
  23. package/docs/ar/intlayer_with_astro_react.md +32 -36
  24. package/docs/ar/intlayer_with_astro_solid.md +32 -36
  25. package/docs/ar/intlayer_with_astro_svelte.md +32 -36
  26. package/docs/ar/intlayer_with_astro_vue.md +32 -36
  27. package/docs/ar/intlayer_with_react_router_v7.md +12 -1
  28. package/docs/ar/intlayer_with_solid_start.md +14 -7
  29. package/docs/ar/intlayer_with_svelte_kit.md +12 -1
  30. package/docs/ar/intlayer_with_tanstack+solid.md +13 -2
  31. package/docs/ar/intlayer_with_tanstack.md +13 -6
  32. package/docs/ar/intlayer_with_vite+lit.md +75 -3
  33. package/docs/ar/intlayer_with_vite+preact.md +27 -19
  34. package/docs/ar/intlayer_with_vite+react.md +27 -19
  35. package/docs/ar/intlayer_with_vite+solid.md +27 -19
  36. package/docs/ar/intlayer_with_vite+svelte.md +27 -19
  37. package/docs/ar/intlayer_with_vite+vanilla.md +16 -3
  38. package/docs/ar/intlayer_with_vite+vue.md +27 -19
  39. package/docs/ar/introduction.md +0 -1
  40. package/docs/ar/readme.md +0 -1
  41. package/docs/ar/releases/v8.md +1 -5
  42. package/docs/bn/intlayer_with_vite+lit.md +75 -3
  43. package/docs/bn/intlayer_with_vite+vanilla.md +16 -3
  44. package/docs/bn/introduction.md +0 -1
  45. package/docs/cs/intlayer_with_vite+lit.md +75 -3
  46. package/docs/cs/intlayer_with_vite+vanilla.md +16 -3
  47. package/docs/cs/introduction.md +0 -1
  48. package/docs/de/intlayer_with_astro.md +12 -25
  49. package/docs/de/intlayer_with_astro_lit.md +23 -27
  50. package/docs/de/intlayer_with_astro_preact.md +23 -27
  51. package/docs/de/intlayer_with_astro_react.md +23 -27
  52. package/docs/de/intlayer_with_astro_solid.md +23 -27
  53. package/docs/de/intlayer_with_astro_svelte.md +23 -27
  54. package/docs/de/intlayer_with_astro_vue.md +23 -27
  55. package/docs/de/intlayer_with_react_router_v7.md +12 -1
  56. package/docs/de/intlayer_with_solid_start.md +14 -7
  57. package/docs/de/intlayer_with_svelte_kit.md +12 -1
  58. package/docs/de/intlayer_with_tanstack+solid.md +13 -2
  59. package/docs/de/intlayer_with_tanstack.md +13 -6
  60. package/docs/de/intlayer_with_vite+lit.md +75 -3
  61. package/docs/de/intlayer_with_vite+preact.md +16 -3
  62. package/docs/de/intlayer_with_vite+react.md +16 -3
  63. package/docs/de/intlayer_with_vite+solid.md +16 -3
  64. package/docs/de/intlayer_with_vite+svelte.md +16 -3
  65. package/docs/de/intlayer_with_vite+vanilla.md +16 -3
  66. package/docs/de/intlayer_with_vite+vue.md +16 -3
  67. package/docs/de/introduction.md +0 -1
  68. package/docs/de/readme.md +0 -1
  69. package/docs/de/releases/v8.md +1 -5
  70. package/docs/en/intlayer_with_astro.md +5 -20
  71. package/docs/en/intlayer_with_astro_lit.md +22 -26
  72. package/docs/en/intlayer_with_astro_preact.md +22 -26
  73. package/docs/en/intlayer_with_astro_react.md +22 -26
  74. package/docs/en/intlayer_with_astro_solid.md +22 -26
  75. package/docs/en/intlayer_with_astro_svelte.md +22 -26
  76. package/docs/en/intlayer_with_astro_vanilla.md +20 -13
  77. package/docs/en/intlayer_with_astro_vue.md +22 -26
  78. package/docs/en/intlayer_with_react_router_v7.md +12 -1
  79. package/docs/en/intlayer_with_solid_start.md +14 -7
  80. package/docs/en/intlayer_with_svelte_kit.md +12 -1
  81. package/docs/en/intlayer_with_tanstack+solid.md +13 -2
  82. package/docs/en/intlayer_with_tanstack.md +12 -5
  83. package/docs/en/intlayer_with_vite+lit.md +75 -3
  84. package/docs/en/intlayer_with_vite+preact.md +16 -3
  85. package/docs/en/intlayer_with_vite+react.md +16 -3
  86. package/docs/en/intlayer_with_vite+solid.md +16 -3
  87. package/docs/en/intlayer_with_vite+svelte.md +16 -3
  88. package/docs/en/intlayer_with_vite+vanilla.md +16 -3
  89. package/docs/en/intlayer_with_vite+vue.md +16 -3
  90. package/docs/en/introduction.md +0 -1
  91. package/docs/en/readme.md +0 -1
  92. package/docs/en/releases/v8.md +1 -5
  93. package/docs/en-GB/intlayer_with_astro.md +12 -25
  94. package/docs/en-GB/intlayer_with_astro_lit.md +23 -27
  95. package/docs/en-GB/intlayer_with_astro_preact.md +23 -27
  96. package/docs/en-GB/intlayer_with_astro_react.md +23 -27
  97. package/docs/en-GB/intlayer_with_astro_solid.md +23 -27
  98. package/docs/en-GB/intlayer_with_astro_svelte.md +23 -27
  99. package/docs/en-GB/intlayer_with_astro_vue.md +23 -27
  100. package/docs/en-GB/intlayer_with_react_router_v7.md +12 -1
  101. package/docs/en-GB/intlayer_with_solid_start.md +14 -7
  102. package/docs/en-GB/intlayer_with_svelte_kit.md +12 -1
  103. package/docs/en-GB/intlayer_with_tanstack+solid.md +13 -2
  104. package/docs/en-GB/intlayer_with_tanstack.md +13 -6
  105. package/docs/en-GB/intlayer_with_vite+lit.md +75 -3
  106. package/docs/en-GB/intlayer_with_vite+preact.md +16 -3
  107. package/docs/en-GB/intlayer_with_vite+react.md +16 -3
  108. package/docs/en-GB/intlayer_with_vite+solid.md +25 -15
  109. package/docs/en-GB/intlayer_with_vite+svelte.md +16 -3
  110. package/docs/en-GB/intlayer_with_vite+vanilla.md +16 -3
  111. package/docs/en-GB/intlayer_with_vite+vue.md +16 -3
  112. package/docs/en-GB/introduction.md +0 -1
  113. package/docs/en-GB/readme.md +0 -1
  114. package/docs/en-GB/releases/v8.md +1 -5
  115. package/docs/es/intlayer_with_astro.md +12 -25
  116. package/docs/es/intlayer_with_astro_lit.md +23 -27
  117. package/docs/es/intlayer_with_astro_preact.md +23 -27
  118. package/docs/es/intlayer_with_astro_react.md +23 -27
  119. package/docs/es/intlayer_with_astro_solid.md +23 -27
  120. package/docs/es/intlayer_with_astro_svelte.md +23 -27
  121. package/docs/es/intlayer_with_astro_vue.md +23 -27
  122. package/docs/es/intlayer_with_react_router_v7.md +12 -1
  123. package/docs/es/intlayer_with_solid_start.md +14 -7
  124. package/docs/es/intlayer_with_svelte_kit.md +12 -1
  125. package/docs/es/intlayer_with_tanstack+solid.md +13 -2
  126. package/docs/es/intlayer_with_tanstack.md +13 -6
  127. package/docs/es/intlayer_with_vite+lit.md +75 -3
  128. package/docs/es/intlayer_with_vite+preact.md +16 -3
  129. package/docs/es/intlayer_with_vite+react.md +16 -3
  130. package/docs/es/intlayer_with_vite+solid.md +16 -3
  131. package/docs/es/intlayer_with_vite+svelte.md +16 -3
  132. package/docs/es/intlayer_with_vite+vanilla.md +16 -3
  133. package/docs/es/intlayer_with_vite+vue.md +16 -3
  134. package/docs/es/introduction.md +0 -1
  135. package/docs/es/readme.md +0 -1
  136. package/docs/es/releases/v8.md +1 -5
  137. package/docs/fr/intlayer_with_astro.md +13 -26
  138. package/docs/fr/intlayer_with_astro_lit.md +24 -28
  139. package/docs/fr/intlayer_with_astro_preact.md +24 -28
  140. package/docs/fr/intlayer_with_astro_react.md +24 -28
  141. package/docs/fr/intlayer_with_astro_solid.md +24 -28
  142. package/docs/fr/intlayer_with_astro_svelte.md +24 -28
  143. package/docs/fr/intlayer_with_astro_vue.md +24 -28
  144. package/docs/fr/intlayer_with_react_router_v7.md +15 -4
  145. package/docs/fr/intlayer_with_solid_start.md +14 -7
  146. package/docs/fr/intlayer_with_svelte_kit.md +15 -4
  147. package/docs/fr/intlayer_with_tanstack+solid.md +15 -4
  148. package/docs/fr/intlayer_with_tanstack.md +13 -6
  149. package/docs/fr/intlayer_with_vite+lit.md +75 -3
  150. package/docs/fr/intlayer_with_vite+preact.md +19 -6
  151. package/docs/fr/intlayer_with_vite+react.md +19 -6
  152. package/docs/fr/intlayer_with_vite+solid.md +19 -6
  153. package/docs/fr/intlayer_with_vite+svelte.md +19 -6
  154. package/docs/fr/intlayer_with_vite+vanilla.md +19 -6
  155. package/docs/fr/intlayer_with_vite+vue.md +19 -6
  156. package/docs/fr/introduction.md +0 -1
  157. package/docs/fr/readme.md +0 -1
  158. package/docs/fr/releases/v8.md +1 -5
  159. package/docs/hi/intlayer_with_astro.md +15 -31
  160. package/docs/hi/intlayer_with_astro_lit.md +26 -33
  161. package/docs/hi/intlayer_with_astro_preact.md +26 -33
  162. package/docs/hi/intlayer_with_astro_react.md +26 -33
  163. package/docs/hi/intlayer_with_astro_solid.md +26 -33
  164. package/docs/hi/intlayer_with_astro_svelte.md +26 -33
  165. package/docs/hi/intlayer_with_astro_vue.md +26 -33
  166. package/docs/hi/intlayer_with_react_router_v7.md +20 -12
  167. package/docs/hi/intlayer_with_solid_start.md +14 -7
  168. package/docs/hi/intlayer_with_svelte_kit.md +20 -12
  169. package/docs/hi/intlayer_with_tanstack+solid.md +13 -2
  170. package/docs/hi/intlayer_with_tanstack.md +21 -17
  171. package/docs/hi/intlayer_with_vite+lit.md +75 -3
  172. package/docs/hi/intlayer_with_vite+preact.md +24 -14
  173. package/docs/hi/intlayer_with_vite+react.md +24 -14
  174. package/docs/hi/intlayer_with_vite+solid.md +24 -14
  175. package/docs/hi/intlayer_with_vite+svelte.md +24 -14
  176. package/docs/hi/intlayer_with_vite+vanilla.md +16 -3
  177. package/docs/hi/intlayer_with_vite+vue.md +24 -14
  178. package/docs/hi/introduction.md +0 -1
  179. package/docs/hi/readme.md +0 -1
  180. package/docs/hi/releases/v8.md +1 -5
  181. package/docs/id/intlayer_with_astro.md +12 -25
  182. package/docs/id/intlayer_with_astro_lit.md +23 -27
  183. package/docs/id/intlayer_with_astro_preact.md +23 -27
  184. package/docs/id/intlayer_with_astro_react.md +23 -27
  185. package/docs/id/intlayer_with_astro_solid.md +23 -27
  186. package/docs/id/intlayer_with_astro_svelte.md +23 -27
  187. package/docs/id/intlayer_with_astro_vue.md +23 -27
  188. package/docs/id/intlayer_with_react_router_v7.md +12 -1
  189. package/docs/id/intlayer_with_solid_start.md +14 -7
  190. package/docs/id/intlayer_with_svelte_kit.md +12 -1
  191. package/docs/id/intlayer_with_tanstack+solid.md +13 -2
  192. package/docs/id/intlayer_with_tanstack.md +13 -6
  193. package/docs/id/intlayer_with_vite+lit.md +75 -3
  194. package/docs/id/intlayer_with_vite+preact.md +16 -3
  195. package/docs/id/intlayer_with_vite+react.md +16 -3
  196. package/docs/id/intlayer_with_vite+solid.md +16 -3
  197. package/docs/id/intlayer_with_vite+svelte.md +16 -3
  198. package/docs/id/intlayer_with_vite+vanilla.md +16 -3
  199. package/docs/id/intlayer_with_vite+vue.md +16 -3
  200. package/docs/id/introduction.md +0 -1
  201. package/docs/id/readme.md +0 -1
  202. package/docs/id/releases/v8.md +1 -5
  203. package/docs/it/intlayer_with_astro.md +12 -25
  204. package/docs/it/intlayer_with_astro_lit.md +23 -27
  205. package/docs/it/intlayer_with_astro_preact.md +23 -27
  206. package/docs/it/intlayer_with_astro_react.md +23 -27
  207. package/docs/it/intlayer_with_astro_solid.md +23 -27
  208. package/docs/it/intlayer_with_astro_svelte.md +23 -27
  209. package/docs/it/intlayer_with_astro_vue.md +23 -27
  210. package/docs/it/intlayer_with_react_router_v7.md +12 -1
  211. package/docs/it/intlayer_with_solid_start.md +14 -7
  212. package/docs/it/intlayer_with_svelte_kit.md +12 -1
  213. package/docs/it/intlayer_with_tanstack+solid.md +13 -2
  214. package/docs/it/intlayer_with_tanstack.md +13 -6
  215. package/docs/it/intlayer_with_vite+lit.md +75 -3
  216. package/docs/it/intlayer_with_vite+preact.md +16 -3
  217. package/docs/it/intlayer_with_vite+react.md +16 -3
  218. package/docs/it/intlayer_with_vite+solid.md +16 -3
  219. package/docs/it/intlayer_with_vite+svelte.md +16 -3
  220. package/docs/it/intlayer_with_vite+vanilla.md +16 -3
  221. package/docs/it/intlayer_with_vite+vue.md +16 -3
  222. package/docs/it/introduction.md +0 -1
  223. package/docs/it/readme.md +0 -1
  224. package/docs/it/releases/v8.md +1 -5
  225. package/docs/ja/intlayer_with_astro.md +12 -25
  226. package/docs/ja/intlayer_with_astro_lit.md +23 -27
  227. package/docs/ja/intlayer_with_astro_preact.md +23 -27
  228. package/docs/ja/intlayer_with_astro_react.md +23 -27
  229. package/docs/ja/intlayer_with_astro_solid.md +23 -27
  230. package/docs/ja/intlayer_with_astro_svelte.md +23 -27
  231. package/docs/ja/intlayer_with_astro_vue.md +23 -27
  232. package/docs/ja/intlayer_with_react_router_v7.md +12 -1
  233. package/docs/ja/intlayer_with_solid_start.md +14 -7
  234. package/docs/ja/intlayer_with_svelte_kit.md +21 -15
  235. package/docs/ja/intlayer_with_tanstack+solid.md +13 -2
  236. package/docs/ja/intlayer_with_tanstack.md +13 -6
  237. package/docs/ja/intlayer_with_vite+lit.md +75 -3
  238. package/docs/ja/intlayer_with_vite+preact.md +16 -3
  239. package/docs/ja/intlayer_with_vite+react.md +16 -3
  240. package/docs/ja/intlayer_with_vite+solid.md +16 -3
  241. package/docs/ja/intlayer_with_vite+svelte.md +16 -3
  242. package/docs/ja/intlayer_with_vite+vanilla.md +16 -3
  243. package/docs/ja/intlayer_with_vite+vue.md +16 -3
  244. package/docs/ja/introduction.md +0 -1
  245. package/docs/ja/readme.md +0 -1
  246. package/docs/ja/releases/v8.md +1 -5
  247. package/docs/ko/intlayer_with_astro.md +6 -21
  248. package/docs/ko/intlayer_with_astro_lit.md +23 -27
  249. package/docs/ko/intlayer_with_astro_preact.md +23 -27
  250. package/docs/ko/intlayer_with_astro_react.md +23 -27
  251. package/docs/ko/intlayer_with_astro_solid.md +23 -27
  252. package/docs/ko/intlayer_with_astro_svelte.md +23 -27
  253. package/docs/ko/intlayer_with_astro_vue.md +23 -27
  254. package/docs/ko/intlayer_with_react_router_v7.md +12 -1
  255. package/docs/ko/intlayer_with_solid_start.md +14 -7
  256. package/docs/ko/intlayer_with_svelte_kit.md +12 -1
  257. package/docs/ko/intlayer_with_tanstack+solid.md +13 -2
  258. package/docs/ko/intlayer_with_tanstack.md +13 -6
  259. package/docs/ko/intlayer_with_vite+lit.md +75 -3
  260. package/docs/ko/intlayer_with_vite+preact.md +16 -3
  261. package/docs/ko/intlayer_with_vite+react.md +16 -3
  262. package/docs/ko/intlayer_with_vite+solid.md +26 -16
  263. package/docs/ko/intlayer_with_vite+svelte.md +16 -3
  264. package/docs/ko/intlayer_with_vite+vanilla.md +16 -3
  265. package/docs/ko/intlayer_with_vite+vue.md +16 -3
  266. package/docs/ko/introduction.md +0 -1
  267. package/docs/ko/readme.md +0 -1
  268. package/docs/ko/releases/v8.md +1 -5
  269. package/docs/nl/intlayer_with_vite+lit.md +75 -3
  270. package/docs/nl/intlayer_with_vite+vanilla.md +16 -3
  271. package/docs/nl/introduction.md +0 -1
  272. package/docs/pl/intlayer_with_astro.md +6 -21
  273. package/docs/pl/intlayer_with_astro_lit.md +23 -27
  274. package/docs/pl/intlayer_with_astro_preact.md +23 -27
  275. package/docs/pl/intlayer_with_astro_react.md +23 -27
  276. package/docs/pl/intlayer_with_astro_solid.md +23 -27
  277. package/docs/pl/intlayer_with_astro_svelte.md +23 -27
  278. package/docs/pl/intlayer_with_astro_vue.md +23 -27
  279. package/docs/pl/intlayer_with_react_router_v7.md +12 -1
  280. package/docs/pl/intlayer_with_solid_start.md +14 -7
  281. package/docs/pl/intlayer_with_svelte_kit.md +12 -1
  282. package/docs/pl/intlayer_with_tanstack+solid.md +13 -2
  283. package/docs/pl/intlayer_with_tanstack.md +13 -6
  284. package/docs/pl/intlayer_with_vite+lit.md +75 -3
  285. package/docs/pl/intlayer_with_vite+preact.md +16 -3
  286. package/docs/pl/intlayer_with_vite+react.md +16 -3
  287. package/docs/pl/intlayer_with_vite+solid.md +16 -3
  288. package/docs/pl/intlayer_with_vite+svelte.md +16 -3
  289. package/docs/pl/intlayer_with_vite+vanilla.md +16 -3
  290. package/docs/pl/intlayer_with_vite+vue.md +16 -3
  291. package/docs/pl/introduction.md +0 -1
  292. package/docs/pl/readme.md +0 -1
  293. package/docs/pl/releases/v8.md +1 -5
  294. package/docs/pt/intlayer_with_astro.md +6 -21
  295. package/docs/pt/intlayer_with_astro_lit.md +23 -27
  296. package/docs/pt/intlayer_with_astro_preact.md +23 -27
  297. package/docs/pt/intlayer_with_astro_react.md +23 -27
  298. package/docs/pt/intlayer_with_astro_solid.md +23 -27
  299. package/docs/pt/intlayer_with_astro_svelte.md +23 -27
  300. package/docs/pt/intlayer_with_astro_vue.md +23 -27
  301. package/docs/pt/intlayer_with_react_router_v7.md +12 -1
  302. package/docs/pt/intlayer_with_solid_start.md +14 -7
  303. package/docs/pt/intlayer_with_svelte_kit.md +12 -1
  304. package/docs/pt/intlayer_with_tanstack+solid.md +13 -2
  305. package/docs/pt/intlayer_with_tanstack.md +13 -6
  306. package/docs/pt/intlayer_with_vite+lit.md +75 -3
  307. package/docs/pt/intlayer_with_vite+preact.md +16 -3
  308. package/docs/pt/intlayer_with_vite+react.md +16 -3
  309. package/docs/pt/intlayer_with_vite+solid.md +16 -3
  310. package/docs/pt/intlayer_with_vite+svelte.md +16 -3
  311. package/docs/pt/intlayer_with_vite+vanilla.md +16 -3
  312. package/docs/pt/intlayer_with_vite+vue.md +16 -3
  313. package/docs/pt/introduction.md +0 -1
  314. package/docs/pt/readme.md +0 -1
  315. package/docs/pt/releases/v8.md +1 -5
  316. package/docs/ru/intlayer_with_astro.md +12 -25
  317. package/docs/ru/intlayer_with_astro_lit.md +23 -27
  318. package/docs/ru/intlayer_with_astro_preact.md +23 -27
  319. package/docs/ru/intlayer_with_astro_react.md +23 -27
  320. package/docs/ru/intlayer_with_astro_solid.md +23 -27
  321. package/docs/ru/intlayer_with_astro_svelte.md +23 -27
  322. package/docs/ru/intlayer_with_astro_vue.md +23 -27
  323. package/docs/ru/intlayer_with_react_router_v7.md +12 -1
  324. package/docs/ru/intlayer_with_solid_start.md +14 -7
  325. package/docs/ru/intlayer_with_svelte_kit.md +12 -1
  326. package/docs/ru/intlayer_with_tanstack+solid.md +13 -2
  327. package/docs/ru/intlayer_with_tanstack.md +13 -6
  328. package/docs/ru/intlayer_with_vite+lit.md +75 -3
  329. package/docs/ru/intlayer_with_vite+preact.md +16 -3
  330. package/docs/ru/intlayer_with_vite+react.md +16 -3
  331. package/docs/ru/intlayer_with_vite+solid.md +16 -3
  332. package/docs/ru/intlayer_with_vite+svelte.md +16 -3
  333. package/docs/ru/intlayer_with_vite+vanilla.md +16 -3
  334. package/docs/ru/intlayer_with_vite+vue.md +16 -3
  335. package/docs/ru/introduction.md +0 -1
  336. package/docs/ru/readme.md +0 -1
  337. package/docs/ru/releases/v8.md +1 -5
  338. package/docs/tr/intlayer_with_astro.md +12 -25
  339. package/docs/tr/intlayer_with_astro_lit.md +24 -28
  340. package/docs/tr/intlayer_with_astro_preact.md +24 -28
  341. package/docs/tr/intlayer_with_astro_react.md +24 -28
  342. package/docs/tr/intlayer_with_astro_solid.md +24 -28
  343. package/docs/tr/intlayer_with_astro_svelte.md +24 -28
  344. package/docs/tr/intlayer_with_astro_vue.md +24 -28
  345. package/docs/tr/intlayer_with_react_router_v7.md +12 -1
  346. package/docs/tr/intlayer_with_solid_start.md +14 -7
  347. package/docs/tr/intlayer_with_svelte_kit.md +12 -1
  348. package/docs/tr/intlayer_with_tanstack+solid.md +13 -2
  349. package/docs/tr/intlayer_with_tanstack.md +13 -6
  350. package/docs/tr/intlayer_with_vite+lit.md +75 -3
  351. package/docs/tr/intlayer_with_vite+preact.md +16 -3
  352. package/docs/tr/intlayer_with_vite+react.md +16 -3
  353. package/docs/tr/intlayer_with_vite+solid.md +16 -3
  354. package/docs/tr/intlayer_with_vite+svelte.md +16 -3
  355. package/docs/tr/intlayer_with_vite+vanilla.md +16 -3
  356. package/docs/tr/intlayer_with_vite+vue.md +16 -3
  357. package/docs/tr/introduction.md +0 -1
  358. package/docs/tr/readme.md +0 -1
  359. package/docs/tr/releases/v8.md +1 -5
  360. package/docs/uk/intlayer_with_astro.md +12 -25
  361. package/docs/uk/intlayer_with_astro_lit.md +23 -27
  362. package/docs/uk/intlayer_with_astro_preact.md +23 -27
  363. package/docs/uk/intlayer_with_astro_react.md +23 -27
  364. package/docs/uk/intlayer_with_astro_solid.md +23 -27
  365. package/docs/uk/intlayer_with_astro_svelte.md +23 -27
  366. package/docs/uk/intlayer_with_astro_vue.md +23 -27
  367. package/docs/uk/intlayer_with_react_router_v7.md +12 -1
  368. package/docs/uk/intlayer_with_solid_start.md +14 -7
  369. package/docs/uk/intlayer_with_svelte_kit.md +12 -1
  370. package/docs/uk/intlayer_with_tanstack+solid.md +13 -2
  371. package/docs/uk/intlayer_with_tanstack.md +13 -6
  372. package/docs/uk/intlayer_with_vite+lit.md +75 -3
  373. package/docs/uk/intlayer_with_vite+preact.md +16 -3
  374. package/docs/uk/intlayer_with_vite+react.md +16 -3
  375. package/docs/uk/intlayer_with_vite+solid.md +16 -3
  376. package/docs/uk/intlayer_with_vite+svelte.md +16 -3
  377. package/docs/uk/intlayer_with_vite+vanilla.md +16 -3
  378. package/docs/uk/intlayer_with_vite+vue.md +16 -3
  379. package/docs/uk/introduction.md +0 -1
  380. package/docs/uk/readme.md +0 -1
  381. package/docs/uk/releases/v8.md +1 -5
  382. package/docs/ur/intlayer_with_vite+lit.md +75 -3
  383. package/docs/ur/intlayer_with_vite+vanilla.md +16 -3
  384. package/docs/ur/introduction.md +0 -1
  385. package/docs/vi/intlayer_with_astro.md +12 -25
  386. package/docs/vi/intlayer_with_astro_lit.md +23 -27
  387. package/docs/vi/intlayer_with_astro_preact.md +23 -27
  388. package/docs/vi/intlayer_with_astro_react.md +23 -27
  389. package/docs/vi/intlayer_with_astro_solid.md +23 -27
  390. package/docs/vi/intlayer_with_astro_svelte.md +23 -27
  391. package/docs/vi/intlayer_with_astro_vue.md +23 -27
  392. package/docs/vi/intlayer_with_react_router_v7.md +12 -1
  393. package/docs/vi/intlayer_with_solid_start.md +14 -7
  394. package/docs/vi/intlayer_with_svelte_kit.md +12 -1
  395. package/docs/vi/intlayer_with_tanstack+solid.md +13 -2
  396. package/docs/vi/intlayer_with_tanstack.md +13 -6
  397. package/docs/vi/intlayer_with_vite+lit.md +75 -3
  398. package/docs/vi/intlayer_with_vite+preact.md +16 -3
  399. package/docs/vi/intlayer_with_vite+react.md +16 -3
  400. package/docs/vi/intlayer_with_vite+solid.md +16 -3
  401. package/docs/vi/intlayer_with_vite+svelte.md +16 -3
  402. package/docs/vi/intlayer_with_vite+vanilla.md +16 -3
  403. package/docs/vi/intlayer_with_vite+vue.md +16 -3
  404. package/docs/vi/introduction.md +0 -1
  405. package/docs/vi/readme.md +0 -1
  406. package/docs/vi/releases/v8.md +1 -5
  407. package/docs/zh/intlayer_with_astro.md +6 -21
  408. package/docs/zh/intlayer_with_astro_lit.md +23 -27
  409. package/docs/zh/intlayer_with_astro_preact.md +23 -27
  410. package/docs/zh/intlayer_with_astro_react.md +23 -27
  411. package/docs/zh/intlayer_with_astro_solid.md +23 -27
  412. package/docs/zh/intlayer_with_astro_svelte.md +23 -27
  413. package/docs/zh/intlayer_with_astro_vue.md +23 -27
  414. package/docs/zh/intlayer_with_react_router_v7.md +12 -1
  415. package/docs/zh/intlayer_with_solid_start.md +14 -7
  416. package/docs/zh/intlayer_with_svelte_kit.md +12 -1
  417. package/docs/zh/intlayer_with_tanstack+solid.md +13 -2
  418. package/docs/zh/intlayer_with_tanstack.md +13 -6
  419. package/docs/zh/intlayer_with_vite+lit.md +75 -3
  420. package/docs/zh/intlayer_with_vite+preact.md +16 -3
  421. package/docs/zh/intlayer_with_vite+react.md +16 -3
  422. package/docs/zh/intlayer_with_vite+solid.md +16 -3
  423. package/docs/zh/intlayer_with_vite+svelte.md +16 -3
  424. package/docs/zh/intlayer_with_vite+vanilla.md +16 -3
  425. package/docs/zh/intlayer_with_vite+vue.md +16 -3
  426. package/docs/zh/introduction.md +0 -1
  427. package/docs/zh/readme.md +0 -1
  428. package/docs/zh/releases/v8.md +1 -5
  429. package/docs/zh-TW/introduction.md +0 -1
  430. package/package.json +6 -6
  431. package/docs/ar/intlayer_with_astro_vanilla.md +0 -709
  432. package/docs/de/intlayer_with_astro_vanilla.md +0 -705
  433. package/docs/en-GB/intlayer_with_astro_vanilla.md +0 -709
  434. package/docs/es/intlayer_with_astro_vanilla.md +0 -701
  435. package/docs/fr/intlayer_with_astro_vanilla.md +0 -701
  436. package/docs/hi/intlayer_with_astro_vanilla.md +0 -720
  437. package/docs/id/intlayer_with_astro_vanilla.md +0 -705
  438. package/docs/it/intlayer_with_astro_vanilla.md +0 -705
  439. package/docs/ja/intlayer_with_astro_vanilla.md +0 -708
  440. package/docs/ko/intlayer_with_astro_vanilla.md +0 -720
  441. package/docs/pl/intlayer_with_astro_vanilla.md +0 -705
  442. package/docs/pt/intlayer_with_astro_vanilla.md +0 -705
  443. package/docs/ru/intlayer_with_astro_vanilla.md +0 -716
  444. package/docs/tr/intlayer_with_astro_vanilla.md +0 -705
  445. package/docs/uk/intlayer_with_astro_vanilla.md +0 -705
  446. package/docs/vi/intlayer_with_astro_vanilla.md +0 -705
  447. package/docs/zh/intlayer_with_astro_vanilla.md +0 -704
@@ -1,704 +0,0 @@
1
- ---
2
- createdAt: 2026-04-24
3
- updatedAt: 2026-08-30
4
- title: "Astro + Vanilla JS i18n - 翻译你的应用的完整指南"
5
- description: "告别 i18next。2026 年构建多语言 (i18n) Astro + Vanilla JS 应用的完整指南。使用 AI 代理翻译并优化包体积、SEO 和性能。"
6
- keywords:
7
- - 国际化
8
- - 文档
9
- - Intlayer
10
- - Astro
11
- - Vanilla JS
12
- - JavaScript
13
- - TypeScript
14
- slugs:
15
- - doc
16
- - environment
17
- - astro
18
- - vanilla
19
- applicationTemplate: https://github.com/aymericzip/intlayer-astro-template
20
- applicationShowcase: https://intlayer-astro-template.vercel.app
21
- history:
22
- - version: 8.9.0
23
- date: 2026-05-04
24
- changes: "更新 Solid useIntlayer API 用法以直接访问属性"
25
- - version: 8.7.7
26
- date: 2026-04-24
27
- changes: "Astro + Vanilla JS 的初始文档"
28
- author: aymericzip
29
- ---
30
-
31
- # 使用 Intlayer 翻译您的 Astro + Vanilla JS 网站 | 国际化 (i18n)
32
-
33
- <Tabs defaultTab="code">
34
- <Tab label="代码" value="code">
35
-
36
- <iframe
37
- src="https://ide.intlayer.org/aymericzip/intlayer-astro-template?file=intlayer.config.ts"
38
- className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
39
- title="Demo CodeSandbox - 如何使用 Intlayer 国际化您的应用程序"
40
- sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
41
- loading="lazy"
42
- />
43
-
44
- </Tab>
45
- <Tab label="演示" value="demo">
46
-
47
- <iframe
48
- src="https://intlayer-astro-template.vercel.app"
49
- className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
50
- title="演示 - intlayer-astro-template"
51
- sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
52
- loading="lazy"
53
- />
54
-
55
- </Tab>
56
- </Tabs>
57
-
58
- ## 目录
59
-
60
- <TOC/>
61
-
62
- ## 为什么选择 Inlayer 而不是替代品?
63
-
64
- 与“astro-i18n”或“i18next”等主要解决方案相比,Intlayer是一个具有集成优化的解决方案,例如:
65
-
66
- <AccordionGroup>
67
- <Accordion header="Full Astro 覆盖">
68
-
69
- Intlayer 经过优化,可与 Astro 完美配合,提供**多语言路由**、**站点地图**以及扩展国际化 (i18n) 所需的所有功能。
70
-
71
- </Accordion>
72
- <Accordion header="捆绑尺寸">
73
-
74
- 不要将大量 JSON 文件加载到页面中,而只需加载必要的内容。 Intlayer 有助于**将捆绑包和页面大小减少多达 50%**。
75
-
76
- </Accordion>
77
- <Accordion header="可维护性">
78
-
79
- 确定应用程序内容的范围**有利于大型应用程序的维护**。您可以复制或删除单个功能文件夹,而无需承担检查整个内容代码库的精神负担。此外,Intlayer 具有**完全类型化 (fully typed)**,以确保您的内容的准确性。
80
-
81
- </Accordion>
82
- <Accordion header="人工智能代理">
83
-
84
- 共置内容**减少大型语言模型 (LLM) 所需的上下文**。 Intlayer 还附带了一套工具,例如用于测试缺失翻译的 **CLI**、**[LSP](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/lsp.md)**、**[MCP](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md)** 和 **[agent skills](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/agent_skills.md)**,使 AI 代理的开发者体验 (DX) 更加流畅。
85
-
86
- </Accordion>
87
- <Accordion header="自动化">
88
-
89
- 使用您选择的法学硕士,通过自动化在 CI/CD 管道中进行翻译,而费用由您的 AI 提供商承担。 Intlayer 还提供了一个**编译器**来自动提取内容,以及一个[网络平台](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md)来帮助**在后台翻译**。
90
-
91
- </Accordion>
92
- <Accordion header="表现">
93
-
94
- 将大量 JSON 文件连接到组件可能会导致性能和反应性问题。 Intlayer 可在构建时 (build time)优化您的内容加载。
95
-
96
- </Accordion>
97
- <Accordion header="无需开发即可扩展">
98
-
99
- Intlayer 不仅仅是一个 i18n 解决方案,还提供了一个**自托管的[可视化编辑器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_visual_editor.md)**和一个**[完整的 CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md)** 来帮助您管理多语言内容**实时**,与译员、文案人员和其他团队成员无缝协作。内容可以本地和/或远程存储。
100
-
101
- </Accordion>
102
- </AccordionGroup>
103
-
104
- ## 在 Astro + Vanilla JS 中配置 Intlayer 的分步指南
105
-
106
- 在 GitHub 上查看[应用程序模板](https://github.com/aymericzip/intlayer-astro-template)。
107
-
108
- <Steps>
109
- <Step number={1} title="安装依赖">
110
-
111
- 使用您喜欢的包管理器安装所需的软件包:
112
-
113
- ```bash packageManager="npm"
114
- npx intlayer init --interactive
115
- ```
116
-
117
- ```bash packageManager="pnpm"
118
- pnpm dlx intlayer init --interactive
119
- ```
120
-
121
- ```bash packageManager="yarn"
122
- yarn dlx intlayer init --interactive
123
- ```
124
-
125
- ```bash packageManager="bun"
126
- bunx intlayer init --interactive
127
- ```
128
-
129
- > `--interactive` 标志是可选的。如果您是 AI 代理,请使用 `intlayer-cli init`。
130
-
131
- > 该命令将检测您的环境并安装所需的软件包。例如:
132
-
133
- ```bash packageManager="npm"
134
- npm install intlayer astro-intlayer vanilla-intlayer
135
- ```
136
-
137
- ```bash packageManager="pnpm"
138
- pnpm add intlayer astro-intlayer vanilla-intlayer
139
- ```
140
-
141
- ```bash packageManager="yarn"
142
- yarn add intlayer astro-intlayer vanilla-intlayer
143
- ```
144
-
145
- ```bash packageManager="bun"
146
- bun add intlayer astro-intlayer vanilla-intlayer
147
- ```
148
-
149
- - **intlayer**
150
- 核心软件包,提供用于配置管理、翻译、[内容声明](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)的国际化工具。
151
-
152
- - **astro-intlayer**
153
- 包含将 Intlayer 与 [Vite 构建器](https://vite.dev/guide/why.html#why-bundle-for-production)集成的 Astro 集成插件,以及用于检测用户首选语言、管理 Cookie 和处理 URL 重定向的中间件。
154
-
155
- - **vanilla-intlayer**
156
- 将 Intlayer 与 Vanilla JavaScript / TypeScript 应用程序集成的软件包。它提供了一个发布/订阅单例 (`IntlayerClient`) 和基于回调的辅助函数 (`useIntlayer`, `useLocale` 等),允许 Astro 的 `<script>` 标签内的任何部分在不使用框架的情况下响应语言更改。
157
-
158
- </Step>
159
- <Step number={2} title="配置您的项目">
160
-
161
- 创建一个配置文件来定义您的应用程序语言:
162
-
163
- ```typescript fileName="intlayer.config.ts"
164
- import { Locales, type IntlayerConfig } from "intlayer";
165
-
166
- const config: IntlayerConfig = {
167
- internationalization: {
168
- locales: [
169
- Locales.ENGLISH,
170
- Locales.FRENCH,
171
- Locales.SPANISH,
172
- // 您的其他语言
173
- ],
174
- defaultLocale: Locales.ENGLISH,
175
- },
176
- };
177
-
178
- export default config;
179
- ```
180
-
181
- > 通过此配置文件,您可以配置本地化 URL、中间件重定向、Cookie 名称、内容声明的位置和扩展名、在控制台中禁用 Intlayer 日志等。有关可用参数的完整列表,请参阅[配置文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/configuration.md)。
182
-
183
- </Step>
184
- <Step number={3} title="在 Astro 配置中集成 Intlayer">
185
-
186
- 将 intlayer 插件添加到您的 Astro 配置中。对于 Vanilla JS,不需要额外的 UI 框架集成。
187
-
188
- ```typescript fileName="astro.config.ts"
189
- // @ts-check
190
-
191
- import { intlayer } from "astro-intlayer";
192
- import { defineConfig } from "astro/config";
193
-
194
- // https://astro.build/config
195
- export default defineConfig({
196
- integrations: [intlayer()],
197
- });
198
- ```
199
-
200
- > `intlayer()` 集成插件用于将 Intlayer 与 Astro 集成。它确保内容声明文件的构建并在开发模式下进行监视。它在 Astro 应用程序中定义 Intlayer 环境变量,并提供别名以优化性能。
201
-
202
- </Step>
203
- <Step number={4} title="声明您的内容">
204
-
205
- 创建并管理您的内容声明以存储翻译:
206
-
207
- ```typescript fileName="src/app.content.ts"
208
- import { t, type Dictionary } from "intlayer";
209
-
210
- const appContent = {
211
- key: "app",
212
- content: {
213
- greeting: t({
214
- en: "Hello World",
215
- fr: "Bonjour le monde",
216
- es: "Hola mundo",
217
- zh: "你好,世界",
218
- }),
219
- description: t({
220
- en: "Welcome to my multilingual Astro site.",
221
- fr: "Bienvenue sur mon site Astro multilingue.",
222
- es: "Bienvenido a mi sitio Astro multilingüe.",
223
- zh: "欢迎来到我的多语言 Astro 网站。",
224
- }),
225
- switchLocale: t({
226
- en: "Switch language:",
227
- fr: "Changer de langue :",
228
- es: "Cambiar idioma:",
229
- zh: "切换语言:",
230
- }),
231
- },
232
- } satisfies Dictionary;
233
-
234
- export default appContent;
235
- ```
236
-
237
- > 只要您的内容声明包含在 `contentDir`(默认为 `./src`)中,且匹配内容声明文件扩展名(默认为 `.content.{json,ts,tsx,js,jsx,mjs,cjs,md,mdx,yaml,yml}`),就可以在应用程序的任何位置定义。
238
-
239
- > 有关更多信息,请参阅[内容声明文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/content_file.md)。
240
-
241
- </Step>
242
- <Step number={5} title="在 Astro 中使用内容">
243
-
244
- 对于 Vanilla JS,所有服务端渲染都是通过直接在 `.astro` 文件中使用 `getIntlayer` 完成的。随后,`<script>` 块在客户端初始化 `vanilla-intlayer` 以处理语言切换。
245
-
246
- ```astro fileName="src/pages/[...locale]/index.astro"
247
- ---
248
- import {
249
- getIntlayer,
250
- getLocaleFromPath,
251
- getLocalizedUrl,
252
- getPrefix,
253
- getLocaleName,
254
- localeMap,
255
- locales,
256
- defaultLocale,
257
- getPathWithoutLocale,
258
- type LocalesValues,
259
- } from "intlayer";
260
-
261
- export const getStaticPaths = () => {
262
- return localeMap(({ locale }) => ({
263
- params: { locale: getPrefix(locale).localePrefix },
264
- }));
265
- };
266
-
267
- const locale = getLocaleFromPath(Astro.url.pathname) as LocalesValues;
268
- const pathWithoutLocale = getPathWithoutLocale(Astro.url.pathname);
269
- const { greeting, description, switchLocale } = getIntlayer("app", locale);
270
- ---
271
-
272
- <!doctype html>
273
- <html lang={locale} dir={getHTMLTextDir(locale)}>
274
- <head>
275
- <meta charset="utf-8" />
276
- <meta name="viewport" content="width=device-width" />
277
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
278
- <title>{greeting}</title>
279
-
280
- <!-- 规范链接 -->
281
- <link
282
- rel="canonical"
283
- href={new URL(getLocalizedUrl(Astro.url.pathname, locale), Astro.site)}
284
- />
285
-
286
- <!-- Hreflang 链接 -->
287
- {
288
- localeMap(({ locale: mapLocale }) => (
289
- <link
290
- rel="alternate"
291
- hreflang={mapLocale}
292
- href={new URL(
293
- getLocalizedUrl(Astro.url.pathname, mapLocale),
294
- Astro.site
295
- )}
296
- />
297
- ))
298
- }
299
-
300
- <link
301
- rel="alternate"
302
- hreflang="x-default"
303
- href={new URL(
304
- getLocalizedUrl(Astro.url.pathname, defaultLocale),
305
- Astro.site
306
- )}
307
- />
308
- </head>
309
- <body>
310
- <main>
311
- <h1 id="greeting">{greeting}</h1>
312
- <p id="description">{description}</p>
313
-
314
- <div class="locale-switcher">
315
- <span class="switcher-label">{switchLocale}</span>
316
- <div class="locale-buttons">
317
- {
318
- locales.map((localeItem) => (
319
- <a
320
- href={localeItem === locale ? undefined : getLocalizedUrl(pathWithoutLocale, localeItem)}
321
- class={`locale-btn ${localeItem === locale ? "active" : ""}`}
322
- data-locale={localeItem}
323
- aria-disabled={localeItem === locale}
324
- >
325
- {getLocaleName(localeItem)}
326
- </a>
327
- ))
328
- }
329
- </div>
330
- </div>
331
- </main>
332
- </body>
333
- </html>
334
- ```
335
-
336
- > 如果你想在 `string` 属性中使用你的内容,例如 `alt`、`title`、`href`、`aria-label` 等,你可以像这样使用该函数的值:
337
-
338
- > ```tsx
339
- > <img src={content.image.src.value} alt={content.image.value} />
340
- > <img src={content.image.src.toString()} alt={content.image.toString()} />
341
- > <img src={String(content.image.src)} alt={String(content.image)} />
342
- > ```
343
-
344
- > **关于路由设置的说明:**
345
- > 您使用的目录结构取决于 `intlayer.config.ts` 中的 `middleware.routing` 设置:
346
- >
347
- > - **`prefix-no-default`(默认)**:在根目录下保留默认语言(无前缀),并为其他语言添加前缀。使用 `[...locale]` 来捕获所有情况。
348
- > - **`prefix-all`**:所有 URL 都有语言前缀。如果您不需要单独处理根目录,可以使用标准的 `[locale]`。
349
- > - **`search-param` 或 `no-prefix`**:不需要语言文件夹。语言通过查询参数或 Cookie 处理。
350
-
351
- </Step>
352
- <Step number={6} title="添加语言切换功能">
353
-
354
- 在带有 Vanilla JS 的 Astro 中,语言切换器在服务端渲染为普通链接,并通过 `<script>` 块在客户端进行激活。当用户点击语言链接时,`vanilla-intlayer` 会在导航到本地化 URL 之前通过 `setLocale` 设置语言 Cookie。
355
-
356
- ```astro fileName="src/pages/[...locale]/index.astro"
357
- <!-- 服务端标记请参见上面的第五步 -->
358
-
359
- <script>
360
- import { installIntlayer, useLocale } from "vanilla-intlayer";
361
- import { getLocaleFromPath, getLocalizedUrl, type LocalesValues } from "intlayer";
362
-
363
- // 使用当前 URL 的语言初始化客户端 Intlayer
364
- const locale = getLocaleFromPath(window.location.pathname);
365
- installIntlayer({ locale: locale as LocalesValues });
366
-
367
- const { setLocale } = useLocale({
368
- onLocaleChange: (newLocale: LocalesValues) => {
369
- window.location.href = getLocalizedUrl(window.location.pathname, newLocale);
370
- },
371
- });
372
-
373
- // 为语言切换链接绑定点击事件
374
- const localeLinks = document.querySelectorAll("[data-locale]");
375
- localeLinks.forEach((link) => {
376
- link.addEventListener("click", (e) => {
377
- const localeValue = link.getAttribute("data-locale") as LocalesValues;
378
- if (localeValue && localeValue !== locale) {
379
- e.preventDefault();
380
- setLocale(localeValue);
381
- }
382
- });
383
- });
384
- </script>
385
- ```
386
-
387
- > **关于持久性的说明:**
388
- > `installIntlayer` 使用服务端定义的语言初始化 Intlayer 单例。带 `onLocaleChange` 的 `useLocale` 确保在导航之前通过中间件设置语言 Cookie,以便记住用户在未来访问时的首选语言。
389
-
390
- > **关于渐进式增强的说明:**
391
- > 即使没有 JavaScript,语言切换链接也会作为标准的 `<a>` 标签工作。如果 JS 可用,调用 `setLocale` 会在导航前更新 Cookie,允许中间件执行正确的重定向。
392
-
393
- </Step>
394
- <Step number={7} title="站点地图和 Robots.txt">
395
-
396
- Intlayer 提供了实用工具来动态创建您的本地化站点地图和 robots.txt 文件。
397
-
398
- #### 站点地图
399
-
400
- Intlayer 附带一个内置的站点地图生成器,可帮助您轻松为应用程序创建站点地图。它能够处理本地化路由,并为搜索引擎添加必要的元数据。
401
-
402
- > Intlayer 生成的站点地图支持 `xhtml:link` 命名空间(Hreflang XML 扩展)。与仅列出原始 URL 的默认站点地图生成器不同,Intlayer 会自动在页面的所有语言版本(例如 `/about`、`/about?lang=fr` 和 `/about?lang=es`)之间创建所需的双向链接。这确保了搜索引擎能够正确索引并向合适的受众提供正确的语言版本。
403
-
404
- 创建 `src/pages/sitemap.xml.ts` 以生成包含所有本地化路由的站点地图。
405
-
406
- ```typescript fileName="src/pages/sitemap.xml.ts"
407
- import type { APIRoute } from "astro";
408
- import { generateSitemap, type SitemapUrlEntry } from "intlayer";
409
-
410
- const pathList: SitemapUrlEntry[] = [
411
- { path: "/", changefreq: "daily", priority: 1.0 },
412
- { path: "/about", changefreq: "monthly", priority: 0.7 },
413
- ];
414
-
415
- const SITE_URL = import.meta.env.SITE ?? "http://localhost:4321";
416
-
417
- export const GET: APIRoute = async ({ site }) => {
418
- const xmlOutput = generateSitemap(pathList, { siteUrl: SITE_URL });
419
-
420
- return new Response(xmlOutput, {
421
- headers: { "Content-Type": "application/xml" },
422
- });
423
- };
424
- ```
425
-
426
- #### Robots.txt
427
-
428
- 创建 `src/pages/robots.txt.ts` 以控制搜索引擎抓取。
429
-
430
- ```typescript fileName="src/pages/robots.txt.ts"
431
- import type { APIRoute } from "astro";
432
- import { getMultilingualUrls } from "intlayer";
433
-
434
- const getAllMultilingualUrls = (urls: string[]) =>
435
- urls.flatMap((url) => Object.values(getMultilingualUrls(url)) as string[]);
436
-
437
- const disallowedPaths = getAllMultilingualUrls(["/admin", "/private"]);
438
-
439
- export const GET: APIRoute = ({ site }) => {
440
- const robotsTxt = [
441
- "User-agent: *",
442
- "Allow: /",
443
- ...disallowedPaths.map((path) => `Disallow: ${path}`),
444
- "",
445
- `Sitemap: ${new URL("/sitemap.xml", site).href}`,
446
- ].join("\n");
447
-
448
- return new Response(robotsTxt, {
449
- headers: { "Content-Type": "text/plain" },
450
- });
451
- };
452
- ```
453
-
454
- </Step>
455
- <Step number={15} title="提取组件中的内容(可选)" isOptional={true}>
456
-
457
- 如果您有现有的代码库,转换数千个文件可能会非常耗时。
458
-
459
- 为了简化此过程,Intlayer 提供了 [编译器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/compiler.md) / [提取器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/cli/extract.md) 来转换您的组件并提取内容。
460
-
461
- 要进行设置,您可以在 `intlayer.config.ts` 文件中添加 `compiler` 部分:
462
-
463
- ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
464
- import { type IntlayerConfig } from "intlayer";
465
-
466
- const config: IntlayerConfig = {
467
- // ... 您的其他配置
468
- compiler: {
469
- /**
470
- * 指示是否应启用编译器。
471
- */
472
- enabled: true,
473
-
474
- /**
475
- * 定义输出文件路径
476
- */
477
- output: ({ fileName, extension }) => `./${fileName}${extension}`,
478
-
479
- /**
480
- * 指示在转换后是否应保存组件。这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
481
- */
482
- saveComponents: false,
483
-
484
- /**
485
- * 字典键前缀
486
- */
487
- dictionaryKeyPrefix: "",
488
- },
489
- };
490
-
491
- export default config;
492
- ```
493
-
494
- <Tabs>
495
- <Tab value='提取命令'>
496
-
497
- 运行提取器以转换组件并提取内容
498
-
499
- ```bash packageManager="npm"
500
- npx intlayer extract
501
- ```
502
-
503
- ```bash packageManager="pnpm"
504
- pnpm intlayer extract
505
- ```
506
-
507
- ```bash packageManager="yarn"
508
- yarn intlayer extract
509
- ```
510
-
511
- ```bash packageManager="bun"
512
- bun x intlayer extract
513
- ```
514
-
515
- </Tab>
516
- <Tab value='Babel 编译器'>
517
-
518
- > Since v9, the `intlayerCompiler` is included in the `intlayer` plugin. So you don't need to add it manually.
519
-
520
- 更新您的 `vite.config.ts` 以包含 `intlayerCompiler` 插件:
521
-
522
- ```ts fileName="vite.config.ts"
523
- import { defineConfig } from "vite";
524
- import { intlayer, intlayerCompiler } from "vite-intlayer";
525
-
526
- export default defineConfig({
527
- plugins: [
528
- intlayer(),
529
- intlayerCompiler(), // Adds the compiler plugin
530
- ],
531
- });
532
- ```
533
-
534
- ```bash packageManager="npm"
535
- npm run build # 或 npm run dev
536
- ```
537
-
538
- ```bash packageManager="pnpm"
539
- pnpm run build # 或 pnpm run dev
540
- ```
541
-
542
- ```bash packageManager="yarn"
543
- yarn build # 或 yarn dev
544
- ```
545
-
546
- ```bash packageManager="bun"
547
- bun run build # 或 bun run dev
548
- ```
549
-
550
- </Tab>
551
- </Tabs>
552
-
553
- </Step>
554
-
555
- </Steps>
556
-
557
- ### TypeScript 配置
558
-
559
- Intlayer 使用模块扩展来利用 TypeScript,使您的代码库更加健壮。
560
-
561
- ![自动补全](https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true)
562
-
563
- ![翻译错误](https://github.com/aymericzip/intlayer/blob/main/docs/assets/translation_error.webp?raw=true)
564
-
565
- 确保您的 TypeScript 配置包含自动生成的类型。
566
-
567
- ```json5 fileName="tsconfig.json"
568
- {
569
- // ... 您现有的 TypeScript 配置
570
- "include": [
571
- // ... 您现有的 TypeScript 配置
572
- ".intlayer/**/*.ts", // 包含自动生成的类型
573
- ],
574
- }
575
- ```
576
-
577
- ### Git 配置
578
-
579
- 建议忽略 Intlayer 生成的文件。这可以避免将它们提交到您的 Git 仓库。
580
-
581
- 为此,您可以将以下说明添加到 `.gitignore` 文件中:
582
-
583
- ```bash
584
- # 忽略 Intlayer 生成的文件
585
- .intlayer
586
- ```
587
-
588
- ### VS Code 扩展
589
-
590
- 为了改善使用 Intlayer 的开发体验,您可以安装**官方 Intlayer VS Code 扩展**。
591
-
592
- [从 VS Code Marketplace 安装](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
593
-
594
- 此扩展提供:
595
-
596
- - 翻译键的**自动补全**。
597
- - 缺失翻译的**实时错误检测**。
598
- - 翻译内容的**内联预览**。
599
- - 轻松创建和更新翻译的**快速操作**。
600
-
601
- 有关使用该扩展的更多信息,请参阅 [Intlayer VS Code 扩展文档](https://intlayer.org/doc/vs-code-extension)。
602
-
603
- ### 深入了解
604
-
605
- 如果您想了解更多,还可以实现[可视化编辑器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_visual_editor.md)或使用 [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_CMS.md) 将您的内容外部化。
606
-
607
- ## 常见问题
608
-
609
- <FAQ>
610
-
611
- <Question title="国际化不使用 UI 框架的 Astro 站点有哪些不同的解决方案?">
612
-
613
- Astro 内置的 `i18n` 选项仅处理语言前缀和重定向,内容层由您自行负责。由此有以下选择:
614
-
615
- - **手写字典**:每个页面直接导入纯 JSON 或 TypeScript 对象。无需依赖,但缺乏类型安全、复数规则以及查找缺失翻译的工具支持。
616
- - **`Intlayer`**:最先进的解决方案。内容可以在代码库中的任何位置声明([靠近每个组件或集中管理](https://intlayer.org/zh/blog/per-component-vs-centralized-i18n)),在构建时进行编译并具备完整类型支持,提供 AI 翻译、CI 缺失翻译检查、可视化编辑器和 CMS。
617
-
618
- 在不使用 UI 框架的情况下,您最希望避免的是引入 i18n 库的运行时开销。Intlayer 在构建时解析内容,因此静态 Astro 页面输出的是已翻译的纯 HTML,完全不包含字典数据。请参阅 [为什么选择 Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/interest_of_intlayer.md)。
619
-
620
- </Question>
621
- <Question title="i18n 会给我的 Astro bundle 体积增加多少?">
622
-
623
- 远少于基于命名空间的方案,因为页面永远不会下载它不渲染的语言目录。Astro 页面是在构建时渲染的,因此它们输出的是纯 HTML,完全不包含字典;只有孤岛才会接收字典。构建时编译器将内容调用解析为组件使用的确切条目,并且 [动态字典](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dynamic_dictionaries/index.md) 会按语言环境拆分剩余内容。与常规替代方案相比,Intlayer 可将 bundle 和页面体积减少高达 50%。请参阅 [Bundle 体积优化](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/bundle_optimization.md) 和 [性能基准](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/benchmark/index.md)。
624
-
625
- </Question>
626
- <Question title="我可以从 i18next 或手写字典迁移而无需重写组件吗?">
627
-
628
- 基本可以。请按照 [i18next 迁移指南](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/migration_from_i18next_to_intlayer.md) 迁移内容。您也可以逐步迁移:[JSON 同步插件](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/plugins/sync-json.md) 将现有的 JSON 目录作为单一真实来源(source of truth),并生成 Intlayer 字典,使两个层在逐个组件迁移时保持同步。
629
-
630
- </Question>
631
- <Question title="我可以保留现有的 JSON 翻译文件吗?">
632
-
633
- 可以。[JSON 同步插件](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/plugins/sync-json.md) 将您的 `/messages/{locale}/{namespace}.json` 文件作为单一真实来源(source of truth),并双向生成 Intlayer 字典。[PO 同步插件](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/plugins/sync-po.md) 对 gettext 目录执行相同的操作,而 [按语言环境组织的文件](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/per_locale_file.md) 允许您按语言拆分内容,而不是将所有语言打包到一个文件中。
634
-
635
- </Question>
636
- <Question title="我必须逐个键迁移我的内容吗?">
637
-
638
- 不需要。运行 `npx intlayer extract`,Intlayer 会读取您的组件,提取面向用户的字符串,并在每个组件旁边生成 `.content` 文件,这样您只需审查 diff,而无需手动逐一复制字符串到语言目录中。本指南的第 15 步详细介绍了此过程。
639
-
640
- 如需全自动流程,[Intlayer Compiler](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/compiler.md) 可在构建时执行相同操作:它在每次更改时扫描您的 JSX、TSX、Vue 和 Svelte 源代码,生成字典并通过热模块替换 (HMR) 保持同步,因此完全无需手动维护键名。
641
-
642
- 开启编译器前有两个限制值得了解:它通过静态分析工作,因此仅在运行时存在的字符串(如 API 错误代码或 CMS 字段)无法被捕获;此外它需要区分用户文本和应用程序逻辑(如 `className="active"` 或状态代码),在大型代码库中需要少量注解。而 [extract 命令](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/cli/extract.md) 则通过让您参与审查避免了这两个问题。
643
-
644
- </Question>
645
- <Question title="有哪些可用的编辑器和 AI 代理工具?">
646
-
647
- 共有 5 个工具,均为可选:
648
-
649
- - **[VS Code 扩展](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/vs_code_extension.md)**:从 `useIntlayer` 键跳转到声明它的内容文件,从组件中提取内容,并从命令面板或专属的 Intlayer 选项卡运行 build、fill、test、push 和 pull。
650
- - **[LSP 服务器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/lsp.md)**:在任何支持 LSP 的编辑器中提供相同的感知能力,支持跳转到定义、查找所有引用、悬停预览翻译值、键和字段的自动补全,以及在键未声明时发出警告。它还可以解析 `i18next`、`react-i18next`、`next-intl` 和 `use-intl` 调用,助力平滑迁移。
651
- - **[MCP 服务器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/mcp_server.md)**:向 Cursor、VS Code、Claude Desktop、Claude Code 和 ChatGPT 公开 Intlayer 文档与 CLI,使 AI 助手能够基于最新文档进行准确回答,并能自行运行 `intlayer fill` 等命令。
652
- - **[Agent Skills](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/agent_skills.md)**:针对特定领域的技能(如 `intlayer-config`、`intlayer-cli` 和 `intlayer-content`,以及每个框架对应的专属技能),教导 AI 代理您的路由配置和内容节点类型。
653
- - **[ESLint 插件](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/eslint.md)**:`no-raw-text` 规则标记硬编码字符串,并提供针对静态字典键和未使用内容的额外规则。
654
-
655
- </Question>
656
- <Question title="页面上是否需要 JavaScript 才能使翻译生效?">
657
-
658
- 不需要。Astro 在构建时渲染页面,Intlayer 在该渲染过程中直接解析内容,因此生成的 HTML 已经包含了翻译好的文本。`vanilla-intlayer` 仅在您于浏览器中实现交互的部分才需要引入。
659
-
660
- </Question>
661
- <Question title="后续如果添加交互式孤岛,是否需要更改现有内容?">
662
-
663
- 不需要,这正是统一内容层的优势所在。无论是后续引入 [React](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_astro_react.md)、[Vue](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_astro_vue.md)、[Svelte](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_astro_svelte.md)、[Solid](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_astro_solid.md)、[Preact](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_astro_preact.md) 还是 [Lit](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_astro_lit.md),页面上的 `astro-intlayer` 与孤岛组件中的框架绑定均直接读取完全相同的内容声明。
664
-
665
- </Question>
666
- <Question title="如何设置支持语言环境的路由和语言切换器?">
667
-
668
- 第 6 步介绍了切换器。`routing.mode` 决定 URL 方案:`"prefix-no-default"`(默认)、`"prefix-all"`、`"no-prefix"` 或 `"search-params"`,而 `routing.domains` 可将语言环境映射到其独立域名。`getLocalizedUrl` 会重写当前路径,使切换语言时读者保留在同一页面。请参阅 [配置参考](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/configuration.md)。
669
-
670
- </Question>
671
- <Question title="如何生成本地化站点地图和 hreflang 标签?">
672
-
673
- 第 7 步涵盖了 `sitemap.xml` 和 `robots.txt`。`getMultilingualUrls` 为每个声明的语言环境构建备用链接(包括 `x-default`),搜索引擎以此为不同受众提供对应语言版本。
674
-
675
- </Question>
676
- <Question title="如何使用 AI 自动翻译站点?">
677
-
678
- 运行 `npx intlayer fill`。它会使用您选择的 LLM、您自己的提供商和 API 密钥填充缺失的翻译,并且 `--git-diff` 参数可将处理范围限制在当前分支修改的内容。请参阅 [fill 命令](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/cli/fill.md) 和 [CI/CD 集成](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/CI_CD.md)。
679
-
680
- </Question>
681
- <Question title="Intlayer 是否支持复数、性别和富文本?">
682
-
683
- 支持:包括 [复数形式](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/plurial.md)、[基于性别的内容](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/gender.md)、条件渲染、插值用的 [插入内容 (insertions)](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/insertion.md)、长文本使用的 [Markdown](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/markdown.md),以及用于数字、日期和货币的 [格式化工具](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/formatters.md)。
684
-
685
- </Question>
686
- <Question title="翻译人员如何无需接触代码即可编辑内容?">
687
-
688
- 可以通过自托管的 [可视化编辑器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_visual_editor.md)(任何人都可以直接在运行中的应用上就地修改文案),或通过 [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_CMS.md) 进行无需重新部署的内容外部化更新。
689
-
690
- </Question>
691
- <Question title="可视化编辑器的成本是多少?如果我不需要它,会不会显得多余?">
692
-
693
- 如果未进行配置,Intlayer [可视化编辑器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_visual_editor.md)对您的应用程序是 **零成本** 的。额外的逻辑仅在显式启用并在需要时才会加载。
694
-
695
- 即使启用,其开销也极其轻量(仅在激活时动态加载 +5 kB),因为主要逻辑由 [app.intlayer.org](https://app.intlayer.org) 上的服务端编辑器或通过 `intlayer-editor` 软件包进行处理。如果您只需要一个无需可视化编辑的简单翻译方案,Intlayer 不会给您的应用带来任何额外负担。
696
-
697
- </Question>
698
- <Question title="Intlayer 是免费且开源的吗?">
699
-
700
- 是的,基于 Apache 2.0 许可证开源,包含商业用途。托管版 CMS 是可选的付费服务,同时完全支持 [自托管](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/self_hosting.md)。
701
-
702
- </Question>
703
-
704
- </FAQ>