@intlayer/docs 6.1.6-canary.0 → 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.
- package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +71 -80
- package/dist/cjs/generated/docs.entry.cjs +16 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +16 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/intlayer_with_angular.md +2 -2
- package/docs/ar/intlayer_with_astro.md +246 -0
- package/docs/ar/intlayer_with_create_react_app.md +3 -2
- package/docs/ar/intlayer_with_express.md +2 -2
- package/docs/ar/intlayer_with_nestjs.md +2 -2
- package/docs/ar/intlayer_with_nextjs_14.md +2 -2
- package/docs/ar/intlayer_with_nextjs_15.md +2 -2
- package/docs/ar/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ar/intlayer_with_nuxt.md +2 -2
- package/docs/ar/intlayer_with_react_native+expo.md +11 -20
- package/docs/ar/intlayer_with_react_router_v7.md +195 -241
- package/docs/ar/intlayer_with_tanstack.md +198 -272
- package/docs/ar/intlayer_with_vite+preact.md +9 -9
- package/docs/ar/intlayer_with_vite+react.md +7 -7
- package/docs/ar/intlayer_with_vite+vue.md +9 -9
- package/docs/de/intlayer_with_angular.md +2 -2
- package/docs/de/intlayer_with_astro.md +246 -0
- package/docs/de/intlayer_with_create_react_app.md +2 -2
- package/docs/de/intlayer_with_express.md +2 -2
- package/docs/de/intlayer_with_nestjs.md +2 -2
- package/docs/de/intlayer_with_nextjs_14.md +2 -2
- package/docs/de/intlayer_with_nextjs_15.md +2 -2
- package/docs/de/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/de/intlayer_with_nuxt.md +2 -2
- package/docs/de/intlayer_with_react_native+expo.md +11 -20
- package/docs/de/intlayer_with_react_router_v7.md +193 -242
- package/docs/de/intlayer_with_tanstack.md +194 -266
- package/docs/de/intlayer_with_vite+preact.md +9 -9
- package/docs/de/intlayer_with_vite+react.md +9 -9
- package/docs/de/intlayer_with_vite+vue.md +11 -11
- package/docs/de/packages/vite-intlayer/index.md +3 -3
- package/docs/en/how_works_intlayer.md +1 -1
- package/docs/en/index.md +1 -1
- package/docs/en/intlayer_cli.md +1 -1
- package/docs/en/intlayer_with_angular.md +4 -4
- package/docs/en/intlayer_with_astro.md +246 -0
- package/docs/en/intlayer_with_create_react_app.md +4 -4
- package/docs/en/intlayer_with_express.md +3 -3
- package/docs/en/intlayer_with_lynx+react.md +1 -1
- package/docs/en/intlayer_with_nestjs.md +2 -2
- package/docs/en/intlayer_with_nextjs_14.md +13 -4
- package/docs/en/intlayer_with_nextjs_15.md +13 -4
- package/docs/en/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/en/intlayer_with_nuxt.md +4 -4
- package/docs/en/intlayer_with_react_native+expo.md +46 -24
- package/docs/en/intlayer_with_react_router_v7.md +164 -211
- package/docs/en/intlayer_with_tanstack.md +166 -241
- package/docs/en/intlayer_with_vite+preact.md +12 -12
- package/docs/en/intlayer_with_vite+react.md +12 -12
- package/docs/en/intlayer_with_vite+solid.md +2 -2
- package/docs/en/intlayer_with_vite+svelte.md +2 -2
- package/docs/en/intlayer_with_vite+vue.md +12 -12
- package/docs/en/introduction.md +1 -1
- package/docs/en/packages/next-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/react-intlayer/useI18n.md +1 -1
- package/docs/en/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/en/releases/v6.md +1 -0
- package/docs/en/roadmap.md +1 -1
- package/docs/en-GB/intlayer_with_angular.md +3 -3
- package/docs/en-GB/intlayer_with_astro.md +246 -0
- package/docs/en-GB/intlayer_with_create_react_app.md +5 -4
- package/docs/en-GB/intlayer_with_express.md +2 -2
- package/docs/en-GB/intlayer_with_nestjs.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_14.md +4 -4
- package/docs/en-GB/intlayer_with_nextjs_15.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/en-GB/intlayer_with_nuxt.md +2 -2
- package/docs/en-GB/intlayer_with_react_native+expo.md +11 -20
- package/docs/en-GB/intlayer_with_react_router_v7.md +171 -220
- package/docs/en-GB/intlayer_with_tanstack.md +174 -248
- package/docs/en-GB/intlayer_with_vite+preact.md +9 -9
- package/docs/en-GB/intlayer_with_vite+react.md +9 -9
- package/docs/en-GB/intlayer_with_vite+vue.md +11 -11
- package/docs/en-GB/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en-GB/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/es/intlayer_with_angular.md +2 -2
- package/docs/es/intlayer_with_astro.md +246 -0
- package/docs/es/intlayer_with_create_react_app.md +3 -2
- package/docs/es/intlayer_with_express.md +2 -2
- package/docs/es/intlayer_with_nextjs_14.md +2 -2
- package/docs/es/intlayer_with_nextjs_15.md +2 -2
- package/docs/es/intlayer_with_react_native+expo.md +11 -20
- package/docs/es/intlayer_with_react_router_v7.md +188 -232
- package/docs/es/intlayer_with_tanstack.md +203 -273
- package/docs/es/intlayer_with_vite+preact.md +7 -7
- package/docs/es/intlayer_with_vite+react.md +7 -7
- package/docs/es/intlayer_with_vite+vue.md +9 -9
- package/docs/fr/intlayer_with_angular.md +2 -2
- package/docs/fr/intlayer_with_astro.md +246 -0
- package/docs/fr/intlayer_with_create_react_app.md +3 -2
- package/docs/fr/intlayer_with_express.md +2 -2
- package/docs/fr/intlayer_with_nestjs.md +2 -2
- package/docs/fr/intlayer_with_nextjs_14.md +2 -2
- package/docs/fr/intlayer_with_react_native+expo.md +11 -20
- package/docs/fr/intlayer_with_react_router_v7.md +188 -248
- package/docs/fr/intlayer_with_tanstack.md +192 -265
- package/docs/fr/intlayer_with_vite+preact.md +7 -7
- package/docs/fr/intlayer_with_vite+react.md +7 -7
- package/docs/fr/intlayer_with_vite+vue.md +9 -9
- package/docs/hi/intlayer_cli.md +1 -4
- package/docs/hi/intlayer_with_angular.md +2 -2
- package/docs/hi/intlayer_with_astro.md +246 -0
- package/docs/hi/intlayer_with_create_react_app.md +2 -2
- package/docs/hi/intlayer_with_express.md +2 -2
- package/docs/hi/intlayer_with_nestjs.md +2 -2
- package/docs/hi/intlayer_with_nextjs_14.md +2 -2
- package/docs/hi/intlayer_with_nextjs_15.md +2 -2
- package/docs/hi/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/hi/intlayer_with_nuxt.md +2 -2
- package/docs/hi/intlayer_with_react_native+expo.md +11 -20
- package/docs/hi/intlayer_with_react_router_v7.md +199 -243
- package/docs/hi/intlayer_with_tanstack.md +210 -285
- package/docs/hi/intlayer_with_vite+preact.md +9 -9
- package/docs/hi/intlayer_with_vite+react.md +9 -9
- package/docs/hi/intlayer_with_vite+solid.md +1 -1
- package/docs/hi/intlayer_with_vite+vue.md +11 -11
- package/docs/it/intlayer_with_angular.md +2 -2
- package/docs/it/intlayer_with_astro.md +246 -0
- package/docs/it/intlayer_with_create_react_app.md +3 -2
- package/docs/it/intlayer_with_express.md +2 -2
- package/docs/it/intlayer_with_nestjs.md +2 -2
- package/docs/it/intlayer_with_nextjs_14.md +2 -2
- package/docs/it/intlayer_with_nextjs_15.md +2 -2
- package/docs/it/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/it/intlayer_with_nuxt.md +2 -2
- package/docs/it/intlayer_with_react_native+expo.md +11 -21
- package/docs/it/intlayer_with_react_router_v7.md +195 -242
- package/docs/it/intlayer_with_tanstack.md +203 -267
- package/docs/it/intlayer_with_vite+preact.md +9 -9
- package/docs/it/intlayer_with_vite+react.md +13 -11
- package/docs/it/intlayer_with_vite+vue.md +11 -11
- package/docs/ja/intlayer_with_angular.md +2 -2
- package/docs/ja/intlayer_with_astro.md +246 -0
- package/docs/ja/intlayer_with_create_react_app.md +3 -2
- package/docs/ja/intlayer_with_express.md +2 -2
- package/docs/ja/intlayer_with_nestjs.md +2 -2
- package/docs/ja/intlayer_with_nextjs_14.md +2 -2
- package/docs/ja/intlayer_with_nextjs_15.md +2 -2
- package/docs/ja/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ja/intlayer_with_nuxt.md +2 -2
- package/docs/ja/intlayer_with_react_native+expo.md +18 -29
- package/docs/ja/intlayer_with_react_router_v7.md +204 -250
- package/docs/ja/intlayer_with_tanstack.md +218 -286
- package/docs/ja/intlayer_with_vite+preact.md +9 -9
- package/docs/ja/intlayer_with_vite+react.md +11 -11
- package/docs/ja/intlayer_with_vite+vue.md +11 -11
- package/docs/ko/intlayer_with_angular.md +2 -2
- package/docs/ko/intlayer_with_astro.md +246 -0
- package/docs/ko/intlayer_with_create_react_app.md +3 -2
- package/docs/ko/intlayer_with_express.md +2 -2
- package/docs/ko/intlayer_with_nestjs.md +2 -2
- package/docs/ko/intlayer_with_nextjs_14.md +2 -2
- package/docs/ko/intlayer_with_nextjs_15.md +2 -2
- package/docs/ko/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ko/intlayer_with_nuxt.md +2 -2
- package/docs/ko/intlayer_with_react_native+expo.md +19 -28
- package/docs/ko/intlayer_with_react_router_v7.md +190 -244
- package/docs/ko/intlayer_with_tanstack.md +200 -270
- package/docs/ko/intlayer_with_vite+preact.md +9 -9
- package/docs/ko/intlayer_with_vite+react.md +9 -9
- package/docs/ko/intlayer_with_vite+vue.md +11 -11
- package/docs/pt/intlayer_with_angular.md +2 -2
- package/docs/pt/intlayer_with_astro.md +246 -0
- package/docs/pt/intlayer_with_create_react_app.md +3 -2
- package/docs/pt/intlayer_with_express.md +2 -2
- package/docs/pt/intlayer_with_nestjs.md +2 -2
- package/docs/pt/intlayer_with_nextjs_14.md +2 -2
- package/docs/pt/intlayer_with_nextjs_15.md +2 -2
- package/docs/pt/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/pt/intlayer_with_nuxt.md +2 -2
- package/docs/pt/intlayer_with_react_native+expo.md +11 -20
- package/docs/pt/intlayer_with_react_router_v7.md +7 -13
- package/docs/pt/intlayer_with_tanstack.md +183 -258
- package/docs/pt/intlayer_with_vite+preact.md +9 -9
- package/docs/pt/intlayer_with_vite+react.md +9 -9
- package/docs/pt/intlayer_with_vite+vue.md +9 -9
- package/docs/ru/intlayer_with_angular.md +2 -2
- package/docs/ru/intlayer_with_astro.md +246 -0
- package/docs/ru/intlayer_with_create_react_app.md +3 -2
- package/docs/ru/intlayer_with_express.md +2 -2
- package/docs/ru/intlayer_with_nestjs.md +2 -2
- package/docs/ru/intlayer_with_nextjs_14.md +2 -2
- package/docs/ru/intlayer_with_nextjs_15.md +2 -2
- package/docs/ru/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ru/intlayer_with_nuxt.md +2 -2
- package/docs/ru/intlayer_with_react_native+expo.md +11 -20
- package/docs/ru/intlayer_with_react_router_v7.md +192 -238
- package/docs/ru/intlayer_with_tanstack.md +197 -269
- package/docs/ru/intlayer_with_vite+preact.md +9 -9
- package/docs/ru/intlayer_with_vite+react.md +9 -9
- package/docs/ru/intlayer_with_vite+vue.md +11 -11
- package/docs/tr/how_works_intlayer.md +1 -1
- package/docs/tr/index.md +1 -1
- package/docs/tr/intlayer_cli.md +1 -1
- package/docs/tr/intlayer_with_angular.md +4 -4
- package/docs/tr/intlayer_with_astro.md +246 -0
- package/docs/tr/intlayer_with_create_react_app.md +4 -4
- package/docs/tr/intlayer_with_express.md +3 -3
- package/docs/tr/intlayer_with_lynx+react.md +1 -1
- package/docs/tr/intlayer_with_nestjs.md +2 -2
- package/docs/tr/intlayer_with_nextjs_14.md +2 -2
- package/docs/tr/intlayer_with_nextjs_15.md +4 -4
- package/docs/tr/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/tr/intlayer_with_nuxt.md +4 -4
- package/docs/tr/intlayer_with_react_native+expo.md +12 -21
- package/docs/tr/intlayer_with_react_router_v7.md +222 -267
- package/docs/tr/intlayer_with_tanstack.md +400 -303
- package/docs/tr/intlayer_with_vite+preact.md +12 -12
- package/docs/tr/intlayer_with_vite+react.md +12 -12
- package/docs/tr/intlayer_with_vite+solid.md +2 -2
- package/docs/tr/intlayer_with_vite+svelte.md +2 -2
- package/docs/tr/intlayer_with_vite+vue.md +12 -12
- package/docs/tr/introduction.md +1 -1
- package/docs/tr/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/tr/packages/react-intlayer/useI18n.md +1 -1
- package/docs/tr/roadmap.md +1 -1
- package/docs/zh/intlayer_with_angular.md +2 -2
- package/docs/zh/intlayer_with_astro.md +246 -0
- package/docs/zh/intlayer_with_create_react_app.md +3 -2
- package/docs/zh/intlayer_with_express.md +2 -2
- package/docs/zh/intlayer_with_nestjs.md +2 -2
- package/docs/zh/intlayer_with_nextjs_14.md +2 -2
- package/docs/zh/intlayer_with_nextjs_15.md +2 -2
- package/docs/zh/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/zh/intlayer_with_nuxt.md +2 -2
- package/docs/zh/intlayer_with_react_native+expo.md +19 -28
- package/docs/zh/intlayer_with_react_router_v7.md +200 -248
- package/docs/zh/intlayer_with_tanstack.md +208 -283
- package/docs/zh/intlayer_with_vite+preact.md +9 -9
- package/docs/zh/intlayer_with_vite+react.md +9 -9
- package/docs/zh/intlayer_with_vite+vue.md +9 -9
- package/package.json +11 -11
- package/src/generated/docs.entry.ts +16 -0
|
@@ -37,7 +37,7 @@ We focus on **Next.js 13+ App Router** (with **React Server Components**) and ev
|
|
|
37
37
|
|
|
38
38
|
> **tl;dr**: All three can localize a Next.js app. If you want **component-scoped content**, **strict TypeScript types**, **build-time missing-key checks**, **tree-shaken dictionaries**, and **first-class App Router + SEO helpers**, **Intlayer** is the most complete, modern choice.
|
|
39
39
|
|
|
40
|
-
> One confusion often made by developers is to think that `next-intl` is the Next.js version of `react-intl`. It's not
|
|
40
|
+
> One confusion often made by developers is to think that `next-intl` is the Next.js version of `react-intl`. It's not, `next-intl` is maintained by [Amann](https://github.com/amannn), while `react-intl` is maintained by [FormatJS](https://github.com/formatjs/formatjs).
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
@@ -180,16 +180,16 @@ Here an example of the impact of bundle size optimization using `intlayer` in a
|
|
|
180
180
|
<Columns>
|
|
181
181
|
<Column>
|
|
182
182
|
|
|
183
|
-
**next-
|
|
183
|
+
**next-i18next**
|
|
184
184
|
|
|
185
|
-
-
|
|
185
|
+
- Base typings for hooks. **strict key typing requires extra tooling/config**.
|
|
186
186
|
|
|
187
187
|
</Column>
|
|
188
188
|
<Column>
|
|
189
189
|
|
|
190
|
-
**next-
|
|
190
|
+
**next-intl**
|
|
191
191
|
|
|
192
|
-
-
|
|
192
|
+
- Solid TypeScript support, but **keys aren’t strictly typed by default**. you’ll maintain safety patterns manually.
|
|
193
193
|
|
|
194
194
|
</Column>
|
|
195
195
|
<Column>
|
|
@@ -210,16 +210,16 @@ Here an example of the impact of bundle size optimization using `intlayer` in a
|
|
|
210
210
|
<Columns>
|
|
211
211
|
<Column>
|
|
212
212
|
|
|
213
|
-
**next-
|
|
213
|
+
**next-i18next**
|
|
214
214
|
|
|
215
|
-
- Relies on **runtime fallbacks
|
|
215
|
+
- Relies on **runtime fallbacks**. Build doesn’t fail.
|
|
216
216
|
|
|
217
217
|
</Column>
|
|
218
218
|
<Column>
|
|
219
219
|
|
|
220
|
-
**next-
|
|
220
|
+
**next-intl**
|
|
221
221
|
|
|
222
|
-
- Relies on **runtime fallbacks
|
|
222
|
+
- Relies on **runtime fallbacks**. Build doesn’t fail.
|
|
223
223
|
|
|
224
224
|
</Column>
|
|
225
225
|
<Column>
|
|
@@ -231,7 +231,7 @@ Here an example of the impact of bundle size optimization using `intlayer` in a
|
|
|
231
231
|
</Column>
|
|
232
232
|
</Columns>
|
|
233
233
|
|
|
234
|
-
**Why it matters:** Catching gaps during build prevents
|
|
234
|
+
**Why it matters:** Catching gaps during build prevents 'undefined' strings in production.
|
|
235
235
|
|
|
236
236
|
---
|
|
237
237
|
|
|
@@ -240,28 +240,30 @@ Here an example of the impact of bundle size optimization using `intlayer` in a
|
|
|
240
240
|
<Columns>
|
|
241
241
|
<Column>
|
|
242
242
|
|
|
243
|
-
**next-
|
|
243
|
+
**next-i18next**
|
|
244
244
|
|
|
245
|
-
-
|
|
245
|
+
- Allows localized routing. But middleware is not built-in.
|
|
246
246
|
|
|
247
247
|
</Column>
|
|
248
248
|
<Column>
|
|
249
249
|
|
|
250
|
-
**next-
|
|
250
|
+
**next-intl**
|
|
251
251
|
|
|
252
|
-
-
|
|
252
|
+
- Allows localized routing.
|
|
253
|
+
- Provides middleware.
|
|
253
254
|
|
|
254
255
|
</Column>
|
|
255
256
|
<Column>
|
|
256
257
|
|
|
257
258
|
**intlayer**
|
|
258
259
|
|
|
259
|
-
-
|
|
260
|
+
- Allows localized routing.
|
|
261
|
+
- Provides middleware.
|
|
260
262
|
|
|
261
263
|
</Column>
|
|
262
264
|
</Columns>
|
|
263
265
|
|
|
264
|
-
**Why it matters:**
|
|
266
|
+
**Why it matters:** Helps for SEO and discovery, as well as user experience.
|
|
265
267
|
|
|
266
268
|
---
|
|
267
269
|
|
|
@@ -270,58 +272,33 @@ Here an example of the impact of bundle size optimization using `intlayer` in a
|
|
|
270
272
|
<Columns>
|
|
271
273
|
<Column>
|
|
272
274
|
|
|
273
|
-
**next-intl**
|
|
274
|
-
|
|
275
|
-
- Supports Next.js 13+. Often requires passing t-functions/formatters through component trees in hybrid setups.
|
|
276
|
-
|
|
277
|
-
</Column>
|
|
278
|
-
<Column>
|
|
279
|
-
|
|
280
275
|
**next-i18next**
|
|
281
276
|
|
|
282
|
-
-
|
|
283
|
-
|
|
284
|
-
</Column>
|
|
285
|
-
<Column>
|
|
286
|
-
|
|
287
|
-
**intlayer**
|
|
288
|
-
|
|
289
|
-
- Supports Next.js 13+ and smooths the **server/client boundary** with a consistent API and RSC-oriented providers, avoiding shuttling formatters or t-functions.
|
|
277
|
+
- Support page and layout server components.
|
|
278
|
+
- Do not provide synchronous API for children server components.
|
|
290
279
|
|
|
291
280
|
</Column>
|
|
292
|
-
</Columns>
|
|
293
|
-
|
|
294
|
-
**Why it matters:** Cleaner mental model and fewer edge cases in hybrid trees.
|
|
295
|
-
|
|
296
|
-
---
|
|
297
|
-
|
|
298
|
-
## DX, tooling & maintenance
|
|
299
|
-
|
|
300
|
-
<Columns>
|
|
301
281
|
<Column>
|
|
302
282
|
|
|
303
283
|
**next-intl**
|
|
304
284
|
|
|
305
|
-
-
|
|
306
|
-
|
|
307
|
-
</Column>
|
|
308
|
-
<Column>
|
|
309
|
-
|
|
310
|
-
**next-i18next**
|
|
311
|
-
|
|
312
|
-
- Commonly paired with external localization platforms and editorial workflows.
|
|
285
|
+
- Support page and layout server components.
|
|
286
|
+
- Do not provide synchronous API for children server components.
|
|
313
287
|
|
|
314
288
|
</Column>
|
|
315
289
|
<Column>
|
|
316
290
|
|
|
317
291
|
**intlayer**
|
|
318
292
|
|
|
319
|
-
-
|
|
293
|
+
- Support page and layout server components.
|
|
294
|
+
- Provide synchronous API for children server components.
|
|
320
295
|
|
|
321
296
|
</Column>
|
|
322
297
|
</Columns>
|
|
323
298
|
|
|
324
|
-
**Why it matters:**
|
|
299
|
+
**Why it matters:** Server component suport is a key feature of Next.js 13+, helping for performance. Passing props the locale or the `t` function from the parent to the child server components make your components less reusable.
|
|
300
|
+
|
|
301
|
+
---
|
|
325
302
|
|
|
326
303
|
## Integration with localization platforms (TMS)
|
|
327
304
|
|
|
@@ -342,6 +319,8 @@ Large organizations often rely on Translation Management Systems (TMS) like **Cr
|
|
|
342
319
|
|
|
343
320
|
> Note: `next-intl` and `i18next` also accepts TypeScript catalogs. If your team stores messages in `.ts` files or decentralizes them by feature, you can face similar TMS friction. However, many `next-intl` setups remain centralized in a `locales/` folder, which is a bit easier to refactor to JSON for TMS.
|
|
344
321
|
|
|
322
|
+
---
|
|
323
|
+
|
|
345
324
|
## Developer Experience
|
|
346
325
|
|
|
347
326
|
This part makes a deep comparison between the three solutions. Rather than considering simple cases, as described in the 'getting started' documentation for each solution, we will consider a real use case, more similar to a real project.
|
|
@@ -1008,20 +987,24 @@ export default ServerComponent;
|
|
|
1008
987
|
|
|
1009
988
|
```tsx fileName="src/components/ServerComponent.tsx"
|
|
1010
989
|
type ServerComponentProps = {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
990
|
+
t: (key: string) => string;
|
|
991
|
+
locale: string;
|
|
992
|
+
count: number;
|
|
993
|
+
formatter: Intl.NumberFormat;
|
|
1014
994
|
};
|
|
1015
995
|
|
|
1016
996
|
const ServerComponent = ({
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
997
|
+
t,
|
|
998
|
+
locale,
|
|
999
|
+
count,
|
|
1000
|
+
formatter,
|
|
1020
1001
|
}: ServerComponentProps) => {
|
|
1002
|
+
const formatted = formatter.format(count);
|
|
1003
|
+
|
|
1021
1004
|
return (
|
|
1022
1005
|
<div>
|
|
1023
|
-
<p>{
|
|
1024
|
-
<button aria-label={label}>{increment}</button>
|
|
1006
|
+
<p>{formatted}</p>
|
|
1007
|
+
<button aria-label={t("counter.label")}>{t("counter.increment")}</button>
|
|
1025
1008
|
</div>
|
|
1026
1009
|
);
|
|
1027
1010
|
};
|
|
@@ -1105,12 +1088,16 @@ export function abs(locale: string, path: string) {
|
|
|
1105
1088
|
import type { Metadata } from "next";
|
|
1106
1089
|
import { locales, defaultLocale, localizedPath } from "@/i18n.config";
|
|
1107
1090
|
|
|
1108
|
-
|
|
1091
|
+
type GenerateMetadataParams = {
|
|
1092
|
+
params: Promise<{
|
|
1093
|
+
locale: string;
|
|
1094
|
+
}>;
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
export const generateMetadata = async ({
|
|
1109
1098
|
params,
|
|
1110
|
-
}: {
|
|
1111
|
-
|
|
1112
|
-
}): Promise<Metadata> {
|
|
1113
|
-
const { locale } = params;
|
|
1099
|
+
}: GenerateMetadataParams): Promise<Metadata> => {
|
|
1100
|
+
const { locale } = await params;
|
|
1114
1101
|
|
|
1115
1102
|
// Import the correct JSON bundle from src/locales
|
|
1116
1103
|
const messages = (await import("@/locales/" + locale + "/about.json"))
|
|
@@ -1128,7 +1115,7 @@ export async function generateMetadata({
|
|
|
1128
1115
|
languages: { ...languages, "x-default": "/about" },
|
|
1129
1116
|
},
|
|
1130
1117
|
};
|
|
1131
|
-
}
|
|
1118
|
+
};
|
|
1132
1119
|
|
|
1133
1120
|
export default async function AboutPage() {
|
|
1134
1121
|
return <h1>About</h1>;
|
|
@@ -1139,7 +1126,7 @@ export default async function AboutPage() {
|
|
|
1139
1126
|
import type { MetadataRoute } from "next";
|
|
1140
1127
|
import { locales, defaultLocale, abs } from "@/i18n.config";
|
|
1141
1128
|
|
|
1142
|
-
export
|
|
1129
|
+
export const sitemap = (): MetadataRoute.Sitemap => {
|
|
1143
1130
|
const languages = Object.fromEntries(
|
|
1144
1131
|
locales.map((locale) => [locale, abs(locale, "/about")])
|
|
1145
1132
|
);
|
|
@@ -1152,7 +1139,7 @@ export default function sitemap(): MetadataRoute.Sitemap {
|
|
|
1152
1139
|
alternates: { languages },
|
|
1153
1140
|
},
|
|
1154
1141
|
];
|
|
1155
|
-
}
|
|
1142
|
+
};
|
|
1156
1143
|
```
|
|
1157
1144
|
|
|
1158
1145
|
```ts fileName="src/app/robots.ts"
|
|
@@ -1168,7 +1155,7 @@ const expandAllLocales = (path: string) => [
|
|
|
1168
1155
|
.map((locale) => localizedPath(locale, path)),
|
|
1169
1156
|
];
|
|
1170
1157
|
|
|
1171
|
-
export
|
|
1158
|
+
export const robots = (): MetadataRoute.Robots => {
|
|
1172
1159
|
const disallow = [
|
|
1173
1160
|
...expandAllLocales("/dashboard"),
|
|
1174
1161
|
...expandAllLocales("/admin"),
|
|
@@ -1179,7 +1166,7 @@ export default function robots(): MetadataRoute.Robots {
|
|
|
1179
1166
|
host: ORIGIN,
|
|
1180
1167
|
sitemap: ORIGIN + "/sitemap.xml",
|
|
1181
1168
|
};
|
|
1182
|
-
}
|
|
1169
|
+
};
|
|
1183
1170
|
```
|
|
1184
1171
|
|
|
1185
1172
|
</TabItem>
|
|
@@ -1190,16 +1177,20 @@ import type { Metadata } from "next";
|
|
|
1190
1177
|
import { locales, defaultLocale } from "@/i18n";
|
|
1191
1178
|
import { getTranslations } from "next-intl/server";
|
|
1192
1179
|
|
|
1193
|
-
|
|
1180
|
+
const localizedPath = (locale: string, path: string) => {
|
|
1194
1181
|
return locale === defaultLocale ? path : "/" + locale + path;
|
|
1195
|
-
}
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
type GenerateMetadataParams = {
|
|
1185
|
+
params: Promise<{
|
|
1186
|
+
locale: string;
|
|
1187
|
+
}>;
|
|
1188
|
+
};
|
|
1196
1189
|
|
|
1197
|
-
export async
|
|
1190
|
+
export const generateMetadata = async ({
|
|
1198
1191
|
params,
|
|
1199
|
-
}: {
|
|
1200
|
-
|
|
1201
|
-
}): Promise<Metadata> {
|
|
1202
|
-
const { locale } = params;
|
|
1192
|
+
}: GenerateMetadataParams): Promise<Metadata> => {
|
|
1193
|
+
const { locale } = await params;
|
|
1203
1194
|
const t = await getTranslations({ locale, namespace: "about" });
|
|
1204
1195
|
|
|
1205
1196
|
const url = "/about";
|
|
@@ -1215,7 +1206,7 @@ export async function generateMetadata({
|
|
|
1215
1206
|
languages: { ...languages, "x-default": url },
|
|
1216
1207
|
},
|
|
1217
1208
|
};
|
|
1218
|
-
}
|
|
1209
|
+
};
|
|
1219
1210
|
|
|
1220
1211
|
// ... Rest of the page code
|
|
1221
1212
|
```
|
|
@@ -1229,7 +1220,7 @@ const origin = "https://example.com";
|
|
|
1229
1220
|
const formatterLocalizedPath = (locale: string, path: string) =>
|
|
1230
1221
|
locale === defaultLocale ? origin + path : origin + "/" + locale + path;
|
|
1231
1222
|
|
|
1232
|
-
export
|
|
1223
|
+
export const sitemap = (): MetadataRoute.Sitemap => {
|
|
1233
1224
|
const aboutLanguages = Object.fromEntries(
|
|
1234
1225
|
locales.map((l) => [l, formatterLocalizedPath(l, "/about")])
|
|
1235
1226
|
);
|
|
@@ -1243,7 +1234,7 @@ export default function sitemap(): MetadataRoute.Sitemap {
|
|
|
1243
1234
|
alternates: { languages: aboutLanguages },
|
|
1244
1235
|
},
|
|
1245
1236
|
];
|
|
1246
|
-
}
|
|
1237
|
+
};
|
|
1247
1238
|
```
|
|
1248
1239
|
|
|
1249
1240
|
```tsx fileName="src/app/robots.ts"
|
|
@@ -1258,7 +1249,7 @@ const withAllLocales = (path: string) => [
|
|
|
1258
1249
|
.map((locale) => "/" + locale + path),
|
|
1259
1250
|
];
|
|
1260
1251
|
|
|
1261
|
-
export
|
|
1252
|
+
export const robots = (): MetadataRoute.Robots => {
|
|
1262
1253
|
const disallow = [
|
|
1263
1254
|
...withAllLocales("/dashboard"),
|
|
1264
1255
|
...withAllLocales("/admin"),
|
|
@@ -1269,7 +1260,7 @@ export default function robots(): MetadataRoute.Robots {
|
|
|
1269
1260
|
host: origin,
|
|
1270
1261
|
sitemap: origin + "/sitemap.xml",
|
|
1271
1262
|
};
|
|
1272
|
-
}
|
|
1263
|
+
};
|
|
1273
1264
|
```
|
|
1274
1265
|
|
|
1275
1266
|
</TabItem>
|
|
@@ -395,6 +395,22 @@ const docsEntry = {
|
|
|
395
395
|
hi: readLocale("intlayer_with_angular.md", "hi"),
|
|
396
396
|
tr: readLocale("intlayer_with_angular.md", "tr")
|
|
397
397
|
},
|
|
398
|
+
"./docs/en/intlayer_with_astro.md": {
|
|
399
|
+
en: readLocale("intlayer_with_astro.md", "en"),
|
|
400
|
+
fr: readLocale("intlayer_with_astro.md", "fr"),
|
|
401
|
+
ru: readLocale("intlayer_with_astro.md", "ru"),
|
|
402
|
+
ja: readLocale("intlayer_with_astro.md", "ja"),
|
|
403
|
+
ko: readLocale("intlayer_with_astro.md", "ko"),
|
|
404
|
+
zh: readLocale("intlayer_with_astro.md", "zh"),
|
|
405
|
+
es: readLocale("intlayer_with_astro.md", "es"),
|
|
406
|
+
de: readLocale("intlayer_with_astro.md", "de"),
|
|
407
|
+
ar: readLocale("intlayer_with_astro.md", "ar"),
|
|
408
|
+
pt: readLocale("intlayer_with_astro.md", "pt"),
|
|
409
|
+
"en-GB": readLocale("intlayer_with_astro.md", "en-GB"),
|
|
410
|
+
it: readLocale("intlayer_with_astro.md", "it"),
|
|
411
|
+
hi: readLocale("intlayer_with_astro.md", "hi"),
|
|
412
|
+
tr: readLocale("intlayer_with_astro.md", "tr")
|
|
413
|
+
},
|
|
398
414
|
"./docs/en/intlayer_with_create_react_app.md": {
|
|
399
415
|
en: readLocale("intlayer_with_create_react_app.md", "en"),
|
|
400
416
|
fr: readLocale("intlayer_with_create_react_app.md", "fr"),
|