@intlayer/docs 6.1.5 → 6.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md +404 -173
- package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +262 -113
- package/blog/en/intlayer_with_next-i18next.mdx +431 -0
- package/blog/en/intlayer_with_next-intl.mdx +335 -0
- package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +463 -209
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +185 -71
- package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +36 -28
- package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/dist/cjs/generated/docs.entry.cjs +32 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +32 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +2 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/component_i18n.md +186 -0
- package/docs/ar/intlayer_with_angular.md +2 -2
- package/docs/ar/intlayer_with_astro.md +246 -0
- package/docs/ar/intlayer_with_create_react_app.md +3 -2
- package/docs/ar/intlayer_with_express.md +2 -2
- package/docs/ar/intlayer_with_nestjs.md +2 -2
- package/docs/ar/intlayer_with_nextjs_14.md +2 -2
- package/docs/ar/intlayer_with_nextjs_15.md +2 -2
- package/docs/ar/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ar/intlayer_with_nuxt.md +2 -2
- package/docs/ar/intlayer_with_react_native+expo.md +11 -20
- package/docs/ar/intlayer_with_react_router_v7.md +195 -241
- package/docs/ar/intlayer_with_tanstack.md +198 -272
- package/docs/ar/intlayer_with_vite+preact.md +9 -9
- package/docs/ar/intlayer_with_vite+react.md +7 -7
- package/docs/ar/intlayer_with_vite+vue.md +9 -9
- package/docs/ar/vs_code_extension.md +48 -109
- package/docs/de/component_i18n.md +186 -0
- package/docs/de/intlayer_with_angular.md +2 -2
- package/docs/de/intlayer_with_astro.md +246 -0
- package/docs/de/intlayer_with_create_react_app.md +2 -2
- package/docs/de/intlayer_with_express.md +2 -2
- package/docs/de/intlayer_with_nestjs.md +2 -2
- package/docs/de/intlayer_with_nextjs_14.md +2 -2
- package/docs/de/intlayer_with_nextjs_15.md +2 -2
- package/docs/de/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/de/intlayer_with_nuxt.md +2 -2
- package/docs/de/intlayer_with_react_native+expo.md +11 -20
- package/docs/de/intlayer_with_react_router_v7.md +193 -242
- package/docs/de/intlayer_with_tanstack.md +194 -266
- package/docs/de/intlayer_with_vite+preact.md +9 -9
- package/docs/de/intlayer_with_vite+react.md +9 -9
- package/docs/de/intlayer_with_vite+vue.md +11 -11
- package/docs/de/packages/vite-intlayer/index.md +3 -3
- package/docs/de/vs_code_extension.md +46 -107
- package/docs/en/component_i18n.md +186 -0
- package/docs/en/how_works_intlayer.md +1 -1
- package/docs/en/index.md +1 -1
- package/docs/en/intlayer_cli.md +1 -1
- package/docs/en/intlayer_with_angular.md +4 -4
- package/docs/en/intlayer_with_astro.md +246 -0
- package/docs/en/intlayer_with_create_react_app.md +4 -4
- package/docs/en/intlayer_with_express.md +3 -3
- package/docs/en/intlayer_with_lynx+react.md +1 -1
- package/docs/en/intlayer_with_nestjs.md +2 -2
- package/docs/en/intlayer_with_nextjs_14.md +31 -5
- package/docs/en/intlayer_with_nextjs_15.md +31 -5
- package/docs/en/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/en/intlayer_with_nuxt.md +4 -4
- package/docs/en/intlayer_with_react_native+expo.md +46 -24
- package/docs/en/intlayer_with_react_router_v7.md +164 -211
- package/docs/en/intlayer_with_tanstack.md +166 -241
- package/docs/en/intlayer_with_vite+preact.md +12 -12
- package/docs/en/intlayer_with_vite+react.md +12 -12
- package/docs/en/intlayer_with_vite+solid.md +2 -2
- package/docs/en/intlayer_with_vite+svelte.md +2 -2
- package/docs/en/intlayer_with_vite+vue.md +12 -12
- package/docs/en/introduction.md +1 -1
- package/docs/en/packages/next-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/react-intlayer/useI18n.md +1 -1
- package/docs/en/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/en/releases/v6.md +1 -0
- package/docs/en/roadmap.md +1 -1
- package/docs/en/vs_code_extension.md +24 -114
- package/docs/en-GB/component_i18n.md +186 -0
- package/docs/en-GB/intlayer_with_angular.md +3 -3
- package/docs/en-GB/intlayer_with_astro.md +246 -0
- package/docs/en-GB/intlayer_with_create_react_app.md +5 -4
- package/docs/en-GB/intlayer_with_express.md +2 -2
- package/docs/en-GB/intlayer_with_nestjs.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_14.md +4 -4
- package/docs/en-GB/intlayer_with_nextjs_15.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/en-GB/intlayer_with_nuxt.md +2 -2
- package/docs/en-GB/intlayer_with_react_native+expo.md +11 -20
- package/docs/en-GB/intlayer_with_react_router_v7.md +171 -220
- package/docs/en-GB/intlayer_with_tanstack.md +174 -248
- package/docs/en-GB/intlayer_with_vite+preact.md +9 -9
- package/docs/en-GB/intlayer_with_vite+react.md +9 -9
- package/docs/en-GB/intlayer_with_vite+vue.md +11 -11
- package/docs/en-GB/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en-GB/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/en-GB/vs_code_extension.md +42 -103
- package/docs/es/component_i18n.md +182 -0
- package/docs/es/intlayer_with_angular.md +2 -2
- package/docs/es/intlayer_with_astro.md +246 -0
- package/docs/es/intlayer_with_create_react_app.md +3 -2
- package/docs/es/intlayer_with_express.md +2 -2
- package/docs/es/intlayer_with_nextjs_14.md +2 -2
- package/docs/es/intlayer_with_nextjs_15.md +2 -2
- package/docs/es/intlayer_with_react_native+expo.md +11 -20
- package/docs/es/intlayer_with_react_router_v7.md +188 -232
- package/docs/es/intlayer_with_tanstack.md +203 -273
- package/docs/es/intlayer_with_vite+preact.md +7 -7
- package/docs/es/intlayer_with_vite+react.md +7 -7
- package/docs/es/intlayer_with_vite+vue.md +9 -9
- package/docs/es/vs_code_extension.md +53 -114
- package/docs/fr/component_i18n.md +186 -0
- package/docs/fr/intlayer_with_angular.md +2 -2
- package/docs/fr/intlayer_with_astro.md +246 -0
- package/docs/fr/intlayer_with_create_react_app.md +3 -2
- package/docs/fr/intlayer_with_express.md +2 -2
- package/docs/fr/intlayer_with_nestjs.md +2 -2
- package/docs/fr/intlayer_with_nextjs_14.md +2 -2
- package/docs/fr/intlayer_with_react_native+expo.md +11 -20
- package/docs/fr/intlayer_with_react_router_v7.md +188 -248
- package/docs/fr/intlayer_with_tanstack.md +192 -265
- package/docs/fr/intlayer_with_vite+preact.md +7 -7
- package/docs/fr/intlayer_with_vite+react.md +7 -7
- package/docs/fr/intlayer_with_vite+vue.md +9 -9
- package/docs/fr/vs_code_extension.md +50 -111
- package/docs/hi/component_i18n.md +186 -0
- package/docs/hi/intlayer_cli.md +1 -4
- package/docs/hi/intlayer_with_angular.md +2 -2
- package/docs/hi/intlayer_with_astro.md +246 -0
- package/docs/hi/intlayer_with_create_react_app.md +2 -2
- package/docs/hi/intlayer_with_express.md +2 -2
- package/docs/hi/intlayer_with_nestjs.md +2 -2
- package/docs/hi/intlayer_with_nextjs_14.md +2 -2
- package/docs/hi/intlayer_with_nextjs_15.md +2 -2
- package/docs/hi/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/hi/intlayer_with_nuxt.md +2 -2
- package/docs/hi/intlayer_with_react_native+expo.md +11 -20
- package/docs/hi/intlayer_with_react_router_v7.md +199 -243
- package/docs/hi/intlayer_with_tanstack.md +210 -285
- package/docs/hi/intlayer_with_vite+preact.md +9 -9
- package/docs/hi/intlayer_with_vite+react.md +9 -9
- package/docs/hi/intlayer_with_vite+solid.md +1 -1
- package/docs/hi/intlayer_with_vite+vue.md +11 -11
- package/docs/hi/vs_code_extension.md +49 -110
- package/docs/it/component_i18n.md +186 -0
- package/docs/it/intlayer_with_angular.md +2 -2
- package/docs/it/intlayer_with_astro.md +246 -0
- package/docs/it/intlayer_with_create_react_app.md +3 -2
- package/docs/it/intlayer_with_express.md +2 -2
- package/docs/it/intlayer_with_nestjs.md +2 -2
- package/docs/it/intlayer_with_nextjs_14.md +2 -2
- package/docs/it/intlayer_with_nextjs_15.md +2 -2
- package/docs/it/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/it/intlayer_with_nuxt.md +2 -2
- package/docs/it/intlayer_with_react_native+expo.md +11 -21
- package/docs/it/intlayer_with_react_router_v7.md +195 -242
- package/docs/it/intlayer_with_tanstack.md +203 -267
- package/docs/it/intlayer_with_vite+preact.md +9 -9
- package/docs/it/intlayer_with_vite+react.md +13 -11
- package/docs/it/intlayer_with_vite+vue.md +11 -11
- package/docs/it/vs_code_extension.md +50 -111
- package/docs/ja/component_i18n.md +186 -0
- package/docs/ja/intlayer_with_angular.md +2 -2
- package/docs/ja/intlayer_with_astro.md +246 -0
- package/docs/ja/intlayer_with_create_react_app.md +3 -2
- package/docs/ja/intlayer_with_express.md +2 -2
- package/docs/ja/intlayer_with_nestjs.md +2 -2
- package/docs/ja/intlayer_with_nextjs_14.md +2 -2
- package/docs/ja/intlayer_with_nextjs_15.md +2 -2
- package/docs/ja/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ja/intlayer_with_nuxt.md +2 -2
- package/docs/ja/intlayer_with_react_native+expo.md +18 -29
- package/docs/ja/intlayer_with_react_router_v7.md +204 -250
- package/docs/ja/intlayer_with_tanstack.md +218 -286
- package/docs/ja/intlayer_with_vite+preact.md +9 -9
- package/docs/ja/intlayer_with_vite+react.md +11 -11
- package/docs/ja/intlayer_with_vite+vue.md +11 -11
- package/docs/ja/vs_code_extension.md +50 -111
- package/docs/ko/component_i18n.md +186 -0
- package/docs/ko/intlayer_with_angular.md +2 -2
- package/docs/ko/intlayer_with_astro.md +246 -0
- package/docs/ko/intlayer_with_create_react_app.md +3 -2
- package/docs/ko/intlayer_with_express.md +2 -2
- package/docs/ko/intlayer_with_nestjs.md +2 -2
- package/docs/ko/intlayer_with_nextjs_14.md +2 -2
- package/docs/ko/intlayer_with_nextjs_15.md +2 -2
- package/docs/ko/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ko/intlayer_with_nuxt.md +2 -2
- package/docs/ko/intlayer_with_react_native+expo.md +19 -28
- package/docs/ko/intlayer_with_react_router_v7.md +190 -244
- package/docs/ko/intlayer_with_tanstack.md +200 -270
- package/docs/ko/intlayer_with_vite+preact.md +9 -9
- package/docs/ko/intlayer_with_vite+react.md +9 -9
- package/docs/ko/intlayer_with_vite+vue.md +11 -11
- package/docs/ko/vs_code_extension.md +48 -109
- package/docs/pt/component_i18n.md +186 -0
- package/docs/pt/intlayer_with_angular.md +2 -2
- package/docs/pt/intlayer_with_astro.md +246 -0
- package/docs/pt/intlayer_with_create_react_app.md +3 -2
- package/docs/pt/intlayer_with_express.md +2 -2
- package/docs/pt/intlayer_with_nestjs.md +2 -2
- package/docs/pt/intlayer_with_nextjs_14.md +2 -2
- package/docs/pt/intlayer_with_nextjs_15.md +2 -2
- package/docs/pt/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/pt/intlayer_with_nuxt.md +2 -2
- package/docs/pt/intlayer_with_react_native+expo.md +11 -20
- package/docs/pt/intlayer_with_react_router_v7.md +7 -13
- package/docs/pt/intlayer_with_tanstack.md +183 -258
- package/docs/pt/intlayer_with_vite+preact.md +9 -9
- package/docs/pt/intlayer_with_vite+react.md +9 -9
- package/docs/pt/intlayer_with_vite+vue.md +9 -9
- package/docs/pt/vs_code_extension.md +46 -107
- package/docs/ru/component_i18n.md +186 -0
- package/docs/ru/intlayer_with_angular.md +2 -2
- package/docs/ru/intlayer_with_astro.md +246 -0
- package/docs/ru/intlayer_with_create_react_app.md +3 -2
- package/docs/ru/intlayer_with_express.md +2 -2
- package/docs/ru/intlayer_with_nestjs.md +2 -2
- package/docs/ru/intlayer_with_nextjs_14.md +2 -2
- package/docs/ru/intlayer_with_nextjs_15.md +2 -2
- package/docs/ru/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ru/intlayer_with_nuxt.md +2 -2
- package/docs/ru/intlayer_with_react_native+expo.md +11 -20
- package/docs/ru/intlayer_with_react_router_v7.md +192 -238
- package/docs/ru/intlayer_with_tanstack.md +197 -269
- package/docs/ru/intlayer_with_vite+preact.md +9 -9
- package/docs/ru/intlayer_with_vite+react.md +9 -9
- package/docs/ru/intlayer_with_vite+vue.md +11 -11
- package/docs/ru/vs_code_extension.md +48 -109
- package/docs/tr/component_i18n.md +186 -0
- package/docs/tr/how_works_intlayer.md +1 -1
- package/docs/tr/index.md +1 -1
- package/docs/tr/intlayer_cli.md +1 -1
- package/docs/tr/intlayer_with_angular.md +4 -4
- package/docs/tr/intlayer_with_astro.md +246 -0
- package/docs/tr/intlayer_with_create_react_app.md +4 -4
- package/docs/tr/intlayer_with_express.md +3 -3
- package/docs/tr/intlayer_with_lynx+react.md +1 -1
- package/docs/tr/intlayer_with_nestjs.md +2 -2
- package/docs/tr/intlayer_with_nextjs_14.md +2 -2
- package/docs/tr/intlayer_with_nextjs_15.md +4 -4
- package/docs/tr/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/tr/intlayer_with_nuxt.md +4 -4
- package/docs/tr/intlayer_with_react_native+expo.md +12 -21
- package/docs/tr/intlayer_with_react_router_v7.md +222 -267
- package/docs/tr/intlayer_with_tanstack.md +400 -303
- package/docs/tr/intlayer_with_vite+preact.md +12 -12
- package/docs/tr/intlayer_with_vite+react.md +12 -12
- package/docs/tr/intlayer_with_vite+solid.md +2 -2
- package/docs/tr/intlayer_with_vite+svelte.md +2 -2
- package/docs/tr/intlayer_with_vite+vue.md +12 -12
- package/docs/tr/introduction.md +1 -1
- package/docs/tr/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/tr/packages/react-intlayer/useI18n.md +1 -1
- package/docs/tr/roadmap.md +1 -1
- package/docs/tr/vs_code_extension.md +54 -115
- package/docs/zh/component_i18n.md +186 -0
- package/docs/zh/intlayer_with_angular.md +2 -2
- package/docs/zh/intlayer_with_astro.md +246 -0
- package/docs/zh/intlayer_with_create_react_app.md +3 -2
- package/docs/zh/intlayer_with_express.md +2 -2
- package/docs/zh/intlayer_with_nestjs.md +2 -2
- package/docs/zh/intlayer_with_nextjs_14.md +2 -2
- package/docs/zh/intlayer_with_nextjs_15.md +2 -2
- package/docs/zh/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/zh/intlayer_with_nuxt.md +2 -2
- package/docs/zh/intlayer_with_react_native+expo.md +19 -28
- package/docs/zh/intlayer_with_react_router_v7.md +200 -248
- package/docs/zh/intlayer_with_tanstack.md +208 -283
- package/docs/zh/intlayer_with_vite+preact.md +9 -9
- package/docs/zh/intlayer_with_vite+react.md +9 -9
- package/docs/zh/intlayer_with_vite+vue.md +9 -9
- package/docs/zh/vs_code_extension.md +51 -105
- package/package.json +10 -10
- package/src/generated/docs.entry.ts +32 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-03-07
|
|
3
|
+
updatedAt: 2025-10-03
|
|
4
|
+
title: Iniziare con Intlayer in Astro
|
|
5
|
+
description: Scopri come aggiungere l'internazionalizzazione (i18n) alla tua applicazione Vite e React usando Intlayer. Segui questa guida per rendere la tua app multilingue.
|
|
6
|
+
keywords:
|
|
7
|
+
- Internazionalizzazione
|
|
8
|
+
- Documentazione
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Vite
|
|
11
|
+
- React
|
|
12
|
+
- i18n
|
|
13
|
+
- JavaScript
|
|
14
|
+
slugs:
|
|
15
|
+
- doc
|
|
16
|
+
- environment
|
|
17
|
+
- astro
|
|
18
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-astro-template
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Iniziare con l'internazionalizzazione (i18n) usando Intlayer e Astro
|
|
22
|
+
|
|
23
|
+
Consulta il [Template dell'Applicazione](https://github.com/aymericzip/intlayer-astro-template) su GitHub.
|
|
24
|
+
|
|
25
|
+
## Cos'è Intlayer?
|
|
26
|
+
|
|
27
|
+
**Intlayer** è una libreria innovativa e open-source per l'internazionalizzazione (i18n) progettata per semplificare il supporto multilingue nelle moderne applicazioni web.
|
|
28
|
+
|
|
29
|
+
Con Intlayer, puoi:
|
|
30
|
+
|
|
31
|
+
- **Gestire facilmente le traduzioni** utilizzando dizionari dichiarativi a livello di componente.
|
|
32
|
+
- **Localizzare dinamicamente i metadata**, le rotte e i contenuti.
|
|
33
|
+
- **Garantire il supporto a TypeScript** con tipi autogenerati, migliorando l'autocompletamento e il rilevamento degli errori.
|
|
34
|
+
- **Beneficiare di funzionalità avanzate**, come il rilevamento e il cambio dinamico della lingua.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Guida passo-passo per configurare Intlayer in Astro
|
|
39
|
+
|
|
40
|
+
### Passo 1: Installa le dipendenze
|
|
41
|
+
|
|
42
|
+
Installa i pacchetti necessari usando il tuo gestore di pacchetti:
|
|
43
|
+
|
|
44
|
+
```bash packageManager="npm"
|
|
45
|
+
npm install intlayer astro-intlayer
|
|
46
|
+
# Optional: add React island support
|
|
47
|
+
npm install react react-dom react-intlayer @astrojs/react
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```bash packageManager="pnpm"
|
|
51
|
+
pnpm add intlayer astro-intlayer
|
|
52
|
+
# Opzionale: aggiungi il supporto per React island
|
|
53
|
+
pnpm add react react-dom react-intlayer @astrojs/react
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash packageManager="yarn"
|
|
57
|
+
yarn add intlayer astro-intlayer
|
|
58
|
+
# Opzionale: aggiungi il supporto per React island
|
|
59
|
+
yarn add react react-dom react-intlayer @astrojs/react
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- **intlayer**
|
|
63
|
+
Il pacchetto principale che fornisce strumenti di internazionalizzazione per la gestione della configurazione, la traduzione, la [dichiarazione dei contenuti](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/dictionary/get_started.md), la traspilazione e i [comandi CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_cli.md).
|
|
64
|
+
|
|
65
|
+
- **astro-intlayer**
|
|
66
|
+
Include il plugin di integrazione Astro per integrare Intlayer con il [bundler Vite](https://vite.dev/guide/why.html#why-bundle-for-production), oltre a middleware per rilevare la lingua preferita dall'utente, gestire i cookie e gestire il reindirizzamento degli URL.
|
|
67
|
+
|
|
68
|
+
### Passo 2: Configurazione del tuo progetto
|
|
69
|
+
|
|
70
|
+
Crea un file di configurazione per configurare le lingue della tua applicazione:
|
|
71
|
+
|
|
72
|
+
```typescript fileName="intlayer.config.ts"
|
|
73
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
74
|
+
|
|
75
|
+
const config: IntlayerConfig = {
|
|
76
|
+
internationalization: {
|
|
77
|
+
locales: [
|
|
78
|
+
Locales.ENGLISH,
|
|
79
|
+
Locales.FRENCH,
|
|
80
|
+
Locales.SPANISH,
|
|
81
|
+
// Le tue altre lingue
|
|
82
|
+
],
|
|
83
|
+
defaultLocale: Locales.ENGLISH,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default config;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
> Attraverso questo file di configurazione, puoi impostare URL localizzati, il reindirizzamento del middleware, i nomi dei cookie, la posizione e l'estensione delle tue dichiarazioni di contenuto, disabilitare i log di Intlayer nella console e altro ancora. Per un elenco completo dei parametri disponibili, consulta la [documentazione di configurazione](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/configuration.md).
|
|
91
|
+
|
|
92
|
+
### Passo 3: Integra Intlayer nella tua configurazione Astro
|
|
93
|
+
|
|
94
|
+
Aggiungi il plugin intlayer nella tua configurazione.
|
|
95
|
+
|
|
96
|
+
```typescript fileName="astro.config.ts"
|
|
97
|
+
// @ts-check
|
|
98
|
+
|
|
99
|
+
import { intlayer } from "astro-intlayer";
|
|
100
|
+
import { defineConfig } from "astro/config";
|
|
101
|
+
|
|
102
|
+
// https://astro.build/config
|
|
103
|
+
export default defineConfig({
|
|
104
|
+
integrations: [intlayer()],
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> Il plugin di integrazione `intlayer()` per Astro viene utilizzato per integrare Intlayer con Astro. Garantisce la creazione dei file di dichiarazione del contenuto e li monitora in modalità sviluppo. Definisce le variabili d'ambiente di Intlayer all'interno dell'applicazione Astro. Inoltre, fornisce alias per ottimizzare le prestazioni.
|
|
109
|
+
|
|
110
|
+
### Passo 4: Dichiara il tuo contenuto
|
|
111
|
+
|
|
112
|
+
Crea e gestisci le tue dichiarazioni di contenuto per memorizzare le traduzioni:
|
|
113
|
+
|
|
114
|
+
```tsx fileName="src/app.content.tsx"
|
|
115
|
+
import { t, type Dictionary } from "intlayer";
|
|
116
|
+
import type { ReactNode } from "react";
|
|
117
|
+
|
|
118
|
+
const appContent = {
|
|
119
|
+
key: "app",
|
|
120
|
+
content: {
|
|
121
|
+
title: t({
|
|
122
|
+
en: "Hello World",
|
|
123
|
+
fr: "Bonjour le monde",
|
|
124
|
+
es: "Hola mundo",
|
|
125
|
+
}),
|
|
126
|
+
},
|
|
127
|
+
} satisfies Dictionary;
|
|
128
|
+
|
|
129
|
+
export default appContent;
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
> Le tue dichiarazioni di contenuto possono essere definite ovunque nella tua applicazione non appena sono incluse nella directory `contentDir` (di default, `./src`). E devono corrispondere all'estensione del file di dichiarazione del contenuto (di default, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
133
|
+
|
|
134
|
+
> Per maggiori dettagli, consulta la [documentazione sulla dichiarazione del contenuto](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/dictionary/get_started.md).
|
|
135
|
+
|
|
136
|
+
### Passo 5: Usa il tuo contenuto in Astro
|
|
137
|
+
|
|
138
|
+
Puoi utilizzare i dizionari direttamente nei file `.astro` usando gli helper core esportati da `intlayer`.
|
|
139
|
+
|
|
140
|
+
```astro fileName="src/pages/index.astro"
|
|
141
|
+
<!-- astro -->
|
|
142
|
+
---
|
|
143
|
+
import { getIntlayer } from "intlayer";
|
|
144
|
+
import appContent from "../app.content";
|
|
145
|
+
|
|
146
|
+
const { title } = getIntlayer('app');
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
<html lang="en">
|
|
150
|
+
<head>
|
|
151
|
+
<meta charset="utf-8" />
|
|
152
|
+
<meta name="viewport" content="width=device-width" />
|
|
153
|
+
<title>{title}</title>
|
|
154
|
+
</head>
|
|
155
|
+
<body>
|
|
156
|
+
<h1>{title}</h1>
|
|
157
|
+
</body>
|
|
158
|
+
</html>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Passo 6: Routing localizzato
|
|
162
|
+
|
|
163
|
+
Crea un segmento di route dinamico per servire pagine localizzate, ad esempio `src/pages/[locale]/index.astro`:
|
|
164
|
+
|
|
165
|
+
```astro fileName="src/pages/[locale]/index.astro"
|
|
166
|
+
<!-- astro -->
|
|
167
|
+
---
|
|
168
|
+
import { getIntlayer } from "intlayer";
|
|
169
|
+
|
|
170
|
+
const { title } = getIntlayer('app');
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
<h1>{title}</h1>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
L'integrazione con Astro aggiunge un middleware Vite durante lo sviluppo che aiuta con il routing consapevole della localizzazione e le definizioni dell'ambiente. Puoi comunque collegarti tra le localizzazioni usando la tua logica o funzioni di utilità come `getLocalizedUrl` da `intlayer`.
|
|
177
|
+
|
|
178
|
+
### Passo 7: Continua a usare il tuo framework preferito
|
|
179
|
+
|
|
180
|
+
Continua a usare il tuo framework preferito per costruire la tua applicazione.
|
|
181
|
+
|
|
182
|
+
- Intlayer + React: [Intlayer con React](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_with_vite+react.md)
|
|
183
|
+
- Intlayer + Vue: [Intlayer con Vue](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_with_vite+vue.md)
|
|
184
|
+
- Intlayer + Svelte: [Intlayer con Svelte](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_with_vite+svelte.md)
|
|
185
|
+
- Intlayer + Solid: [Intlayer con Solid](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_with_vite+solid.md)
|
|
186
|
+
- Intlayer + Preact: [Intlayer con Preact](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_with_vite+preact.md)
|
|
187
|
+
|
|
188
|
+
### Configurare TypeScript
|
|
189
|
+
|
|
190
|
+
Intlayer utilizza l'augmentation dei moduli per sfruttare i vantaggi di TypeScript e rendere il tuo codice più robusto.
|
|
191
|
+
|
|
192
|
+

|
|
193
|
+
|
|
194
|
+

|
|
195
|
+
|
|
196
|
+
Assicurati che la tua configurazione di TypeScript includa i tipi generati automaticamente.
|
|
197
|
+
|
|
198
|
+
```json5 fileName="tsconfig.json"
|
|
199
|
+
{
|
|
200
|
+
// ... Le tue configurazioni TypeScript esistenti
|
|
201
|
+
"include": [
|
|
202
|
+
// ... Le tue configurazioni TypeScript esistenti
|
|
203
|
+
".intlayer/**/*.ts", // Includi i tipi generati automaticamente
|
|
204
|
+
],
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Configurazione Git
|
|
209
|
+
|
|
210
|
+
Si consiglia di ignorare i file generati da Intlayer. Questo ti permette di evitare di committarli nel tuo repository Git.
|
|
211
|
+
|
|
212
|
+
Per fare ciò, puoi aggiungere le seguenti istruzioni al tuo file `.gitignore`:
|
|
213
|
+
|
|
214
|
+
```plaintext
|
|
215
|
+
# Ignora i file generati da Intlayer
|
|
216
|
+
.intlayer
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Estensione VS Code
|
|
220
|
+
|
|
221
|
+
Per migliorare la tua esperienza di sviluppo con Intlayer, puoi installare l'**Estensione ufficiale Intlayer per VS Code**.
|
|
222
|
+
|
|
223
|
+
[Installa dal Marketplace di VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
224
|
+
|
|
225
|
+
Questa estensione offre:
|
|
226
|
+
|
|
227
|
+
- **Completamento automatico** per le chiavi di traduzione.
|
|
228
|
+
- **Rilevamento errori in tempo reale** per traduzioni mancanti.
|
|
229
|
+
- **Anteprime inline** del contenuto tradotto.
|
|
230
|
+
- **Azioni rapide** per creare e aggiornare facilmente le traduzioni.
|
|
231
|
+
|
|
232
|
+
Per maggiori dettagli su come utilizzare l'estensione, consulta la [documentazione dell'Estensione Intlayer per VS Code](https://intlayer.org/doc/vs-code-extension).
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### Vai oltre
|
|
237
|
+
|
|
238
|
+
Per andare oltre, puoi implementare l'[editor visuale](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_visual_editor.md) o esternalizzare i tuoi contenuti utilizzando il [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_CMS.md).
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Cronologia della documentazione
|
|
243
|
+
|
|
244
|
+
| Versione | Data | Modifiche |
|
|
245
|
+
| -------- | ---------- | -------------------------------------------------------------- |
|
|
246
|
+
| 6.2.0 | 2025-10-03 | Aggiornamento per integrazione Astro, configurazione, utilizzo |
|
|
@@ -1094,9 +1094,10 @@ Applicando queste modifiche, la tua applicazione:
|
|
|
1094
1094
|
|
|
1095
1095
|
Intlayer utilizza l'augmentation dei moduli per sfruttare i vantaggi di TypeScript e rendere il tuo codice più robusto.
|
|
1096
1096
|
|
|
1097
|
-

|
|
1098
|
+
|
|
1099
|
+

|
|
1098
1100
|
|
|
1099
|
-

|
|
1100
1101
|
Assicurati che la tua configurazione TypeScript includa i tipi generati automaticamente.
|
|
1101
1102
|
|
|
1102
1103
|
```json5 fileName="tsconfig.json"
|
|
@@ -368,9 +368,9 @@ Per impostazione predefinita, `express-intlayer` interpreta l'intestazione `Acce
|
|
|
368
368
|
|
|
369
369
|
`express-intlayer` sfrutta le potenti capacità di TypeScript per migliorare il processo di internazionalizzazione. Il typing statico di TypeScript garantisce che ogni chiave di traduzione sia considerata, riducendo il rischio di traduzioni mancanti e migliorando la manutenibilità.
|
|
370
370
|
|
|
371
|
-

|
|
372
372
|
|
|
373
|
-

|
|
374
374
|
|
|
375
375
|
Assicurati che i tipi autogenerati (di default in ./types/intlayer.d.ts) siano inclusi nel tuo file tsconfig.json.
|
|
376
376
|
|
|
@@ -219,9 +219,9 @@ Per impostazione predefinita, `express-intlayer` interpreterà l'intestazione `A
|
|
|
219
219
|
|
|
220
220
|
`express-intlayer` sfrutta le potenti capacità di TypeScript per migliorare il processo di internazionalizzazione. Il typing statico di TypeScript garantisce che ogni chiave di traduzione sia considerata, riducendo il rischio di traduzioni mancanti e migliorando la manutenibilità.
|
|
221
221
|
|
|
222
|
-

|
|
223
223
|
|
|
224
|
-

|
|
225
225
|
|
|
226
226
|
Assicurati che i tipi generati automaticamente (di default in ./types/intlayer.d.ts) siano inclusi nel tuo file tsconfig.json.
|
|
227
227
|
|
|
@@ -1224,9 +1224,9 @@ Integrando questo componente `Link` in tutta la tua applicazione, mantieni un'es
|
|
|
1224
1224
|
|
|
1225
1225
|
Intlayer utilizza l'augmentazione dei moduli per ottenere i vantaggi di TypeScript e rendere il tuo codice più robusto.
|
|
1226
1226
|
|
|
1227
|
-

|
|
1228
1228
|
|
|
1229
|
-

|
|
1230
1230
|
|
|
1231
1231
|
Assicurati che la configurazione di TypeScript includa i tipi autogenerati.
|
|
1232
1232
|
|
|
@@ -1479,9 +1479,9 @@ yarn add @intlayer/swc --save-dev
|
|
|
1479
1479
|
|
|
1480
1480
|
Intlayer utilizza l'augmentation dei moduli per sfruttare i vantaggi di TypeScript e rendere il tuo codice più robusto.
|
|
1481
1481
|
|
|
1482
|
-

|
|
1483
1483
|
|
|
1484
|
-

|
|
1485
1485
|
|
|
1486
1486
|
Assicurati che la tua configurazione di TypeScript includa i tipi generati automaticamente.
|
|
1487
1487
|
|
|
@@ -1433,9 +1433,9 @@ yarn add @intlayer/swc --save-dev
|
|
|
1433
1433
|
|
|
1434
1434
|
Intlayer utilizza l'augmentation dei moduli per sfruttare i vantaggi di TypeScript e rendere il tuo codice più robusto.
|
|
1435
1435
|
|
|
1436
|
-

|
|
1437
1437
|
|
|
1438
|
-

|
|
1439
1439
|
|
|
1440
1440
|
Assicurati che la tua configurazione di TypeScript includa i tipi generati automaticamente.
|
|
1441
1441
|
|
|
@@ -755,9 +755,9 @@ module.exports = aboutMetaContent;
|
|
|
755
755
|
|
|
756
756
|
Intlayer utilizza l'augmentation dei moduli per sfruttare i vantaggi di TypeScript e rendere il tuo codice più robusto.
|
|
757
757
|
|
|
758
|
-

|
|
759
759
|
|
|
760
|
-

|
|
761
761
|
|
|
762
762
|
Assicurati che la tua configurazione di TypeScript includa i tipi generati automaticamente.
|
|
763
763
|
|
|
@@ -148,28 +148,25 @@ module.exports = (async () => {
|
|
|
148
148
|
|
|
149
149
|
## Passo 4: Aggiungi il provider Intlayer
|
|
150
150
|
|
|
151
|
-
Per mantenere sincronizzata la lingua dell'utente in tutta l'applicazione,
|
|
151
|
+
Per mantenere sincronizzata la lingua dell'utente in tutta l'applicazione, devi avvolgere il componente radice con il componente `IntlayerProvider` da `react-intlayer-native`.
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
> Assicurati di utilizzare il provider da `react-native-intlayer` invece di `react-intlayer`. L'export da `react-native-intlayer` include polyfills per l'API web.
|
|
154
154
|
|
|
155
155
|
```tsx fileName="app/_layout.tsx" codeFormat="typescript"
|
|
156
156
|
import { Stack } from "expo-router";
|
|
157
157
|
import { getLocales } from "expo-localization";
|
|
158
|
-
import {
|
|
159
|
-
import { intlayerPolyfill } from "react-native-intlayer";
|
|
158
|
+
import { IntlayerProvider } from "react-native-intlayer";
|
|
160
159
|
import { type FC } from "react";
|
|
161
160
|
|
|
162
|
-
intlayerPolyfill();
|
|
163
|
-
|
|
164
161
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
165
162
|
|
|
166
163
|
const RootLayout: FC = () => {
|
|
167
164
|
return (
|
|
168
|
-
<
|
|
165
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
169
166
|
<Stack>
|
|
170
167
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
171
168
|
</Stack>
|
|
172
|
-
</
|
|
169
|
+
</IntlayerProvider>
|
|
173
170
|
);
|
|
174
171
|
};
|
|
175
172
|
|
|
@@ -179,20 +176,17 @@ export default RootLayout;
|
|
|
179
176
|
```jsx fileName="app/_layout.mjx" codeFormat="esm"
|
|
180
177
|
import { Stack } from "expo-router";
|
|
181
178
|
import { getLocales } from "expo-localization";
|
|
182
|
-
import {
|
|
183
|
-
import { intlayerPolyfill } from "react-native-intlayer";
|
|
184
|
-
|
|
185
|
-
intlayerPolyfill();
|
|
179
|
+
import { IntlayerProvider } from "react-native-intlayer";
|
|
186
180
|
|
|
187
181
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
188
182
|
|
|
189
183
|
const RootLayout = () => {
|
|
190
184
|
return (
|
|
191
|
-
<
|
|
185
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
192
186
|
<Stack>
|
|
193
187
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
194
188
|
</Stack>
|
|
195
|
-
</
|
|
189
|
+
</IntlayerProvider>
|
|
196
190
|
);
|
|
197
191
|
};
|
|
198
192
|
|
|
@@ -202,22 +196,18 @@ export default RootLayout;
|
|
|
202
196
|
```jsx fileName="app/_layout.cjx" codeFormat="commonjs"
|
|
203
197
|
const { Stack } = require("expo-router");
|
|
204
198
|
const { getLocales } = require("expo-localization");
|
|
205
|
-
const {
|
|
206
|
-
const { intlayerPolyfill } = require("react-native-intlayer");
|
|
207
|
-
|
|
208
|
-
// Applichiamo il polyfill di Intlayer per garantire la compatibilità
|
|
209
|
-
intlayerPolyfill();
|
|
199
|
+
const { IntlayerProvider } = require("react-native-intlayer");
|
|
210
200
|
|
|
211
201
|
// Funzione per ottenere la lingua del dispositivo
|
|
212
202
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
213
203
|
|
|
214
204
|
const RootLayout = () => {
|
|
215
205
|
return (
|
|
216
|
-
<
|
|
206
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
217
207
|
<Stack>
|
|
218
208
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
219
209
|
</Stack>
|
|
220
|
-
</
|
|
210
|
+
</IntlayerProvider>
|
|
221
211
|
);
|
|
222
212
|
};
|
|
223
213
|
|