@intlayer/docs 6.1.5 → 6.1.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 (284) hide show
  1. package/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md +404 -173
  2. package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +262 -113
  3. package/blog/en/intlayer_with_next-i18next.mdx +431 -0
  4. package/blog/en/intlayer_with_next-intl.mdx +335 -0
  5. package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +463 -209
  6. package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  7. package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +185 -71
  8. package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  9. package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  10. package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  11. package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  12. package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  13. package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +36 -28
  14. package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  15. package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  16. package/dist/cjs/generated/docs.entry.cjs +32 -0
  17. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  18. package/dist/esm/generated/docs.entry.mjs +32 -0
  19. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  20. package/dist/types/generated/docs.entry.d.ts +2 -0
  21. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  22. package/docs/ar/component_i18n.md +186 -0
  23. package/docs/ar/intlayer_with_angular.md +2 -2
  24. package/docs/ar/intlayer_with_astro.md +246 -0
  25. package/docs/ar/intlayer_with_create_react_app.md +3 -2
  26. package/docs/ar/intlayer_with_express.md +2 -2
  27. package/docs/ar/intlayer_with_nestjs.md +2 -2
  28. package/docs/ar/intlayer_with_nextjs_14.md +2 -2
  29. package/docs/ar/intlayer_with_nextjs_15.md +2 -2
  30. package/docs/ar/intlayer_with_nextjs_page_router.md +2 -2
  31. package/docs/ar/intlayer_with_nuxt.md +2 -2
  32. package/docs/ar/intlayer_with_react_native+expo.md +11 -20
  33. package/docs/ar/intlayer_with_react_router_v7.md +195 -241
  34. package/docs/ar/intlayer_with_tanstack.md +198 -272
  35. package/docs/ar/intlayer_with_vite+preact.md +9 -9
  36. package/docs/ar/intlayer_with_vite+react.md +7 -7
  37. package/docs/ar/intlayer_with_vite+vue.md +9 -9
  38. package/docs/ar/vs_code_extension.md +48 -109
  39. package/docs/de/component_i18n.md +186 -0
  40. package/docs/de/intlayer_with_angular.md +2 -2
  41. package/docs/de/intlayer_with_astro.md +246 -0
  42. package/docs/de/intlayer_with_create_react_app.md +2 -2
  43. package/docs/de/intlayer_with_express.md +2 -2
  44. package/docs/de/intlayer_with_nestjs.md +2 -2
  45. package/docs/de/intlayer_with_nextjs_14.md +2 -2
  46. package/docs/de/intlayer_with_nextjs_15.md +2 -2
  47. package/docs/de/intlayer_with_nextjs_page_router.md +2 -2
  48. package/docs/de/intlayer_with_nuxt.md +2 -2
  49. package/docs/de/intlayer_with_react_native+expo.md +11 -20
  50. package/docs/de/intlayer_with_react_router_v7.md +193 -242
  51. package/docs/de/intlayer_with_tanstack.md +194 -266
  52. package/docs/de/intlayer_with_vite+preact.md +9 -9
  53. package/docs/de/intlayer_with_vite+react.md +9 -9
  54. package/docs/de/intlayer_with_vite+vue.md +11 -11
  55. package/docs/de/packages/vite-intlayer/index.md +3 -3
  56. package/docs/de/vs_code_extension.md +46 -107
  57. package/docs/en/component_i18n.md +186 -0
  58. package/docs/en/how_works_intlayer.md +1 -1
  59. package/docs/en/index.md +1 -1
  60. package/docs/en/intlayer_cli.md +1 -1
  61. package/docs/en/intlayer_with_angular.md +4 -4
  62. package/docs/en/intlayer_with_astro.md +246 -0
  63. package/docs/en/intlayer_with_create_react_app.md +4 -4
  64. package/docs/en/intlayer_with_express.md +3 -3
  65. package/docs/en/intlayer_with_lynx+react.md +1 -1
  66. package/docs/en/intlayer_with_nestjs.md +2 -2
  67. package/docs/en/intlayer_with_nextjs_14.md +31 -5
  68. package/docs/en/intlayer_with_nextjs_15.md +31 -5
  69. package/docs/en/intlayer_with_nextjs_page_router.md +5 -5
  70. package/docs/en/intlayer_with_nuxt.md +4 -4
  71. package/docs/en/intlayer_with_react_native+expo.md +46 -24
  72. package/docs/en/intlayer_with_react_router_v7.md +164 -211
  73. package/docs/en/intlayer_with_tanstack.md +166 -241
  74. package/docs/en/intlayer_with_vite+preact.md +12 -12
  75. package/docs/en/intlayer_with_vite+react.md +12 -12
  76. package/docs/en/intlayer_with_vite+solid.md +2 -2
  77. package/docs/en/intlayer_with_vite+svelte.md +2 -2
  78. package/docs/en/intlayer_with_vite+vue.md +12 -12
  79. package/docs/en/introduction.md +1 -1
  80. package/docs/en/packages/next-intlayer/useDictionary.md +1 -1
  81. package/docs/en/packages/next-intlayer/useIntlayer.md +1 -1
  82. package/docs/en/packages/react-intlayer/useDictionary.md +1 -1
  83. package/docs/en/packages/react-intlayer/useI18n.md +1 -1
  84. package/docs/en/packages/react-intlayer/useIntlayer.md +1 -1
  85. package/docs/en/releases/v6.md +1 -0
  86. package/docs/en/roadmap.md +1 -1
  87. package/docs/en/vs_code_extension.md +24 -114
  88. package/docs/en-GB/component_i18n.md +186 -0
  89. package/docs/en-GB/intlayer_with_angular.md +3 -3
  90. package/docs/en-GB/intlayer_with_astro.md +246 -0
  91. package/docs/en-GB/intlayer_with_create_react_app.md +5 -4
  92. package/docs/en-GB/intlayer_with_express.md +2 -2
  93. package/docs/en-GB/intlayer_with_nestjs.md +2 -2
  94. package/docs/en-GB/intlayer_with_nextjs_14.md +4 -4
  95. package/docs/en-GB/intlayer_with_nextjs_15.md +2 -2
  96. package/docs/en-GB/intlayer_with_nextjs_page_router.md +2 -2
  97. package/docs/en-GB/intlayer_with_nuxt.md +2 -2
  98. package/docs/en-GB/intlayer_with_react_native+expo.md +11 -20
  99. package/docs/en-GB/intlayer_with_react_router_v7.md +171 -220
  100. package/docs/en-GB/intlayer_with_tanstack.md +174 -248
  101. package/docs/en-GB/intlayer_with_vite+preact.md +9 -9
  102. package/docs/en-GB/intlayer_with_vite+react.md +9 -9
  103. package/docs/en-GB/intlayer_with_vite+vue.md +11 -11
  104. package/docs/en-GB/packages/next-intlayer/useIntlayer.md +1 -1
  105. package/docs/en-GB/packages/react-intlayer/useIntlayer.md +1 -1
  106. package/docs/en-GB/vs_code_extension.md +42 -103
  107. package/docs/es/component_i18n.md +182 -0
  108. package/docs/es/intlayer_with_angular.md +2 -2
  109. package/docs/es/intlayer_with_astro.md +246 -0
  110. package/docs/es/intlayer_with_create_react_app.md +3 -2
  111. package/docs/es/intlayer_with_express.md +2 -2
  112. package/docs/es/intlayer_with_nextjs_14.md +2 -2
  113. package/docs/es/intlayer_with_nextjs_15.md +2 -2
  114. package/docs/es/intlayer_with_react_native+expo.md +11 -20
  115. package/docs/es/intlayer_with_react_router_v7.md +188 -232
  116. package/docs/es/intlayer_with_tanstack.md +203 -273
  117. package/docs/es/intlayer_with_vite+preact.md +7 -7
  118. package/docs/es/intlayer_with_vite+react.md +7 -7
  119. package/docs/es/intlayer_with_vite+vue.md +9 -9
  120. package/docs/es/vs_code_extension.md +53 -114
  121. package/docs/fr/component_i18n.md +186 -0
  122. package/docs/fr/intlayer_with_angular.md +2 -2
  123. package/docs/fr/intlayer_with_astro.md +246 -0
  124. package/docs/fr/intlayer_with_create_react_app.md +3 -2
  125. package/docs/fr/intlayer_with_express.md +2 -2
  126. package/docs/fr/intlayer_with_nestjs.md +2 -2
  127. package/docs/fr/intlayer_with_nextjs_14.md +2 -2
  128. package/docs/fr/intlayer_with_react_native+expo.md +11 -20
  129. package/docs/fr/intlayer_with_react_router_v7.md +188 -248
  130. package/docs/fr/intlayer_with_tanstack.md +192 -265
  131. package/docs/fr/intlayer_with_vite+preact.md +7 -7
  132. package/docs/fr/intlayer_with_vite+react.md +7 -7
  133. package/docs/fr/intlayer_with_vite+vue.md +9 -9
  134. package/docs/fr/vs_code_extension.md +50 -111
  135. package/docs/hi/component_i18n.md +186 -0
  136. package/docs/hi/intlayer_cli.md +1 -4
  137. package/docs/hi/intlayer_with_angular.md +2 -2
  138. package/docs/hi/intlayer_with_astro.md +246 -0
  139. package/docs/hi/intlayer_with_create_react_app.md +2 -2
  140. package/docs/hi/intlayer_with_express.md +2 -2
  141. package/docs/hi/intlayer_with_nestjs.md +2 -2
  142. package/docs/hi/intlayer_with_nextjs_14.md +2 -2
  143. package/docs/hi/intlayer_with_nextjs_15.md +2 -2
  144. package/docs/hi/intlayer_with_nextjs_page_router.md +2 -2
  145. package/docs/hi/intlayer_with_nuxt.md +2 -2
  146. package/docs/hi/intlayer_with_react_native+expo.md +11 -20
  147. package/docs/hi/intlayer_with_react_router_v7.md +199 -243
  148. package/docs/hi/intlayer_with_tanstack.md +210 -285
  149. package/docs/hi/intlayer_with_vite+preact.md +9 -9
  150. package/docs/hi/intlayer_with_vite+react.md +9 -9
  151. package/docs/hi/intlayer_with_vite+solid.md +1 -1
  152. package/docs/hi/intlayer_with_vite+vue.md +11 -11
  153. package/docs/hi/vs_code_extension.md +49 -110
  154. package/docs/it/component_i18n.md +186 -0
  155. package/docs/it/intlayer_with_angular.md +2 -2
  156. package/docs/it/intlayer_with_astro.md +246 -0
  157. package/docs/it/intlayer_with_create_react_app.md +3 -2
  158. package/docs/it/intlayer_with_express.md +2 -2
  159. package/docs/it/intlayer_with_nestjs.md +2 -2
  160. package/docs/it/intlayer_with_nextjs_14.md +2 -2
  161. package/docs/it/intlayer_with_nextjs_15.md +2 -2
  162. package/docs/it/intlayer_with_nextjs_page_router.md +2 -2
  163. package/docs/it/intlayer_with_nuxt.md +2 -2
  164. package/docs/it/intlayer_with_react_native+expo.md +11 -21
  165. package/docs/it/intlayer_with_react_router_v7.md +195 -242
  166. package/docs/it/intlayer_with_tanstack.md +203 -267
  167. package/docs/it/intlayer_with_vite+preact.md +9 -9
  168. package/docs/it/intlayer_with_vite+react.md +13 -11
  169. package/docs/it/intlayer_with_vite+vue.md +11 -11
  170. package/docs/it/vs_code_extension.md +50 -111
  171. package/docs/ja/component_i18n.md +186 -0
  172. package/docs/ja/intlayer_with_angular.md +2 -2
  173. package/docs/ja/intlayer_with_astro.md +246 -0
  174. package/docs/ja/intlayer_with_create_react_app.md +3 -2
  175. package/docs/ja/intlayer_with_express.md +2 -2
  176. package/docs/ja/intlayer_with_nestjs.md +2 -2
  177. package/docs/ja/intlayer_with_nextjs_14.md +2 -2
  178. package/docs/ja/intlayer_with_nextjs_15.md +2 -2
  179. package/docs/ja/intlayer_with_nextjs_page_router.md +2 -2
  180. package/docs/ja/intlayer_with_nuxt.md +2 -2
  181. package/docs/ja/intlayer_with_react_native+expo.md +18 -29
  182. package/docs/ja/intlayer_with_react_router_v7.md +204 -250
  183. package/docs/ja/intlayer_with_tanstack.md +218 -286
  184. package/docs/ja/intlayer_with_vite+preact.md +9 -9
  185. package/docs/ja/intlayer_with_vite+react.md +11 -11
  186. package/docs/ja/intlayer_with_vite+vue.md +11 -11
  187. package/docs/ja/vs_code_extension.md +50 -111
  188. package/docs/ko/component_i18n.md +186 -0
  189. package/docs/ko/intlayer_with_angular.md +2 -2
  190. package/docs/ko/intlayer_with_astro.md +246 -0
  191. package/docs/ko/intlayer_with_create_react_app.md +3 -2
  192. package/docs/ko/intlayer_with_express.md +2 -2
  193. package/docs/ko/intlayer_with_nestjs.md +2 -2
  194. package/docs/ko/intlayer_with_nextjs_14.md +2 -2
  195. package/docs/ko/intlayer_with_nextjs_15.md +2 -2
  196. package/docs/ko/intlayer_with_nextjs_page_router.md +2 -2
  197. package/docs/ko/intlayer_with_nuxt.md +2 -2
  198. package/docs/ko/intlayer_with_react_native+expo.md +19 -28
  199. package/docs/ko/intlayer_with_react_router_v7.md +190 -244
  200. package/docs/ko/intlayer_with_tanstack.md +200 -270
  201. package/docs/ko/intlayer_with_vite+preact.md +9 -9
  202. package/docs/ko/intlayer_with_vite+react.md +9 -9
  203. package/docs/ko/intlayer_with_vite+vue.md +11 -11
  204. package/docs/ko/vs_code_extension.md +48 -109
  205. package/docs/pt/component_i18n.md +186 -0
  206. package/docs/pt/intlayer_with_angular.md +2 -2
  207. package/docs/pt/intlayer_with_astro.md +246 -0
  208. package/docs/pt/intlayer_with_create_react_app.md +3 -2
  209. package/docs/pt/intlayer_with_express.md +2 -2
  210. package/docs/pt/intlayer_with_nestjs.md +2 -2
  211. package/docs/pt/intlayer_with_nextjs_14.md +2 -2
  212. package/docs/pt/intlayer_with_nextjs_15.md +2 -2
  213. package/docs/pt/intlayer_with_nextjs_page_router.md +2 -2
  214. package/docs/pt/intlayer_with_nuxt.md +2 -2
  215. package/docs/pt/intlayer_with_react_native+expo.md +11 -20
  216. package/docs/pt/intlayer_with_react_router_v7.md +7 -13
  217. package/docs/pt/intlayer_with_tanstack.md +183 -258
  218. package/docs/pt/intlayer_with_vite+preact.md +9 -9
  219. package/docs/pt/intlayer_with_vite+react.md +9 -9
  220. package/docs/pt/intlayer_with_vite+vue.md +9 -9
  221. package/docs/pt/vs_code_extension.md +46 -107
  222. package/docs/ru/component_i18n.md +186 -0
  223. package/docs/ru/intlayer_with_angular.md +2 -2
  224. package/docs/ru/intlayer_with_astro.md +246 -0
  225. package/docs/ru/intlayer_with_create_react_app.md +3 -2
  226. package/docs/ru/intlayer_with_express.md +2 -2
  227. package/docs/ru/intlayer_with_nestjs.md +2 -2
  228. package/docs/ru/intlayer_with_nextjs_14.md +2 -2
  229. package/docs/ru/intlayer_with_nextjs_15.md +2 -2
  230. package/docs/ru/intlayer_with_nextjs_page_router.md +2 -2
  231. package/docs/ru/intlayer_with_nuxt.md +2 -2
  232. package/docs/ru/intlayer_with_react_native+expo.md +11 -20
  233. package/docs/ru/intlayer_with_react_router_v7.md +192 -238
  234. package/docs/ru/intlayer_with_tanstack.md +197 -269
  235. package/docs/ru/intlayer_with_vite+preact.md +9 -9
  236. package/docs/ru/intlayer_with_vite+react.md +9 -9
  237. package/docs/ru/intlayer_with_vite+vue.md +11 -11
  238. package/docs/ru/vs_code_extension.md +48 -109
  239. package/docs/tr/component_i18n.md +186 -0
  240. package/docs/tr/how_works_intlayer.md +1 -1
  241. package/docs/tr/index.md +1 -1
  242. package/docs/tr/intlayer_cli.md +1 -1
  243. package/docs/tr/intlayer_with_angular.md +4 -4
  244. package/docs/tr/intlayer_with_astro.md +246 -0
  245. package/docs/tr/intlayer_with_create_react_app.md +4 -4
  246. package/docs/tr/intlayer_with_express.md +3 -3
  247. package/docs/tr/intlayer_with_lynx+react.md +1 -1
  248. package/docs/tr/intlayer_with_nestjs.md +2 -2
  249. package/docs/tr/intlayer_with_nextjs_14.md +2 -2
  250. package/docs/tr/intlayer_with_nextjs_15.md +4 -4
  251. package/docs/tr/intlayer_with_nextjs_page_router.md +5 -5
  252. package/docs/tr/intlayer_with_nuxt.md +4 -4
  253. package/docs/tr/intlayer_with_react_native+expo.md +12 -21
  254. package/docs/tr/intlayer_with_react_router_v7.md +222 -267
  255. package/docs/tr/intlayer_with_tanstack.md +400 -303
  256. package/docs/tr/intlayer_with_vite+preact.md +12 -12
  257. package/docs/tr/intlayer_with_vite+react.md +12 -12
  258. package/docs/tr/intlayer_with_vite+solid.md +2 -2
  259. package/docs/tr/intlayer_with_vite+svelte.md +2 -2
  260. package/docs/tr/intlayer_with_vite+vue.md +12 -12
  261. package/docs/tr/introduction.md +1 -1
  262. package/docs/tr/packages/react-intlayer/useDictionary.md +1 -1
  263. package/docs/tr/packages/react-intlayer/useI18n.md +1 -1
  264. package/docs/tr/roadmap.md +1 -1
  265. package/docs/tr/vs_code_extension.md +54 -115
  266. package/docs/zh/component_i18n.md +186 -0
  267. package/docs/zh/intlayer_with_angular.md +2 -2
  268. package/docs/zh/intlayer_with_astro.md +246 -0
  269. package/docs/zh/intlayer_with_create_react_app.md +3 -2
  270. package/docs/zh/intlayer_with_express.md +2 -2
  271. package/docs/zh/intlayer_with_nestjs.md +2 -2
  272. package/docs/zh/intlayer_with_nextjs_14.md +2 -2
  273. package/docs/zh/intlayer_with_nextjs_15.md +2 -2
  274. package/docs/zh/intlayer_with_nextjs_page_router.md +2 -2
  275. package/docs/zh/intlayer_with_nuxt.md +2 -2
  276. package/docs/zh/intlayer_with_react_native+expo.md +19 -28
  277. package/docs/zh/intlayer_with_react_router_v7.md +200 -248
  278. package/docs/zh/intlayer_with_tanstack.md +208 -283
  279. package/docs/zh/intlayer_with_vite+preact.md +9 -9
  280. package/docs/zh/intlayer_with_vite+react.md +9 -9
  281. package/docs/zh/intlayer_with_vite+vue.md +9 -9
  282. package/docs/zh/vs_code_extension.md +51 -105
  283. package/package.json +10 -10
  284. package/src/generated/docs.entry.ts +32 -0
