@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.
- package/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md +404 -173
- package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +262 -113
- package/blog/en/intlayer_with_next-i18next.mdx +431 -0
- package/blog/en/intlayer_with_next-intl.mdx +335 -0
- package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +463 -209
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +185 -71
- package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +36 -28
- package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/dist/cjs/generated/docs.entry.cjs +32 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +32 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +2 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/component_i18n.md +186 -0
- 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/ar/vs_code_extension.md +48 -109
- package/docs/de/component_i18n.md +186 -0
- 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/de/vs_code_extension.md +46 -107
- package/docs/en/component_i18n.md +186 -0
- 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 +31 -5
- package/docs/en/intlayer_with_nextjs_15.md +31 -5
- 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/vs_code_extension.md +24 -114
- package/docs/en-GB/component_i18n.md +186 -0
- 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/en-GB/vs_code_extension.md +42 -103
- package/docs/es/component_i18n.md +182 -0
- 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/es/vs_code_extension.md +53 -114
- package/docs/fr/component_i18n.md +186 -0
- 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/fr/vs_code_extension.md +50 -111
- package/docs/hi/component_i18n.md +186 -0
- 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/hi/vs_code_extension.md +49 -110
- package/docs/it/component_i18n.md +186 -0
- 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/it/vs_code_extension.md +50 -111
- package/docs/ja/component_i18n.md +186 -0
- 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/ja/vs_code_extension.md +50 -111
- package/docs/ko/component_i18n.md +186 -0
- 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/ko/vs_code_extension.md +48 -109
- package/docs/pt/component_i18n.md +186 -0
- 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/pt/vs_code_extension.md +46 -107
- package/docs/ru/component_i18n.md +186 -0
- 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/ru/vs_code_extension.md +48 -109
- package/docs/tr/component_i18n.md +186 -0
- 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/tr/vs_code_extension.md +54 -115
- package/docs/zh/component_i18n.md +186 -0
- 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/docs/zh/vs_code_extension.md +51 -105
- package/package.json +10 -10
- package/src/generated/docs.entry.ts +32 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-04
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-10-03
|
|
4
4
|
title: Comenzando con Intlayer en React Router v7
|
|
5
5
|
description: Aprende cómo agregar internacionalización (i18n) a tu aplicación React Router v7 usando Intlayer. Sigue esta guía completa para hacer tu aplicación multilingüe con enrutamiento consciente del locale.
|
|
6
6
|
keywords:
|
|
@@ -17,11 +17,10 @@ slugs:
|
|
|
17
17
|
- environment
|
|
18
18
|
- vite-and-react
|
|
19
19
|
- react-router-v7
|
|
20
|
-
applicationTemplate: https://github.com/
|
|
21
|
-
author: AydinTheFirst
|
|
20
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-react-router-v7-template
|
|
22
21
|
---
|
|
23
22
|
|
|
24
|
-
# Comenzando
|
|
23
|
+
# Comenzando a internacionalizar (i18n) con Intlayer y React Router v7
|
|
25
24
|
|
|
26
25
|
Esta guía demuestra cómo integrar **Intlayer** para una internacionalización fluida en proyectos con React Router v7, con enrutamiento consciente del locale, soporte para TypeScript y prácticas modernas de desarrollo.
|
|
27
26
|
|
|
@@ -33,7 +32,7 @@ Con Intlayer, puedes:
|
|
|
33
32
|
|
|
34
33
|
- **Gestionar traducciones fácilmente** usando diccionarios declarativos a nivel de componente.
|
|
35
34
|
- **Localizar dinámicamente metadatos**, rutas y contenido.
|
|
36
|
-
- **
|
|
35
|
+
- **Garantizar soporte para TypeScript** con tipos autogenerados, mejorando la autocompletación y la detección de errores.
|
|
37
36
|
- **Beneficiarte de características avanzadas**, como la detección y cambio dinámico de locale.
|
|
38
37
|
- **Habilitar enrutamiento consciente del locale** con el sistema de enrutamiento basado en configuración de React Router v7.
|
|
39
38
|
|
|
@@ -59,17 +58,17 @@ pnpm add vite-intlayer --save-dev
|
|
|
59
58
|
|
|
60
59
|
- **intlayer**
|
|
61
60
|
|
|
62
|
-
El paquete principal que proporciona herramientas de internacionalización para la gestión de configuración, traducción, [declaración de contenido](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/dictionary/get_started.md),
|
|
61
|
+
El paquete principal que proporciona herramientas de internacionalización para la gestión de configuración, traducción, [declaración de contenido](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/dictionary/get_started.md), transpile y [comandos CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/intlayer_cli.md).
|
|
63
62
|
|
|
64
63
|
- **react-intlayer**
|
|
65
64
|
El paquete que integra Intlayer con la aplicación React. Proporciona proveedores de contexto y hooks para la internacionalización en React.
|
|
66
65
|
|
|
67
66
|
- **vite-intlayer**
|
|
68
|
-
Incluye el plugin de Vite para integrar Intlayer con el [
|
|
67
|
+
Incluye el plugin de Vite para integrar Intlayer con el [empaquetador Vite](https://vite.dev/guide/why.html#why-bundle-for-production), así como middleware para detectar el locale preferido del usuario, gestionar cookies y manejar la redirección de URLs.
|
|
69
68
|
|
|
70
69
|
### Paso 2: Configuración de tu proyecto
|
|
71
70
|
|
|
72
|
-
|
|
71
|
+
Crea un archivo de configuración para configurar los idiomas de tu aplicación:
|
|
73
72
|
|
|
74
73
|
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
75
74
|
import { type IntlayerConfig, Locales } from "intlayer";
|
|
@@ -77,10 +76,7 @@ import { type IntlayerConfig, Locales } from "intlayer";
|
|
|
77
76
|
const config: IntlayerConfig = {
|
|
78
77
|
internationalization: {
|
|
79
78
|
defaultLocale: Locales.ENGLISH,
|
|
80
|
-
locales: [Locales.ENGLISH, Locales.
|
|
81
|
-
},
|
|
82
|
-
middleware: {
|
|
83
|
-
prefixDefault: true, // Siempre anteponer el prefijo del idioma predeterminado en las URLs
|
|
79
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
84
80
|
},
|
|
85
81
|
};
|
|
86
82
|
|
|
@@ -91,13 +87,11 @@ export default config;
|
|
|
91
87
|
import { Locales } from "intlayer";
|
|
92
88
|
|
|
93
89
|
/** @type {import('intlayer').IntlayerConfig} */
|
|
90
|
+
// Configuración de internacionalización
|
|
94
91
|
const config = {
|
|
95
92
|
internationalization: {
|
|
96
|
-
defaultLocale: Locales.ENGLISH,
|
|
97
|
-
locales: [Locales.ENGLISH, Locales.
|
|
98
|
-
},
|
|
99
|
-
middleware: {
|
|
100
|
-
prefixDefault: true,
|
|
93
|
+
defaultLocale: Locales.ENGLISH, // Idioma predeterminado
|
|
94
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH], // Idiomas soportados
|
|
101
95
|
},
|
|
102
96
|
};
|
|
103
97
|
|
|
@@ -111,81 +105,75 @@ const { Locales } = require("intlayer");
|
|
|
111
105
|
const config = {
|
|
112
106
|
internationalization: {
|
|
113
107
|
defaultLocale: Locales.ENGLISH,
|
|
114
|
-
locales: [Locales.ENGLISH, Locales.
|
|
115
|
-
},
|
|
116
|
-
middleware: {
|
|
117
|
-
prefixDefault: true,
|
|
108
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
118
109
|
},
|
|
119
110
|
};
|
|
120
111
|
|
|
121
112
|
module.exports = config;
|
|
122
113
|
```
|
|
123
114
|
|
|
124
|
-
> A través de este archivo de configuración, puedes configurar URLs localizadas, redirección
|
|
125
|
-
|
|
126
|
-
### Paso 3: Configurar las Rutas de React Router v7
|
|
127
|
-
|
|
128
|
-
Configura tu configuración de enrutamiento con rutas conscientes del locale:
|
|
115
|
+
> A través de este archivo de configuración, puedes configurar URLs localizadas, redirección mediante middleware, nombres de cookies, la ubicación y extensión de tus declaraciones de contenido, deshabilitar los registros de Intlayer en la consola, y más. Para una lista completa de los parámetros disponibles, consulta la [documentación de configuración](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/configuration.md).
|
|
129
116
|
|
|
130
|
-
|
|
131
|
-
import { layout, route, type RouteConfig } from "@react-router/dev/routes";
|
|
132
|
-
|
|
133
|
-
export default [
|
|
134
|
-
layout("routes/layout.tsx", [
|
|
135
|
-
route("/", "routes/page.tsx"), // Página raíz - redirige al locale
|
|
136
|
-
route("/:lang", "routes/[lang]/page.tsx"), // Página de inicio localizada
|
|
137
|
-
route("/:lang/about", "routes/[lang]/about/page.tsx"), // Página "about" localizada
|
|
138
|
-
]),
|
|
139
|
-
] satisfies RouteConfig;
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Paso 4: Integrar Intlayer en tu Configuración de Vite
|
|
117
|
+
### Paso 3: Integra Intlayer en tu configuración de Vite
|
|
143
118
|
|
|
144
119
|
Agrega el plugin intlayer en tu configuración:
|
|
145
120
|
|
|
146
|
-
```typescript fileName="vite.config.ts"
|
|
121
|
+
```typescript fileName="vite.config.ts"
|
|
147
122
|
import { reactRouter } from "@react-router/dev/vite";
|
|
148
123
|
import { defineConfig } from "vite";
|
|
149
|
-
import {
|
|
124
|
+
import { intlayer } from "vite-intlayer";
|
|
150
125
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
151
126
|
|
|
152
127
|
export default defineConfig({
|
|
153
|
-
plugins: [
|
|
154
|
-
reactRouter(),
|
|
155
|
-
tsconfigPaths(),
|
|
156
|
-
intlayer(),
|
|
157
|
-
intlayerMiddlewarePlugin(),
|
|
158
|
-
],
|
|
128
|
+
plugins: [reactRouter(), tsconfigPaths(), intlayer()],
|
|
159
129
|
});
|
|
160
130
|
```
|
|
161
131
|
|
|
162
|
-
> El plugin `intlayer()`
|
|
132
|
+
> El plugin `intlayer()` para Vite se utiliza para integrar Intlayer con Vite. Asegura la construcción de archivos de declaración de contenido y los supervisa en modo desarrollo. Define variables de entorno de Intlayer dentro de la aplicación Vite. Además, proporciona alias para optimizar el rendimiento.
|
|
133
|
+
|
|
134
|
+
### Paso 4: Configurar las rutas de React Router v7
|
|
135
|
+
|
|
136
|
+
Configura tu enrutamiento con rutas conscientes del locale:
|
|
137
|
+
|
|
138
|
+
```typescript fileName="app/routes.ts"
|
|
139
|
+
import { layout, route, type RouteConfig } from "@react-router/dev/routes";
|
|
140
|
+
|
|
141
|
+
export default [
|
|
142
|
+
layout("routes/layout.tsx", [
|
|
143
|
+
route("/:lang?", "routes/page.tsx"), // Página de inicio localizada
|
|
144
|
+
route("/:lang?/about", "routes/about/page.tsx"), // Página "acerca de" localizada
|
|
145
|
+
]),
|
|
146
|
+
] satisfies RouteConfig;
|
|
147
|
+
```
|
|
163
148
|
|
|
164
149
|
### Paso 5: Crear Componentes de Layout
|
|
165
150
|
|
|
166
|
-
Configura tu layout raíz y los layouts específicos por
|
|
151
|
+
Configura tu layout raíz y los layouts específicos por localización:
|
|
167
152
|
|
|
168
153
|
#### Layout Raíz
|
|
169
154
|
|
|
170
|
-
```tsx fileName="app/routes/layout.tsx"
|
|
171
|
-
// app/routes/layout.tsx
|
|
172
|
-
import { Outlet } from "react-router";
|
|
155
|
+
```tsx fileName="app/routes/layout.tsx"
|
|
173
156
|
import { IntlayerProvider } from "react-intlayer";
|
|
157
|
+
import { Outlet } from "react-router";
|
|
158
|
+
|
|
159
|
+
import type { Route } from "./+types/layout";
|
|
160
|
+
|
|
161
|
+
export default function RootLayout({ params }: Route.ComponentProps) {
|
|
162
|
+
const { locale } = params;
|
|
174
163
|
|
|
175
|
-
export default function RootLayout() {
|
|
176
164
|
return (
|
|
177
|
-
<IntlayerProvider>
|
|
165
|
+
<IntlayerProvider locale={locale}>
|
|
178
166
|
<Outlet />
|
|
179
167
|
</IntlayerProvider>
|
|
180
168
|
);
|
|
181
169
|
}
|
|
182
170
|
```
|
|
183
171
|
|
|
184
|
-
### Paso 6: Declara
|
|
172
|
+
### Paso 6: Declara Tu Contenido
|
|
185
173
|
|
|
186
174
|
Crea y gestiona tus declaraciones de contenido para almacenar traducciones:
|
|
187
175
|
|
|
188
|
-
```tsx fileName="app/routes/[lang]/page.content.ts"
|
|
176
|
+
```tsx fileName="app/routes/[lang]/page.content.ts"
|
|
189
177
|
import { t, type Dictionary } from "intlayer";
|
|
190
178
|
|
|
191
179
|
const pageContent = {
|
|
@@ -193,19 +181,23 @@ const pageContent = {
|
|
|
193
181
|
content: {
|
|
194
182
|
title: t({
|
|
195
183
|
en: "Welcome to React Router v7 + Intlayer",
|
|
196
|
-
|
|
184
|
+
es: "Bienvenido a React Router v7 + Intlayer",
|
|
185
|
+
fr: "Bienvenue sur React Router v7 + Intlayer",
|
|
197
186
|
}),
|
|
198
187
|
description: t({
|
|
199
188
|
en: "Build multilingual applications with ease using React Router v7 and Intlayer.",
|
|
200
|
-
|
|
189
|
+
es: "Cree aplicaciones multilingües fácilmente usando React Router v7 y Intlayer.",
|
|
190
|
+
fr: "Créez des applications multilingues facilement avec React Router v7 et Intlayer.",
|
|
201
191
|
}),
|
|
202
192
|
aboutLink: t({
|
|
203
|
-
en: "
|
|
204
|
-
|
|
193
|
+
en: "Aprender Sobre Nosotros",
|
|
194
|
+
es: "Aprender Sobre Nosotros",
|
|
195
|
+
fr: "En savoir plus sur nous",
|
|
205
196
|
}),
|
|
206
197
|
homeLink: t({
|
|
207
198
|
en: "Inicio",
|
|
208
|
-
|
|
199
|
+
es: "Inicio",
|
|
200
|
+
fr: "Accueil",
|
|
209
201
|
}),
|
|
210
202
|
},
|
|
211
203
|
} satisfies Dictionary;
|
|
@@ -213,104 +205,92 @@ const pageContent = {
|
|
|
213
205
|
export default pageContent;
|
|
214
206
|
```
|
|
215
207
|
|
|
216
|
-
> Tus declaraciones de contenido pueden definirse en cualquier parte de tu aplicación tan pronto como se incluyan en el directorio `contentDir` (por defecto, `./app`). Y deben coincidir con la extensión
|
|
208
|
+
> Tus declaraciones de contenido pueden definirse en cualquier parte de tu aplicación tan pronto como se incluyan en el directorio `contentDir` (por defecto, `./app`). Y deben coincidir con la extensión del archivo de declaración de contenido (por defecto, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
217
209
|
|
|
218
210
|
> Para más detalles, consulta la [documentación de declaración de contenido](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/dictionary/get_started.md).
|
|
219
211
|
|
|
220
|
-
### Paso 7: Crear Componentes
|
|
221
|
-
|
|
222
|
-
Crea un componente `LocalizedLink` para la navegación consciente del idioma:
|
|
212
|
+
### Paso 7: Crear Componentes Sensibles al Idioma
|
|
223
213
|
|
|
224
|
-
|
|
225
|
-
// app/components/localized-link.tsx
|
|
226
|
-
import { getLocalizedUrl } from "intlayer";
|
|
227
|
-
import { useLocale } from "react-intlayer";
|
|
228
|
-
import React from "react";
|
|
229
|
-
import { Link, useLocation } from "react-router";
|
|
214
|
+
Crea un componente `LocalizedLink` para la navegación sensible al idioma:
|
|
230
215
|
|
|
231
|
-
|
|
216
|
+
```tsx fileName="app/components/localized-link.tsx"
|
|
217
|
+
import type { FC } from "react";
|
|
232
218
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
219
|
+
import { getLocalizedUrl, type LocalesValues } from "intlayer";
|
|
220
|
+
import { useLocale } from "react-intlayer";
|
|
221
|
+
import { Link, type LinkProps, type To } from "react-router";
|
|
236
222
|
|
|
237
|
-
|
|
238
|
-
/^([a-z][a-z0-9+.-]*:)?\/\//i.test(path) || path.startsWith("mailto:");
|
|
223
|
+
const isExternalLink = (to: string) => /^(https?:)?\/\//.test(to);
|
|
239
224
|
|
|
225
|
+
// Función para localizar la URL según el locale
|
|
226
|
+
export const locacalizeTo = (to: To, locale: LocalesValues): To => {
|
|
240
227
|
if (typeof to === "string") {
|
|
241
|
-
if (
|
|
242
|
-
return
|
|
228
|
+
if (isExternalLink(to)) {
|
|
229
|
+
return to;
|
|
243
230
|
}
|
|
244
|
-
|
|
231
|
+
|
|
232
|
+
return getLocalizedUrl(to, locale);
|
|
245
233
|
}
|
|
246
234
|
|
|
247
|
-
if (to
|
|
248
|
-
|
|
249
|
-
if (pathname && pathname.startsWith("/") && !isExternal(pathname)) {
|
|
250
|
-
return (
|
|
251
|
-
<Link
|
|
252
|
-
to={{ ...to, pathname: getLocalizedUrl(pathname, locale) }}
|
|
253
|
-
{...props}
|
|
254
|
-
/>
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
return <Link to={to} {...props} />;
|
|
235
|
+
if (isExternalLink(to.pathname ?? "")) {
|
|
236
|
+
return to;
|
|
258
237
|
}
|
|
259
238
|
|
|
260
|
-
return
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
```
|
|
239
|
+
return {
|
|
240
|
+
...to,
|
|
241
|
+
pathname: getLocalizedUrl(to.pathname ?? "", locale),
|
|
242
|
+
};
|
|
243
|
+
};
|
|
268
244
|
|
|
269
|
-
|
|
245
|
+
// Componente para enlaces localizados
|
|
246
|
+
export const LocalizedLink: FC<LinkProps> = (props) => {
|
|
247
|
+
const { locale } = useLocale();
|
|
270
248
|
|
|
271
|
-
|
|
249
|
+
return <Link {...props} to={locacalizeTo(props.to, locale)} />;
|
|
250
|
+
};
|
|
251
|
+
```
|
|
272
252
|
|
|
273
|
-
|
|
253
|
+
En caso de que desees navegar a las rutas localizadas, puedes usar el hook `useLocalizedNavigate`:
|
|
274
254
|
|
|
275
|
-
```tsx fileName="app/
|
|
276
|
-
|
|
277
|
-
import {
|
|
278
|
-
import { Navigate } from "react-router";
|
|
255
|
+
```tsx fileName="app/hooks/useLocalizedNavigate.ts"
|
|
256
|
+
import { useLocale } from "intlayer";
|
|
257
|
+
import { type NavigateOptions, type To, useNavigate } from "react-router";
|
|
279
258
|
|
|
280
|
-
|
|
259
|
+
import { locacalizeTo } from "~/components/localized-link";
|
|
260
|
+
|
|
261
|
+
export const useLocalizedNavigate = () => {
|
|
262
|
+
const navigate = useNavigate();
|
|
281
263
|
const { locale } = useLocale();
|
|
282
264
|
|
|
283
|
-
|
|
284
|
-
|
|
265
|
+
const localizedNavigate = (to: To, options?: NavigateOptions) => {
|
|
266
|
+
const localedTo = locacalizeTo(to, locale);
|
|
267
|
+
|
|
268
|
+
navigate(localedTo, options);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
return localizedNavigate;
|
|
272
|
+
};
|
|
285
273
|
```
|
|
286
274
|
|
|
275
|
+
### Paso 8: Utiliza Intlayer en tus Páginas
|
|
276
|
+
|
|
277
|
+
Accede a tus diccionarios de contenido a lo largo de toda tu aplicación:
|
|
278
|
+
|
|
287
279
|
#### Página de inicio localizada
|
|
288
280
|
|
|
289
|
-
```tsx fileName="app/routes/[lang]/page.tsx"
|
|
281
|
+
```tsx fileName="app/routes/[lang]/page.tsx"
|
|
290
282
|
import { useIntlayer } from "react-intlayer";
|
|
291
|
-
import LocalizedLink from "~/components/localized-link";
|
|
283
|
+
import { LocalizedLink } from "~/components/localized-link";
|
|
292
284
|
|
|
293
285
|
export default function Page() {
|
|
294
|
-
const
|
|
286
|
+
const { title, description, aboutLink } = useIntlayer("page");
|
|
295
287
|
|
|
296
288
|
return (
|
|
297
|
-
<div
|
|
298
|
-
<h1>{
|
|
299
|
-
<p>{
|
|
300
|
-
<nav
|
|
301
|
-
<LocalizedLink
|
|
302
|
-
to="/about"
|
|
303
|
-
style={{
|
|
304
|
-
display: "inline-block",
|
|
305
|
-
padding: "0.5rem 1rem",
|
|
306
|
-
backgroundColor: "#007bff",
|
|
307
|
-
color: "white",
|
|
308
|
-
textDecoration: "none",
|
|
309
|
-
borderRadius: "4px",
|
|
310
|
-
}}
|
|
311
|
-
>
|
|
312
|
-
{content.aboutLink}
|
|
313
|
-
</LocalizedLink>
|
|
289
|
+
<div>
|
|
290
|
+
<h1>{title}</h1>
|
|
291
|
+
<p>{description}</p>
|
|
292
|
+
<nav>
|
|
293
|
+
<LocalizedLink to="/about">{aboutLink}</LocalizedLink>
|
|
314
294
|
</nav>
|
|
315
295
|
</div>
|
|
316
296
|
);
|
|
@@ -319,47 +299,62 @@ export default function Page() {
|
|
|
319
299
|
|
|
320
300
|
> Para aprender más sobre el hook `useIntlayer`, consulta la [documentación](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/react-intlayer/useIntlayer.md).
|
|
321
301
|
|
|
322
|
-
### Paso 9: Crear un
|
|
302
|
+
### Paso 9: Crear un componente para cambiar de idioma
|
|
323
303
|
|
|
324
304
|
Crea un componente para permitir a los usuarios cambiar de idioma:
|
|
325
305
|
|
|
326
|
-
```tsx fileName="app/components/locale-switcher.tsx"
|
|
327
|
-
import {
|
|
328
|
-
import { useLocale } from "react-intlayer";
|
|
329
|
-
import { useLocation, useNavigate } from "react-router";
|
|
306
|
+
```tsx fileName="app/components/locale-switcher.tsx"
|
|
307
|
+
import type { FC } from "react";
|
|
330
308
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
309
|
+
import {
|
|
310
|
+
getHTMLTextDir,
|
|
311
|
+
getLocaleName,
|
|
312
|
+
getLocalizedUrl,
|
|
313
|
+
getPathWithoutLocale,
|
|
314
|
+
} from "intlayer";
|
|
315
|
+
import { setLocaleCookie, useIntlayer, useLocale } from "react-intlayer";
|
|
316
|
+
import { Link, useLocation } from "react-router";
|
|
335
317
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
};
|
|
318
|
+
export const LocaleSwitcher: FC = () => {
|
|
319
|
+
const { localeSwitcherLabel } = useIntlayer("locale-switcher");
|
|
320
|
+
const { pathname } = useLocation();
|
|
321
|
+
|
|
322
|
+
const { availableLocales, locale } = useLocale();
|
|
323
|
+
|
|
324
|
+
const pathWithoutLocale = getPathWithoutLocale(pathname);
|
|
344
325
|
|
|
345
326
|
return (
|
|
346
|
-
<
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
327
|
+
<ol>
|
|
328
|
+
{availableLocales.map((localeItem) => (
|
|
329
|
+
<li key={localeItem}>
|
|
330
|
+
<Link
|
|
331
|
+
aria-current={localeItem === locale ? "page" : undefined}
|
|
332
|
+
aria-label={`${localeSwitcherLabel.value} ${getLocaleName(localeItem)}`}
|
|
333
|
+
onClick={() => setLocaleCookie(localeItem)}
|
|
334
|
+
to={getLocalizedUrl(pathWithoutLocale, localeItem)}
|
|
335
|
+
>
|
|
336
|
+
<span>
|
|
337
|
+
{/* Localización - p.ej. FR */}
|
|
338
|
+
{localeItem}
|
|
339
|
+
</span>
|
|
340
|
+
<span>
|
|
341
|
+
{/* Idioma en su propia localización - p.ej. Français */}
|
|
342
|
+
{getLocaleName(localeItem, locale)}
|
|
343
|
+
</span>
|
|
344
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
345
|
+
{/* Idioma en la localización actual - p.ej. Francés con la localización actual configurada a Locales.SPANISH */}
|
|
346
|
+
{getLocaleName(localeItem)}
|
|
347
|
+
</span>
|
|
348
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
349
|
+
{/* Idioma en inglés - por ejemplo, French */}
|
|
350
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
351
|
+
</span>
|
|
352
|
+
</Link>
|
|
353
|
+
</li>
|
|
354
|
+
))}
|
|
355
|
+
</ol>
|
|
361
356
|
);
|
|
362
|
-
}
|
|
357
|
+
};
|
|
363
358
|
```
|
|
364
359
|
|
|
365
360
|
> Para aprender más sobre el hook `useLocale`, consulta la [documentación](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/react-intlayer/useLocale.md).
|
|
@@ -368,8 +363,7 @@ export default function LocaleSwitcher() {
|
|
|
368
363
|
|
|
369
364
|
Crea un hook para gestionar los atributos lang y dir del HTML:
|
|
370
365
|
|
|
371
|
-
```tsx fileName="app/hooks/useI18nHTMLAttributes.tsx"
|
|
372
|
-
// app/hooks/useI18nHTMLAttributes.tsx
|
|
366
|
+
```tsx fileName="app/hooks/useI18nHTMLAttributes.tsx"
|
|
373
367
|
import { getHTMLTextDir } from "intlayer";
|
|
374
368
|
import { useEffect } from "react";
|
|
375
369
|
import { useLocale } from "react-intlayer";
|
|
@@ -386,8 +380,7 @@ export const useI18nHTMLAttributes = () => {
|
|
|
386
380
|
|
|
387
381
|
Luego úsalo en tu componente raíz:
|
|
388
382
|
|
|
389
|
-
```tsx fileName="app/
|
|
390
|
-
// app/routes/layout.tsx
|
|
383
|
+
```tsx fileName="app/routes/layout.tsx"
|
|
391
384
|
import { Outlet } from "react-router";
|
|
392
385
|
import { IntlayerProvider } from "react-intlayer";
|
|
393
386
|
|
|
@@ -404,35 +397,26 @@ export default function RootLayout() {
|
|
|
404
397
|
}
|
|
405
398
|
```
|
|
406
399
|
|
|
407
|
-
### Paso 11:
|
|
400
|
+
### Paso 11: Añadir middleware (Opcional)
|
|
408
401
|
|
|
409
|
-
|
|
402
|
+
También puedes usar el `intlayerMiddleware` para agregar enrutamiento del lado del servidor a tu aplicación. Este plugin detectará automáticamente la configuración regional actual basada en la URL y establecerá la cookie de configuración regional apropiada. Si no se especifica ninguna configuración regional, el plugin determinará la configuración regional más adecuada según las preferencias de idioma del navegador del usuario. Si no se detecta ninguna configuración regional, redirigirá a la configuración regional predeterminada.
|
|
410
403
|
|
|
411
|
-
|
|
412
|
-
# Construir diccionarios de Intlayer
|
|
413
|
-
npm run intlayer:build
|
|
414
|
-
|
|
415
|
-
# Iniciar servidor de desarrollo
|
|
416
|
-
npm run dev
|
|
417
|
-
```
|
|
404
|
+
> Ten en cuenta que para usar el `intlayerMiddleware` en producción, necesitas cambiar el paquete `vite-intlayer` de `devDependencies` a `dependencies`.
|
|
418
405
|
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
|
|
406
|
+
```typescript {3,7} fileName="vite.config.ts"
|
|
407
|
+
import { defineConfig } from "vite";
|
|
408
|
+
import react from "@vitejs/plugin-react-swc";
|
|
409
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
422
410
|
|
|
423
|
-
|
|
424
|
-
|
|
411
|
+
// https://vitejs.dev/config/
|
|
412
|
+
export default defineConfig({
|
|
413
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
414
|
+
});
|
|
425
415
|
```
|
|
426
416
|
|
|
427
|
-
|
|
428
|
-
# Construir diccionarios de Intlayer
|
|
429
|
-
yarn intlayer:build
|
|
430
|
-
|
|
431
|
-
# Iniciar servidor de desarrollo
|
|
432
|
-
yarn dev
|
|
433
|
-
```
|
|
417
|
+
---
|
|
434
418
|
|
|
435
|
-
|
|
419
|
+
## Configurar TypeScript
|
|
436
420
|
|
|
437
421
|
Intlayer utiliza la ampliación de módulos para aprovechar las ventajas de TypeScript y fortalecer tu base de código.
|
|
438
422
|
|
|
@@ -440,21 +424,21 @@ Asegúrate de que tu configuración de TypeScript incluya los tipos autogenerado
|
|
|
440
424
|
|
|
441
425
|
```json5 fileName="tsconfig.json"
|
|
442
426
|
{
|
|
443
|
-
|
|
444
|
-
// ... tus configuraciones existentes de TypeScript
|
|
445
|
-
},
|
|
427
|
+
// ... tus configuraciones existentes
|
|
446
428
|
include: [
|
|
447
429
|
// ... tus inclusiones existentes
|
|
448
|
-
".intlayer/**/*.ts", // Incluir los tipos
|
|
430
|
+
".intlayer/**/*.ts", // Incluir los tipos autogenerados
|
|
449
431
|
],
|
|
450
432
|
}
|
|
451
433
|
```
|
|
452
434
|
|
|
453
|
-
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Configuración de Git
|
|
454
438
|
|
|
455
439
|
Se recomienda ignorar los archivos generados por Intlayer. Esto te permite evitar comprometerlos en tu repositorio Git.
|
|
456
440
|
|
|
457
|
-
Para
|
|
441
|
+
Para hacer esto, puedes agregar las siguientes instrucciones a tu archivo `.gitignore`:
|
|
458
442
|
|
|
459
443
|
```plaintext fileName=".gitignore"
|
|
460
444
|
# Ignorar los archivos generados por Intlayer
|
|
@@ -463,55 +447,26 @@ Para hacerlo, puedes agregar las siguientes instrucciones a tu archivo `.gitigno
|
|
|
463
447
|
|
|
464
448
|
---
|
|
465
449
|
|
|
466
|
-
##
|
|
467
|
-
|
|
468
|
-
Al desplegar tu aplicación:
|
|
469
|
-
|
|
470
|
-
1. **Construye tu aplicación:**
|
|
471
|
-
|
|
472
|
-
```bash
|
|
473
|
-
npm run build
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
2. **Construye los diccionarios de Intlayer:**
|
|
477
|
-
|
|
478
|
-
```bash
|
|
479
|
-
npm run intlayer:build
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
3. **Mueve `vite-intlayer` a las dependencias** si usas middleware en producción:
|
|
483
|
-
```bash
|
|
484
|
-
npm install vite-intlayer --save
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
Tu aplicación ahora soportará:
|
|
488
|
-
|
|
489
|
-
- **Estructura de URL**: `/en`, `/en/about`, `/tr`, `/tr/about`
|
|
490
|
-
- **Detección automática de idioma** basada en las preferencias del navegador
|
|
491
|
-
- **Enrutamiento consciente del idioma** con React Router v7
|
|
492
|
-
- **Soporte para TypeScript** con tipos auto-generados
|
|
493
|
-
- **Renderizado del lado del servidor** con manejo adecuado del idioma
|
|
494
|
-
|
|
495
|
-
## Extensión para VS Code
|
|
450
|
+
## Extensión de VS Code
|
|
496
451
|
|
|
497
452
|
Para mejorar tu experiencia de desarrollo con Intlayer, puedes instalar la **Extensión oficial de Intlayer para VS Code**.
|
|
498
453
|
|
|
499
454
|
[Instalar desde el Marketplace de VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
500
455
|
|
|
501
|
-
Esta extensión
|
|
456
|
+
Esta extensión ofrece:
|
|
502
457
|
|
|
503
458
|
- **Autocompletado** para las claves de traducción.
|
|
504
459
|
- **Detección de errores en tiempo real** para traducciones faltantes.
|
|
505
460
|
- **Previsualizaciones en línea** del contenido traducido.
|
|
506
461
|
- **Acciones rápidas** para crear y actualizar traducciones fácilmente.
|
|
507
462
|
|
|
508
|
-
Para más detalles sobre cómo usar la extensión, consulta la [documentación de la
|
|
463
|
+
Para más detalles sobre cómo usar la extensión, consulta la [documentación de la Extensión de Intlayer para VS Code](https://intlayer.org/doc/vs-code-extension).
|
|
509
464
|
|
|
510
465
|
---
|
|
511
466
|
|
|
512
467
|
## Ir Más Allá
|
|
513
468
|
|
|
514
|
-
Para
|
|
469
|
+
Para profundizar, puedes implementar el [editor visual](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/intlayer_visual_editor.md) o externalizar tu contenido usando el [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/intlayer_CMS.md).
|
|
515
470
|
|
|
516
471
|
---
|
|
517
472
|
|
|
@@ -524,10 +479,11 @@ Para ir más allá, puedes implementar el [editor visual](https://github.com/aym
|
|
|
524
479
|
- [Declaración de Contenido](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/dictionary/get_started.md)
|
|
525
480
|
- [Configuración](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/configuration.md)
|
|
526
481
|
|
|
527
|
-
Esta guía completa proporciona todo lo que necesitas para integrar Intlayer con React Router v7 para una aplicación
|
|
482
|
+
Esta guía completa proporciona todo lo que necesitas para integrar Intlayer con React Router v7 para una aplicación completamente internacionalizada con enrutamiento consciente del idioma y soporte para TypeScript.
|
|
528
483
|
|
|
529
|
-
## Historial de la
|
|
484
|
+
## Historial de la documentación
|
|
530
485
|
|
|
531
|
-
| Versión | Fecha
|
|
532
|
-
| ------- |
|
|
533
|
-
|
|
|
486
|
+
| Versión | Fecha | Cambios |
|
|
487
|
+
| ------- | ---------- | ---------------------------- |
|
|
488
|
+
| 6.1.5 | 2025-10-03 | Documento actualizado |
|
|
489
|
+
| 5.8.2 | 2025-09-04 | Añadido para React Router v7 |
|