@intlayer/docs 8.3.0-canary.4 → 8.3.1

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 (240) hide show
  1. package/docs/ar/compiler.md +84 -49
  2. package/docs/ar/configuration.md +80 -37
  3. package/docs/ar/intlayer_with_nextjs_16.md +174 -1
  4. package/docs/ar/intlayer_with_nextjs_compiler.md +174 -1
  5. package/docs/ar/intlayer_with_react_router_v7.md +224 -1
  6. package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +225 -1
  7. package/docs/ar/intlayer_with_svelte_kit.md +175 -2
  8. package/docs/ar/intlayer_with_tanstack.md +176 -1
  9. package/docs/ar/intlayer_with_vite+preact.md +174 -1
  10. package/docs/ar/intlayer_with_vite+react.md +174 -1
  11. package/docs/ar/intlayer_with_vite+solid.md +174 -1
  12. package/docs/ar/intlayer_with_vite+svelte.md +174 -1
  13. package/docs/ar/intlayer_with_vite+vue.md +174 -1
  14. package/docs/de/compiler.md +83 -48
  15. package/docs/de/configuration.md +434 -212
  16. package/docs/de/intlayer_with_nextjs_16.md +176 -1
  17. package/docs/de/intlayer_with_nextjs_compiler.md +106 -349
  18. package/docs/de/intlayer_with_react_router_v7.md +225 -2
  19. package/docs/de/intlayer_with_react_router_v7_fs_routes.md +221 -79
  20. package/docs/de/intlayer_with_svelte_kit.md +158 -2
  21. package/docs/de/intlayer_with_tanstack.md +159 -1
  22. package/docs/de/intlayer_with_vite+preact.md +157 -1
  23. package/docs/de/intlayer_with_vite+react.md +157 -1
  24. package/docs/de/intlayer_with_vite+solid.md +159 -3
  25. package/docs/de/intlayer_with_vite+svelte.md +157 -1
  26. package/docs/de/intlayer_with_vite+vue.md +157 -1
  27. package/docs/en/compiler.md +60 -33
  28. package/docs/en/configuration.md +80 -57
  29. package/docs/en/intlayer_with_nextjs_16.md +176 -0
  30. package/docs/en/intlayer_with_nextjs_compiler.md +179 -1
  31. package/docs/en/intlayer_with_react_router_v7.md +159 -0
  32. package/docs/en/intlayer_with_react_router_v7_fs_routes.md +159 -0
  33. package/docs/en/intlayer_with_svelte_kit.md +159 -0
  34. package/docs/en/intlayer_with_tanstack.md +160 -1
  35. package/docs/en/intlayer_with_vite+preact.md +159 -0
  36. package/docs/en/intlayer_with_vite+react.md +159 -0
  37. package/docs/en/intlayer_with_vite+solid.md +148 -27
  38. package/docs/en/intlayer_with_vite+svelte.md +159 -0
  39. package/docs/en/intlayer_with_vite+vue.md +142 -41
  40. package/docs/en-GB/compiler.md +66 -34
  41. package/docs/en-GB/configuration.md +78 -36
  42. package/docs/es/compiler.md +83 -48
  43. package/docs/es/configuration.md +429 -206
  44. package/docs/es/intlayer_with_adonisjs.md +1 -1
  45. package/docs/es/intlayer_with_express.md +1 -1
  46. package/docs/es/intlayer_with_fastify.md +1 -1
  47. package/docs/es/intlayer_with_hono.md +1 -1
  48. package/docs/es/intlayer_with_nestjs.md +1 -1
  49. package/docs/es/intlayer_with_nextjs_16.md +176 -3
  50. package/docs/es/intlayer_with_nextjs_compiler.md +175 -2
  51. package/docs/es/intlayer_with_nuxt.md +1 -1
  52. package/docs/es/intlayer_with_react_router_v7.md +227 -4
  53. package/docs/es/intlayer_with_react_router_v7_fs_routes.md +162 -4
  54. package/docs/es/intlayer_with_svelte_kit.md +158 -2
  55. package/docs/es/intlayer_with_tanstack.md +160 -2
  56. package/docs/es/intlayer_with_vite+preact.md +162 -6
  57. package/docs/es/intlayer_with_vite+react.md +160 -4
  58. package/docs/es/intlayer_with_vite+solid.md +163 -7
  59. package/docs/es/intlayer_with_vite+svelte.md +157 -1
  60. package/docs/es/intlayer_with_vite+vue.md +165 -9
  61. package/docs/fr/compiler.md +81 -46
  62. package/docs/fr/configuration.md +355 -134
  63. package/docs/fr/intlayer_with_adonisjs.md +1 -1
  64. package/docs/fr/intlayer_with_express.md +1 -1
  65. package/docs/fr/intlayer_with_fastify.md +1 -1
  66. package/docs/fr/intlayer_with_hono.md +1 -1
  67. package/docs/fr/intlayer_with_nestjs.md +1 -1
  68. package/docs/fr/intlayer_with_nextjs_16.md +183 -7
  69. package/docs/fr/intlayer_with_nextjs_compiler.md +179 -3
  70. package/docs/fr/intlayer_with_react_router_v7.md +229 -3
  71. package/docs/fr/intlayer_with_react_router_v7_fs_routes.md +237 -6
  72. package/docs/fr/intlayer_with_svelte_kit.md +158 -2
  73. package/docs/fr/intlayer_with_tanstack.md +159 -1
  74. package/docs/fr/intlayer_with_vite+preact.md +164 -8
  75. package/docs/fr/intlayer_with_vite+react.md +162 -6
  76. package/docs/fr/intlayer_with_vite+solid.md +163 -7
  77. package/docs/fr/intlayer_with_vite+svelte.md +157 -1
  78. package/docs/fr/intlayer_with_vite+vue.md +164 -8
  79. package/docs/hi/compiler.md +81 -46
  80. package/docs/hi/configuration.md +87 -44
  81. package/docs/hi/intlayer_with_nextjs_16.md +174 -1
  82. package/docs/hi/intlayer_with_nextjs_compiler.md +174 -1
  83. package/docs/hi/intlayer_with_react_router_v7.md +224 -1
  84. package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +225 -1
  85. package/docs/hi/intlayer_with_svelte_kit.md +158 -2
  86. package/docs/hi/intlayer_with_tanstack.md +159 -1
  87. package/docs/hi/intlayer_with_vite+preact.md +157 -1
  88. package/docs/hi/intlayer_with_vite+react.md +157 -1
  89. package/docs/hi/intlayer_with_vite+solid.md +157 -1
  90. package/docs/hi/intlayer_with_vite+svelte.md +157 -1
  91. package/docs/hi/intlayer_with_vite+vue.md +157 -1
  92. package/docs/id/compiler.md +84 -51
  93. package/docs/id/configuration.md +83 -45
  94. package/docs/id/intlayer_with_nextjs_16.md +174 -1
  95. package/docs/id/intlayer_with_nextjs_compiler.md +174 -1
  96. package/docs/id/intlayer_with_react_router_v7.md +224 -1
  97. package/docs/id/intlayer_with_react_router_v7_fs_routes.md +225 -1
  98. package/docs/id/intlayer_with_svelte_kit.md +158 -2
  99. package/docs/id/intlayer_with_tanstack.md +159 -1
  100. package/docs/id/intlayer_with_vite+preact.md +157 -1
  101. package/docs/id/intlayer_with_vite+react.md +157 -1
  102. package/docs/id/intlayer_with_vite+solid.md +157 -1
  103. package/docs/id/intlayer_with_vite+svelte.md +157 -1
  104. package/docs/id/intlayer_with_vite+vue.md +157 -1
  105. package/docs/it/compiler.md +81 -46
  106. package/docs/it/configuration.md +426 -204
  107. package/docs/it/intlayer_with_nextjs_16.md +174 -1
  108. package/docs/it/intlayer_with_nextjs_compiler.md +174 -1
  109. package/docs/it/intlayer_with_react_router_v7.md +225 -2
  110. package/docs/it/intlayer_with_react_router_v7_fs_routes.md +226 -2
  111. package/docs/it/intlayer_with_svelte_kit.md +158 -2
  112. package/docs/it/intlayer_with_tanstack.md +159 -1
  113. package/docs/it/intlayer_with_vite+preact.md +157 -1
  114. package/docs/it/intlayer_with_vite+react.md +157 -1
  115. package/docs/it/intlayer_with_vite+solid.md +159 -3
  116. package/docs/it/intlayer_with_vite+svelte.md +157 -1
  117. package/docs/it/intlayer_with_vite+vue.md +157 -1
  118. package/docs/ja/compiler.md +94 -58
  119. package/docs/ja/configuration.md +88 -45
  120. package/docs/ja/intlayer_with_nextjs_16.md +174 -1
  121. package/docs/ja/intlayer_with_nextjs_compiler.md +174 -1
  122. package/docs/ja/intlayer_with_react_router_v7.md +184 -394
  123. package/docs/ja/intlayer_with_react_router_v7_fs_routes.md +226 -2
  124. package/docs/ja/intlayer_with_svelte_kit.md +119 -595
  125. package/docs/ja/intlayer_with_tanstack.md +131 -642
  126. package/docs/ja/intlayer_with_vite+preact.md +111 -1231
  127. package/docs/ja/intlayer_with_vite+react.md +129 -1304
  128. package/docs/ja/intlayer_with_vite+solid.md +159 -3
  129. package/docs/ja/intlayer_with_vite+svelte.md +157 -1
  130. package/docs/ja/intlayer_with_vite+vue.md +157 -1
  131. package/docs/ko/compiler.md +88 -52
  132. package/docs/ko/configuration.md +87 -44
  133. package/docs/ko/intlayer_with_nextjs_16.md +174 -1
  134. package/docs/ko/intlayer_with_nextjs_compiler.md +174 -1
  135. package/docs/ko/intlayer_with_react_router_v7.md +225 -2
  136. package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +226 -2
  137. package/docs/ko/intlayer_with_svelte_kit.md +158 -2
  138. package/docs/ko/intlayer_with_tanstack.md +159 -1
  139. package/docs/ko/intlayer_with_vite+preact.md +157 -1
  140. package/docs/ko/intlayer_with_vite+react.md +157 -1
  141. package/docs/ko/intlayer_with_vite+solid.md +159 -3
  142. package/docs/ko/intlayer_with_vite+svelte.md +157 -1
  143. package/docs/ko/intlayer_with_vite+vue.md +157 -1
  144. package/docs/pl/compiler.md +84 -51
  145. package/docs/pl/configuration.md +83 -37
  146. package/docs/pl/intlayer_with_nextjs_16.md +174 -1
  147. package/docs/pl/intlayer_with_nextjs_compiler.md +174 -1
  148. package/docs/pl/intlayer_with_react_router_v7.md +224 -1
  149. package/docs/pl/intlayer_with_react_router_v7_fs_routes.md +225 -1
  150. package/docs/pl/intlayer_with_svelte_kit.md +158 -2
  151. package/docs/pl/intlayer_with_tanstack.md +159 -1
  152. package/docs/pl/intlayer_with_vite+preact.md +157 -1
  153. package/docs/pl/intlayer_with_vite+react.md +157 -1
  154. package/docs/pl/intlayer_with_vite+solid.md +157 -1
  155. package/docs/pl/intlayer_with_vite+svelte.md +157 -1
  156. package/docs/pl/intlayer_with_vite+vue.md +157 -1
  157. package/docs/pt/compiler.md +81 -46
  158. package/docs/pt/configuration.md +404 -194
  159. package/docs/pt/intlayer_with_nextjs_16.md +174 -1
  160. package/docs/pt/intlayer_with_nextjs_compiler.md +174 -1
  161. package/docs/pt/intlayer_with_react_router_v7.md +224 -1
  162. package/docs/pt/intlayer_with_react_router_v7_fs_routes.md +225 -1
  163. package/docs/pt/intlayer_with_svelte_kit.md +158 -2
  164. package/docs/pt/intlayer_with_tanstack.md +159 -1
  165. package/docs/pt/intlayer_with_vite+preact.md +157 -1
  166. package/docs/pt/intlayer_with_vite+react.md +157 -1
  167. package/docs/pt/intlayer_with_vite+solid.md +157 -1
  168. package/docs/pt/intlayer_with_vite+svelte.md +157 -1
  169. package/docs/pt/intlayer_with_vite+vue.md +157 -1
  170. package/docs/ru/compiler.md +90 -57
  171. package/docs/ru/configuration.md +76 -46
  172. package/docs/ru/intlayer_with_nextjs_16.md +174 -1
  173. package/docs/ru/intlayer_with_nextjs_compiler.md +174 -1
  174. package/docs/ru/intlayer_with_react_router_v7.md +224 -1
  175. package/docs/ru/intlayer_with_react_router_v7_fs_routes.md +225 -1
  176. package/docs/ru/intlayer_with_svelte_kit.md +158 -2
  177. package/docs/ru/intlayer_with_tanstack.md +159 -1
  178. package/docs/ru/intlayer_with_vite+preact.md +157 -1
  179. package/docs/ru/intlayer_with_vite+react.md +157 -1
  180. package/docs/ru/intlayer_with_vite+solid.md +157 -1
  181. package/docs/ru/intlayer_with_vite+svelte.md +157 -1
  182. package/docs/ru/intlayer_with_vite+vue.md +157 -1
  183. package/docs/tr/compiler.md +85 -52
  184. package/docs/tr/configuration.md +83 -40
  185. package/docs/tr/intlayer_with_nextjs_16.md +174 -1
  186. package/docs/tr/intlayer_with_nextjs_compiler.md +174 -1
  187. package/docs/tr/intlayer_with_react_router_v7.md +224 -1
  188. package/docs/tr/intlayer_with_react_router_v7_fs_routes.md +225 -1
  189. package/docs/tr/intlayer_with_svelte_kit.md +158 -2
  190. package/docs/tr/intlayer_with_tanstack.md +159 -1
  191. package/docs/tr/intlayer_with_vite+preact.md +157 -1
  192. package/docs/tr/intlayer_with_vite+react.md +157 -1
  193. package/docs/tr/intlayer_with_vite+solid.md +157 -1
  194. package/docs/tr/intlayer_with_vite+svelte.md +157 -1
  195. package/docs/tr/intlayer_with_vite+vue.md +157 -1
  196. package/docs/uk/compiler.md +96 -61
  197. package/docs/uk/configuration.md +83 -37
  198. package/docs/uk/intlayer_with_nextjs_16.md +174 -1
  199. package/docs/uk/intlayer_with_nextjs_compiler.md +174 -1
  200. package/docs/uk/intlayer_with_react_router_v7.md +224 -1
  201. package/docs/uk/intlayer_with_react_router_v7_fs_routes.md +225 -1
  202. package/docs/uk/intlayer_with_svelte_kit.md +157 -1
  203. package/docs/uk/intlayer_with_tanstack.md +159 -1
  204. package/docs/uk/intlayer_with_vite+preact.md +157 -1
  205. package/docs/uk/intlayer_with_vite+react.md +157 -1
  206. package/docs/uk/intlayer_with_vite+solid.md +157 -1
  207. package/docs/uk/intlayer_with_vite+svelte.md +157 -1
  208. package/docs/uk/intlayer_with_vite+vue.md +157 -1
  209. package/docs/vi/compiler.md +85 -50
  210. package/docs/vi/configuration.md +85 -39
  211. package/docs/vi/intlayer_with_nextjs_16.md +174 -1
  212. package/docs/vi/intlayer_with_nextjs_compiler.md +174 -1
  213. package/docs/vi/intlayer_with_react_router_v7.md +224 -1
  214. package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +225 -1
  215. package/docs/vi/intlayer_with_svelte_kit.md +158 -2
  216. package/docs/vi/intlayer_with_tanstack.md +159 -1
  217. package/docs/vi/intlayer_with_vite+preact.md +157 -1
  218. package/docs/vi/intlayer_with_vite+react.md +157 -1
  219. package/docs/vi/intlayer_with_vite+solid.md +157 -1
  220. package/docs/vi/intlayer_with_vite+svelte.md +157 -1
  221. package/docs/vi/intlayer_with_vite+vue.md +157 -1
  222. package/docs/zh/compiler.md +84 -49
  223. package/docs/zh/configuration.md +80 -37
  224. package/docs/zh/intlayer_with_adonisjs.md +1 -1
  225. package/docs/zh/intlayer_with_express.md +1 -1
  226. package/docs/zh/intlayer_with_fastify.md +1 -1
  227. package/docs/zh/intlayer_with_hono.md +1 -1
  228. package/docs/zh/intlayer_with_nestjs.md +1 -1
  229. package/docs/zh/intlayer_with_nextjs_16.md +174 -1
  230. package/docs/zh/intlayer_with_nextjs_compiler.md +174 -1
  231. package/docs/zh/intlayer_with_react_router_v7.md +227 -4
  232. package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +228 -4
  233. package/docs/zh/intlayer_with_svelte_kit.md +158 -2
  234. package/docs/zh/intlayer_with_tanstack.md +159 -1
  235. package/docs/zh/intlayer_with_vite+preact.md +159 -3
  236. package/docs/zh/intlayer_with_vite+react.md +157 -1
  237. package/docs/zh/intlayer_with_vite+solid.md +161 -5
  238. package/docs/zh/intlayer_with_vite+svelte.md +157 -1
  239. package/docs/zh/intlayer_with_vite+vue.md +158 -2
  240. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-09-04