@@ -19,6 +19,8 @@ slugs:
19
19
 
20
20
  # next-i18next VS next-intl VS intlayer | Next.js Internationalisierung (i18n)
21
21
 
22
+ ![next-i18next VS next-intl VS intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/assets/i18next-next-intl-intlayer.png?raw=true)
23
+
22
24
  Werfen wir einen Blick auf die Gemeinsamkeiten und Unterschiede zwischen drei i18n-Optionen für Next.js: next-i18next, next-intl und Intlayer.
23
25
 
24
26
  Dies ist kein vollständiges Tutorial. Es ist ein Vergleich, der Ihnen bei der Auswahl helfen soll.
@@ -173,9 +175,9 @@ Im Fall von `next-intl` und `next-i18next` erfordert die Bibliothek das Laden de
173
175
 
174
176
  Hier ein Beispiel für die Auswirkung der Bundle-Größenoptimierung mit `intlayer` in einer vite + react Anwendung:
175
177
 
176
- | Optimiertes Bundle | Nicht optimiertes Bundle |
177
- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
178
- | ![optimiertes Bundle](https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png) | ![nicht optimiertes Bundle](https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle_no_optimization.png) |
178
+ | Optimiertes Bundle | Nicht optimiertes Bundle |
179
+ | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
180
+ | ![optimiertes Bundle](https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true) | ![nicht optimiertes Bundle](https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle_no_optimization.png?raw=true) |
179
181
 
