@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: Come tradurre la tua Tanstack Start – guida i18n 2025
|
|
5
5
|
description: Scopri come aggiungere l'internazionalizzazione (i18n) alla tua applicazione Tanstack Start utilizzando Intlayer. Segui questa guida completa per rendere la tua app multilingue con il routing consapevole della localizzazione.
|
|
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: Introdotto validatePrefix e aggiunto il passaggio 14: Gestione delle pagine 404 con rotte localizzate.
|
|
22
25
|
- version: 7.3.9
|
|
23
26
|
date: 2025-12-05
|
|
24
|
-
changes:
|
|
27
|
+
changes: Aggiunto passaggio 13: Recupera la lingua locale nelle server actions (Opzionale)
|
|
25
28
|
- version: 6.5.2
|
|
26
29
|
date: 2025-10-03
|
|
27
30
|
changes: Aggiornamento documentazione
|
|
@@ -622,7 +625,123 @@ export const getLocaleServer = createServerFn().handler(async () => {
|
|
|
622
625
|
|
|
623
626
|
---
|
|
624
627
|
|
|
625
|
-
### Passo 14:
|
|
628
|
+
### Passo 14: Gestire le pagine non trovate (Opzionale)
|
|
629
|
+
|
|
630
|
+
Quando un utente visita una pagina inesistente, puoi visualizzare una pagina personalizzata di non trovata e il prefisso locale può influenzare il modo in cui viene attivata la pagina di non trovata.
|
|
631
|
+
|
|
632
|
+
#### Comprendere la gestione 404 di TanStack Router con prefissi locale
|
|
633
|
+
|
|
634
|
+
In TanStack Router, gestire le pagine 404 con route localizzate richiede un approccio multistrato:
|
|
635
|
+
|
|
636
|
+
1. **Route 404 dedicata**: Una route specifica per visualizzare l'interfaccia utente 404
|
|
637
|
+
2. **Validazione a livello di route**: Valida i prefissi locale e reindirizza quelli non validi a 404
|
|
638
|
+
3. **Route catch-all**: Cattura tutti i percorsi non corrispondenti all'interno del segmento locale
|
|
639
|
+
|
|
640
|
+
```tsx fileName="src/routes/{-$locale}/404.tsx"
|
|
641
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
642
|
+
|
|
643
|
+
// Questo crea una route dedicata /[locale]/404
|
|
644
|
+
// Viene utilizzata sia come route diretta che importata come componente in altri file
|
|
645
|
+
export const Route = createFileRoute("/{-$locale}/404")({
|
|
646
|
+
component: NotFoundComponent,
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
// Esportato separatamente in modo che possa essere riutilizzato in notFoundComponent e route catch-all
|
|
650
|
+
export function NotFoundComponent() {
|
|
651
|
+
return (
|
|
652
|
+
<div>
|
|
653
|
+
<h1>404</h1>
|
|
654
|
+
</div>
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
```tsx fileName="src/routes/{-$locale}/route.tsx"
|
|
660
|
+
import { createFileRoute, Outlet, redirect } from "@tanstack/react-router";
|
|
661
|
+
import { validatePrefix } from "intlayer";
|
|
662
|
+
import { IntlayerProvider, useLocale } from "react-intlayer";
|
|
663
|
+
|
|
664
|
+
import { LocaleSwitcher } from "@/components/locale-switcher";
|
|
665
|
+
import { NotFoundComponent } from "./404";
|
|
666
|
+
|
|
667
|
+
export const Route = createFileRoute("/{-$locale}")({
|
|
668
|
+
// beforeLoad viene eseguito prima che la route venga renderizzata (sia sul server che sul client)
|
|
669
|
+
// È il posto ideale per validare il prefisso della locale
|
|
670
|
+
beforeLoad: ({ params }) => {
|
|
671
|
+
// Ottieni la locale dai parametri della route (non dagli header del server, poiché beforeLoad viene eseguito sia sul client che sul server)
|
|
672
|
+
const localeParam = params.locale;
|
|
673
|
+
|
|
674
|
+
// validatePrefix verifica se la locale è valida secondo la tua configurazione intlayer
|
|
675
|
+
// Restituisce: { isValid: boolean, localePrefix: string }
|
|
676
|
+
// - isValid: true se il prefisso corrisponde a una locale configurata (o è vuoto quando il prefisso è opzionale)
|
|
677
|
+
// - localePrefix: il prefisso validato o il prefisso della locale predefinito per i reindirizzamenti
|
|
678
|
+
const { isValid, localePrefix } = validatePrefix(localeParam);
|
|
679
|
+
|
|
680
|
+
if (isValid) {
|
|
681
|
+
// La locale è valida, consenti alla route di renderizzarsi normalmente
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// Prefisso della locale non valido (ad esempio, /xyz/about dove "xyz" non è una locale valida)
|
|
686
|
+
// Reindirizza alla pagina 404 con un prefisso della locale valido
|
|
687
|
+
// Questo assicura che la pagina 404 sia ancora correttamente localizzata
|
|
688
|
+
throw redirect({
|
|
689
|
+
to: "/{-$locale}/404",
|
|
690
|
+
params: { locale: localePrefix },
|
|
691
|
+
});
|
|
692
|
+
},
|
|
693
|
+
component: RouteComponent,
|
|
694
|
+
// notFoundComponent viene chiamato quando una route figlia non esiste
|
|
695
|
+
// ad esempio, /en/pagina-inesistente attiva questo all'interno del layout /en
|
|
696
|
+
notFoundComponent: NotFoundLayout,
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
function RouteComponent() {
|
|
700
|
+
const { defaultLocale } = useLocale();
|
|
701
|
+
const { locale } = Route.useParams();
|
|
702
|
+
|
|
703
|
+
return (
|
|
704
|
+
// Avvolgi l'intero segmento della locale con IntlayerProvider
|
|
705
|
+
// Torna a defaultLocale quando il parametro locale è undefined (modalità prefisso opzionale)
|
|
706
|
+
<IntlayerProvider locale={locale ?? defaultLocale}>
|
|
707
|
+
<Outlet />
|
|
708
|
+
</IntlayerProvider>
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// NotFoundLayout avvolge il componente 404 con IntlayerProvider
|
|
713
|
+
// Questo assicura che le traduzioni funzionino ancora sulla pagina 404
|
|
714
|
+
function NotFoundLayout() {
|
|
715
|
+
const { defaultLocale } = useLocale();
|
|
716
|
+
const { locale } = Route.useParams();
|
|
717
|
+
|
|
718
|
+
return (
|
|
719
|
+
<IntlayerProvider locale={locale ?? defaultLocale}>
|
|
720
|
+
<NotFoundComponent />
|
|
721
|
+
{/* Includi LocaleSwitcher in modo che gli utenti possano cambiare lingua anche su 404 */}
|
|
722
|
+
<LocaleSwitcher />
|
|
723
|
+
</IntlayerProvider>
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
```tsx fileName="src/routes/{-$locale}/$.tsx"
|
|
729
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
730
|
+
|
|
731
|
+
import { NotFoundComponent } from "./404";
|
|
732
|
+
|
|
733
|
+
// La route $ (splat/catch-all) corrisponde a qualsiasi percorso che non corrisponde ad altre route
|
|
734
|
+
// ad esempio, /en/qualche/percorso/profondamente/annidato/non-valido
|
|
735
|
+
// Questo assicura che TUTTI i percorsi non corrispondenti all'interno di una locale mostrino la pagina 404
|
|
736
|
+
// Senza questo, i percorsi profondi non corrispondenti potrebbero mostrare una pagina vuota o un errore
|
|
737
|
+
export const Route = createFileRoute("/{-$locale}/$")({
|
|
738
|
+
component: NotFoundComponent,
|
|
739
|
+
});
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
---
|
|
743
|
+
|
|
744
|
+
### Passo 15: Configurare TypeScript (Opzionale)
|
|
626
745
|
|
|
627
746
|
Intlayer utilizza l'augmentation dei moduli per sfruttare i vantaggi di TypeScript e rendere il tuo codice più robusto.
|
|
628
747
|
|
|
@@ -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: Sincronizza i dizionari Intlayer con file JSON i18n di terze parti (i18next, next-intl, react-intl, vue-i18n e altri). Mantieni il tuo i18n esistente mentre usi Intlayer per gestire, tradurre e testare i tuoi messaggi.
|
|
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: Aggiunto supporto per i formati ICU e i18next
|
|
27
30
|
- version: 6.1.6
|
|
28
31
|
date: 2025-10-05
|
|
29
32
|
changes: Documentazione iniziale del plugin Sync JSON
|
|
30
33
|
---
|
|
31
34
|
|
|
32
|
-
# Sync JSON (ponti i18n)
|
|
35
|
+
# Sync JSON (ponti i18n) - Sync JSON con supporto ICU / i18next
|
|
33
36
|
|
|
34
37
|
<iframe title="Come mantenere sincronizzate le tue traduzioni JSON 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, // richiesto
|
|
106
109
|
location?: string, // etichetta opzionale, predefinito: "plugin"
|
|
107
110
|
priority?: number, // priorità opzionale per la risoluzione dei conflitti, predefinito: 0
|
|
111
|
+
format?: 'intlayer' | 'icu' | 'i18next', // formattatore opzionale, predefinito: 'intlayer'
|
|
108
112
|
});
|
|
109
113
|
```
|
|
110
114
|
|
|
115
|
+
#### `format` ('intlayer' | 'icu' | 'i18next')
|
|
116
|
+
|
|
117
|
+
Specifica il formattatore da utilizzare per il contenuto del dizionario durante la sincronizzazione dei file JSON. Ciò consente di utilizzare diverse sintassi di formattazione dei messaggi compatibili con varie librerie i18n.
|
|
118
|
+
|
|
119
|
+
- `'intlayer'`: Il formattatore Intlayer predefinito (predefinito).
|
|
120
|
+
- `'icu'`: Utilizza la formattazione dei messaggi ICU (compatibile con librerie come react-intl, vue-i18n).
|
|
121
|
+
- `'i18next'`: Utilizza la formattazione dei messaggi i18next (compatibile con i18next, next-i18next, Solid-i18next).
|
|
122
|
+
|
|
123
|
+
**Esempio:**
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
syncJSON({
|
|
127
|
+
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
128
|
+
format: "i18next", // Usare la formattazione i18next per la compatibilità
|
|
129
|
+
}),
|
|
130
|
+
```
|
|
131
|
+
|
|
111
132
|
## Più sorgenti JSON e priorità
|
|
112
133
|
|
|
113
134
|
Puoi aggiungere più plugin `syncJSON` per sincronizzare diverse sorgenti JSON. Questo è utile quando hai più librerie i18n o diverse strutture JSON nel tuo progetto.
|
|
@@ -134,6 +155,7 @@ export default defineConfig({
|
|
|
134
155
|
plugins: [
|
|
135
156
|
// Sorgente JSON primaria (priorità più alta)
|
|
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
|
// Sorgente JSON di fallback (priorità più bassa)
|
|
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
|
// Sorgente JSON legacy (priorità più bassa)
|
|
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: フィールドのドキュメントを追加
|
|
@@ -387,6 +390,26 @@ Intlayerの辞書は`Dictionary`型で定義され、その動作を制御する
|
|
|
387
390
|
}
|
|
388
391
|
```
|
|
389
392
|
|
|
393
|
+
#### `format` ('intlayer' | 'icu' | 'i18next')
|
|
394
|
+
|
|
395
|
+
辞書コンテンツに使用するフォーマッターを指定します。これにより、異なるメッセージフォーマット構文を使用できます。
|
|
396
|
+
|
|
397
|
+
- `'intlayer'`: デフォルトのIntlayerフォーマッター。
|
|
398
|
+
- `'icu'`: ICUメッセージフォーマットを使用します。
|
|
399
|
+
- `'i18next'`: i18nextメッセージフォーマットを使用します。
|
|
400
|
+
|
|
401
|
+
**例:**
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
{
|
|
405
|
+
key: "my-dictionary",
|
|
406
|
+
format: "icu",
|
|
407
|
+
content: {
|
|
408
|
+
message: "Hello {name}, you have {count, plural, one {# message} other {# messages}}"
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
390
413
|
#### `locale` (LocalesValues)
|
|
391
414
|
|
|
392
415
|
辞書をロケールごとの辞書に変換し、content内で宣言された各フィールドが自動的に翻訳ノードに変換されます。このプロパティが設定されている場合:
|
|
@@ -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
|
- ドキュメント
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-09
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-12-11
|
|
4
4
|
title: Tanstack Startアプリを翻訳する方法 – i18nガイド 2025
|
|
5
5
|
description: Intlayerを使ってTanstack Startアプリケーションに国際化(i18n)を追加する方法を学びます。ロケール対応ルーティングで多言語対応アプリを作成するための包括的なガイドです。
|
|
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: validatePrefix を導入し、ステップ14: ローカライズされたルートでの 404 ページ処理 を追加
|
|
22
25
|
- version: 7.3.9
|
|
23
26
|
date: 2025-12-05
|
|
24
|
-
changes:
|
|
27
|
+
changes: ステップ13: サーバーアクション内でロケールを取得する方法(オプション)を追加
|
|
25
28
|
- version: 5.8.1
|
|
26
29
|
date: 2025-09-09
|
|
27
30
|
changes: Tanstack Start 用に追加
|
|
@@ -594,7 +597,123 @@ export const getLocaleServer = createServerFn().handler(async () => {
|
|
|
594
597
|
|
|
595
598
|
---
|
|
596
599
|
|
|
597
|
-
### ステップ14:
|
|
600
|
+
### ステップ14: 見つからないページの管理(任意)
|
|
601
|
+
|
|
602
|
+
ユーザーが存在しないページにアクセスした場合、カスタムの見つからないページを表示でき、ロケールプレフィックスが見つからないページのトリガー方法に影響を与える可能性があります。
|
|
603
|
+
|
|
604
|
+
#### ロケールプレフィックスを使用したTanStack Routerの404処理を理解する
|
|
605
|
+
|
|
606
|
+
TanStack Routerでは、ローカライズされたルートで404ページを処理するには、多層的なアプローチが必要です:
|
|
607
|
+
|
|
608
|
+
1. **専用の404ルート**: 404 UIを表示するための特定のルート
|
|
609
|
+
2. **ルートレベルの検証**: ロケールプレフィックスを検証し、無効なものを404にリダイレクト
|
|
610
|
+
3. **キャッチオールルート**: ロケールセグメント内で一致しないすべてのパスをキャプチャ
|
|
611
|
+
|
|
612
|
+
```tsx fileName="src/routes/{-$locale}/404.tsx"
|
|
613
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
614
|
+
|
|
615
|
+
// これは専用の /[locale]/404 ルートを作成します
|
|
616
|
+
// 直接ルートとして使用されるか、他のファイルでコンポーネントとしてインポートされます
|
|
617
|
+
export const Route = createFileRoute("/{-$locale}/404")({
|
|
618
|
+
component: NotFoundComponent,
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
// notFoundComponent および catch-all ルートで再利用できるように個別にエクスポートされます
|
|
622
|
+
export function NotFoundComponent() {
|
|
623
|
+
return (
|
|
624
|
+
<div>
|
|
625
|
+
<h1>404</h1>
|
|
626
|
+
</div>
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
```tsx fileName="src/routes/{-$locale}/route.tsx"
|
|
632
|
+
import { createFileRoute, Outlet, redirect } from "@tanstack/react-router";
|
|
633
|
+
import { validatePrefix } from "intlayer";
|
|
634
|
+
import { IntlayerProvider, useLocale } from "react-intlayer";
|
|
635
|
+
|
|
636
|
+
import { LocaleSwitcher } from "@/components/locale-switcher";
|
|
637
|
+
import { NotFoundComponent } from "./404";
|
|
638
|
+
|
|
639
|
+
export const Route = createFileRoute("/{-$locale}")({
|
|
640
|
+
// beforeLoadはルートがレンダリングされる前に実行されます(サーバーとクライアントの両方で)
|
|
641
|
+
// ロケールプレフィックスを検証するのに理想的な場所です
|
|
642
|
+
beforeLoad: ({ params }) => {
|
|
643
|
+
// ルートパラメータからロケールを取得(サーバーヘッダーからではない。beforeLoadはクライアントとサーバーの両方で実行されるため)
|
|
644
|
+
const localeParam = params.locale;
|
|
645
|
+
|
|
646
|
+
// validatePrefixは、ロケールがintlayer設定に従って有効かどうかをチェックします
|
|
647
|
+
// 戻り値: { isValid: boolean, localePrefix: string }
|
|
648
|
+
// - isValid: プレフィックスが設定されたロケールと一致する場合(またはプレフィックスがオプションの場合は空)はtrue
|
|
649
|
+
// - localePrefix: 検証されたプレフィックスまたはリダイレクト用のデフォルトのロケールプレフィックス
|
|
650
|
+
const { isValid, localePrefix } = validatePrefix(localeParam);
|
|
651
|
+
|
|
652
|
+
if (isValid) {
|
|
653
|
+
// ロケールが有効です。ルートが正常にレンダリングされるようにします
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// 無効なロケールプレフィックス(例: "xyz"が有効なロケールではない /xyz/about)
|
|
658
|
+
// 有効なロケールプレフィックスで404ページにリダイレクト
|
|
659
|
+
// これにより、404ページが適切にローカライズされたままになります
|
|
660
|
+
throw redirect({
|
|
661
|
+
to: "/{-$locale}/404",
|
|
662
|
+
params: { locale: localePrefix },
|
|
663
|
+
});
|
|
664
|
+
},
|
|
665
|
+
component: RouteComponent,
|
|
666
|
+
// notFoundComponentは子ルートが存在しないときに呼び出されます
|
|
667
|
+
// 例: /en/存在しないページが /en レイアウト内でこれをトリガーします
|
|
668
|
+
notFoundComponent: NotFoundLayout,
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
function RouteComponent() {
|
|
672
|
+
const { defaultLocale } = useLocale();
|
|
673
|
+
const { locale } = Route.useParams();
|
|
674
|
+
|
|
675
|
+
return (
|
|
676
|
+
// ロケールセグメント全体をIntlayerProviderでラップ
|
|
677
|
+
// ロケールパラメータがundefinedの場合、defaultLocaleにフォールバック(オプションプレフィックスモード)
|
|
678
|
+
<IntlayerProvider locale={locale ?? defaultLocale}>
|
|
679
|
+
<Outlet />
|
|
680
|
+
</IntlayerProvider>
|
|
681
|
+
);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// NotFoundLayoutは404コンポーネントをIntlayerProviderでラップします
|
|
685
|
+
// これにより、404ページで翻訳が引き続き機能することが保証されます
|
|
686
|
+
function NotFoundLayout() {
|
|
687
|
+
const { defaultLocale } = useLocale();
|
|
688
|
+
const { locale } = Route.useParams();
|
|
689
|
+
|
|
690
|
+
return (
|
|
691
|
+
<IntlayerProvider locale={locale ?? defaultLocale}>
|
|
692
|
+
<NotFoundComponent />
|
|
693
|
+
{/* ユーザーが404でも言語を変更できるようにLocaleSwitcherを含める */}
|
|
694
|
+
<LocaleSwitcher />
|
|
695
|
+
</IntlayerProvider>
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
```tsx fileName="src/routes/{-$locale}/$.tsx"
|
|
701
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
702
|
+
|
|
703
|
+
import { NotFoundComponent } from "./404";
|
|
704
|
+
|
|
705
|
+
// $ (splat/catch-all) ルートは、他のルートと一致しない任意のパスに一致します
|
|
706
|
+
// 例: /en/いくつかの/深く/ネストされた/無効な/パス
|
|
707
|
+
// これにより、ロケール内の一致しないすべてのパスが404ページを表示することが保証されます
|
|
708
|
+
// これがないと、一致しない深いパスが空白ページやエラーを表示する可能性があります
|
|
709
|
+
export const Route = createFileRoute("/{-$locale}/$")({
|
|
710
|
+
component: NotFoundComponent,
|
|
711
|
+
});
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
---
|
|
715
|
+
|
|
716
|
+
### ステップ15: TypeScriptの設定(任意)
|
|
598
717
|
|
|
599
718
|
Intlayerはモジュール拡張を使用して、TypeScriptの利点を活かし、コードベースを強化します。
|
|
600
719
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-03-13
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-12-13
|
|
4
4
|
title: Sync JSON プラグイン
|
|
5
5
|
description: Intlayerの辞書をサードパーティのi18n JSONファイル(i18next、next-intl、react-intl、vue-i18nなど)と同期します。既存のi18nを維持しながら、Intlayerでメッセージの管理、翻訳、テストを行えます。
|
|
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: ICUおよびi18next形式のサポートを追加
|
|
27
30
|
- version: 6.1.6
|
|
28
31
|
date: 2025-10-05
|
|
29
32
|
changes: Sync JSONプラグインの初期ドキュメント
|
|
30
33
|
---
|
|
31
34
|
|
|
32
|
-
# Sync JSON(i18n
|
|
35
|
+
# Sync JSON(i18nブリッジ)- ICU / i18nextサポート付きSync JSON
|
|
33
36
|
|
|
34
37
|
<iframe title="IntlayerでJSON翻訳を同期状態に保つ方法" 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, // 必須
|
|
106
109
|
location?: string, // オプションのラベル、デフォルト: "plugin"
|
|
107
110
|
priority?: number, // コンフリクト解決のためのオプションの優先度、デフォルト: 0
|
|
111
|
+
format?: 'intlayer' | 'icu' | 'i18next', // オプションのフォーマッター、デフォルト: 'intlayer'
|
|
108
112
|
});
|
|
109
113
|
```
|
|
110
114
|
|
|
115
|
+
#### `format` ('intlayer' | 'icu' | 'i18next')
|
|
116
|
+
|
|
117
|
+
JSONファイルを同期する際に辞書コンテンツに使用するフォーマッターを指定します。これにより、さまざまなi18nライブラリと互換性のある異なるメッセージフォーマット構文を使用できます。
|
|
118
|
+
|
|
119
|
+
- `'intlayer'`: デフォルトのIntlayerフォーマッター(デフォルト)。
|
|
120
|
+
- `'icu'`: ICUメッセージフォーマットを使用します(react-intl、vue-i18nなどのライブラリと互換性があります)。
|
|
121
|
+
- `'i18next'`: i18nextメッセージフォーマットを使用します(i18next、next-i18next、Solid-i18nextと互換性があります)。
|
|
122
|
+
|
|
123
|
+
**例:**
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
syncJSON({
|
|
127
|
+
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
128
|
+
format: "i18next", // 互換性のためにi18nextフォーマットを使用
|
|
129
|
+
}),
|
|
130
|
+
```
|
|
131
|
+
|
|
111
132
|
## 複数の JSON ソースと優先度
|
|
112
133
|
|
|
113
134
|
複数の `syncJSON` プラグインを追加して異なる JSON ソースを同期することができます。これは、複数の i18n ライブラリや異なる JSON 構造をプロジェクトで使用している場合に便利です。
|
|
@@ -134,6 +155,7 @@ export default defineConfig({
|
|
|
134
155
|
plugins: [
|
|
135
156
|
// プライマリJSONソース(最も高い優先度)
|
|
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
|
// フォールバックJSONソース(低い優先度)
|
|
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
|
// レガシーJSONソース(最も低い優先度)
|
|
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,46 @@ content: { /* ... */ }
|
|
|
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
|
+
|
|
412
|
+
#### `format` ('intlayer' | 'icu' | 'i18next')
|
|
413
|
+
|
|
414
|
+
사전 콘텐츠에 사용할 포맷터를 지정합니다. 이를 통해 다양한 메시지 포맷팅 구문을 사용할 수 있습니다.
|
|
415
|
+
|
|
416
|
+
- `'intlayer'`: 기본 Intlayer 포맷터.
|
|
417
|
+
- `'icu'`: ICU 메시지 포맷팅을 사용합니다.
|
|
418
|
+
- `'i18next'`: i18next 메시지 포맷팅을 사용합니다.
|
|
419
|
+
|
|
420
|
+
**예시:**
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
{
|
|
424
|
+
key: "my-dictionary",
|
|
425
|
+
format: "icu",
|
|
426
|
+
content: {
|
|
427
|
+
message: "Hello {name}, you have {count, plural, one {# message} other {# messages}}"
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
389
432
|
#### `locale` (LocalesValues)
|
|
390
433
|
|
|
391
434
|
사전을 각 로케일별 사전으로 변환하며, content에 선언된 각 필드는 자동으로 번역 노드로 변환됩니다. 이 속성이 설정되면:
|
|
@@ -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
|
- 문서
|