@intlayer/docs 7.3.14 → 7.4.0
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/intlayer_with_i18next.md +3 -0
- package/blog/ar/intlayer_with_next-i18next.md +3 -0
- package/blog/ar/intlayer_with_next-intl.md +3 -0
- package/blog/ar/intlayer_with_react-i18next.md +3 -0
- package/blog/ar/intlayer_with_react-intl.md +3 -0
- package/blog/ar/intlayer_with_vue-i18n.md +3 -0
- package/blog/de/intlayer_with_i18next.md +3 -0
- package/blog/de/intlayer_with_next-i18next.md +3 -0
- package/blog/de/intlayer_with_next-intl.md +3 -0
- package/blog/de/intlayer_with_react-i18next.md +3 -0
- package/blog/de/intlayer_with_react-intl.md +3 -0
- package/blog/de/intlayer_with_vue-i18n.md +3 -0
- package/blog/en/intlayer_with_i18next.md +7 -0
- package/blog/en/intlayer_with_next-i18next.md +3 -0
- package/blog/en/intlayer_with_next-intl.md +7 -0
- package/blog/en/intlayer_with_react-i18next.md +3 -0
- package/blog/en/intlayer_with_react-intl.md +3 -0
- package/blog/en/intlayer_with_vue-i18n.md +3 -0
- package/blog/en-GB/intlayer_with_i18next.md +3 -0
- package/blog/en-GB/intlayer_with_next-i18next.md +3 -0
- package/blog/en-GB/intlayer_with_next-intl.md +3 -0
- package/blog/en-GB/intlayer_with_react-i18next.md +3 -0
- package/blog/en-GB/intlayer_with_react-intl.md +3 -0
- package/blog/en-GB/intlayer_with_vue-i18n.md +3 -0
- package/blog/es/intlayer_with_i18next.md +3 -0
- package/blog/es/intlayer_with_next-i18next.md +3 -0
- package/blog/es/intlayer_with_next-intl.md +3 -0
- package/blog/es/intlayer_with_react-i18next.md +3 -0
- package/blog/es/intlayer_with_react-intl.md +3 -0
- package/blog/es/intlayer_with_vue-i18n.md +3 -0
- package/blog/fr/intlayer_with_i18next.md +3 -0
- package/blog/fr/intlayer_with_next-i18next.md +3 -0
- package/blog/fr/intlayer_with_next-intl.md +3 -0
- package/blog/fr/intlayer_with_react-i18next.md +3 -0
- package/blog/fr/intlayer_with_react-intl.md +3 -0
- package/blog/fr/intlayer_with_vue-i18n.md +3 -0
- package/blog/hi/intlayer_with_i18next.md +3 -0
- package/blog/hi/intlayer_with_next-i18next.md +3 -0
- package/blog/hi/intlayer_with_next-intl.md +3 -0
- package/blog/hi/intlayer_with_react-i18next.md +3 -0
- package/blog/hi/intlayer_with_react-intl.md +3 -0
- package/blog/hi/intlayer_with_vue-i18n.md +3 -0
- package/blog/id/intlayer_with_i18next.md +3 -0
- package/blog/id/intlayer_with_next-i18next.md +3 -0
- package/blog/id/intlayer_with_next-intl.md +3 -0
- package/blog/id/intlayer_with_react-i18next.md +3 -0
- package/blog/id/intlayer_with_react-intl.md +3 -0
- package/blog/id/intlayer_with_vue-i18n.md +3 -0
- package/blog/it/intlayer_with_i18next.md +3 -0
- package/blog/it/intlayer_with_next-i18next.md +3 -0
- package/blog/it/intlayer_with_next-intl.md +3 -0
- package/blog/it/intlayer_with_react-i18next.md +3 -0
- package/blog/it/intlayer_with_react-intl.md +3 -0
- package/blog/it/intlayer_with_vue-i18n.md +3 -0
- package/blog/ja/intlayer_with_i18next.md +3 -0
- package/blog/ja/intlayer_with_next-i18next.md +3 -0
- package/blog/ja/intlayer_with_next-intl.md +3 -0
- package/blog/ja/intlayer_with_react-i18next.md +3 -0
- package/blog/ja/intlayer_with_react-intl.md +3 -0
- package/blog/ja/intlayer_with_vue-i18n.md +3 -0
- package/blog/ko/intlayer_with_i18next.md +3 -0
- package/blog/ko/intlayer_with_next-i18next.md +3 -0
- package/blog/ko/intlayer_with_next-intl.md +3 -0
- package/blog/ko/intlayer_with_react-i18next.md +3 -0
- package/blog/ko/intlayer_with_react-intl.md +3 -0
- package/blog/ko/intlayer_with_vue-i18n.md +3 -0
- package/blog/pl/intlayer_with_i18next.md +3 -0
- package/blog/pl/intlayer_with_next-i18next.md +3 -0
- package/blog/pl/intlayer_with_next-intl.md +3 -0
- package/blog/pl/intlayer_with_react-i18next.md +3 -0
- package/blog/pl/intlayer_with_react-intl.md +3 -0
- package/blog/pl/intlayer_with_vue-i18n.md +3 -0
- package/blog/pt/intlayer_with_i18next.md +3 -0
- package/blog/pt/intlayer_with_next-i18next.md +3 -0
- package/blog/pt/intlayer_with_next-intl.md +3 -0
- package/blog/pt/intlayer_with_react-i18next.md +3 -0
- package/blog/pt/intlayer_with_react-intl.md +3 -0
- package/blog/pt/intlayer_with_vue-i18n.md +3 -0
- package/blog/ru/intlayer_with_i18next.md +3 -0
- package/blog/ru/intlayer_with_next-i18next.md +3 -0
- package/blog/ru/intlayer_with_next-intl.md +3 -0
- package/blog/ru/intlayer_with_react-i18next.md +3 -0
- package/blog/ru/intlayer_with_react-intl.md +3 -0
- package/blog/ru/intlayer_with_vue-i18n.md +3 -0
- package/blog/tr/intlayer_with_i18next.md +3 -0
- package/blog/tr/intlayer_with_next-i18next.md +3 -0
- package/blog/tr/intlayer_with_next-intl.md +3 -0
- package/blog/tr/intlayer_with_react-i18next.md +3 -0
- package/blog/tr/intlayer_with_vue-i18n.md +3 -0
- package/blog/vi/intlayer_with_i18next.md +3 -0
- package/blog/vi/intlayer_with_next-i18next.md +3 -0
- package/blog/vi/intlayer_with_next-intl.md +3 -0
- package/blog/vi/intlayer_with_react-i18next.md +3 -0
- package/blog/vi/intlayer_with_react-intl.md +3 -0
- package/blog/vi/intlayer_with_vue-i18n.md +3 -0
- package/blog/zh/intlayer_with_i18next.md +3 -0
- package/blog/zh/intlayer_with_next-i18next.md +3 -0
- package/blog/zh/intlayer_with_next-intl.md +3 -0
- package/blog/zh/intlayer_with_react-i18next.md +3 -0
- package/blog/zh/intlayer_with_react-intl.md +3 -0
- package/blog/zh/intlayer_with_vue-i18n.md +3 -0
- package/docs/ar/intlayer_with_lynx+react.md +1 -1
- package/docs/ar/intlayer_with_tanstack.md +132 -2
- package/docs/ar/intlayer_with_vite+react.md +99 -331
- package/docs/ar/plugins/sync-json.md +3 -0
- package/docs/de/intlayer_with_lynx+react.md +1 -1
- package/docs/de/intlayer_with_tanstack.md +132 -2
- package/docs/de/intlayer_with_vite+react.md +116 -380
- package/docs/de/plugins/sync-json.md +3 -0
- package/docs/en/intlayer_with_tanstack.md +131 -1
- package/docs/en/intlayer_with_vite+react.md +6 -10
- package/docs/en/plugins/sync-json.md +3 -0
- package/docs/en-GB/intlayer_with_tanstack.md +131 -1
- package/docs/en-GB/intlayer_with_vite+react.md +62 -74
- package/docs/en-GB/plugins/sync-json.md +3 -0
- package/docs/es/intlayer_with_tanstack.md +132 -2
- package/docs/es/intlayer_with_vite+react.md +101 -333
- package/docs/es/plugins/sync-json.md +3 -0
- package/docs/fr/intlayer_with_tanstack.md +132 -2
- package/docs/fr/intlayer_with_vite+react.md +101 -357
- package/docs/fr/plugins/sync-json.md +3 -0
- package/docs/hi/intlayer_with_tanstack.md +132 -2
- package/docs/hi/intlayer_with_vite+react.md +120 -333
- package/docs/hi/plugins/sync-json.md +3 -0
- package/docs/id/intlayer_with_tanstack.md +132 -2
- package/docs/id/intlayer_with_vite+react.md +7 -13
- package/docs/id/plugins/sync-json.md +3 -0
- package/docs/it/intlayer_with_lynx+react.md +1 -1
- package/docs/it/intlayer_with_tanstack.md +132 -2
- package/docs/it/intlayer_with_vite+react.md +121 -393
- package/docs/it/plugins/sync-json.md +3 -0
- package/docs/ja/intlayer_with_tanstack.md +132 -2
- package/docs/ja/intlayer_with_vite+react.md +106 -378
- package/docs/ja/plugins/sync-json.md +3 -0
- package/docs/ko/intlayer_with_lynx+react.md +1 -1
- package/docs/ko/intlayer_with_tanstack.md +132 -2
- package/docs/ko/intlayer_with_vite+react.md +90 -322
- package/docs/ko/plugins/sync-json.md +3 -0
- package/docs/pl/intlayer_with_tanstack.md +132 -2
- package/docs/pl/intlayer_with_vite+react.md +25 -21
- package/docs/pl/plugins/sync-json.md +3 -0
- package/docs/pt/intlayer_with_tanstack.md +132 -2
- package/docs/pt/intlayer_with_vite+react.md +96 -328
- package/docs/pt/plugins/sync-json.md +3 -0
- package/docs/ru/intlayer_with_lynx+react.md +1 -1
- package/docs/ru/intlayer_with_tanstack.md +132 -2
- package/docs/ru/intlayer_with_vite+react.md +109 -362
- package/docs/ru/plugins/sync-json.md +3 -0
- package/docs/tr/intlayer_with_tanstack.md +132 -2
- package/docs/tr/intlayer_with_vite+react.md +132 -366
- package/docs/tr/plugins/sync-json.md +3 -0
- package/docs/vi/intlayer_with_tanstack.md +132 -2
- package/docs/vi/intlayer_with_vite+react.md +16 -19
- package/docs/vi/plugins/sync-json.md +3 -0
- package/docs/zh/intlayer_with_tanstack.md +133 -3
- package/docs/zh/intlayer_with_vite+react.md +91 -374
- package/docs/zh/plugins/sync-json.md +3 -0
- package/frequent_questions/ar/customized_locale_list.md +1 -1
- package/frequent_questions/de/customized_locale_list.md +1 -1
- package/frequent_questions/en/customized_locale_list.md +1 -1
- package/frequent_questions/en-GB/customized_locale_list.md +1 -1
- package/frequent_questions/es/customized_locale_list.md +1 -1
- package/frequent_questions/fr/customized_locale_list.md +1 -1
- package/frequent_questions/hi/customized_locale_list.md +1 -1
- package/frequent_questions/id/customized_locale_list.md +1 -1
- package/frequent_questions/it/customized_locale_list.md +1 -1
- package/frequent_questions/ja/customized_locale_list.md +1 -1
- package/frequent_questions/ko/customized_locale_list.md +1 -1
- package/frequent_questions/pl/customized_locale_list.md +1 -1
- package/frequent_questions/pt/customized_locale_list.md +1 -1
- package/frequent_questions/ru/customized_locale_list.md +1 -1
- package/frequent_questions/tr/customized_locale_list.md +1 -1
- package/frequent_questions/vi/customized_locale_list.md +1 -1
- package/frequent_questions/zh/customized_locale_list.md +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2024-03-07
|
|
3
|
-
updatedAt:
|
|
4
|
-
title: Cómo traducir tu Vite
|
|
3
|
+
updatedAt: 2025-12-10
|
|
4
|
+
title: Cómo traducir tu aplicación Vite y React – guía i18n 2025
|
|
5
5
|
description: Aprende cómo agregar internacionalización (i18n) a tu aplicación Vite y React usando Intlayer. Sigue esta guía para hacer tu aplicación multilingüe.
|
|
6
6
|
keywords:
|
|
7
7
|
- Internacionalización
|
|
@@ -16,23 +16,19 @@ slugs:
|
|
|
16
16
|
- environment
|
|
17
17
|
- vite-and-react
|
|
18
18
|
applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
|
|
19
|
-
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
19
|
+
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
20
20
|
history:
|
|
21
21
|
- version: 5.5.10
|
|
22
22
|
date: 2025-06-29
|
|
23
23
|
changes: Historial inicial
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
#
|
|
26
|
+
# Traduce tu sitio web Vite y React usando Intlayer | Internacionalización (i18n)
|
|
27
27
|
|
|
28
28
|
## Tabla de contenido
|
|
29
29
|
|
|
30
30
|
<TOC/>
|
|
31
31
|
|
|
32
|
-
<iframe title="The best i18n solution for Vite and React? Discover Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/dS9L7uJeak4?si=VaKmrYMmXjo3xpk2"/>
|
|
33
|
-
|
|
34
|
-
Consulta la [Plantilla de Aplicación](https://github.com/aymericzip/intlayer-vite-react-template) en GitHub.
|
|
35
|
-
|
|
36
32
|
## ¿Qué es Intlayer?
|
|
37
33
|
|
|
38
34
|
**Intlayer** es una biblioteca innovadora y de código abierto para internacionalización (i18n) diseñada para simplificar el soporte multilingüe en aplicaciones web modernas.
|
|
@@ -48,6 +44,27 @@ Con Intlayer, puedes:
|
|
|
48
44
|
|
|
49
45
|
## Guía paso a paso para configurar Intlayer en una aplicación Vite y React
|
|
50
46
|
|
|
47
|
+
<Tab defaultTab="video">
|
|
48
|
+
<TabItem label="Video" value="video">
|
|
49
|
+
|
|
50
|
+
<iframe title="The best i18n solution for Vite and React? Discover Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/dS9L7uJeak4?si=VaKmrYMmXjo3xpk2"/>
|
|
51
|
+
|
|
52
|
+
</TabItem>
|
|
53
|
+
<TabItem label="Code" value="code">
|
|
54
|
+
|
|
55
|
+
<iframe
|
|
56
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-vite-react-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
57
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
58
|
+
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
59
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
60
|
+
loading="lazy"
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
</TabItem>
|
|
64
|
+
</Tab>
|
|
65
|
+
|
|
66
|
+
Consulta la [Plantilla de Aplicación](https://github.com/aymericzip/intlayer-vite-react-template) en GitHub.
|
|
67
|
+
|
|
51
68
|
### Paso 1: Instalar dependencias
|
|
52
69
|
|
|
53
70
|
Instala los paquetes necesarios usando npm:
|
|
@@ -68,14 +85,13 @@ yarn add vite-intlayer --save-dev
|
|
|
68
85
|
```
|
|
69
86
|
|
|
70
87
|
- **intlayer**
|
|
71
|
-
|
|
72
|
-
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).
|
|
88
|
+
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/en/dictionary/content_file.md), transpile y [comandos CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/cli/index.md).
|
|
73
89
|
|
|
74
90
|
- **react-intlayer**
|
|
75
91
|
El paquete que integra Intlayer con aplicaciones React. Proporciona proveedores de contexto y hooks para la internacionalización en React.
|
|
76
92
|
|
|
77
93
|
- **vite-intlayer**
|
|
78
|
-
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
|
|
94
|
+
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 la configuración regional preferida del usuario, gestionar cookies y manejar redirecciones de URL.
|
|
79
95
|
|
|
80
96
|
### Paso 2: Configuración de tu proyecto
|
|
81
97
|
|
|
@@ -137,7 +153,7 @@ const config = {
|
|
|
137
153
|
module.exports = config;
|
|
138
154
|
```
|
|
139
155
|
|
|
140
|
-
> A través de este archivo de configuración, puedes configurar URLs localizadas, redirección de middleware, nombres de cookies, la ubicación y extensión de tus declaraciones de contenido, desactivar 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/
|
|
156
|
+
> A través de este archivo de configuración, puedes configurar URLs localizadas, redirección de middleware, nombres de cookies, la ubicación y extensión de tus declaraciones de contenido, desactivar 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/en/configuration.md).
|
|
141
157
|
|
|
142
158
|
### Paso 3: Integra Intlayer en tu configuración de Vite
|
|
143
159
|
|
|
@@ -414,7 +430,7 @@ module.exports = appContent;
|
|
|
414
430
|
|
|
415
431
|
> Sus declaraciones de contenido pueden definirse en cualquier lugar de su aplicación tan pronto como se incluyan en el directorio `contentDir` (por defecto, `./src`). Y coincidan con la extensión del archivo de declaración de contenido (por defecto, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
416
432
|
|
|
417
|
-
> Para más detalles, consulte la [documentación de declaración de contenido](https://github.com/aymericzip/intlayer/blob/main/docs/docs/
|
|
433
|
+
> Para más detalles, consulte la [documentación de declaración de contenido](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md).
|
|
418
434
|
|
|
419
435
|
> Si su archivo de contenido incluye código TSX, debería considerar importar `import React from "react";` en su archivo de contenido.
|
|
420
436
|
|
|
@@ -634,87 +650,15 @@ Ejemplo:
|
|
|
634
650
|
- https://example.com/fr/about
|
|
635
651
|
```
|
|
636
652
|
|
|
637
|
-
> Por defecto, las rutas no tienen prefijo para la configuración regional predeterminada. Si desea agregar un prefijo para la configuración regional predeterminada, puede establecer la opción `middleware.prefixDefault` en `true` en su configuración. Consulte la [documentación de configuración](https://github.com/aymericzip/intlayer/blob/main/docs/docs/
|
|
653
|
+
> Por defecto, las rutas no tienen prefijo para la configuración regional predeterminada. Si desea agregar un prefijo para la configuración regional predeterminada, puede establecer la opción `middleware.prefixDefault` en `true` en su configuración. Consulte la [documentación de configuración](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md) para obtener más información.
|
|
638
654
|
|
|
639
655
|
Para agregar enrutamiento localizado a su aplicación, puede crear un componente `LocaleRouter` que envuelva las rutas de su aplicación y gestione el enrutamiento basado en la configuración regional. Aquí hay un ejemplo usando [React Router](https://reactrouter.com/home):
|
|
640
656
|
|
|
641
657
|
```tsx fileName="src/components/LocaleRouter.tsx" codeFormat="typescript"
|
|
642
|
-
|
|
643
|
-
import { type Locales, configuration, getPathWithoutLocale } from "intlayer"; // Funciones y tipos utilitarios de 'intlayer'
|
|
658
|
+
import { localeMap } from "intlayer"; // Funciones y tipos utilitarios de 'intlayer'
|
|
644
659
|
import type { FC, PropsWithChildren } from "react"; // Tipos de React para componentes funcionales y props
|
|
645
660
|
import { IntlayerProvider } from "react-intlayer"; // Proveedor para el contexto de internacionalización
|
|
646
|
-
import {
|
|
647
|
-
BrowserRouter,
|
|
648
|
-
Routes,
|
|
649
|
-
Route,
|
|
650
|
-
Navigate,
|
|
651
|
-
useLocation,
|
|
652
|
-
} from "react-router-dom"; // Componentes del router para gestionar la navegación
|
|
653
|
-
|
|
654
|
-
// Desestructurando la configuración de Intlayer
|
|
655
|
-
const { internationalization, middleware } = configuration;
|
|
656
|
-
const { locales, defaultLocale } = internationalization;
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* Un componente que maneja la localización y envuelve a los hijos con el contexto de locale apropiado.
|
|
660
|
-
* Gestiona la detección y validación del locale basado en la URL.
|
|
661
|
-
*/
|
|
662
|
-
const AppLocalized: FC<PropsWithChildren<{ locale: Locales }>> = ({
|
|
663
|
-
children,
|
|
664
|
-
locale,
|
|
665
|
-
}) => {
|
|
666
|
-
const { pathname, search } = useLocation(); // Obtener la ruta URL actual
|
|
667
|
-
|
|
668
|
-
// Determinar la configuración regional actual, usando la predeterminada si no se proporciona
|
|
669
|
-
const currentLocale = locale ?? defaultLocale;
|
|
670
|
-
|
|
671
|
-
// Eliminar el prefijo de la configuración regional de la ruta para construir una ruta base
|
|
672
|
-
const pathWithoutLocale = getPathWithoutLocale(
|
|
673
|
-
pathname // Ruta URL actual
|
|
674
|
-
);
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* Si middleware.prefixDefault es true, la configuración regional predeterminada siempre debe tener prefijo.
|
|
678
|
-
*/
|
|
679
|
-
if (middleware.prefixDefault) {
|
|
680
|
-
// Validar la configuración regional
|
|
681
|
-
if (!locale || !locales.includes(locale)) {
|
|
682
|
-
// Redirigir a la configuración regional predeterminada con la ruta actualizada
|
|
683
|
-
return (
|
|
684
|
-
<Navigate
|
|
685
|
-
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
686
|
-
replace // Reemplaza la entrada actual del historial con la nueva
|
|
687
|
-
/>
|
|
688
|
-
);
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
// Envuelve los hijos con IntlayerProvider y establece la configuración regional actual
|
|
692
|
-
return (
|
|
693
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
694
|
-
);
|
|
695
|
-
} else {
|
|
696
|
-
/**
|
|
697
|
-
* Cuando middleware.prefixDefault es falso, la configuración regional predeterminada no tiene prefijo.
|
|
698
|
-
* Asegúrate de que la configuración regional actual sea válida y no sea la predeterminada.
|
|
699
|
-
*/
|
|
700
|
-
if (
|
|
701
|
-
currentLocale.toString() !== defaultLocale.toString() &&
|
|
702
|
-
!locales
|
|
703
|
-
.filter(
|
|
704
|
-
(locale) => locale.toString() !== defaultLocale.toString() // Excluir la configuración regional predeterminada
|
|
705
|
-
)
|
|
706
|
-
.includes(currentLocale) // Verifica si la configuración regional actual está en la lista de configuraciones regionales válidas
|
|
707
|
-
) {
|
|
708
|
-
// Redirige a la ruta sin el prefijo de configuración regional
|
|
709
|
-
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
// Envuelve los hijos con IntlayerProvider y establece la configuración regional actual
|
|
713
|
-
return (
|
|
714
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
715
|
-
);
|
|
716
|
-
}
|
|
717
|
-
};
|
|
661
|
+
import { BrowserRouter, Route, Routes } from "react-router-dom"; // Componentes del router para gestionar la navegación
|
|
718
662
|
|
|
719
663
|
/**
|
|
720
664
|
* Un componente de enrutador que configura rutas específicas por configuración regional.
|
|
@@ -723,256 +667,81 @@ const AppLocalized: FC<PropsWithChildren<{ locale: Locales }>> = ({
|
|
|
723
667
|
export const LocaleRouter: FC<PropsWithChildren> = ({ children }) => (
|
|
724
668
|
<BrowserRouter>
|
|
725
669
|
<Routes>
|
|
726
|
-
{
|
|
727
|
-
|
|
728
|
-
(
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
/>
|
|
737
|
-
))}
|
|
738
|
-
|
|
739
|
-
{
|
|
740
|
-
// Si el prefijo para la localidad por defecto está deshabilitado, renderiza los hijos directamente en la ruta raíz
|
|
741
|
-
!middleware.prefixDefault && (
|
|
742
|
-
<Route
|
|
743
|
-
path="*"
|
|
744
|
-
element={
|
|
745
|
-
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
746
|
-
} // Envuelve los hijos con la gestión de la localidad
|
|
747
|
-
/>
|
|
748
|
-
)
|
|
749
|
-
}
|
|
670
|
+
{localeMap(({ locale, urlPrefix }) => (
|
|
671
|
+
<Route
|
|
672
|
+
// Patrón de ruta para capturar la localidad (por ejemplo, /en/, /fr/) y coincidir con todas las rutas subsecuentes
|
|
673
|
+
path={`${urlPrefix}/*`}
|
|
674
|
+
key={locale}
|
|
675
|
+
element={
|
|
676
|
+
<IntlayerProvider locale={locale}>{children}</IntlayerProvider>
|
|
677
|
+
} // Envuelve los hijos con la gestión de la localidad
|
|
678
|
+
/>
|
|
679
|
+
))}
|
|
750
680
|
</Routes>
|
|
751
681
|
</BrowserRouter>
|
|
752
682
|
);
|
|
753
683
|
```
|
|
754
684
|
|
|
755
685
|
```jsx fileName="src/components/LocaleRouter.mjx" codeFormat="esm"
|
|
756
|
-
//
|
|
757
|
-
import {
|
|
758
|
-
//
|
|
759
|
-
import {
|
|
760
|
-
import {
|
|
761
|
-
BrowserRouter,
|
|
762
|
-
Routes,
|
|
763
|
-
Route,
|
|
764
|
-
Navigate,
|
|
765
|
-
useLocation,
|
|
766
|
-
} from "react-router-dom"; // Componentes del enrutador para gestionar la navegación
|
|
767
|
-
|
|
768
|
-
// Desestructuración de la configuración desde Intlayer
|
|
769
|
-
const { internationalization, middleware } = configuration;
|
|
770
|
-
const { locales, defaultLocale } = internationalization;
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* Un componente que maneja la localización y envuelve a los hijos con el contexto de idioma apropiado.
|
|
774
|
-
* Gestiona la detección y validación de la localización basada en la URL.
|
|
775
|
-
*/
|
|
776
|
-
const AppLocalized = ({ children, locale }) => {
|
|
777
|
-
const { pathname, search } = useLocation(); // Obtener la ruta URL actual
|
|
778
|
-
|
|
779
|
-
// Determinar la localización actual, usando la predeterminada si no se proporciona
|
|
780
|
-
const currentLocale = locale ?? defaultLocale;
|
|
781
|
-
|
|
782
|
-
// Eliminar el prefijo de localización de la ruta para construir una ruta base
|
|
783
|
-
const pathWithoutLocale = getPathWithoutLocale(
|
|
784
|
-
pathname // Ruta URL actual
|
|
785
|
-
);
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* Si middleware.prefixDefault es true, la localización predeterminada siempre debe tener prefijo.
|
|
789
|
-
*/
|
|
790
|
-
if (middleware.prefixDefault) {
|
|
791
|
-
// Validar la localización
|
|
792
|
-
if (!locale || !locales.includes(locale)) {
|
|
793
|
-
// Redirigir a la localización predeterminada con la ruta actualizada
|
|
794
|
-
return (
|
|
795
|
-
<Navigate
|
|
796
|
-
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
797
|
-
replace // Reemplaza la entrada actual del historial con la nueva
|
|
798
|
-
/>
|
|
799
|
-
);
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
// Envuelve los hijos con IntlayerProvider y establece la localidad actual
|
|
803
|
-
return (
|
|
804
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
805
|
-
);
|
|
806
|
-
} else {
|
|
807
|
-
/**
|
|
808
|
-
* Cuando middleware.prefixDefault es falso, la localidad por defecto no tiene prefijo.
|
|
809
|
-
* Asegura que la localidad actual sea válida y no la localidad por defecto.
|
|
810
|
-
*/
|
|
811
|
-
if (
|
|
812
|
-
currentLocale.toString() !== defaultLocale.toString() &&
|
|
813
|
-
!locales
|
|
814
|
-
.filter(
|
|
815
|
-
(locale) => locale.toString() !== defaultLocale.toString() // Excluir la localidad por defecto
|
|
816
|
-
)
|
|
817
|
-
.includes(currentLocale) // Verifica si la configuración regional actual está en la lista de configuraciones regionales válidas
|
|
818
|
-
) {
|
|
819
|
-
// Redirige a la ruta sin el prefijo de configuración regional
|
|
820
|
-
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
// Envuelve los hijos con IntlayerProvider y establece la configuración regional actual
|
|
824
|
-
return (
|
|
825
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
826
|
-
);
|
|
827
|
-
}
|
|
828
|
-
};
|
|
686
|
+
import { localeMap } from 'intlayer'; // Funciones utilitarias y tipos de 'intlayer'
|
|
687
|
+
import type { FC, PropsWithChildren } from 'react'; // Tipos de React para componentes funcionales y props
|
|
688
|
+
import { IntlayerProvider } from 'react-intlayer'; // Proveedor para el contexto de internacionalización
|
|
689
|
+
import { BrowserRouter, Route, Routes } from 'react-router-dom'; // Componentes del enrutador para gestionar la navegación
|
|
829
690
|
|
|
830
691
|
/**
|
|
831
692
|
* Un componente de enrutador que configura rutas específicas por configuración regional.
|
|
832
693
|
* Utiliza React Router para gestionar la navegación y renderizar componentes localizados.
|
|
833
694
|
*/
|
|
834
|
-
export const LocaleRouter = ({ children }) => (
|
|
695
|
+
export const LocaleRouter: FC<PropsWithChildren> = ({ children }) => (
|
|
835
696
|
<BrowserRouter>
|
|
836
697
|
<Routes>
|
|
837
|
-
{
|
|
838
|
-
|
|
839
|
-
(
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
/>
|
|
848
|
-
))}
|
|
849
|
-
|
|
850
|
-
{
|
|
851
|
-
// Si la prefijación de la localidad por defecto está deshabilitada, renderiza los hijos directamente en la ruta raíz
|
|
852
|
-
!middleware.prefixDefault && (
|
|
853
|
-
<Route
|
|
854
|
-
path="*"
|
|
855
|
-
element={
|
|
856
|
-
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
857
|
-
} // Envuelve los hijos con la gestión de la localidad
|
|
858
|
-
/>
|
|
859
|
-
)
|
|
860
|
-
}
|
|
698
|
+
{localeMap(({ locale, urlPrefix }) => (
|
|
699
|
+
<Route
|
|
700
|
+
// Patrón de ruta para capturar la localidad (por ejemplo, /en/, /fr/) y coincidir con todas las rutas subsecuentes
|
|
701
|
+
path={`${urlPrefix}/*`}
|
|
702
|
+
key={locale}
|
|
703
|
+
element={
|
|
704
|
+
<IntlayerProvider locale={locale}>{children}</IntlayerProvider>
|
|
705
|
+
} // Envuelve los hijos con la gestión de la localidad
|
|
706
|
+
/>
|
|
707
|
+
))}
|
|
861
708
|
</Routes>
|
|
862
709
|
</BrowserRouter>
|
|
863
710
|
);
|
|
864
711
|
```
|
|
865
712
|
|
|
866
713
|
```jsx fileName="src/components/LocaleRouter.cjx" codeFormat="commonjs"
|
|
867
|
-
//
|
|
868
|
-
const
|
|
869
|
-
const { IntlayerProvider
|
|
870
|
-
const {
|
|
871
|
-
BrowserRouter,
|
|
872
|
-
Routes,
|
|
873
|
-
Route,
|
|
874
|
-
Navigate,
|
|
875
|
-
useLocation,
|
|
876
|
-
} = require("react-router-dom"); // Componentes del enrutador para gestionar la navegación
|
|
877
|
-
|
|
878
|
-
// Desestructurando la configuración de Intlayer
|
|
879
|
-
const { internationalization, middleware } = configuration;
|
|
880
|
-
const { locales, defaultLocale } = internationalization;
|
|
714
|
+
const { localeMap } = require("intlayer"); // Funciones utilitarias y tipos de 'intlayer'
|
|
715
|
+
const React = require("react"); // Importar React
|
|
716
|
+
const { IntlayerProvider } = require("react-intlayer"); // Proveedor para el contexto de internacionalización
|
|
717
|
+
const { BrowserRouter, Route, Routes } = require("react-router-dom"); // Componentes del enrutador para gestionar la navegación
|
|
881
718
|
|
|
882
719
|
/**
|
|
883
|
-
* Un componente
|
|
884
|
-
* Gestiona la detección y validación del locale basado en la URL.
|
|
885
|
-
*/
|
|
886
|
-
const AppLocalized = ({ children, locale }) => {
|
|
887
|
-
const { pathname, search } = useLocation(); // Obtener la ruta URL actual
|
|
888
|
-
|
|
889
|
-
// Determinar la configuración regional actual, usando la predeterminada si no se proporciona
|
|
890
|
-
const currentLocale = locale ?? defaultLocale;
|
|
891
|
-
|
|
892
|
-
// Eliminar el prefijo de la configuración regional de la ruta para construir una ruta base
|
|
893
|
-
const pathWithoutLocale = getPathWithoutLocale(
|
|
894
|
-
pathname // Ruta URL actual
|
|
895
|
-
);
|
|
896
|
-
|
|
897
|
-
/**
|
|
898
|
-
* Si middleware.prefixDefault es verdadero, la configuración regional predeterminada siempre debe tener prefijo.
|
|
899
|
-
*/
|
|
900
|
-
if (middleware.prefixDefault) {
|
|
901
|
-
// Validar la configuración regional
|
|
902
|
-
if (!locale || !locales.includes(locale)) {
|
|
903
|
-
// Redirigir a la configuración regional predeterminada con la ruta actualizada
|
|
904
|
-
return (
|
|
905
|
-
<Navigate
|
|
906
|
-
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
907
|
-
replace // Reemplaza la entrada actual del historial con la nueva
|
|
908
|
-
/>
|
|
909
|
-
);
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
// Envuelve los hijos con IntlayerProvider y establece la localidad actual
|
|
913
|
-
return (
|
|
914
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
915
|
-
);
|
|
916
|
-
} else {
|
|
917
|
-
/**
|
|
918
|
-
* Cuando middleware.prefixDefault es falso, la localidad por defecto no se antepone.
|
|
919
|
-
* Asegura que la localidad actual sea válida y no la localidad por defecto.
|
|
920
|
-
*/
|
|
921
|
-
if (
|
|
922
|
-
currentLocale.toString() !== defaultLocale.toString() &&
|
|
923
|
-
!locales
|
|
924
|
-
.filter(
|
|
925
|
-
(locale) => locale.toString() !== defaultLocale.toString() // Excluir la localidad por defecto
|
|
926
|
-
)
|
|
927
|
-
.includes(currentLocale) // Verifica si la localidad actual está en la lista de localidades válidas
|
|
928
|
-
) {
|
|
929
|
-
// Redirigir a la ruta sin el prefijo de la localidad
|
|
930
|
-
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
// Envolver los hijos con IntlayerProvider y establecer la localidad actual
|
|
934
|
-
return (
|
|
935
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
936
|
-
);
|
|
937
|
-
}
|
|
938
|
-
};
|
|
939
|
-
|
|
940
|
-
/**
|
|
941
|
-
* Un componente de enrutador que configura rutas específicas por localidad.
|
|
720
|
+
* Un componente de enrutador que configura rutas específicas por configuración regional.
|
|
942
721
|
* Utiliza React Router para gestionar la navegación y renderizar componentes localizados.
|
|
943
722
|
*/
|
|
944
|
-
const LocaleRouter = ({ children }) =>
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
723
|
+
const LocaleRouter = ({ children }) =>
|
|
724
|
+
React.createElement(
|
|
725
|
+
BrowserRouter,
|
|
726
|
+
{},
|
|
727
|
+
React.createElement(
|
|
728
|
+
Routes,
|
|
729
|
+
{},
|
|
730
|
+
localeMap(({ locale, urlPrefix }) =>
|
|
731
|
+
React.createElement(Route, {
|
|
732
|
+
path: `${urlPrefix}/*`,
|
|
733
|
+
key: locale,
|
|
734
|
+
element: React.createElement(IntlayerProvider, { locale }, children),
|
|
735
|
+
})
|
|
736
|
+
)
|
|
737
|
+
)
|
|
738
|
+
);
|
|
959
739
|
|
|
960
|
-
|
|
961
|
-
// Si la prefijación de la configuración regional predeterminada está deshabilitada, renderiza los hijos directamente en la ruta raíz
|
|
962
|
-
!middleware.prefixDefault && (
|
|
963
|
-
<Route
|
|
964
|
-
path="*"
|
|
965
|
-
element={
|
|
966
|
-
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
967
|
-
} // Envuelve los hijos con la gestión de la configuración regional
|
|
968
|
-
/>
|
|
969
|
-
)
|
|
970
|
-
}
|
|
971
|
-
</Routes>
|
|
972
|
-
</BrowserRouter>
|
|
973
|
-
);
|
|
740
|
+
exports.LocaleRouter = LocaleRouter;
|
|
974
741
|
```
|
|
975
742
|
|
|
743
|
+
> Nota: Si usas `routing.mode: 'no-prefix' | 'search-params'`, probablemente no necesites usar la función `localeMap`.
|
|
744
|
+
|
|
976
745
|
Luego, puedes usar el componente `LocaleRouter` en tu aplicación:
|
|
977
746
|
|
|
978
747
|
```tsx fileName="src/App.tsx" codeFormat="typescript"
|
|
@@ -1014,6 +783,8 @@ const App = () => (
|
|
|
1014
783
|
|
|
1015
784
|
Paralelamente, también puedes usar el `intlayerProxy` 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 correspondiente. Si no se especifica ninguna configuración regional, el plugin determinará la configuración regional más adecuada basándose en las preferencias de idioma del navegador del usuario. Si no se detecta ninguna configuración regional, redirigirá a la configuración regional predeterminada.
|
|
1016
785
|
|
|
786
|
+
> Ten en cuenta que para usar el `intlayerProxy` en producción, debes mover el paquete `vite-intlayer` de `devDependencies` a `dependencies`.
|
|
787
|
+
|
|
1017
788
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
1018
789
|
import { defineConfig } from "vite";
|
|
1019
790
|
import react from "@vitejs/plugin-react-swc";
|
|
@@ -1246,14 +1017,14 @@ const LocaleSwitcher = () => {
|
|
|
1246
1017
|
|
|
1247
1018
|
> Referencias de la documentación:
|
|
1248
1019
|
>
|
|
1249
|
-
> - [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/
|
|
1250
|
-
> - [`getLocaleName` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/
|
|
1251
|
-
> - [`getLocalizedUrl` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/
|
|
1252
|
-
> - [`getHTMLTextDir` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/
|
|
1020
|
+
> - [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useLocale.md)
|
|
1021
|
+
> - [`getLocaleName` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/intlayer/getLocaleName.md)
|
|
1022
|
+
> - [`getLocalizedUrl` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/intlayer/getLocalizedUrl.md)
|
|
1023
|
+
> - [`getHTMLTextDir` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/intlayer/getHTMLTextDir.md)
|
|
1253
1024
|
> - [`hrefLang` attribute](https://developers.google.com/search/docs/specialty/international/localized-versions?hl=fr)
|
|
1254
|
-
> - [`lang` attribute](https://developer.mozilla.org/
|
|
1255
|
-
> - [`dir` attribute](https://developer.mozilla.org/
|
|
1256
|
-
> - [`aria-current` attribute](https://developer.mozilla.org/
|
|
1025
|
+
> - [`lang` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang)
|
|
1026
|
+
> - [`dir` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir)
|
|
1027
|
+
> - [`aria-current` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)
|
|
1257
1028
|
|
|
1258
1029
|
A continuación se muestra el **Paso 9** actualizado con explicaciones añadidas y ejemplos de código refinados:
|
|
1259
1030
|
|
|
@@ -1421,9 +1192,9 @@ module.exports = App;
|
|
|
1421
1192
|
|
|
1422
1193
|
Al aplicar estos cambios, tu aplicación:
|
|
1423
1194
|
|
|
1424
|
-
-
|
|
1425
|
-
-
|
|
1426
|
-
-
|
|
1195
|
+
- Asegurar que el atributo **language** (`lang`) refleje correctamente la configuración regional actual, lo cual es importante para SEO y el comportamiento del navegador.
|
|
1196
|
+
- Ajustar la **dirección del texto** (`dir`) según la configuración regional, mejorando la legibilidad y usabilidad para idiomas con diferentes órdenes de lectura.
|
|
1197
|
+
- Proporcionar una experiencia más **accesible**, ya que las tecnologías de asistencia dependen de estos atributos para funcionar de manera óptima.
|
|
1427
1198
|
|
|
1428
1199
|
### (Opcional) Paso 10: Crear un Componente de Enlace Localizado
|
|
1429
1200
|
|
|
@@ -1446,11 +1217,10 @@ import {
|
|
|
1446
1217
|
} from "react";
|
|
1447
1218
|
import { useLocale } from "react-intlayer";
|
|
1448
1219
|
|
|
1449
|
-
export interface LinkProps
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
> {}
|
|
1220
|
+
export interface LinkProps extends DetailedHTMLProps<
|
|
1221
|
+
AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
1222
|
+
HTMLAnchorElement
|
|
1223
|
+
> {}
|
|
1454
1224
|
|
|
1455
1225
|
/**
|
|
1456
1226
|
* Función utilitaria para verificar si una URL dada es externa.
|
|
@@ -1577,9 +1347,9 @@ Al integrar este componente `Link` en toda su aplicación, mantiene una experien
|
|
|
1577
1347
|
|
|
1578
1348
|
Intlayer utiliza la ampliación de módulos para aprovechar las ventajas de TypeScript y fortalecer su base de código.
|
|
1579
1349
|
|
|
1580
|
-

|
|
1581
1351
|
|
|
1582
|
-

|
|
1583
1353
|
|
|
1584
1354
|
Asegúrese de que su configuración de TypeScript incluya los tipos generados automáticamente.
|
|
1585
1355
|
|
|
@@ -1599,8 +1369,8 @@ Se recomienda ignorar los archivos generados por Intlayer. Esto te permite evita
|
|
|
1599
1369
|
|
|
1600
1370
|
Para hacerlo, puedes agregar las siguientes instrucciones a tu archivo `.gitignore`:
|
|
1601
1371
|
|
|
1602
|
-
```plaintext
|
|
1603
|
-
#
|
|
1372
|
+
```plaintext fileName=".gitignore"
|
|
1373
|
+
# Ignore the files generated by Intlayer
|
|
1604
1374
|
.intlayer
|
|
1605
1375
|
```
|
|
1606
1376
|
|
|
@@ -1624,5 +1394,3 @@ Para más detalles sobre cómo usar la extensión, consulta la [documentación d
|
|
|
1624
1394
|
### Ir más allá
|
|
1625
1395
|
|
|
1626
1396
|
Para ir más allá, 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).
|
|
1627
|
-
|
|
1628
|
-
---
|
|
@@ -22,6 +22,7 @@ slugs:
|
|
|
22
22
|
- doc
|
|
23
23
|
- plugin
|
|
24
24
|
- sync-json
|
|
25
|
+
youtubeVideo: https://www.youtube.com/watch?v=MpGMxniDHNg
|
|
25
26
|
history:
|
|
26
27
|
- version: 6.1.6
|
|
27
28
|
date: 2025-10-05
|
|
@@ -30,6 +31,8 @@ history:
|
|
|
30
31
|
|
|
31
32
|
## Sincronización JSON (puentes i18n)
|
|
32
33
|
|
|
34
|
+
<iframe title="Cómo mantener tus traducciones JSON sincronizadas con Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/MpGMxniDHNg?autoplay=0&origin=http://intlayer.org&controls=0&rel=1"/>
|
|
35
|
+
|
|
33
36
|
Usa Intlayer como un complemento para tu stack i18n existente. Este plugin mantiene tus mensajes JSON sincronizados con los diccionarios de Intlayer para que puedas:
|
|
34
37
|
|
|
35
38
|
- Mantener i18next, next-intl, react-intl, vue-i18n, next-translate, nuxt-i18n, Solid-i18next, svelte-i18n, etc.
|