180
182
  ---
181
183
 
@@ -348,25 +350,25 @@ Die App-Struktur ist wichtig, um eine gute Wartbarkeit Ihres Codes sicherzustell
348
350
 
349
351
  ```bash
350
352
  .
351
- ├── public
352
- │ └── locales
353
- │ ├── en
354
- │ │ ├── home.json
355
- │ │ └── navbar.json
356
- │ ├── fr
357
- │ │ ├── home.json
358
- │ │ └── navbar.json
359
- │ └── es
360
- │ ├── home.json
361
- │ └── navbar.json
362
- ├── next-i18next.config.js
353
+ ├── i18n.config.ts
363
354
  └── src
364
- ├── middleware.ts
355
+ ├── locales
356
+ │ ├── en
357
+ │ │ ├── common.json
358
+ │ │ └── about.json
359
+ │ └── fr
360
+ │ ├── common.json
361
+ │ └── about.json
365
362
  ├── app
366
- └── home.tsx
363
+ ├── i18n
364
+ │ │ └── server.ts
365
+ │ └── [locale]
366
+ │ ├── layout.tsx
367
+ │ └── about.tsx
367
368
  └── components
368
- └── Navbar
369
- └── index.tsx
369
+ ├── I18nProvider.tsx
370
+ ├── ClientComponent.tsx
371
+ └── ServerComponent.tsx
370
372
  ```
