@intlayer/docs 7.3.15 → 7.5.0-canary.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 +2 -0
- package/blog/ar/intlayer_with_next-i18next.md +2 -0
- package/blog/ar/intlayer_with_next-intl.md +2 -0
- package/blog/ar/intlayer_with_react-i18next.md +2 -0
- package/blog/ar/intlayer_with_react-intl.md +2 -0
- package/blog/ar/intlayer_with_vue-i18n.md +2 -0
- package/blog/de/intlayer_with_i18next.md +2 -0
- package/blog/de/intlayer_with_next-i18next.md +1 -0
- package/blog/de/intlayer_with_next-intl.md +2 -0
- package/blog/de/intlayer_with_react-i18next.md +2 -0
- package/blog/de/intlayer_with_react-intl.md +2 -0
- package/blog/de/intlayer_with_vue-i18n.md +2 -0
- package/blog/en/intlayer_with_i18next.md +6 -0
- package/blog/en/intlayer_with_next-i18next.md +3 -0
- package/blog/en/intlayer_with_next-intl.md +3 -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 +2 -0
- package/blog/en-GB/intlayer_with_next-i18next.md +2 -0
- package/blog/en-GB/intlayer_with_next-intl.md +2 -0
- package/blog/en-GB/intlayer_with_react-i18next.md +2 -0
- package/blog/en-GB/intlayer_with_react-intl.md +2 -0
- package/blog/en-GB/intlayer_with_vue-i18n.md +2 -0
- package/blog/es/intlayer_with_i18next.md +2 -0
- package/blog/es/intlayer_with_next-i18next.md +2 -0
- package/blog/es/intlayer_with_next-intl.md +2 -0
- package/blog/es/intlayer_with_react-i18next.md +2 -0
- package/blog/es/intlayer_with_react-intl.md +2 -0
- package/blog/es/intlayer_with_vue-i18n.md +2 -0
- package/blog/fr/intlayer_with_i18next.md +2 -0
- package/blog/fr/intlayer_with_next-i18next.md +2 -0
- package/blog/fr/intlayer_with_next-intl.md +2 -0
- package/blog/fr/intlayer_with_react-i18next.md +2 -0
- package/blog/fr/intlayer_with_react-intl.md +2 -0
- package/blog/fr/intlayer_with_vue-i18n.md +2 -0
- package/blog/hi/intlayer_with_i18next.md +2 -0
- package/blog/hi/intlayer_with_next-i18next.md +2 -0
- package/blog/hi/intlayer_with_next-intl.md +2 -0
- package/blog/hi/intlayer_with_react-i18next.md +2 -0
- package/blog/hi/intlayer_with_react-intl.md +2 -0
- package/blog/hi/intlayer_with_vue-i18n.md +2 -0
- package/blog/id/intlayer_with_i18next.md +2 -0
- package/blog/id/intlayer_with_next-i18next.md +2 -0
- package/blog/id/intlayer_with_next-intl.md +2 -0
- package/blog/id/intlayer_with_react-i18next.md +2 -0
- package/blog/id/intlayer_with_react-intl.md +2 -0
- package/blog/id/intlayer_with_vue-i18n.md +2 -0
- package/blog/it/intlayer_with_i18next.md +2 -0
- package/blog/it/intlayer_with_next-i18next.md +2 -0
- package/blog/it/intlayer_with_next-intl.md +2 -0
- package/blog/it/intlayer_with_react-i18next.md +2 -0
- package/blog/it/intlayer_with_react-intl.md +2 -0
- package/blog/it/intlayer_with_vue-i18n.md +2 -0
- package/blog/ja/intlayer_with_i18next.md +2 -0
- package/blog/ja/intlayer_with_next-i18next.md +1 -0
- package/blog/ja/intlayer_with_next-intl.md +2 -0
- package/blog/ja/intlayer_with_react-i18next.md +2 -0
- package/blog/ja/intlayer_with_react-intl.md +2 -0
- package/blog/ja/intlayer_with_vue-i18n.md +2 -0
- package/blog/ko/intlayer_with_i18next.md +2 -0
- package/blog/ko/intlayer_with_next-i18next.md +2 -0
- package/blog/ko/intlayer_with_next-intl.md +2 -0
- package/blog/ko/intlayer_with_react-i18next.md +2 -0
- package/blog/ko/intlayer_with_react-intl.md +2 -0
- package/blog/ko/intlayer_with_vue-i18n.md +2 -0
- package/blog/pl/intlayer_with_i18next.md +2 -0
- package/blog/pl/intlayer_with_next-i18next.md +2 -0
- package/blog/pl/intlayer_with_next-intl.md +2 -0
- package/blog/pl/intlayer_with_react-i18next.md +2 -0
- package/blog/pl/intlayer_with_react-intl.md +2 -0
- package/blog/pl/intlayer_with_vue-i18n.md +2 -0
- package/blog/pt/intlayer_with_i18next.md +2 -0
- package/blog/pt/intlayer_with_next-i18next.md +2 -0
- package/blog/pt/intlayer_with_next-intl.md +2 -0
- package/blog/pt/intlayer_with_react-i18next.md +2 -0
- package/blog/pt/intlayer_with_react-intl.md +2 -0
- package/blog/pt/intlayer_with_vue-i18n.md +2 -0
- package/blog/ru/intlayer_with_i18next.md +2 -0
- package/blog/ru/intlayer_with_next-i18next.md +2 -0
- package/blog/ru/intlayer_with_next-intl.md +2 -0
- package/blog/ru/intlayer_with_react-i18next.md +2 -0
- package/blog/ru/intlayer_with_react-intl.md +2 -0
- package/blog/ru/intlayer_with_vue-i18n.md +2 -0
- package/blog/tr/intlayer_with_i18next.md +2 -0
- package/blog/tr/intlayer_with_next-i18next.md +2 -0
- package/blog/tr/intlayer_with_next-intl.md +2 -0
- package/blog/tr/intlayer_with_react-i18next.md +2 -0
- package/blog/tr/intlayer_with_react-intl.md +2 -0
- package/blog/tr/intlayer_with_vue-i18n.md +2 -0
- package/blog/vi/intlayer_with_i18next.md +2 -0
- package/blog/vi/intlayer_with_next-i18next.md +2 -0
- package/blog/vi/intlayer_with_next-intl.md +2 -0
- package/blog/vi/intlayer_with_react-i18next.md +2 -0
- package/blog/vi/intlayer_with_react-intl.md +2 -0
- package/blog/vi/intlayer_with_vue-i18n.md +2 -0
- package/blog/zh/intlayer_with_i18next.md +2 -0
- package/blog/zh/intlayer_with_next-i18next.md +2 -0
- package/blog/zh/intlayer_with_next-intl.md +2 -0
- package/blog/zh/intlayer_with_react-i18next.md +2 -0
- package/blog/zh/intlayer_with_react-intl.md +2 -0
- package/blog/zh/intlayer_with_vue-i18n.md +2 -0
- package/docs/ar/dictionary/content_file.md +24 -1
- package/docs/ar/intlayer_with_astro.md +1 -1
- package/docs/ar/intlayer_with_express.md +1 -1
- package/docs/ar/intlayer_with_nestjs.md +1 -1
- package/docs/ar/intlayer_with_next-i18next.md +1 -0
- package/docs/ar/intlayer_with_next-intl.md +1 -0
- package/docs/ar/intlayer_with_tanstack.md +122 -3
- package/docs/ar/plugins/sync-json.md +27 -2
- package/docs/de/dictionary/content_file.md +24 -1
- package/docs/de/intlayer_with_astro.md +1 -1
- package/docs/de/intlayer_with_express.md +1 -1
- package/docs/de/intlayer_with_nestjs.md +1 -1
- package/docs/de/intlayer_with_next-i18next.md +1 -0
- package/docs/de/intlayer_with_next-intl.md +1 -0
- package/docs/de/intlayer_with_tanstack.md +122 -3
- package/docs/de/plugins/sync-json.md +27 -2
- package/docs/en/dictionary/content_file.md +24 -1
- package/docs/en/intlayer_with_astro.md +1 -1
- package/docs/en/intlayer_with_express.md +1 -1
- package/docs/en/intlayer_with_nestjs.md +1 -2
- package/docs/en/intlayer_with_next-i18next.md +1 -0
- package/docs/en/intlayer_with_next-intl.md +1 -0
- package/docs/en/intlayer_with_tanstack.md +120 -1
- package/docs/en/plugins/sync-json.md +53 -2
- package/docs/en-GB/dictionary/content_file.md +24 -1
- package/docs/en-GB/intlayer_with_astro.md +1 -1
- package/docs/en-GB/intlayer_with_express.md +1 -1
- package/docs/en-GB/intlayer_with_nestjs.md +1 -1
- package/docs/en-GB/intlayer_with_next-i18next.md +1 -0
- package/docs/en-GB/intlayer_with_next-intl.md +1 -0
- package/docs/en-GB/intlayer_with_tanstack.md +121 -2
- package/docs/en-GB/plugins/sync-json.md +26 -1
- package/docs/es/dictionary/content_file.md +24 -1
- package/docs/es/intlayer_with_astro.md +1 -1
- package/docs/es/intlayer_with_express.md +1 -1
- package/docs/es/intlayer_with_nestjs.md +1 -1
- package/docs/es/intlayer_with_next-i18next.md +1 -0
- package/docs/es/intlayer_with_next-intl.md +1 -0
- package/docs/es/intlayer_with_tanstack.md +122 -3
- package/docs/es/plugins/sync-json.md +27 -2
- package/docs/fr/dictionary/content_file.md +24 -1
- package/docs/fr/intlayer_with_astro.md +1 -1
- package/docs/fr/intlayer_with_express.md +1 -1
- package/docs/fr/intlayer_with_nestjs.md +1 -1
- package/docs/fr/intlayer_with_next-i18next.md +1 -0
- package/docs/fr/intlayer_with_next-intl.md +1 -0
- package/docs/fr/intlayer_with_tanstack.md +122 -3
- package/docs/fr/plugins/sync-json.md +27 -2
- package/docs/hi/dictionary/content_file.md +24 -1
- package/docs/hi/intlayer_with_astro.md +1 -1
- package/docs/hi/intlayer_with_express.md +1 -1
- package/docs/hi/intlayer_with_nestjs.md +1 -1
- package/docs/hi/intlayer_with_next-i18next.md +1 -0
- package/docs/hi/intlayer_with_next-intl.md +1 -0
- package/docs/hi/intlayer_with_tanstack.md +122 -3
- package/docs/hi/plugins/sync-json.md +27 -2
- package/docs/id/dictionary/content_file.md +24 -1
- package/docs/id/intlayer_with_astro.md +1 -1
- package/docs/id/intlayer_with_express.md +1 -1
- package/docs/id/intlayer_with_nestjs.md +1 -1
- package/docs/id/intlayer_with_next-i18next.md +1 -0
- package/docs/id/intlayer_with_next-intl.md +1 -0
- package/docs/id/intlayer_with_tanstack.md +122 -3
- package/docs/id/plugins/sync-json.md +27 -2
- package/docs/it/dictionary/content_file.md +24 -1
- package/docs/it/intlayer_with_astro.md +1 -1
- package/docs/it/intlayer_with_express.md +1 -1
- package/docs/it/intlayer_with_nestjs.md +1 -1
- package/docs/it/intlayer_with_next-i18next.md +1 -0
- package/docs/it/intlayer_with_next-intl.md +1 -0
- package/docs/it/intlayer_with_tanstack.md +122 -3
- package/docs/it/plugins/sync-json.md +27 -2
- package/docs/ja/dictionary/content_file.md +24 -1
- package/docs/ja/intlayer_with_astro.md +1 -1
- package/docs/ja/intlayer_with_express.md +1 -1
- package/docs/ja/intlayer_with_nestjs.md +1 -1
- package/docs/ja/intlayer_with_next-i18next.md +1 -0
- package/docs/ja/intlayer_with_next-intl.md +1 -0
- package/docs/ja/intlayer_with_tanstack.md +122 -3
- package/docs/ja/plugins/sync-json.md +27 -2
- package/docs/ko/dictionary/content_file.md +44 -1
- package/docs/ko/intlayer_with_astro.md +1 -1
- package/docs/ko/intlayer_with_express.md +1 -1
- package/docs/ko/intlayer_with_nestjs.md +1 -1
- package/docs/ko/intlayer_with_next-i18next.md +1 -0
- package/docs/ko/intlayer_with_next-intl.md +1 -0
- package/docs/ko/intlayer_with_tanstack.md +122 -3
- package/docs/ko/plugins/sync-json.md +27 -2
- package/docs/pl/dictionary/content_file.md +24 -1
- package/docs/pl/intlayer_with_astro.md +2 -2
- package/docs/pl/intlayer_with_express.md +1 -1
- package/docs/pl/intlayer_with_nestjs.md +1 -1
- package/docs/pl/intlayer_with_next-i18next.md +1 -0
- package/docs/pl/intlayer_with_next-intl.md +1 -0
- package/docs/pl/intlayer_with_tanstack.md +122 -3
- package/docs/pl/plugins/sync-json.md +24 -2
- package/docs/pt/dictionary/content_file.md +24 -1
- package/docs/pt/intlayer_with_astro.md +1 -1
- package/docs/pt/intlayer_with_express.md +1 -1
- package/docs/pt/intlayer_with_nestjs.md +1 -1
- package/docs/pt/intlayer_with_next-i18next.md +1 -0
- package/docs/pt/intlayer_with_next-intl.md +1 -0
- package/docs/pt/intlayer_with_tanstack.md +122 -3
- package/docs/pt/plugins/sync-json.md +27 -2
- package/docs/ru/dictionary/content_file.md +44 -1
- package/docs/ru/intlayer_with_astro.md +1 -1
- package/docs/ru/intlayer_with_express.md +1 -1
- package/docs/ru/intlayer_with_nestjs.md +1 -1
- package/docs/ru/intlayer_with_next-i18next.md +1 -0
- package/docs/ru/intlayer_with_next-intl.md +1 -0
- package/docs/ru/intlayer_with_tanstack.md +122 -3
- package/docs/ru/plugins/sync-json.md +27 -2
- package/docs/tr/dictionary/content_file.md +44 -1
- package/docs/tr/intlayer_with_astro.md +1 -1
- package/docs/tr/intlayer_with_express.md +1 -1
- package/docs/tr/intlayer_with_next-i18next.md +1 -0
- package/docs/tr/intlayer_with_next-intl.md +1 -0
- package/docs/tr/intlayer_with_tanstack.md +122 -3
- package/docs/tr/plugins/sync-json.md +27 -2
- package/docs/vi/dictionary/content_file.md +24 -1
- package/docs/vi/intlayer_with_astro.md +1 -1
- package/docs/vi/intlayer_with_express.md +1 -1
- package/docs/vi/intlayer_with_nestjs.md +1 -1
- package/docs/vi/intlayer_with_next-i18next.md +1 -0
- package/docs/vi/intlayer_with_next-intl.md +1 -0
- package/docs/vi/intlayer_with_tanstack.md +122 -3
- package/docs/vi/plugins/sync-json.md +27 -2
- package/docs/zh/dictionary/content_file.md +44 -1
- package/docs/zh/intlayer_with_astro.md +1 -1
- package/docs/zh/intlayer_with_express.md +1 -1
- package/docs/zh/intlayer_with_nestjs.md +1 -1
- package/docs/zh/intlayer_with_next-i18next.md +1 -0
- package/docs/zh/intlayer_with_next-intl.md +1 -0
- package/docs/zh/intlayer_with_tanstack.md +122 -3
- package/docs/zh/plugins/sync-json.md +27 -2
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-09
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-12-11
|
|
4
4
|
title: Cómo traducir tu Tanstack Start – guía i18n 2025
|
|
5
5
|
description: Aprende cómo agregar internacionalización (i18n) a tu aplicación Tanstack Start usando Intlayer. Sigue esta guía completa para hacer que tu aplicación sea multilingüe con enrutamiento consciente de la configuración regional.
|
|
6
6
|
keywords:
|
|
@@ -19,9 +19,12 @@ slugs:
|
|
|
19
19
|
applicationTemplate: https://github.com/aymericzip/intlayer-tanstack-start-template
|
|
20
20
|
youtubeVideo: https://www.youtube.com/watch?v=_XTdKVWaeqg
|
|
21
21
|
history:
|
|
22
|
+
- version: 7.4.0
|
|
23
|
+
date: 2025-12-11
|
|
24
|
+
changes: Introduce validatePrefix y añade el paso 14: Cómo gestionar páginas 404 con rutas localizadas.
|
|
22
25
|
- version: 7.3.9
|
|
23
26
|
date: 2025-12-05
|
|
24
|
-
changes:
|
|
27
|
+
changes: Añade el paso 13: Obtener la configuración regional en tus server actions (Opcional)
|
|
25
28
|
- version: 5.8.1
|
|
26
29
|
date: 2025-09-09
|
|
27
30
|
changes: Añadido para Tanstack Start
|
|
@@ -605,7 +608,123 @@ export const getLocaleServer = createServerFn().handler(async () => {
|
|
|
605
608
|
|
|
606
609
|
---
|
|
607
610
|
|
|
608
|
-
### Paso 14:
|
|
611
|
+
### Paso 14: Gestionar páginas no encontradas (Opcional)
|
|
612
|
+
|
|
613
|
+
Cuando un usuario visita una página que no existe, puedes mostrar una página personalizada de no encontrada y el prefijo de configuración regional puede afectar la forma en que se activa la página de no encontrada.
|
|
614
|
+
|
|
615
|
+
#### Entender el manejo de 404 de TanStack Router con prefijos de configuración regional
|
|
616
|
+
|
|
617
|
+
En TanStack Router, manejar páginas 404 con rutas localizadas requiere un enfoque de múltiples capas:
|
|
618
|
+
|
|
619
|
+
1. **Ruta 404 dedicada**: Una ruta específica para mostrar la UI de 404
|
|
620
|
+
2. **Validación a nivel de ruta**: Valida los prefijos de configuración regional y redirige los inválidos a 404
|
|
621
|
+
3. **Ruta catch-all**: Captura cualquier ruta no coincidente dentro del segmento de configuración regional
|
|
622
|
+
|
|
623
|
+
```tsx fileName="src/routes/{-$locale}/404.tsx"
|
|
624
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
625
|
+
|
|
626
|
+
// Esto crea una ruta dedicada /[locale]/404
|
|
627
|
+
// Se usa tanto como una ruta directa como importada como componente en otros archivos
|
|
628
|
+
export const Route = createFileRoute("/{-$locale}/404")({
|
|
629
|
+
component: NotFoundComponent,
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
// Exportado por separado para que pueda reutilizarse en notFoundComponent y rutas catch-all
|
|
633
|
+
export function NotFoundComponent() {
|
|
634
|
+
return (
|
|
635
|
+
<div>
|
|
636
|
+
<h1>404</h1>
|
|
637
|
+
</div>
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
```tsx fileName="src/routes/{-$locale}/route.tsx"
|
|
643
|
+
import { createFileRoute, Outlet, redirect } from "@tanstack/react-router";
|
|
644
|
+
import { validatePrefix } from "intlayer";
|
|
645
|
+
import { IntlayerProvider, useLocale } from "react-intlayer";
|
|
646
|
+
|
|
647
|
+
import { LocaleSwitcher } from "@/components/locale-switcher";
|
|
648
|
+
import { NotFoundComponent } from "./404";
|
|
649
|
+
|
|
650
|
+
export const Route = createFileRoute("/{-$locale}")({
|
|
651
|
+
// beforeLoad se ejecuta antes de que la ruta se renderice (tanto en el servidor como en el cliente)
|
|
652
|
+
// Es el lugar ideal para validar el prefijo de configuración regional
|
|
653
|
+
beforeLoad: ({ params }) => {
|
|
654
|
+
// Obtener la configuración regional de los parámetros de la ruta (no de los encabezados del servidor, ya que beforeLoad se ejecuta tanto en el cliente como en el servidor)
|
|
655
|
+
const localeParam = params.locale;
|
|
656
|
+
|
|
657
|
+
// validatePrefix verifica si la configuración regional es válida según tu configuración de intlayer
|
|
658
|
+
// Retorna: { isValid: boolean, localePrefix: string }
|
|
659
|
+
// - isValid: true si el prefijo coincide con una configuración regional configurada (o está vacío cuando el prefijo es opcional)
|
|
660
|
+
// - localePrefix: el prefijo validado o el prefijo de configuración regional predeterminado para redirecciones
|
|
661
|
+
const { isValid, localePrefix } = validatePrefix(localeParam);
|
|
662
|
+
|
|
663
|
+
if (isValid) {
|
|
664
|
+
// La configuración regional es válida, permitir que la ruta se renderice normalmente
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// Prefijo de configuración regional inválido (p. ej., /xyz/about donde "xyz" no es una configuración regional válida)
|
|
669
|
+
// Redirigir a la página 404 con un prefijo de configuración regional válido
|
|
670
|
+
// Esto asegura que la página 404 siga estando correctamente localizada
|
|
671
|
+
throw redirect({
|
|
672
|
+
to: "/{-$locale}/404",
|
|
673
|
+
params: { locale: localePrefix },
|
|
674
|
+
});
|
|
675
|
+
},
|
|
676
|
+
component: RouteComponent,
|
|
677
|
+
// notFoundComponent se llama cuando una ruta hija no existe
|
|
678
|
+
// p. ej., /en/pagina-inexistente activa esto dentro del diseño /en
|
|
679
|
+
notFoundComponent: NotFoundLayout,
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
function RouteComponent() {
|
|
683
|
+
const { defaultLocale } = useLocale();
|
|
684
|
+
const { locale } = Route.useParams();
|
|
685
|
+
|
|
686
|
+
return (
|
|
687
|
+
// Envuelve todo el segmento de configuración regional con IntlayerProvider
|
|
688
|
+
// Vuelve a defaultLocale cuando el parámetro locale es undefined (modo de prefijo opcional)
|
|
689
|
+
<IntlayerProvider locale={locale ?? defaultLocale}>
|
|
690
|
+
<Outlet />
|
|
691
|
+
</IntlayerProvider>
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// NotFoundLayout envuelve el componente 404 con IntlayerProvider
|
|
696
|
+
// Esto asegura que las traducciones sigan funcionando en la página 404
|
|
697
|
+
function NotFoundLayout() {
|
|
698
|
+
const { defaultLocale } = useLocale();
|
|
699
|
+
const { locale } = Route.useParams();
|
|
700
|
+
|
|
701
|
+
return (
|
|
702
|
+
<IntlayerProvider locale={locale ?? defaultLocale}>
|
|
703
|
+
<NotFoundComponent />
|
|
704
|
+
{/* Incluir LocaleSwitcher para que los usuarios puedan cambiar el idioma incluso en 404 */}
|
|
705
|
+
<LocaleSwitcher />
|
|
706
|
+
</IntlayerProvider>
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
```tsx fileName="src/routes/{-$locale}/$.tsx"
|
|
712
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
713
|
+
|
|
714
|
+
import { NotFoundComponent } from "./404";
|
|
715
|
+
|
|
716
|
+
// La ruta $ (splat/catch-all) coincide con cualquier ruta que no coincida con otras rutas
|
|
717
|
+
// p. ej., /en/algun/ruta/profunda/anidada/invalida
|
|
718
|
+
// Esto asegura que TODAS las rutas no coincidentes dentro de una configuración regional muestren la página 404
|
|
719
|
+
// Sin esto, las rutas profundas no coincidentes podrían mostrar una página en blanco o un error
|
|
720
|
+
export const Route = createFileRoute("/{-$locale}/$")({
|
|
721
|
+
component: NotFoundComponent,
|
|
722
|
+
});
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
---
|
|
726
|
+
|
|
727
|
+
### Paso 15: Configurar TypeScript (Opcional)
|
|
609
728
|
|
|
610
729
|
Intlayer utiliza la ampliación de módulos para aprovechar las ventajas de TypeScript y fortalecer tu base de código.
|
|
611
730
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-03-13
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-12-13
|
|
4
4
|
title: Plugin de sincronización JSON
|
|
5
5
|
description: Sincroniza los diccionarios de Intlayer con archivos JSON i18n de terceros (i18next, next-intl, react-intl, vue-i18n y más). Mantén tu i18n existente mientras usas Intlayer para gestionar, traducir y probar tus mensajes.
|
|
6
6
|
keywords:
|
|
@@ -24,12 +24,15 @@ slugs:
|
|
|
24
24
|
- sync-json
|
|
25
25
|
youtubeVideo: https://www.youtube.com/watch?v=MpGMxniDHNg
|
|
26
26
|
history:
|
|
27
|
+
- version: 7.5.0
|
|
28
|
+
date: 2025-12-13
|
|
29
|
+
changes: Añadido soporte para formatos ICU e i18next
|
|
27
30
|
- version: 6.1.6
|
|
28
31
|
date: 2025-10-05
|
|
29
32
|
changes: Documentación inicial del plugin de sincronización JSON
|
|
30
33
|
---
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
# Sincronización JSON (puentes i18n) - Sincronización JSON con soporte ICU / i18next
|
|
33
36
|
|
|
34
37
|
<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
38
|
|
|
@@ -105,9 +108,27 @@ syncJSON({
|
|
|
105
108
|
source: ({ key, locale }) => string, // requerido
|
|
106
109
|
location?: string, // etiqueta opcional, por defecto: "plugin"
|
|
107
110
|
priority?: number, // prioridad opcional para resolución de conflictos, por defecto: 0
|
|
111
|
+
format?: 'intlayer' | 'icu' | 'i18next', // formateador opcional, por defecto: 'intlayer'
|
|
108
112
|
});
|
|
109
113
|
```
|
|
110
114
|
|
|
115
|
+
#### `format` ('intlayer' | 'icu' | 'i18next')
|
|
116
|
+
|
|
117
|
+
Especifica el formateador a utilizar para el contenido del diccionario al sincronizar archivos JSON. Esto permite usar diferentes sintaxis de formateo de mensajes compatibles con varias bibliotecas i18n.
|
|
118
|
+
|
|
119
|
+
- `'intlayer'`: El formateador Intlayer por defecto (por defecto).
|
|
120
|
+
- `'icu'`: Usa el formateo de mensajes ICU (compatible con bibliotecas como react-intl, vue-i18n).
|
|
121
|
+
- `'i18next'`: Usa el formateo de mensajes i18next (compatible con i18next, next-i18next, Solid-i18next).
|
|
122
|
+
|
|
123
|
+
**Ejemplo:**
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
syncJSON({
|
|
127
|
+
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
128
|
+
format: "i18next", // Usar formateo i18next para compatibilidad
|
|
129
|
+
}),
|
|
130
|
+
```
|
|
131
|
+
|
|
111
132
|
## Múltiples fuentes JSON y prioridad
|
|
112
133
|
|
|
113
134
|
Puedes agregar múltiples plugins `syncJSON` para sincronizar diferentes fuentes JSON. Esto es útil cuando tienes múltiples bibliotecas i18n o diferentes estructuras JSON en tu proyecto.
|
|
@@ -134,6 +155,7 @@ export default defineConfig({
|
|
|
134
155
|
plugins: [
|
|
135
156
|
// Fuente JSON principal (mayor prioridad)
|
|
136
157
|
syncJSON({
|
|
158
|
+
format: "i18next",
|
|
137
159
|
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
138
160
|
location: "main-translations",
|
|
139
161
|
priority: 10,
|
|
@@ -141,6 +163,7 @@ export default defineConfig({
|
|
|
141
163
|
|
|
142
164
|
// Fuente JSON de respaldo (menor prioridad)
|
|
143
165
|
syncJSON({
|
|
166
|
+
format: "i18next",
|
|
144
167
|
source: ({ locale }) => `./fallback-locales/${locale}.json`,
|
|
145
168
|
location: "fallback-translations",
|
|
146
169
|
priority: 5,
|
|
@@ -148,6 +171,7 @@ export default defineConfig({
|
|
|
148
171
|
|
|
149
172
|
// Fuente JSON heredada (prioridad más baja)
|
|
150
173
|
syncJSON({
|
|
174
|
+
format: "i18next",
|
|
151
175
|
source: ({ locale }) => `/my/other/app/legacy/${locale}/messages.json`,
|
|
152
176
|
location: "legacy-translations",
|
|
153
177
|
priority: 1,
|
|
@@ -178,6 +202,7 @@ import { syncJSON } from "@intlayer/sync-json-plugin";
|
|
|
178
202
|
export default {
|
|
179
203
|
plugins: [
|
|
180
204
|
syncJSON({
|
|
205
|
+
format: "i18next",
|
|
181
206
|
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
182
207
|
}),
|
|
183
208
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-02-07
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-12-13
|
|
4
4
|
title: Fichier de Contenu
|
|
5
5
|
description: Apprenez à personnaliser les extensions pour vos fichiers de déclaration de contenu. Suivez cette documentation pour implémenter efficacement des conditions dans votre projet.
|
|
6
6
|
keywords:
|
|
@@ -12,6 +12,9 @@ slugs:
|
|
|
12
12
|
- concept
|
|
13
13
|
- content
|
|
14
14
|
history:
|
|
15
|
+
- version: 7.5.0
|
|
16
|
+
date: 2025-12-13
|
|
17
|
+
changes: Ajout du support des formats ICU et i18next
|
|
15
18
|
- version: 6.0.0
|
|
16
19
|
date: 2025-09-20
|
|
17
20
|
changes: Ajout de la documentation des champs
|
|
@@ -384,6 +387,26 @@ Tableau de chaînes de caractères pour catégoriser et organiser les dictionnai
|
|
|
384
387
|
}
|
|
385
388
|
```
|
|
386
389
|
|
|
390
|
+
#### `format` ('intlayer' | 'icu' | 'i18next')
|
|
391
|
+
|
|
392
|
+
Spécifie le formateur à utiliser pour le contenu du dictionnaire. Cela permet d'utiliser différentes syntaxes de formatage de messages.
|
|
393
|
+
|
|
394
|
+
- `'intlayer'`: Le formateur Intlayer par défaut.
|
|
395
|
+
- `'icu'`: Utilise le formatage de messages ICU.
|
|
396
|
+
- `'i18next'`: Utilise le formatage de messages i18next.
|
|
397
|
+
|
|
398
|
+
**Exemple :**
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
{
|
|
402
|
+
key: "my-dictionary",
|
|
403
|
+
format: "icu",
|
|
404
|
+
content: {
|
|
405
|
+
message: "Hello {name}, you have {count, plural, one {# message} other {# messages}}"
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
387
410
|
#### `locale` (LocalesValues)
|
|
388
411
|
|
|
389
412
|
Transforme le dictionnaire en un dictionnaire par locale où chaque champ déclaré dans le contenu sera automatiquement transformé en un nœud de traduction. Lorsque cette propriété est définie :
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
createdAt: 2024-03-07
|
|
3
3
|
updatedAt: 2025-10-03
|
|
4
4
|
title: Comment traduire votre Astro – guide i18n 2025
|
|
5
|
-
description: Apprenez à ajouter l'internationalisation (i18n) à votre
|
|
5
|
+
description: Apprenez à ajouter l'internationalisation (i18n) à votre site web Astro en utilisant Intlayer. Suivez ce guide pour rendre votre site multilingue.
|
|
6
6
|
keywords:
|
|
7
7
|
- Internationalisation
|
|
8
8
|
- Documentation
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
createdAt: 2024-08-11
|
|
3
3
|
updatedAt: 2025-06-29
|
|
4
4
|
title: Comment traduire votre Express backend – guide i18n 2025
|
|
5
|
-
description: Découvrez comment rendre votre backend
|
|
5
|
+
description: Découvrez comment rendre votre backend Express multilingue. Suivez la documentation pour l’internationaliser (i18n) et le traduire.
|
|
6
6
|
keywords:
|
|
7
7
|
- Internationalisation
|
|
8
8
|
- Documentation
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
createdAt: 2025-09-09
|
|
3
3
|
updatedAt: 2025-09-09
|
|
4
4
|
title: Comment traduire votre Nest backend – guide i18n 2025
|
|
5
|
-
description: Découvrez comment rendre votre backend
|
|
5
|
+
description: Découvrez comment rendre votre backend NestJS multilingue. Suivez la documentation pour internationaliser (i18n) et traduire.
|
|
6
6
|
keywords:
|
|
7
7
|
- Internationalisation
|
|
8
8
|
- Documentation
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-09
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-12-11
|
|
4
4
|
title: Comment traduire votre Tanstack Start – guide i18n 2025
|
|
5
5
|
description: Apprenez à ajouter l'internationalisation (i18n) à votre application Tanstack Start en utilisant Intlayer. Suivez ce guide complet pour rendre votre application multilingue avec un routage sensible à la locale.
|
|
6
6
|
keywords:
|
|
@@ -19,9 +19,12 @@ slugs:
|
|
|
19
19
|
applicationTemplate: https://github.com/aymericzip/intlayer-tanstack-start-template
|
|
20
20
|
youtubeVideo: https://www.youtube.com/watch?v=_XTdKVWaeqg
|
|
21
21
|
history:
|
|
22
|
+
- version: 7.4.0
|
|
23
|
+
date: 2025-12-11
|
|
24
|
+
changes: Ajout de validatePrefix et étape 14 : gestion des pages 404 avec routes localisées.
|
|
22
25
|
- version: 7.3.9
|
|
23
26
|
date: 2025-12-05
|
|
24
|
-
changes:
|
|
27
|
+
changes: Ajout de l’étape 13 : récupération de la locale dans vos server actions (optionnel)
|
|
25
28
|
- version: 5.8.1
|
|
26
29
|
date: 2025-09-09
|
|
27
30
|
changes: Ajout pour Tanstack Start
|
|
@@ -609,7 +612,123 @@ export const getLocaleServer = createServerFn().handler(async () => {
|
|
|
609
612
|
|
|
610
613
|
---
|
|
611
614
|
|
|
612
|
-
### Étape 14 :
|
|
615
|
+
### Étape 14 : Gérer les pages non trouvées (Optionnel)
|
|
616
|
+
|
|
617
|
+
Lorsqu'un utilisateur visite une page inexistante, vous pouvez afficher une page personnalisée de non trouvée et le préfixe de locale peut affecter la façon dont la page de non trouvée est déclenchée.
|
|
618
|
+
|
|
619
|
+
#### Comprendre la gestion des 404 de TanStack Router avec les préfixes de locale
|
|
620
|
+
|
|
621
|
+
Dans TanStack Router, la gestion des pages 404 avec des routes localisées nécessite une approche multicouche :
|
|
622
|
+
|
|
623
|
+
1. **Route 404 dédiée** : Une route spécifique pour afficher l'interface utilisateur 404
|
|
624
|
+
2. **Validation au niveau de la route** : Valide les préfixes de locale et redirige ceux qui sont invalides vers 404
|
|
625
|
+
3. **Route catch-all** : Capture tous les chemins non correspondants dans le segment de locale
|
|
626
|
+
|
|
627
|
+
```tsx fileName="src/routes/{-$locale}/404.tsx"
|
|
628
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
629
|
+
|
|
630
|
+
// Ceci crée une route dédiée /[locale]/404
|
|
631
|
+
// Elle est utilisée à la fois comme route directe et importée comme composant dans d'autres fichiers
|
|
632
|
+
export const Route = createFileRoute("/{-$locale}/404")({
|
|
633
|
+
component: NotFoundComponent,
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
// Exporté séparément pour pouvoir être réutilisé dans notFoundComponent et les routes catch-all
|
|
637
|
+
export function NotFoundComponent() {
|
|
638
|
+
return (
|
|
639
|
+
<div>
|
|
640
|
+
<h1>404</h1>
|
|
641
|
+
</div>
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
```tsx fileName="src/routes/{-$locale}/route.tsx"
|
|
647
|
+
import { createFileRoute, Outlet, redirect } from "@tanstack/react-router";
|
|
648
|
+
import { validatePrefix } from "intlayer";
|
|
649
|
+
import { IntlayerProvider, useLocale } from "react-intlayer";
|
|
650
|
+
|
|
651
|
+
import { LocaleSwitcher } from "@/components/locale-switcher";
|
|
652
|
+
import { NotFoundComponent } from "./404";
|
|
653
|
+
|
|
654
|
+
export const Route = createFileRoute("/{-$locale}")({
|
|
655
|
+
// beforeLoad s'exécute avant que la route ne soit rendue (à la fois sur le serveur et le client)
|
|
656
|
+
// C'est l'endroit idéal pour valider le préfixe de locale
|
|
657
|
+
beforeLoad: ({ params }) => {
|
|
658
|
+
// Obtenir la locale depuis les paramètres de route (pas depuis les en-têtes du serveur, car beforeLoad s'exécute à la fois sur le client et le serveur)
|
|
659
|
+
const localeParam = params.locale;
|
|
660
|
+
|
|
661
|
+
// validatePrefix vérifie si la locale est valide selon votre configuration intlayer
|
|
662
|
+
// Retourne : { isValid: boolean, localePrefix: string }
|
|
663
|
+
// - isValid: true si le préfixe correspond à une locale configurée (ou est vide lorsque le préfixe est optionnel)
|
|
664
|
+
// - localePrefix: le préfixe validé ou le préfixe de locale par défaut pour les redirections
|
|
665
|
+
const { isValid, localePrefix } = validatePrefix(localeParam);
|
|
666
|
+
|
|
667
|
+
if (isValid) {
|
|
668
|
+
// La locale est valide, permettre à la route de se rendre normalement
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// Préfixe de locale invalide (p. ex., /xyz/about où "xyz" n'est pas une locale valide)
|
|
673
|
+
// Rediriger vers la page 404 avec un préfixe de locale valide
|
|
674
|
+
// Cela garantit que la page 404 est toujours correctement localisée
|
|
675
|
+
throw redirect({
|
|
676
|
+
to: "/{-$locale}/404",
|
|
677
|
+
params: { locale: localePrefix },
|
|
678
|
+
});
|
|
679
|
+
},
|
|
680
|
+
component: RouteComponent,
|
|
681
|
+
// notFoundComponent est appelé lorsqu'une route enfant n'existe pas
|
|
682
|
+
// p. ex., /en/page-inexistante déclenche ceci dans la mise en page /en
|
|
683
|
+
notFoundComponent: NotFoundLayout,
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
function RouteComponent() {
|
|
687
|
+
const { defaultLocale } = useLocale();
|
|
688
|
+
const { locale } = Route.useParams();
|
|
689
|
+
|
|
690
|
+
return (
|
|
691
|
+
// Envelopper tout le segment de locale avec IntlayerProvider
|
|
692
|
+
// Revient à defaultLocale lorsque le paramètre locale est undefined (mode préfixe optionnel)
|
|
693
|
+
<IntlayerProvider locale={locale ?? defaultLocale}>
|
|
694
|
+
<Outlet />
|
|
695
|
+
</IntlayerProvider>
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// NotFoundLayout enveloppe le composant 404 avec IntlayerProvider
|
|
700
|
+
// Cela garantit que les traductions fonctionnent toujours sur la page 404
|
|
701
|
+
function NotFoundLayout() {
|
|
702
|
+
const { defaultLocale } = useLocale();
|
|
703
|
+
const { locale } = Route.useParams();
|
|
704
|
+
|
|
705
|
+
return (
|
|
706
|
+
<IntlayerProvider locale={locale ?? defaultLocale}>
|
|
707
|
+
<NotFoundComponent />
|
|
708
|
+
{/* Inclure LocaleSwitcher pour que les utilisateurs puissent changer de langue même sur 404 */}
|
|
709
|
+
<LocaleSwitcher />
|
|
710
|
+
</IntlayerProvider>
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
```tsx fileName="src/routes/{-$locale}/$.tsx"
|
|
716
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
717
|
+
|
|
718
|
+
import { NotFoundComponent } from "./404";
|
|
719
|
+
|
|
720
|
+
// La route $ (splat/catch-all) correspond à tout chemin qui ne correspond pas à d'autres routes
|
|
721
|
+
// p. ex., /en/quelque/chemin/profond/imbriqué/invalide
|
|
722
|
+
// Cela garantit que TOUS les chemins non correspondants dans une locale affichent la page 404
|
|
723
|
+
// Sans cela, les chemins profonds non correspondants pourraient afficher une page blanche ou une erreur
|
|
724
|
+
export const Route = createFileRoute("/{-$locale}/$")({
|
|
725
|
+
component: NotFoundComponent,
|
|
726
|
+
});
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
---
|
|
730
|
+
|
|
731
|
+
### Étape 15 : Configurer TypeScript (Optionnel)
|
|
613
732
|
|
|
614
733
|
Intlayer utilise l'augmentation de module pour bénéficier de TypeScript et renforcer votre base de code.
|
|
615
734
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-03-13
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-12-13
|
|
4
4
|
title: Plugin Sync JSON
|
|
5
5
|
description: Synchronisez les dictionnaires Intlayer avec des fichiers JSON i18n tiers (i18next, next-intl, react-intl, vue-i18n, et plus). Conservez votre i18n existant tout en utilisant Intlayer pour gérer, traduire et tester vos messages.
|
|
6
6
|
keywords:
|
|
@@ -24,12 +24,15 @@ slugs:
|
|
|
24
24
|
- sync-json
|
|
25
25
|
youtubeVideo: https://www.youtube.com/watch?v=MpGMxniDHNg
|
|
26
26
|
history:
|
|
27
|
+
- version: 7.5.0
|
|
28
|
+
date: 2025-12-13
|
|
29
|
+
changes: Ajout du support des formats ICU et i18next
|
|
27
30
|
- version: 6.1.6
|
|
28
31
|
date: 2025-10-05
|
|
29
32
|
changes: Documentation initiale du plugin Sync JSON
|
|
30
33
|
---
|
|
31
34
|
|
|
32
|
-
# Sync JSON (ponts i18n)
|
|
35
|
+
# Sync JSON (ponts i18n) - Sync JSON avec support ICU / i18next
|
|
33
36
|
|
|
34
37
|
<iframe title="Comment garder vos traductions JSON synchronisées avec 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
38
|
|
|
@@ -105,9 +108,27 @@ syncJSON({
|
|
|
105
108
|
source: ({ key, locale }) => string, // requis
|
|
106
109
|
location?: string, // étiquette optionnelle, par défaut : "plugin"
|
|
107
110
|
priority?: number, // priorité optionnelle pour la résolution des conflits, par défaut : 0
|
|
111
|
+
format?: 'intlayer' | 'icu' | 'i18next', // formateur optionnel, par défaut : 'intlayer'
|
|
108
112
|
});
|
|
109
113
|
```
|
|
110
114
|
|
|
115
|
+
#### `format` ('intlayer' | 'icu' | 'i18next')
|
|
116
|
+
|
|
117
|
+
Spécifie le formateur à utiliser pour le contenu du dictionnaire lors de la synchronisation des fichiers JSON. Cela permet d'utiliser différentes syntaxes de formatage de messages compatibles avec diverses bibliothèques i18n.
|
|
118
|
+
|
|
119
|
+
- `'intlayer'`: Le formateur Intlayer par défaut (par défaut).
|
|
120
|
+
- `'icu'`: Utilise le formatage de messages ICU (compatible avec des bibliothèques comme react-intl, vue-i18n).
|
|
121
|
+
- `'i18next'`: Utilise le formatage de messages i18next (compatible avec i18next, next-i18next, Solid-i18next).
|
|
122
|
+
|
|
123
|
+
**Exemple :**
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
syncJSON({
|
|
127
|
+
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
128
|
+
format: "i18next", // Utiliser le formatage i18next pour la compatibilité
|
|
129
|
+
}),
|
|
130
|
+
```
|
|
131
|
+
|
|
111
132
|
## Sources JSON multiples et priorité
|
|
112
133
|
|
|
113
134
|
Vous pouvez ajouter plusieurs plugins `syncJSON` pour synchroniser différentes sources JSON. Cela est utile lorsque vous avez plusieurs bibliothèques i18n ou différentes structures JSON dans votre projet.
|
|
@@ -134,6 +155,7 @@ export default defineConfig({
|
|
|
134
155
|
plugins: [
|
|
135
156
|
// Source JSON principale (priorité la plus élevée)
|
|
136
157
|
syncJSON({
|
|
158
|
+
format: "i18next",
|
|
137
159
|
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
138
160
|
location: "main-translations",
|
|
139
161
|
priority: 10,
|
|
@@ -141,6 +163,7 @@ export default defineConfig({
|
|
|
141
163
|
|
|
142
164
|
// Source JSON de secours (priorité plus basse)
|
|
143
165
|
syncJSON({
|
|
166
|
+
format: "i18next",
|
|
144
167
|
source: ({ locale }) => `./fallback-locales/${locale}.json`,
|
|
145
168
|
location: "fallback-translations",
|
|
146
169
|
priority: 5,
|
|
@@ -148,6 +171,7 @@ export default defineConfig({
|
|
|
148
171
|
|
|
149
172
|
// Source JSON héritée (priorité la plus basse)
|
|
150
173
|
syncJSON({
|
|
174
|
+
format: "i18next",
|
|
151
175
|
source: ({ locale }) => `/my/other/app/legacy/${locale}/messages.json`,
|
|
152
176
|
location: "legacy-translations",
|
|
153
177
|
priority: 1,
|
|
@@ -178,6 +202,7 @@ import { syncJSON } from "@intlayer/sync-json-plugin";
|
|
|
178
202
|
export default {
|
|
179
203
|
plugins: [
|
|
180
204
|
syncJSON({
|
|
205
|
+
format: "i18next",
|
|
181
206
|
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
182
207
|
}),
|
|
183
208
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-02-07
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-12-13
|
|
4
4
|
title: कंटेंट फ़ाइल
|
|
5
5
|
description: अपनी कंटेंट घोषणा फ़ाइलों के एक्सटेंशनों को कस्टमाइज़ करना सीखें। अपने प्रोजेक्ट में शर्तों को कुशलतापूर्वक लागू करने के लिए इस दस्तावेज़ का पालन करें।
|
|
6
6
|
keywords:
|
|
@@ -12,6 +12,9 @@ slugs:
|
|
|
12
12
|
- concept
|
|
13
13
|
- content
|
|
14
14
|
history:
|
|
15
|
+
- version: 7.5.0
|
|
16
|
+
date: 2025-12-13
|
|
17
|
+
changes: ICU और i18next प्रारूप समर्थन जोड़ा
|
|
15
18
|
- version: 6.0.0
|
|
16
19
|
date: 2025-09-20
|
|
17
20
|
changes: फ़ील्ड्स दस्तावेज़ीकरण जोड़ा
|
|
@@ -386,6 +389,26 @@ Intlayer में एक शब्दकोश `Dictionary` प्रकार
|
|
|
386
389
|
}
|
|
387
390
|
```
|
|
388
391
|
|
|
392
|
+
#### `format` ('intlayer' | 'icu' | 'i18next')
|
|
393
|
+
|
|
394
|
+
शब्दकोश सामग्री के लिए उपयोग करने के लिए फ़ॉर्मेटर निर्दिष्ट करता है। यह विभिन्न संदेश फ़ॉर्मेटिंग सिंटैक्स का उपयोग करने की अनुमति देता है।
|
|
395
|
+
|
|
396
|
+
- `'intlayer'`: डिफ़ॉल्ट Intlayer फ़ॉर्मेटर।
|
|
397
|
+
- `'icu'`: ICU संदेश फ़ॉर्मेटिंग का उपयोग करता है।
|
|
398
|
+
- `'i18next'`: i18next संदेश फ़ॉर्मेटिंग का उपयोग करता है।
|
|
399
|
+
|
|
400
|
+
**उदाहरण:**
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
{
|
|
404
|
+
key: "my-dictionary",
|
|
405
|
+
format: "icu",
|
|
406
|
+
content: {
|
|
407
|
+
message: "Hello {name}, you have {count, plural, one {# message} other {# messages}}"
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
389
412
|
#### `locale` (LocalesValues)
|
|
390
413
|
|
|
391
414
|
शब्दकोश को प्रति-स्थानिक शब्दकोश में परिवर्तित करता है जहाँ सामग्री में घोषित प्रत्येक फ़ील्ड स्वचालित रूप से एक अनुवाद नोड में परिवर्तित हो जाएगा। जब यह गुण सेट किया जाता है:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
createdAt: 2024-03-07
|
|
3
3
|
updatedAt: 2025-10-03
|
|
4
4
|
title: अपना Astro ऐप कैसे अनुवाद करें – i18n गाइड 2025
|
|
5
|
-
description: जानें कि कैसे Intlayer का उपयोग करके अपनी
|
|
5
|
+
description: जानें कि कैसे Intlayer का उपयोग करके अपनी Astro वेबसाइट में अंतरराष्ट्रीयकरण (i18n) जोड़ें। इस गाइड का पालन करें ताकि आपकी वेबसाइट बहुभाषी बन सके।
|
|
6
6
|
keywords:
|
|
7
7
|
- अंतरराष्ट्रीयकरण
|
|
8
8
|
- दस्तावेज़ीकरण
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
createdAt: 2024-08-11
|
|
3
3
|
updatedAt: 2025-06-29
|
|
4
4
|
title: अपना Express backend ऐप कैसे अनुवाद करें – i18n गाइड 2025
|
|
5
|
-
description: जानें कि कैसे
|
|
5
|
+
description: जानें कि कैसे अपने Express बैकएंड को बहुभाषी बनाया जाए। इसे अंतर्राष्ट्रीय बनाने (i18n) और अनुवाद करने के लिए दस्तावेज़ का पालन करें।
|
|
6
6
|
keywords:
|
|
7
7
|
- आंतरराष्ट्रीयकरण
|
|
8
8
|
- दस्तावेज़ीकरण
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
createdAt: 2025-09-09
|
|
3
3
|
updatedAt: 2025-09-09
|
|
4
4
|
title: अपना Nest backend ऐप कैसे अनुवाद करें – i18n गाइड 2025
|
|
5
|
-
description: जानें कि अपने
|
|
5
|
+
description: जानें कि अपने NestJS बैकएंड को बहुभाषी कैसे बनाएं। अंतरराष्ट्रीयकरण (i18n) और अनुवाद के लिए दस्तावेज़ का पालन करें।
|
|
6
6
|
keywords:
|
|
7
7
|
- अंतरराष्ट्रीयकरण
|
|
8
8
|
- दस्तावेज़
|