3
- updatedAt: 2025-12-30
3
+ updatedAt: 2026-03-12
4
4
  title: React Router v7 i18n - 如何翻译React Router v7 应用 2026
5
5
  description: 学习如何使用 Intlayer 为您的 React Router v7 应用添加国际化(i18n)。按照本综合指南,使您的应用支持多语言和基于区域的路由。
6
6
  keywords:
@@ -38,7 +38,7 @@ history:
38
38
 
39
39
  本指南演示了如何在 React Router v7 项目中集成 **Intlayer**,实现无缝国际化,支持基于区域的路由、TypeScript 支持以及现代开发实践。
40
40
 
41
- ## Table of Contents
41
+ ## 目录
42
42
 
43
43
  <TOC/>
44
44
 
@@ -101,7 +101,7 @@ bunx intlayer init
101
101
  ## 在 React Router v7 应用程序中使用基于文件系统的路由设置 Intlayer 的分步指南
102
102
 
103
103
  <Tabs defaultTab="video">
104
- <Tab label="Video" value="video">
104
+ <Tab label="视频" value="video">
105
105
 
106
106
  <iframe title="How to translate an React Router v7 app using 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/dS9L7uJeak4?autoplay=0&amp;origin=http://intlayer.org&amp;controls=0&amp;rel=1"/>