371
373
 
372
374
  </TabItem>
@@ -374,6 +376,7 @@ Die App-Struktur ist wichtig, um eine gute Wartbarkeit Ihres Codes sicherzustell
374
376
 
375
377
  ```bash
376
378
  .
379
+ ├── i18n.ts
377
380
  ├── locales
378
381
  │ ├── en
379
382
  │ │ ├── home.json
@@ -384,11 +387,13 @@ Die App-Struktur ist wichtig, um eine gute Wartbarkeit Ihres Codes sicherzustell
384
387
  │ └── es
385
388
  │ ├── home.json
386
389
  │ └── navbar.json
387
- ├── i18n.ts
388
390
  └── src
389
391
  ├── middleware.ts
390
392
  ├── app
391
- └── home.tsx
393
+ ├── i18n
394
+ │ │ └── server.ts
395
+ │ └── [locale]
396
+ │ └── home.tsx
392
397
  └── components
393
398
  └── Navbar
394
399
  └── index.tsx
@@ -403,9 +408,11 @@ Die App-Struktur ist wichtig, um eine gute Wartbarkeit Ihres Codes sicherzustell
403
408
  └── src
404
409
  ├── middleware.ts
405
410
  ├── app
406
- │ └── home
407
- └── index.tsx
408
- │ └── index.content.ts
411
+ │ └── [locale]
412
+ ├── layout.tsx
413
+ │ └── home
414
+ │ ├── index.tsx
415
+ │ └── index.content.ts
409
416
  └── components
410
417
  └── Navbar
411
418
  ├── index.tsx
@@ -428,155 +435,294 @@ Wie die Bibliothek das Laden von Inhalten handhabt, ist wichtig.
428
435
  <Tab defaultTab="next-intl" group='techno'>
429
436
  <TabItem label="next-i18next" value="next-i18next">
430
437
 
431
- ```tsx fileName="next-i18next.config.js"
432
- module.exports = {
433
- i18n: {
434
- locales: ["en", "fr", "es"],
435
- defaultLocale: "en",
436
- },
437
- };
438
- ```
438
+ ```ts fileName="i18n.config.ts"
439
+ export const locales = ["en", "fr"] as const;
440
+ export type Locale = (typeof locales)[number];
441
+
442
+ export const defaultLocale: Locale = "en";
439
443
 