107
107
 
@@ -111,7 +111,7 @@ bunx intlayer init
111
111
  <iframe
112
112
  src="https://stackblitz.com/github/aymericzip/intlayer-react-router-v7-template?embed=1&ctl=1&file=intlayer.config.ts"
113
113
  className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
114
- title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
114
+ title="Demo CodeSandbox - 如何使用 Intlayer 实现应用国际化"
115
115
  sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
116
116
  loading="lazy"
117
117
  />
@@ -505,6 +505,229 @@ export default function RootLayout() {
505
505
  }
506
506
  ```
507
507
 
508
+ ### (可选) 步骤 1 : 提取组件内容
509
+
510
+ 如果您有现有的代码库,转换数千个文件可能会非常耗时。
511
+
512
+ 为了简化此过程,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) 来转换您的组件并提取内容。
513
+
514
+ 要进行设置,您可以在 `intlayer.config.ts` 文件中添加 `compiler` 部分:
515
+
516
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
517
+ import { type IntlayerConfig } from "intlayer";
518
+
519
+ const config: IntlayerConfig = {
520
+ // ... 您的其他配置
521
+ compiler: {
522
+ /**
523
+ * 指示是否应启用编译器。
524
+ */
525
+ enabled: true,
526
+
527
+ /**
528
+ * 定义输出文件路径
529
+ */
530
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
531
+
532
+ /**
533
+ * 指示在转换后是否应保存组件。这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
534
+ */
535
+ saveComponents: false,
536
+
537
+ /**
538
+ * 字典键前缀
539
+ */
540
+ dictionaryKeyPrefix: "",
541
+ },
542
+ };
543
+
544
+ export default config;
545
+ ```
546
+
547
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
548
+ /** @type {import('intlayer').IntlayerConfig} */
549
+ const config = {
550
+ // ... 您的其他配置
551
+ compiler: {
552
+ /**
553
+ * 指示是否应启用编译器。
554
+ */
555
+ enabled: true,
556
+
557
+ /**
558
+ * 定义输出文件路径
559
+ */
560
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
561
+
562
+ /**
563
+ * 指示在转换后是否应保存组件。这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
564
+ */
565
+ saveComponents: false,
566
+
567
+ /**
568
+ * 字典键前缀
569
+ */
570
+ dictionaryKeyPrefix: "",
571
+ },
572
+ };
573
+
574
+ export default config;
575
+ ```
576
+
577
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
578
+ /** @type {import('intlayer').IntlayerConfig} */
579
+ const config = {
580
+ // ... 您的其他配置
581
+ compiler: {
582
+ /**
583
+ * 指示是否应启用编译器。
584
+ */
585
+ enabled: true,
586
+
587
+ /**
588
+ * 定义输出文件路径
589
+ */
590
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
591
+
592
+ /**
593
+ * 指示在转换后是否应保存组件。这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
594
+ */
595
+ saveComponents: false,
596
+
597
+ /**
598
+ * 字典键前缀
599
+ */
600
+ dictionaryKeyPrefix: "",
601
+ },
602
+ };
603
+
604
+ module.exports = config;
605
+ ```
606
+
607
+ <Tabs>
608
+ <Tab value='提取命令'>
609
+
610
+ 运行提取器以转换组件并提取内容
611
+
612
+ ```bash packageManager="npm"
613
+ npx intlayer extract
614
+ ```
615
+
616
+ ```bash packageManager="pnpm"
617
+ pnpm intlayer extract
618
+ ```
619
+
620
+ ```bash packageManager="yarn"
621
+ yarn intlayer extract
622
+ ```
623
+
624
+ ```bash packageManager="bun"
625
+ bunx intlayer extract
626
+ ```
627
+
628
+ </Tab>
629
+ <Tab value='Babel 编译器'>
630
+
631
+ 更新您的 `vite.config.ts` 以包含 `intlayerCompiler` 插件:
632
+
633
+ ```ts fileName="vite.config.ts"
634
+ import { defineConfig } from "vite";
635
+ import { intlayer, intlayerCompiler } from "vite-intlayer";
636
+
637
+ export default defineConfig({
638
+ plugins: [
639
+ intlayer(),
640
+ intlayerCompiler(), // 添加编译器插件
641
+ ],
642
+ });
643
+ ```
644
+
645
+ ```bash packageManager="npm"
646
+ npm run build # 或 npm run dev
647
+ ```
648
+
649
+ ```bash packageManager="pnpm"
650
+ pnpm run build # 或 pnpm run dev
651
+ ```
652
+
653
+ ```bash packageManager="yarn"
654
+ yarn build # 或 yarn dev
655
+ ```
656
+
657
+ ```bash packageManager="bun"
658
+ bun run build # Or bun run dev
659
+ ```
660
+
661
+ </Tab>
662
+ </Tabs>
663
+
664
+ ---
665
+
666
+ ## Configure TypeScript
667
+
668
+ Intlayer uses module augmentation to get benefits of TypeScript and make your codebase stronger.
669
+
670
+ Ensure your TypeScript configuration includes the autogenerated types:
671
+
672
+ ```json5 fileName="tsconfig.json"
673
+ {
674
+ // ... your existing configurations
675
+ include: [
676
+ // ... your existing includes
677
+ ".intlayer/**/*.ts", // Include the auto-generated types
678
+ ],
679
+ }
680
+ ```
681
+
682
+ ---
683
+
684
+ ## Git Configuration
685
+
686
+ It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
687
+
688
+ To do this, you can add the following instructions to your `.gitignore` file:
689
+
690
+ ```plaintext fileName=".gitignore"
691
+ # 忽略 Intlayer 生成的文件
692
+ .intlayer
693
+ ```
694
+
695
+ ---
696
+
697
+ ## VS Code Extension
698
+
699
+ To improve your development experience with Intlayer, you can install the official **Intlayer VS Code Extension**.
700
+
701
+ [Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
702
+
703
+ This extension provides:
704
+
705
+ - **Autocompletion** for translation keys.
706
+ - **Real-time error detection** for missing translations.
707
+ - **Inline previews** of translated content.
708
+ - **Quick actions** to easily create and update translations.
709
+
710
+ For more details on how to use the extension, refer to the [Intlayer VS Code Extension documentation](https://intlayer.org/doc/vs-code-extension).
711
+
712
+ ---
713
+
714
+ ## Go Further
715
+
716
+ To go further, you can implement the [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_visual_editor.md) or externalize your content using the [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md).
717
+
718
+ ---
719
+
720
+ ## Documentation References
721
+
722
+ - [Intlayer Documentation](https://intlayer.org)
723
+ - [React Router v7 Documentation](https://reactrouter.com/)
724
+ - [useIntlayer hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useIntlayer.md)
725
+ - [useLocale hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useLocale.md)
726
+ - [Content Declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md)
727
+ - [Configuration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md)
728
+
729
+ This comprehensive guide provides everything you need to integrate Intlayer with React Router v7 for a fully internationalized application with locale-aware routing and TypeScript support.
730
+
508
731
  ### 第11步:添加中间件(可选)
509
732
 
510
733
  你也可以使用 `intlayerProxy` 为你的应用添加服务器端路由。该插件会根据 URL 自动检测当前的语言环境,并设置相应的语言环境 cookie。如果未指定语言环境,插件将根据用户浏览器的语言偏好确定最合适的语言环境。如果仍未检测到语言环境,则会重定向到默认语言环境。
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-09-04
3
- updatedAt: 2025-12-30
3
+ updatedAt: 2026-03-12
4
4
  title: React Router v7 i18n - 如何翻译React Router v7 应用 2026
5
5
  description: 学习如何使用 Intlayer 为您的 React Router v7 应用添加国际化(i18n)。按照本综合指南,使您的应用支持多语言和基于区域的路由。
6
6
  keywords:
@@ -37,7 +37,7 @@ history:
37
37
 
38
38
  对于客户端路由,请参阅 [Intlayer 与 React Router v7](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_react_router_v7.md) 指南。
39
39
 
40
- ## Table of Contents
40
+ ## 目录
41
41
 
42
42
  <TOC/>
43
43
 
@@ -100,7 +100,7 @@ bunx intlayer init
100
100
  ## 在 React Router v7 应用程序中使用基于文件系统的路由设置 Intlayer 的分步指南
101
101
 
102
102
  <Tabs defaultTab="video">
103
- <Tab label="Video" value="video">
103
+ <Tab label="视频" value="video">
104
104
 
105
105
  <iframe title="How to translate an React Router v7 (File-System Routes) app using 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/dS9L7uJeak4?autoplay=0&amp;origin=http://intlayer.org&amp;controls=0&amp;rel=1"/>
106
106
 
@@ -110,7 +110,7 @@ bunx intlayer init
110
110
  <iframe
111
111
  src="https://stackblitz.com/github/aymericzip/intlayer-react-router-v7-template?embed=1&ctl=1&file=intlayer.config.ts"
112
112
  className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
113
- title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
113
+ title="Demo CodeSandbox - 如何使用 Intlayer 实现应用国际化"
114
114
  sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
115
115
  loading="lazy"
116
116
  />
@@ -450,6 +450,230 @@ export default function RootLayout() {
450
450
  }
451
451
  ```
452
452
 
453
+ ### (可选) 步骤 1 : 提取组件内容
454
+
455
+ 如果您有现有的代码库,转换数千个文件可能会非常耗时。
456
+
457
+ 为了简化此过程,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) 来转换您的组件并提取内容。
458
+
459
+ 要进行设置,您可以在 `intlayer.config.ts` 文件中添加 `compiler` 部分:
460
+
461
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
462
+ import { type IntlayerConfig } from "intlayer";
463
+
464
+ const config: IntlayerConfig = {
465
+ // ... 您的其他配置
466
+ compiler: {
467
+ /**
468
+ * 指示是否应启用编译器。
469
+ */
470
+ enabled: true,
471
+
472
+ /**
473
+ * 定义输出文件路径
474
+ */
475
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
476
+
477
+ /**
478
+ * 指示在转换后是否应保存组件。这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
479
+ */
480
+ saveComponents: false,
481
+
482
+ /**
483
+ * 字典键前缀
484
+ */
485
+ dictionaryKeyPrefix: "",
486
+ },
487
+ };
488
+
489
+ export default config;
490
+ ```
491
+
492
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
493
+ /** @type {import('intlayer').IntlayerConfig} */
494
+ const config = {
495
+ // ... 您的其他配置
496
+ compiler: {
497
+ /**
498
+ * 指示是否应启用编译器。
499
+ */
500
+ enabled: true,
501
+
502
+ /**
503
+ * 定义输出文件路径
504
+ */
505
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
506
+
507
+ /**
508
+ * 指示在转换后是否应保存组件。这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
509
+ */
510
+ saveComponents: false,
511
+
512
+ /**
513
+ * 字典键前缀
514
+ */
515
+ dictionaryKeyPrefix: "",
516
+ },
517
+ };
518
+
519
+ export default config;
520
+ ```
521
+
522
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
523
+ /** @type {import('intlayer').IntlayerConfig} */
524
+ const config = {
525
+ // ... 您的其他配置
526
+ compiler: {
527
+ /**
528
+ * 指示是否应启用编译器。
529
+ */
530
+ enabled: true,
531
+
532
+ /**
533
+ * 定义输出文件路径
534
+ */
535
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
536
+
537
+ /**
538
+ * 指示在转换后是否应保存组件。这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
539
+ */
540
+ saveComponents: false,
541
+
542
+ /**
543
+ * 字典键前缀
544
+ */
545
+ dictionaryKeyPrefix: "",
546
+ },
547
+ };
548
+
549
+ module.exports = config;
550
+ ```
551
+
552
+ <Tabs>
553
+ <Tab value='提取命令'>
554
+
555
+ 运行提取器以转换组件并提取内容
556
+
557
+ ```bash packageManager="npm"
558
+ npx intlayer extract
559
+ ```
560
+
561
+ ```bash packageManager="pnpm"
562
+ pnpm intlayer extract
563
+ ```
564
+
565
+ ```bash packageManager="yarn"
566
+ yarn intlayer extract
567
+ ```
568
+
569
+ ```bash packageManager="bun"
570
+ bunx intlayer extract
571
+ ```
572
+
573
+ </Tab>
574
+ <Tab value='Babel 编译器'>
575
+
576
+ 更新您的 `vite.config.ts` 以包含 `intlayerCompiler` 插件:
577
+
578
+ ```ts fileName="vite.config.ts"
579
+ import { defineConfig } from "vite";
580
+ import { intlayer, intlayerCompiler } from "vite-intlayer";
581
+
582
+ export default defineConfig({
583
+ plugins: [
584
+ intlayer(),
585
+ intlayerCompiler(), // 添加编译器插件
586
+ ],
587
+ });
588
+ ```
589
+
590
+ ```bash packageManager="npm"
591
+ npm run build # 或 npm run dev
592
+ ```
593
+
594
+ ```bash packageManager="pnpm"
595
+ pnpm run build # 或 pnpm run dev
596
+ ```
597
+
598
+ ```bash packageManager="yarn"
599
+ yarn build # 或 yarn dev
600
+ ```
601
+
602
+ ```bash packageManager="bun"
603
+ bun run build # Or bun run dev
604
+ ```
605
+
606
+ </Tab>
607
+ </Tabs>
608
+
609
+ ---
610
+
611
+ ## Configure TypeScript
612
+
613
+ Intlayer uses module augmentation to get benefits of TypeScript and make your codebase stronger.
614
+
615
+ Ensure your TypeScript configuration includes the autogenerated types:
616
+
617
+ ```json5 fileName="tsconfig.json"
618
+ {
619
+ // ... your existing configurations
620
+ include: [
621
+ // ... your existing includes
622
+ ".intlayer/**/*.ts", // Include the auto-generated types
623
+ ],
624
+ }
625
+ ```
626
+
627
+ ---
628
+
629
+ ## Git Configuration
630
+
631
+ It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
632
+
633
+ To do this, you can add the following instructions to your `.gitignore` file:
634
+
635
+ ```plaintext fileName=".gitignore"
636
+ # 忽略 Intlayer 生成的文件
637
+ .intlayer
638
+ ```
639
+
640
+ ---
641
+
642
+ ## VS Code Extension
643
+
644
+ To improve your development experience with Intlayer, you can install the official **Intlayer VS Code Extension**.
645
+
646
+ [Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
647
+
648
+ This extension provides:
649
+
650
+ - **Autocompletion** for translation keys.
651
+ - **Real-time error detection** for missing translations.
652
+ - **Inline previews** of translated content.
653
+ - **Quick actions** to easily create and update translations.
654
+
655
+ For more details on how to use the extension, refer to the [Intlayer VS Code Extension documentation](https://intlayer.org/doc/vs-code-extension).
656
+
657
+ ---
658
+
659
+ ## Go Further
660
+
661
+ To go further, you can implement the [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_visual_editor.md) or externalize your content using the [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md).
662
+
663
+ ---
664
+
665
+ ## Documentation References
666
+
667
+ - [Intlayer Documentation](https://intlayer.org)
668
+ - [React Router v7 Documentation](https://reactrouter.com/)
669
+ - [React Router fs-routes Documentation](https://reactrouter.com/how-to/file-route-conventions)
670
+ - [useIntlayer hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useIntlayer.md)
671
+ - [useLocale hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useLocale.md)
672
+ - [Content Declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md)
673
+ - [Configuration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md)
674
+
675
+ This comprehensive guide provides everything you need to integrate Intlayer with React Router v7 using file-system based routing for a fully internationalized application with locale-aware routing and TypeScript support.
676
+
453
677
  ### 第11步:添加中间件(可选)
454
678
 
455
679
  你也可以使用 `intlayerProxy` 为你的应用添加服务器端路由。该插件会根据 URL 自动检测当前的语言环境,并设置相应的语言环境 cookie。如果未指定语言环境,插件将根据用户浏览器的语言偏好确定最合适的语言环境。如果仍未检测到语言环境,则会重定向到默认语言环境。
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-11-20
3
- updatedAt: 2025-12-30
3
+ updatedAt: 2026-03-12
4
4
  title: SvelteKit i18n - 如何翻译SvelteKit 应用 2026
5
5
  description: 了解如何使您的 SvelteKit 网站支持多语言。按照文档使用服务器端渲染 (SSR) 进行国际化 (i18n) 和翻译。
6
6
  keywords:
@@ -185,7 +185,7 @@ export default heroContent;
185
185
 
186
186
  > **注意:** `useIntlayer` 返回一个 Svelte 存储,因此你需要使用 `---
187
187
  > createdAt: 2025-11-20
188
- > updatedAt: 2025-11-20
188
+ > updatedAt: 2026-03-12
189
189
  > title: 如何翻译您的 SvelteKit 应用 – 2025 年国际化 (i18n) 指南
190
190
  > description: 了解如何使您的 SvelteKit 网站支持多语言。按照文档使用服务器端渲染 (SSR) 进行国际化 (i18n) 和翻译。
191
191
  > keywords:
@@ -744,6 +744,162 @@ export default defineConfig({
744
744
 
745
745
  ---
746
746
 
747
+ ### (可选) 步骤 1 : 提取组件内容
748
+
749
+ 如果您有现有的代码库,转换数千个文件可能会非常耗时。
750
+
751
+ 为了简化此过程,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) 来转换您的组件并提取内容。
752
+
753
+ 要进行设置,您可以在 `intlayer.config.ts` 文件中添加 `compiler` 部分:
754
+
755
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
756
+ import { type IntlayerConfig } from "intlayer";
757
+
758
+ const config: IntlayerConfig = {
759
+ // ... 您的其他配置
760
+ compiler: {
761
+ /**
762
+ * 指示是否应启用编译器。
763
+ */
764
+ enabled: true,
765
+
766
+ /**
767
+ * 定义输出文件路径
768
+ */
769
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
770
+
771
+ /**
772
+ * 指示在转换后是否应保存组件。这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
773
+ */
774
+ saveComponents: false,
775
+
776
+ /**
777
+ * 字典键前缀
778
+ */
779
+ dictionaryKeyPrefix: "",
780
+ },
781
+ };
782
+
783
+ export default config;
784
+ ```
785
+
786
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
787
+ /** @type {import('intlayer').IntlayerConfig} */
788
+ const config = {
789
+ // ... 您的其他配置
790
+ compiler: {
791
+ /**
792
+ * 指示是否应启用编译器。
793
+ */
794
+ enabled: true,
795
+
796
+ /**
797
+ * 定义输出文件路径
798
+ */
799
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
800
+
801
+ /**
802
+ * 指示在转换后是否应保存组件。这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
803
+ */
804
+ saveComponents: false,
805
+
806
+ /**
807
+ * 字典键前缀
808
+ */
809
+ dictionaryKeyPrefix: "",
810
+ },
811
+ };
812
+
813
+ export default config;
814
+ ```
815
+
816
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
817
+ /** @type {import('intlayer').IntlayerConfig} */
818
+ const config = {
819
+ // ... 您的其他配置
820
+ compiler: {
821
+ /**
822
+ * 指示是否应启用编译器。
823
+ */
824
+ enabled: true,
825
+
826
+ /**
827
+ * 定义输出文件路径
828
+ */
829
+ output: ({ fileName, extension }) => `./${fileName}${extension}`,
830
+
831
+ /**
832
+ * 指示在转换后是否应保存组件。这样,编译器只需运行一次即可转换应用程序,然后即可将其删除。
833
+ */
834
+ saveComponents: false,
835
+
836
+ /**
837
+ * 字典键前缀
838
+ */
839
+ dictionaryKeyPrefix: "",
840
+ },
841
+ };
842
+
843
+ module.exports = config;
844
+ ```
845
+
846
+ <Tabs>
847
+ <Tab value='提取命令'>
848
+
849
+ 运行提取器以转换组件并提取内容
850
+
851
+ ```bash packageManager="npm"
852
+ npx intlayer extract
853
+ ```
854
+
855
+ ```bash packageManager="pnpm"
856
+ pnpm intlayer extract
857
+ ```
858
+
859
+ ```bash packageManager="yarn"
860
+ yarn intlayer extract
861
+ ```
862
+
863
+ ```bash packageManager="bun"
864
+ bunx intlayer extract
865
+ ```
866
+
867
+ </Tab>
868
+ <Tab value='Babel 编译器'>
869
+
870
+ 更新您的 `vite.config.ts` 以包含 `intlayerCompiler` 插件:
871
+
872
+ ```ts fileName="vite.config.ts"
873
+ import { defineConfig } from "vite";
874
+ import { intlayer, intlayerCompiler } from "vite-intlayer";
875
+
876
+ export default defineConfig({
877
+ plugins: [
878
+ intlayer(),
879
+ intlayerCompiler(), // 添加编译器插件
880
+ ],
881
+ });
882
+ ```
883
+
884
+ ```bash packageManager="npm"
885
+ npm run build # 或 npm run dev
886
+ ```
887
+
888
+ ```bash packageManager="pnpm"
889
+ pnpm run build # 或 pnpm run dev
890
+ ```
891
+
892
+ ```bash packageManager="yarn"
893
+ yarn build # 或 yarn dev
894
+ ```
895
+
896
+ ```bash packageManager="bun"
897
+ bun run build # Or bun run dev
898
+ ```
899
+
900
+ </Tab>
901
+ </Tabs>
902
+
747
903
  ### 深入了解
748
904
 
749
905
  - **可视化编辑器**:集成[Intlayer 可视化编辑器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_visual_editor.md),以便直接从用户界面编辑翻译内容。