440
- ```tsx fileName="src/app/_app.tsx"
441
- import { appWithTranslation } from "next-i18next";
444
+ export const rtlLocales = ["ar", "he", "fa", "ur"] as const;
445
+ export const isRtl = (locale: string) =>
446
+ (rtlLocales as readonly string[]).includes(locale);
442
447
 
443
- const MyApp = ({ Component, pageProps }) => <Component {...pageProps} />;
448
+ export function localizedPath(locale: string, path: string) {
449
+ return locale === defaultLocale ? path : "/" + locale + path;
450
+ }
444
451
 
445
- export default appWithTranslation(MyApp);
452
+ const ORIGIN = "https://example.com";
453
+ export function abs(locale: string, path: string) {
454
+ return ORIGIN + localizedPath(locale, path);
455
+ }
446
456
  ```
447
457
 
448
- ```tsx fileName="src/app/[locale]/about/page.tsx"
449
- import type { GetStaticProps } from "next";
450
- import { serverSideTranslations } from "next-i18next/serverSideTranslations";
451
- import { useTranslation } from "next-i18next";
452
- import { I18nextProvider, initReactI18next } from "react-i18next";
458
+ ```ts fileName="src/app/i18n/server.ts"
453
459
  import { createInstance } from "i18next";
454
- import { ClientComponent, ServerComponent } from "@components";
460
+ import { initReactI18next } from "react-i18next/initReactI18next";
461
+ import resourcesToBackend from "i18next-resources-to-backend";
462
+ import { defaultLocale } from "@/i18n.config";
463
+
464
+ // Load JSON resources from src/locales/<locale>/<namespace>.json
465
+ const backend = resourcesToBackend(
466
+ (locale: string, namespace: string) =>
467
+ import(`../../locales/${locale}/${namespace}.json`)
468
+ );
469
+
470
+ export async function initI18next(
471
+ locale: string,
472
+ namespaces: string[] = ["common"]
473
+ ) {
474
+ const i18n = createInstance();
475
+ await i18n
476
+ .use(initReactI18next)
477
+ .use(backend)
478
+ .init({
479
+ lng: locale,
480
+ fallbackLng: defaultLocale,
481
+ ns: namespaces,
482
+ defaultNS: "common",
483
+ interpolation: { escapeValue: false },
484
+ react: { useSuspense: false },
485
+ });
486
+ return i18n;
487
+ }
488
+ ```
455
489
 
456
- export default function HomePage({ locale }: { locale: string }) {
457
- // Deklariere explizit den Namespace, der von dieser Komponente verwendet wird
458
- const resources = await loadMessagesFor(locale); // dein Loader (JSON, etc.)
490
+ ```tsx fileName="src/components/I18nProvider.tsx"
491
+ "use client";
459
492
 
460
- const i18n = createInstance();
461
- i18n.use(initReactI18next).init({
462
- lng: locale,
463
- fallbackLng: "en",
464
- resources,
465
- ns: ["common", "about"],
466
- defaultNS: "common",
467
- interpolation: { escapeValue: false },
493
+ import * as React from "react";
494
+ import { I18nextProvider } from "react-i18next";
495
+ import { createInstance } from "i18next";
496
+ import { initReactI18next } from "react-i18next/initReactI18next";
497
+ import resourcesToBackend from "i18next-resources-to-backend";
498
+ import { defaultLocale } from "@/i18n.config";
499
+
500
+ const backend = resourcesToBackend(
501
+ (locale: string, namespace: string) =>
502
+ import(`../../locales/${locale}/${namespace}.json`)
503
+ );
504
+
505
+ type Props = {
506
+ locale: string;
507
+ namespaces?: string[];
508
+ resources?: Record<string, any>; // { ns: bundle }
509
+ children: React.ReactNode;
510
+ };
511
+
512
+ export default function I18nProvider({
513
+ locale,
514
+ namespaces = ["common"],
515
+ resources,
516
+ children,
517
+ }: Props) {
518
+ const [i18n] = React.useState(() => {
519
+ const i = createInstance();
520
+
521
+ i.use(initReactI18next)
522
+ .use(backend)
523
+ .init({
524
+ lng: locale,
525
+ fallbackLng: defaultLocale,
526
+ ns: namespaces,
527
+ resources: resources ? { [locale]: resources } : undefined,
528
+ defaultNS: "common",
529
+ interpolation: { escapeValue: false },
530
+ react: { useSuspense: false },
531
+ });
532
+
533
+ return i;
468
534
  });
469
535
 
470
- const { t } = useTranslation("about");
536
+ return <I18nextProvider i18n={i18n}>{children}</I18nextProvider>;
537
+ }
538
+ ```
539
+
540
+ ```tsx fileName="src/app/[locale]/layout.tsx"
541
+ import type { ReactNode } from "react";
542
+ import { locales, defaultLocale, isRtl, type Locale } from "@/i18n.config";
543
+
544
+ export const dynamicParams = false;
545
+
546
+ export function generateStaticParams() {
547
+ return locales.map((locale) => ({ locale }));
548
+ }
549
+
550
+ export default function LocaleLayout({
551
+ children,
552
+ params,
553
+ }: {
554
+ children: ReactNode;
555
+ params: { locale: string };
556
+ }) {
557
+ const locale: Locale = (locales as readonly string[]).includes(params.locale)
558
+ ? (params.locale as any)
559
+ : defaultLocale;
560
+
561
+ const dir = isRtl(locale) ? "rtl" : "ltr";
562
+
563
+ return (
564
+ <html lang={locale} dir={dir}>
565
+ <body>{children}</body>
566
+ </html>
567
+ );
568
+ }
569
+ ```
570
+
571
+ ```tsx fileName="src/app/[locale]/about.tsx"
572
+ import I18nProvider from "@/components/I18nProvider";
573
+ import { initI18next } from "@/app/i18n/server";
574
+ import type { Locale } from "@/i18n.config";
575
+ import ClientComponent from "@/components/ClientComponent";
576
+ import ServerComponent from "@/components/ServerComponent";
577
+
578
+ // Force static rendering for the page
579
+ export const dynamic = "force-static";
580
+
581
+ export default async function AboutPage({
582
+ params: { locale },
583
+ }: {
584
+ params: { locale: Locale };
585
+ }) {
586
+ const namespaces = ["common", "about"] as const;
587
+
588
+ const i18n = await initI18next(locale, [...namespaces]);
589
+ const tAbout = i18n.getFixedT(locale, "about");
471
590
 
472
591
  return (
473
- <I18nextProvider i18n={i18n}>
592
+ <I18nProvider locale={locale} namespaces={[...namespaces]}>
474
593
  <main>
475
- <h1>{t("title")}</h1>
594
+ <h1>{tAbout("title")}</h1>
595
+
476
596
  <ClientComponent />
477
- <ServerComponent />
597
+ <ServerComponent t={tAbout} locale={locale} count={0} />
478
598
  </main>
479
- </I18nextProvider>
599
+ </I18nProvider>
480
600
  );
481
601
  }
482
-
483
- export const getStaticProps: GetStaticProps = async ({ locale }) => {
484
- // Laden Sie nur die für DIESE Seite benötigten Namespaces vor
485
- return {
486
- props: {
487
- ...(await serverSideTranslations(locale ?? "en", ["common", "about"])),
488
- },
489
- };
490
- };
491
602
  ```
492
603
 
493
604
  </TabItem>
494
605
  <TabItem label="next-intl" value="next-intl">
495
606
 
496
- ```tsx fileName="i18n.ts"
607
+ ```tsx fileName="src/i18n.ts"
497
608
  import { getRequestConfig } from "next-intl/server";
498
609
  import { notFound } from "next/navigation";
499
610
 
500
- // Kann aus einer gemeinsamen Konfiguration importiert werden
501
- const locales = ["en", "fr", "es"];
611
+ export const locales = ["en", "fr", "es"] as const;
612
+ export const defaultLocale = "en" as const;
613
+
614
+ async function loadMessages(locale: string) {
615
+ // Load only the namespaces your layout/pages need
616
+ const [common, about] = await Promise.all([
617
+ import(`../locales/${locale}/common.json`).then((m) => m.default),
618
+ import(`../locales/${locale}/about.json`).then((m) => m.default),
619
+ ]);
620
+
621
+ return { common, about } as const;
622
+ }
502
623
 
503
624
  export default getRequestConfig(async ({ locale }) => {
504
- // Überprüfen Sie, ob der eingehende `locale`-Parameter gültig ist
505
625
  if (!locales.includes(locale as any)) notFound();
506
626
 
507
627
  return {
508
- messages: (await import(`../messages/${locale}.json`)).default,
628
+ messages: await loadMessages(locale),
509
629
  };
510
630
  });
511
631
  ```
512
632
 
513
- ```tsx fileName="src/app/[locale]/about/layout.tsx"
514
- import { NextIntlClientProvider } from "next-intl";
515
- import { getMessages, unstable_setRequestLocale } from "next-intl/server";
516
- import pick from "lodash/pick";
633
+ ```tsx fileName="src/app/[locale]/layout.tsx"
634
+ import type { ReactNode } from "react";
635
+ import { locales } from "@/i18n";
636
+ import {
637
+ getLocaleDirection,
638
+ unstable_setRequestLocale,
639
+ } from "next-intl/server";
640
+
641
+ export const dynamic = "force-static";
642
+
643
+ export function generateStaticParams() {
644
+ return locales.map((locale) => ({ locale }));
645
+ }
517
646
 
518
647
  export default async function LocaleLayout({
519
648
  children,
520
649
  params,
521
650
  }: {
522
- children: React.ReactNode;
523
- params: { locale: string };
651
+ children: ReactNode;
652
+ params: Promise<{ locale: string }>;
524
653
  }) {
525
- const { locale } = params;
654
+ const { locale } = await params;
526
655
 
527
- // Setze die aktive Anfragelocale für dieses Server-Rendering (RSC)
656
+ // Set the active request locale for this server render (RSC)
528
657
  unstable_setRequestLocale(locale);
529
658
 
530
- // Nachrichten werden serverseitig über src/i18n/request.ts geladen
531
- // (siehe next-intl Dokumentation). Hier senden wir nur einen Teil an den Client,
532
- // der für Client-Komponenten benötigt wird (Payload-Optimierung).
533
- const messages = await getMessages();
534
- const clientMessages = pick(messages, ["common", "about"]);
659
+ const dir = getLocaleDirection(locale);
535
660
 
536
661
  return (
537
- <html lang={locale}>
538
- <body>
539
- <NextIntlClientProvider locale={locale} messages={clientMessages}>
540
- {children}
541
- </NextIntlClientProvider>
542
- </body>
662
+ <html lang={locale} dir={dir}>
663
+ <body>{children}</body>
543
664
  </html>
544
665
  );
545
666
  }
546
667
  ```
547
668
 
548
669
  ```tsx fileName="src/app/[locale]/about/page.tsx"
549
- import { getTranslations } from "next-intl/server";
550
- import { ClientComponent, ServerComponent } from "@components";
670
+ import { getTranslations, getMessages, getFormatter } from "next-intl/server";
671
+ import { NextIntlClientProvider } from "next-intl";
672
+ import pick from "lodash/pick";
673
+ import ServerComponent from "@/components/ServerComponent";
674
+ import ClientComponentExample from "@/components/ClientComponentExample";
551
675
 
552
- export default async function LandingPage({
676
+ export const dynamic = "force-static";
677
+
678
+ export default async function AboutPage({
553
679
  params,
554
680
  }: {
555
- params: { locale: string };
681
+ params: Promise<{ locale: string }>;
556
682
  }) {
557
- // Streng serverseitiges Laden (nicht auf den Client hydriert)
558
- const t = await getTranslations("about");
683
+ const { locale } = await params;
684
+
685
+ // Messages are loaded server-side. Push only what's needed to the client.
686
+ const messages = await getMessages();
687
+ const clientMessages = pick(messages, ["common", "about"]);
688
+
689
+ // Strictly server-side translations/formatting
690
+ const tAbout = await getTranslations("about");
691
+ const tCounter = await getTranslations("about.counter");
692
+ const format = await getFormatter();
693
+
694
+ const initialFormattedCount = format.number(0);
559
695
 
560
696
  return (
561
- <main>
562
- <h1>{t("title")}</h1>
563
- <ClientComponent />
564
- <ServerComponent />
565
- </main>
697
+ <NextIntlClientProvider locale={locale} messages={clientMessages}>
698
+ <main>
699
+ <h1>{tAbout("title")}</h1>
700
+ <ClientComponentExample />
701
+ <ServerComponent
702
+ formattedCount={initialFormattedCount}
703
+ label={tCounter("label")}
704
+ increment={tCounter("increment")}
705
+ />
706
+ </main>
707
+ </NextIntlClientProvider>
566
708
  );
567
709
  }
568
710
  ```
569
711
 
570
712
  </TabItem>
571
- <TabItem label="intlayer" value="intlayer">
713
+ <TabItem label="intlayer" value="intlayer">
572
714
 
573
715
  ```tsx fileName="intlayer.config.ts"
574
- export default {
716
+ import { type IntlayerConfig, Locales } from "intlayer";
717
+
718
+ const config: IntlayerConfig = {
575
719
  internationalization: {
576
- locales: ["en", "fr", "es"],
577
- defaultLocale: "en",
720
+ locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
721
+ defaultLocale: Locales.ENGLISH,
578
722
  },
579
723
  };
724
+
725
+ export default config;
580
726
  ```
581
727
 
582
728
  ```tsx fileName="src/app/[locale]/layout.tsx"
@@ -589,14 +735,16 @@ import {
589
735
 
590
736
  export const dynamic = "force-static";
591
737
 
592
- const LandingLayout: NextLayoutIntlayer = async ({ children, params }) => {
738
+ const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {
593
739
  const { locale } = await params;
594
740
 
595
741
  return (
596
742
  <html lang={locale} dir={getHTMLTextDir(locale)}>
597
- <IntlayerClientProvider locale={locale}>
598
- {children}
599
- </IntlayerClientProvider>
743
+ <body>
744
+ <IntlayerClientProvider locale={locale}>
745
+ {children}
746
+ </IntlayerClientProvider>
747
+ </body>
600
748
  </html>
601
749
  );
602
750
  };
@@ -853,10 +1001,11 @@ const ServerComponent = ({ count }: ServerComponentProps) => {
853
1001
  type ServerComponentProps = {
854
1002
  count: number;
855
1003
  t: (key: string) => string;
1004
+ formatter: Intl.NumberFormat;
856
1005
  };
857
1006
 
858
- const ServerComponent = ({ t, count }: ServerComponentProps) => {
859
- const formatted = new Intl.NumberFormat(i18n.language).format(count);
1007
+ const ServerComponent = ({ t, count, formatter }: ServerComponentProps) => {
1008
+ const formatted = formatter.format(count);
860
1009
 
861
1010
  return (
862
1011
  <div>
@@ -870,7 +1019,7 @@ const ServerComponent = ({ t, count }: ServerComponentProps) => {
870
1019
  > Da die Server-Komponente nicht asynchron sein kann, müssen Sie die Übersetzungen und die Formatierungsfunktion als Props übergeben.
871
1020
  >
872
1021
  > - `const t = await getTranslations("about.counter");`
873
- > - `const format = await getFormatter();`
1022
+ > - `const formatter = await getFormatter().then((formatter) => formatter.number());`
874
1023
 
875
1024
  </TabItem>
876
1025
  <TabItem label="intlayer" value="intlayer">