@intlayer/docs 5.5.8 → 5.5.10

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.
Files changed (172) hide show
  1. package/ar/autoFill.md +1 -2
  2. package/ar/intlayer_with_create_react_app.md +1 -14
  3. package/ar/intlayer_with_nextjs_14.md +1 -14
  4. package/ar/intlayer_with_nextjs_15.md +1 -14
  5. package/ar/intlayer_with_nextjs_page_router.md +1 -13
  6. package/ar/intlayer_with_nuxt.md +792 -0
  7. package/ar/intlayer_with_react_native+expo.md +6 -3
  8. package/ar/intlayer_with_vite+preact.md +7 -18
  9. package/ar/intlayer_with_vite+react.md +7 -17
  10. package/ar/intlayer_with_vite+vue.md +25 -5
  11. package/ar/packages/nuxt-intlayer/index.md +29 -0
  12. package/ar/roadmap.md +11 -11
  13. package/de/autoFill.md +1 -2
  14. package/de/how_works_intlayer.md +1 -1
  15. package/de/intlayer_with_create_react_app.md +1 -14
  16. package/de/intlayer_with_nextjs_14.md +1 -14
  17. package/de/intlayer_with_nextjs_15.md +1 -14
  18. package/de/intlayer_with_nextjs_page_router.md +1 -13
  19. package/de/intlayer_with_nuxt.md +791 -0
  20. package/de/intlayer_with_react_native+expo.md +6 -3
  21. package/de/intlayer_with_vite+preact.md +7 -18
  22. package/de/intlayer_with_vite+react.md +7 -17
  23. package/de/intlayer_with_vite+vue.md +84 -62
  24. package/de/packages/nuxt-intlayer/index.md +29 -0
  25. package/de/roadmap.md +11 -11
  26. package/en/autoFill.md +1 -2
  27. package/en/how_works_intlayer.md +17 -3
  28. package/en/intlayer_with_angular.md +535 -6
  29. package/en/intlayer_with_create_react_app.md +1 -14
  30. package/en/intlayer_with_nextjs_14.md +193 -59
  31. package/en/intlayer_with_nextjs_15.md +192 -61
  32. package/en/intlayer_with_nextjs_page_router.md +396 -61
  33. package/en/intlayer_with_nuxt.md +737 -0
  34. package/en/intlayer_with_react_native+expo.md +6 -3
  35. package/en/intlayer_with_vite+preact.md +8 -27
  36. package/en/intlayer_with_vite+react.md +7 -17
  37. package/en/intlayer_with_vite+solid.md +6 -3
  38. package/en/intlayer_with_vite+svelte.md +6 -3
  39. package/en/intlayer_with_vite+vue.md +17 -6
  40. package/en/packages/nuxt-intlayer/index.md +31 -0
  41. package/en/roadmap.md +13 -13
  42. package/en/t.md +5 -5
  43. package/en-GB/how_works_intlayer.md +16 -4
  44. package/en-GB/intlayer_with_create_react_app.md +1 -14
  45. package/en-GB/intlayer_with_nextjs_14.md +1 -14
  46. package/en-GB/intlayer_with_nextjs_15.md +1 -14
  47. package/en-GB/intlayer_with_nextjs_page_router.md +1 -13
  48. package/en-GB/intlayer_with_nuxt.md +795 -0
  49. package/en-GB/intlayer_with_react_native+expo.md +6 -3
  50. package/en-GB/intlayer_with_vite+preact.md +7 -18
  51. package/en-GB/intlayer_with_vite+react.md +6 -9
  52. package/en-GB/intlayer_with_vite+vue.md +65 -59
  53. package/en-GB/packages/nuxt-intlayer/index.md +31 -0
  54. package/en-GB/roadmap.md +11 -11
  55. package/es/autoFill.md +1 -2
  56. package/es/how_works_intlayer.md +1 -1
  57. package/es/intlayer_with_create_react_app.md +1 -14
  58. package/es/intlayer_with_nextjs_14.md +1 -14
  59. package/es/intlayer_with_nextjs_15.md +1 -14
  60. package/es/intlayer_with_nextjs_page_router.md +1 -13
  61. package/es/intlayer_with_nuxt.md +731 -0
  62. package/es/intlayer_with_react_native+expo.md +6 -3
  63. package/es/intlayer_with_vite+preact.md +7 -18
  64. package/es/intlayer_with_vite+react.md +7 -17
  65. package/es/intlayer_with_vite+vue.md +64 -51
  66. package/es/packages/nuxt-intlayer/index.md +29 -0
  67. package/fr/autoFill.md +1 -2
  68. package/fr/how_works_intlayer.md +1 -1
  69. package/fr/intlayer_with_create_react_app.md +1 -14
  70. package/fr/intlayer_with_nextjs_14.md +1 -14
  71. package/fr/intlayer_with_nextjs_15.md +1 -14
  72. package/fr/intlayer_with_nextjs_page_router.md +1 -13
  73. package/fr/intlayer_with_nuxt.md +731 -0
  74. package/fr/intlayer_with_react_native+expo.md +6 -3
  75. package/fr/intlayer_with_vite+preact.md +7 -18
  76. package/fr/intlayer_with_vite+react.md +7 -17
  77. package/fr/intlayer_with_vite+vue.md +30 -15
  78. package/fr/packages/nuxt-intlayer/index.md +29 -0
  79. package/fr/roadmap.md +11 -11
  80. package/hi/autoFill.md +1 -2
  81. package/hi/how_works_intlayer.md +1 -1
  82. package/hi/intlayer_with_create_react_app.md +1 -14
  83. package/hi/intlayer_with_nextjs_14.md +1 -14
  84. package/hi/intlayer_with_nextjs_15.md +1 -14
  85. package/hi/intlayer_with_nextjs_page_router.md +1 -13
  86. package/hi/intlayer_with_nuxt.md +784 -0
  87. package/hi/intlayer_with_react_native+expo.md +6 -3
  88. package/hi/intlayer_with_vite+preact.md +7 -18
  89. package/hi/intlayer_with_vite+react.md +7 -17
  90. package/hi/intlayer_with_vite+vue.md +59 -47
  91. package/hi/packages/nuxt-intlayer/index.md +29 -0
  92. package/hi/roadmap.md +11 -11
  93. package/index.cjs +30 -0
  94. package/index.d.ts +2 -0
  95. package/it/autoFill.md +1 -2
  96. package/it/how_works_intlayer.md +1 -1
  97. package/it/intlayer_with_create_react_app.md +0 -6
  98. package/it/intlayer_with_nextjs_14.md +1 -14
  99. package/it/intlayer_with_nextjs_15.md +1 -14
  100. package/it/intlayer_with_nextjs_page_router.md +1 -13
  101. package/it/intlayer_with_nuxt.md +793 -0
  102. package/it/intlayer_with_react_native+expo.md +6 -3
  103. package/it/intlayer_with_vite+preact.md +7 -18
  104. package/it/intlayer_with_vite+react.md +7 -17
  105. package/it/intlayer_with_vite+vue.md +26 -17
  106. package/it/packages/nuxt-intlayer/index.md +29 -0
  107. package/it/roadmap.md +11 -11
  108. package/ja/autoFill.md +1 -2
  109. package/ja/how_works_intlayer.md +1 -1
  110. package/ja/intlayer_with_create_react_app.md +1 -14
  111. package/ja/intlayer_with_nextjs_14.md +1 -14
  112. package/ja/intlayer_with_nextjs_15.md +1 -14
  113. package/ja/intlayer_with_nextjs_page_router.md +1 -13
  114. package/ja/intlayer_with_nuxt.md +792 -0
  115. package/ja/intlayer_with_react_native+expo.md +6 -3
  116. package/ja/intlayer_with_vite+preact.md +7 -18
  117. package/ja/intlayer_with_vite+react.md +7 -17
  118. package/ja/intlayer_with_vite+vue.md +68 -63
  119. package/ja/packages/nuxt-intlayer/index.md +29 -0
  120. package/ja/roadmap.md +11 -11
  121. package/ko/autoFill.md +1 -2
  122. package/ko/how_works_intlayer.md +1 -1
  123. package/ko/intlayer_with_create_react_app.md +1 -14
  124. package/ko/intlayer_with_nextjs_14.md +1 -14
  125. package/ko/intlayer_with_nextjs_15.md +1 -14
  126. package/ko/intlayer_with_nextjs_page_router.md +1 -13
  127. package/ko/intlayer_with_nuxt.md +784 -0
  128. package/ko/intlayer_with_react_native+expo.md +6 -3
  129. package/ko/intlayer_with_vite+preact.md +7 -18
  130. package/ko/intlayer_with_vite+react.md +7 -17
  131. package/ko/intlayer_with_vite+vue.md +69 -59
  132. package/ko/packages/nuxt-intlayer/index.md +31 -0
  133. package/ko/roadmap.md +11 -11
  134. package/package.json +4 -4
  135. package/pt/autoFill.md +1 -2
  136. package/pt/how_works_intlayer.md +1 -1
  137. package/pt/intlayer_with_create_react_app.md +1 -14
  138. package/pt/intlayer_with_nextjs_14.md +1 -14
  139. package/pt/intlayer_with_nextjs_15.md +1 -14
  140. package/pt/intlayer_with_nextjs_page_router.md +1 -13
  141. package/pt/intlayer_with_nuxt.md +792 -0
  142. package/pt/intlayer_with_react_native+expo.md +6 -3
  143. package/pt/intlayer_with_vite+preact.md +7 -18
  144. package/pt/intlayer_with_vite+react.md +7 -17
  145. package/pt/intlayer_with_vite+vue.md +23 -19
  146. package/pt/packages/nuxt-intlayer/index.md +29 -0
  147. package/pt/roadmap.md +11 -11
  148. package/ru/autoFill.md +1 -2
  149. package/ru/how_works_intlayer.md +1 -1
  150. package/ru/intlayer_with_create_react_app.md +1 -14
  151. package/ru/intlayer_with_nextjs_14.md +1 -14
  152. package/ru/intlayer_with_nextjs_15.md +1 -14
  153. package/ru/intlayer_with_nextjs_page_router.md +1 -13
  154. package/ru/intlayer_with_nuxt.md +792 -0
  155. package/ru/intlayer_with_react_native+expo.md +6 -3
  156. package/ru/intlayer_with_vite+preact.md +7 -18
  157. package/ru/intlayer_with_vite+react.md +7 -17
  158. package/ru/intlayer_with_vite+vue.md +25 -17
  159. package/ru/packages/nuxt-intlayer/index.md +31 -0
  160. package/ru/roadmap.md +11 -11
  161. package/zh/autoFill.md +1 -2
  162. package/zh/intlayer_with_create_react_app.md +1 -14
  163. package/zh/intlayer_with_nextjs_14.md +1 -14
  164. package/zh/intlayer_with_nextjs_15.md +1 -14
  165. package/zh/intlayer_with_nextjs_page_router.md +1 -13
  166. package/zh/intlayer_with_nuxt.md +784 -0
  167. package/zh/intlayer_with_react_native+expo.md +6 -3
  168. package/zh/intlayer_with_vite+preact.md +7 -18
  169. package/zh/intlayer_with_vite+react.md +7 -17
  170. package/zh/intlayer_with_vite+vue.md +68 -57
  171. package/zh/packages/nuxt-intlayer/index.md +31 -0
  172. package/zh/roadmap.md +11 -11
@@ -0,0 +1,793 @@
1
+ # Iniziare con l'Internazionalizzazione (i18n) con Intlayer e Nuxt
2
+
3
+ Consulta [Application Template](https://github.com/aymericzip/intlayer-nuxt-template) su GitHub.
4
+
5
+ ## Cos'è Intlayer?
6
+
7
+ **Intlayer** è una libreria open-source innovativa per l'internazionalizzazione (i18n) progettata per semplificare il supporto multilingue nelle moderne applicazioni web.
8
+
9
+ Con Intlayer, puoi:
10
+
11
+ - **Gestire facilmente le traduzioni** utilizzando dizionari dichiarativi a livello di componente.
12
+ - **Localizzare dinamicamente metadati**, rotte e contenuti.
13
+ - **Garantire il supporto TypeScript** con tipi autogenerati, migliorando il completamento automatico e il rilevamento degli errori.
14
+ - **Beneficiare di funzionalità avanzate**, come il rilevamento e il cambio dinamico della lingua.
15
+
16
+ ---
17
+
18
+ ## Guida passo-passo per configurare Intlayer in un'applicazione Nuxt
19
+
20
+ ### Passo 1: Installa le dipendenze
21
+
22
+ Installa i pacchetti necessari utilizzando npm:
23
+
24
+ ```bash packageManager="npm"
25
+ npm install intlayer vue-intlayer
26
+ npm install --save-dev nuxt-intlayer
27
+ ```
28
+
29
+ ```bash packageManager="pnpm"
30
+ pnpm add intlayer vue-intlayer
31
+ pnpm add --save-dev nuxt-intlayer
32
+ ```
33
+
34
+ ```bash packageManager="yarn"
35
+ yarn add intlayer vue-intlayer
36
+ yarn add --save-dev nuxt-intlayer
37
+ ```
38
+
39
+ - **intlayer**
40
+
41
+ Il pacchetto principale che fornisce strumenti di internazionalizzazione per la gestione della configurazione, traduzione, [dichiarazione dei contenuti](https://github.com/aymericzip/intlayer/blob/main/docs/it/dictionary/get_started.md), transpilation e [comandi CLI](https://github.com/aymericzip/intlayer/blob/main/docs/it/intlayer_cli.md).
42
+
43
+ - **vue-intlayer**
44
+ Il pacchetto che integra Intlayer con l'applicazione Vue. Fornisce i composables per i componenti Vue.
45
+
46
+ - **nuxt-intlayer**
47
+ Il modulo Nuxt che integra Intlayer con le applicazioni Nuxt. Fornisce configurazione automatica, middleware per il rilevamento della lingua, gestione dei cookie e reindirizzamento degli URL.
48
+
49
+ ### Passo 2: Configurazione del tuo progetto
50
+
51
+ Crea un file di configurazione per configurare le lingue della tua applicazione:
52
+
53
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
54
+ import { Locales, type IntlayerConfig } from "intlayer";
55
+
56
+ const config: IntlayerConfig = {
57
+ internationalization: {
58
+ locales: [
59
+ Locales.ENGLISH,
60
+ Locales.FRENCH,
61
+ Locales.SPANISH,
62
+ // Le tue altre lingue
63
+ ],
64
+ defaultLocale: Locales.ENGLISH,
65
+ },
66
+ };
67
+
68
+ export default config;
69
+ ```
70
+
71
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
72
+ import { Locales } from "intlayer";
73
+
74
+ /** @type {import('intlayer').IntlayerConfig} */
75
+ const config = {
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
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
91
+ const { Locales } = require("intlayer");
92
+
93
+ /** @type {import('intlayer').IntlayerConfig} */
94
+ const config = {
95
+ internationalization: {
96
+ locales: [
97
+ Locales.ENGLISH,
98
+ Locales.FRENCH,
99
+ Locales.SPANISH,
100
+ // Le tue altre lingue
101
+ ],
102
+ defaultLocale: Locales.ENGLISH,
103
+ },
104
+ };
105
+
106
+ module.exports = config;
107
+ ```
108
+
109
+ > Tramite questo file di configurazione, puoi configurare URL localizzati, reindirizzamenti middleware, nomi dei cookie, la posizione e l'estensione delle dichiarazioni dei contenuti, disabilitare i log di Intlayer nella console e altro. Per un elenco completo dei parametri disponibili, consulta la [documentazione di configurazione](https://github.com/aymericzip/intlayer/blob/main/docs/it/configuration.md).
110
+
111
+ ### Passo 3: Integra Intlayer nella configurazione di Nuxt
112
+
113
+ Aggiungi il modulo intlayer alla configurazione di Nuxt:
114
+
115
+ ```typescript fileName="nuxt.config.ts"
116
+ import { defineNuxtConfig } from "nuxt/config";
117
+
118
+ export default defineNuxtConfig({
119
+ // ... La tua configurazione Nuxt esistente
120
+ modules: ["nuxt-intlayer"],
121
+ });
122
+ ```
123
+
124
+ > Il modulo `nuxt-intlayer` gestisce automaticamente l'integrazione di Intlayer con Nuxt. Configura la costruzione della dichiarazione dei contenuti, monitora i file in modalità sviluppo, fornisce middleware per il rilevamento della lingua e gestisce il routing localizzato.
125
+
126
+ ### Passo 4: Dichiarare i tuoi contenuti
127
+
128
+ Crea e gestisci le dichiarazioni dei contenuti per memorizzare le traduzioni:
129
+
130
+ ```tsx fileName="components/helloWorld.content.ts" contentDeclarationFormat="typescript"
131
+ import { t, type Dictionary } from "intlayer";
132
+
133
+ const helloWorldContent = {
134
+ key: "helloworld",
135
+ content: {
136
+ count: t({
137
+ it: "il conteggio è ",
138
+ en: "count is ",
139
+ fr: "le compte est ",
140
+ es: "el recuento es ",
141
+ }),
142
+ edit: t({
143
+ it: "Modifica <code>components/HelloWorld.vue</code> e salva per testare HMR",
144
+ en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
145
+ fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
146
+ es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
147
+ }),
148
+ checkOut: t({
149
+ it: "Controlla ",
150
+ en: "Check out ",
151
+ fr: "Vérifiez ",
152
+ es: "Compruebe ",
153
+ }),
154
+ nuxtIntlayer: t({
155
+ it: "Documentazione di Nuxt Intlayer",
156
+ en: "Nuxt Intlayer documentation",
157
+ fr: "Documentation de Nuxt Intlayer",
158
+ es: "Documentación de Nuxt Intlayer",
159
+ }),
160
+ learnMore: t({
161
+ it: "Scopri di più su Nuxt nel ",
162
+ en: "Learn more about Nuxt in the ",
163
+ fr: "En savoir plus sur Nuxt dans la ",
164
+ es: "Aprenda más sobre Nuxt en la ",
165
+ }),
166
+ nuxtDocs: t({
167
+ it: "Documentazione Nuxt",
168
+ en: "Nuxt Documentation",
169
+ fr: "Documentation Nuxt",
170
+ es: "Documentación de Nuxt",
171
+ }),
172
+ readTheDocs: t({
173
+ it: "Clicca sul logo Nuxt per saperne di più",
174
+ en: "Click on the Nuxt logo to learn more",
175
+ fr: "Cliquez sur le logo Nuxt pour en savoir plus",
176
+ es: "Haga clic en el logotipo de Nuxt para obtener más información",
177
+ }),
178
+ },
179
+ } satisfies Dictionary;
180
+
181
+ export default helloWorldContent;
182
+ ```
183
+
184
+ ```javascript fileName="components/helloWorld.content.mjs" contentDeclarationFormat="esm"
185
+ import { t } from "intlayer";
186
+
187
+ /** @type {import('intlayer').Dictionary} */
188
+ const helloWorldContent = {
189
+ key: "helloworld",
190
+ content: {
191
+ count: t({
192
+ it: "il conteggio è ",
193
+ en: "count is ",
194
+ fr: "le compte est ",
195
+ es: "el recuento es ",
196
+ }),
197
+ edit: t({
198
+ it: "Modifica <code>components/HelloWorld.vue</code> e salva per testare HMR",
199
+ en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
200
+ fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
201
+ es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
202
+ }),
203
+ checkOut: t({
204
+ it: "Controlla ",
205
+ en: "Check out ",
206
+ fr: "Vérifiez ",
207
+ es: "Compruebe ",
208
+ }),
209
+ nuxtIntlayer: t({
210
+ it: "Documentazione di Nuxt Intlayer",
211
+ en: "Nuxt Intlayer documentation",
212
+ fr: "Documentation de Nuxt Intlayer",
213
+ es: "Documentación de Nuxt Intlayer",
214
+ }),
215
+ learnMore: t({
216
+ it: "Scopri di più su Nuxt nel ",
217
+ en: "Learn more about Nuxt in the ",
218
+ fr: "En savoir plus sur Nuxt dans la ",
219
+ es: "Aprenda más sobre Nuxt en la ",
220
+ }),
221
+ nuxtDocs: t({
222
+ it: "Documentazione Nuxt",
223
+ en: "Nuxt Documentation",
224
+ fr: "Documentation Nuxt",
225
+ es: "Documentación de Nuxt",
226
+ }),
227
+ readTheDocs: t({
228
+ it: "Clicca sul logo Nuxt per saperne di più",
229
+ en: "Click on the Nuxt logo to learn more",
230
+ fr: "Cliquez sur le logo Nuxt pour en savoir plus",
231
+ es: "Haga clic en el logotipo de Nuxt para obtener más información",
232
+ }),
233
+ },
234
+ };
235
+
236
+ export default helloWorldContent;
237
+ ```
238
+
239
+ ```javascript fileName="components/helloWorld.content.cjs" contentDeclarationFormat="commonjs"
240
+ const { t } = require("intlayer");
241
+
242
+ /** @type {import('intlayer').Dictionary} */
243
+ const helloWorldContent = {
244
+ key: "helloworld",
245
+ content: {
246
+ count: t({
247
+ it: "il conteggio è ",
248
+ en: "count is ",
249
+ fr: "le compte est ",
250
+ es: "el recuento es ",
251
+ }),
252
+ edit: t({
253
+ it: "Modifica <code>components/HelloWorld.vue</code> e salva per testare HMR",
254
+ en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
255
+ fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
256
+ es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
257
+ }),
258
+ checkOut: t({
259
+ it: "Controlla ",
260
+ en: "Check out ",
261
+ fr: "Vérifiez ",
262
+ es: "Compruebe ",
263
+ }),
264
+ nuxtIntlayer: t({
265
+ it: "Documentazione di Nuxt Intlayer",
266
+ en: "Nuxt Intlayer documentation",
267
+ fr: "Documentation de Nuxt Intlayer",
268
+ es: "Documentación de Nuxt Intlayer",
269
+ }),
270
+ learnMore: t({
271
+ it: "Scopri di più su Nuxt nel ",
272
+ en: "Learn more about Nuxt in the ",
273
+ fr: "En savoir plus sur Nuxt dans la ",
274
+ es: "Aprenda más sobre Nuxt en la ",
275
+ }),
276
+ nuxtDocs: t({
277
+ it: "Documentazione Nuxt",
278
+ en: "Nuxt Documentation",
279
+ fr: "Documentation Nuxt",
280
+ es: "Documentación de Nuxt",
281
+ }),
282
+ readTheDocs: t({
283
+ it: "Clicca sul logo Nuxt per saperne di più",
284
+ en: "Click on the Nuxt logo to learn more",
285
+ fr: "Cliquez sur le logo Nuxt pour en savoir plus",
286
+ es: "Haga clic en el logotipo de Nuxt para obtener más información",
287
+ }),
288
+ },
289
+ };
290
+
291
+ module.exports = helloWorldContent;
292
+ ```
293
+
294
+ ```json fileName="components/helloWorld.content.json" contentDeclarationFormat="json"
295
+ {
296
+ "$schema": "https://intlayer.org/schema.json",
297
+ "key": "helloworld",
298
+ "content": {
299
+ "count": {
300
+ "nodeType": "translation",
301
+ "translation": {
302
+ "it": "il conteggio è ",
303
+ "en": "count is ",
304
+ "fr": "le compte est ",
305
+ "es": "el recuento es "
306
+ }
307
+ },
308
+ "edit": {
309
+ "nodeType": "translation",
310
+ "translation": {
311
+ "it": "Modifica <code>components/HelloWorld.vue</code> e salva per testare HMR",
312
+ "en": "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
313
+ "fr": "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
314
+ "es": "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR"
315
+ }
316
+ },
317
+ "checkOut": {
318
+ "nodeType": "translation",
319
+ "translation": {
320
+ "it": "Dai un'occhiata a ",
321
+ "en": "Check out ",
322
+ "fr": "Vérifiez ",
323
+ "es": "Compruebe "
324
+ }
325
+ },
326
+ "nuxtIntlayer": {
327
+ "nodeType": "translation",
328
+ "translation": {
329
+ "it": "Documentazione di Nuxt Intlayer",
330
+ "en": "Nuxt Intlayer documentation",
331
+ "fr": "Documentation de Nuxt Intlayer",
332
+ "es": "Documentación de Nuxt Intlayer"
333
+ }
334
+ },
335
+ "learnMore": {
336
+ "nodeType": "translation",
337
+ "translation": {
338
+ "it": "Scopri di più su Nuxt nella ",
339
+ "en": "Learn more about Nuxt in the ",
340
+ "fr": "En savoir plus sur Nuxt dans la ",
341
+ "es": "Aprenda más sobre Nuxt en la "
342
+ }
343
+ },
344
+ "nuxtDocs": {
345
+ "nodeType": "translation",
346
+ "translation": {
347
+ "it": "Documentazione Nuxt",
348
+ "en": "Nuxt Documentation",
349
+ "fr": "Documentation Nuxt",
350
+ "es": "Documentación de Nuxt"
351
+ }
352
+ },
353
+ "readTheDocs": {
354
+ "nodeType": "translation",
355
+ "translation": {
356
+ "it": "Fai clic sul logo Nuxt per saperne di più",
357
+ "en": "Click on the Nuxt logo to learn more",
358
+ "fr": "Cliquez sur le logo Nuxt pour en savoir plus",
359
+ "es": "Haga clic en el logotipo de Nuxt para obtener más información"
360
+ }
361
+ }
362
+ }
363
+ }
364
+ ```
365
+
366
+ > Le dichiarazioni di contenuto possono essere definite ovunque nella tua applicazione purché siano incluse nella directory `contentDir` (di default, `./src`). E corrispondano all'estensione del file di dichiarazione del contenuto (di default, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
367
+
368
+ > Per maggiori dettagli, consulta la [documentazione sulla dichiarazione del contenuto](https://github.com/aymericzip/intlayer/blob/main/docs/it/dictionary/get_started.md).
369
+
370
+ ### Passo 5: Utilizza Intlayer nel tuo codice
371
+
372
+ Accedi ai tuoi dizionari di contenuto in tutta l'applicazione Nuxt utilizzando il composable `useIntlayer`:
373
+
374
+ ```vue fileName="components/HelloWorld.vue"
375
+ <script setup lang="ts">
376
+ import { ref } from "vue";
377
+ import { useIntlayer } from "vue-intlayer";
378
+
379
+ defineProps({
380
+ msg: String,
381
+ });
382
+
383
+ // Importa i contenuti tradotti
384
+ const {
385
+ count,
386
+ edit,
387
+ checkOut,
388
+ nuxtIntlayer,
389
+ learnMore,
390
+ nuxtDocs,
391
+ readTheDocs,
392
+ } = useIntlayer("helloworld");
393
+ const countRef = ref(0);
394
+ </script>
395
+
396
+ <template>
397
+ <h1>{{ msg }}</h1>
398
+
399
+ <div class="card">
400
+ <button type="button" @click="countRef++">
401
+ <count />
402
+ {{ countRef }}
403
+ </button>
404
+ <p v-html="edit"></p>
405
+ </div>
406
+
407
+ <p>
408
+ <checkOut />
409
+ <a href="https://nuxt.com/docs/getting-started/introduction" target="_blank"
410
+ >Nuxt</a
411
+ >, <nuxtIntlayer />
412
+ </p>
413
+ <p>
414
+ <learnMore />
415
+ <a href="https://nuxt.com" target="_blank"><nuxtDocs /></a>.
416
+ </p>
417
+ <p class="read-the-docs"><readTheDocs /></p>
418
+ <p class="read-the-docs">{{ readTheDocs }}</p>
419
+ </template>
420
+ ```
421
+
422
+ #### Accesso ai contenuti in Intlayer
423
+
424
+ Intlayer offre due API per accedere ai tuoi contenuti:
425
+
426
+ - **Sintassi basata su componenti** (consigliata):
427
+ Utilizza la sintassi `<myContent />` o `<Component :is="myContent" />` per rendere il contenuto come un nodo Intlayer. Questo si integra perfettamente con l'[Editor Visivo](https://github.com/aymericzip/intlayer/blob/main/docs/it/intlayer_visual_editor.md) e il [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/it/intlayer_CMS.md).
428
+
429
+ - **Sintassi basata su stringhe**:
430
+ Utilizza `{{ myContent }}` per rendere il contenuto come testo semplice, senza supporto per l'Editor Visivo.
431
+
432
+ - **Sintassi HTML grezza**:
433
+ Utilizza `<div v-html="myContent" />` per rendere il contenuto come HTML grezzo, senza supporto per l'Editor Visivo.
434
+
435
+ - **Sintassi di destrutturazione**:
436
+ Il composable `useIntlayer` restituisce un Proxy con il contenuto. Questo proxy può essere destrutturato per accedere al contenuto mantenendo la reattività.
437
+ - Utilizza `const content = useIntlayer("myContent");` e `{{ content.myContent }}` / `<content.myContent />`.
438
+ - Oppure utilizza `const { myContent } = useIntlayer("myContent");` e `{{ myContent }}` / `<myContent />` per destrutturare il contenuto.
439
+
440
+ ### (Opzionale) Passo 6: Cambia la lingua dei tuoi contenuti
441
+
442
+ Per cambiare la lingua dei tuoi contenuti, puoi utilizzare la funzione `setLocale` fornita dal composable `useLocale`. Questa funzione consente di impostare la lingua dell'applicazione e aggiornare i contenuti di conseguenza.
443
+
444
+ Crea un componente per passare da una lingua all'altra:
445
+
446
+ ```vue fileName="components/LocaleSwitcher.vue"
447
+ <template>
448
+ <div class="locale-switcher">
449
+ <select v-model="selectedLocale" @change="changeLocale">
450
+ <option v-for="loc in availableLocales" :key="loc" :value="loc">
451
+ {{ getLocaleName(loc) }}
452
+ </option>
453
+ </select>
454
+ </div>
455
+ </template>
456
+
457
+ <script setup lang="ts">
458
+ import { ref, watch } from "vue";
459
+ import { getLocaleName } from "intlayer";
460
+ import { useLocale } from "vue-intlayer";
461
+
462
+ // Ottieni informazioni sulla lingua e funzione setLocale
463
+ const { locale, availableLocales, setLocale } = useLocale();
464
+
465
+ // Traccia la lingua selezionata con un ref
466
+ const selectedLocale = ref(locale.value);
467
+
468
+ // Aggiorna la lingua quando cambia la selezione
469
+ const changeLocale = () => setLocale(selectedLocale.value);
470
+
471
+ // Mantieni sincronizzato selectedLocale con la lingua globale
472
+ watch(
473
+ () => locale.value,
474
+ (newLocale) => {
475
+ selectedLocale.value = newLocale;
476
+ }
477
+ );
478
+ </script>
479
+ </template>
480
+
481
+ <style scoped>
482
+ .locale-switcher {
483
+ margin: 1rem 0;
484
+ }
485
+
486
+ select {
487
+ padding: 0.5rem;
488
+ border-radius: 0.25rem;
489
+ border: 1px solid #ccc;
490
+ }
491
+ </style>
492
+ ```
493
+
494
+ Quindi, utilizza questo componente nelle tue pagine o layout:
495
+
496
+ ```vue fileName="app.vue"
497
+ <script setup lang="ts">
498
+ import { useIntlayer } from "vue-intlayer";
499
+ import LocaleSwitcher from "~/components/LocaleSwitcher.vue";
500
+
501
+ const content = useIntlayer("app"); // Crea il file di dichiarazione Intlayer correlato
502
+ </script>
503
+
504
+ <template>
505
+ <div>
506
+ <header>
507
+ <LocaleSwitcher />
508
+ </header>
509
+ <main>
510
+ <NuxtPage />
511
+ </main>
512
+ </div>
513
+ </template>
514
+ ```
515
+
516
+ ### (Opzionale) Passo 7: Aggiungi il routing localizzato alla tua applicazione
517
+
518
+ Nuxt gestisce automaticamente il routing localizzato quando utilizzi il modulo `nuxt-intlayer`. Questo crea automaticamente percorsi per ogni lingua in base alla struttura della directory delle tue pagine.
519
+
520
+ Esempio:
521
+
522
+ ```plaintext
523
+ pages/
524
+ ├── index.vue → /, /it, /fr, /es
525
+ ├── about.vue → /about, /it/about, /fr/about, /es/about
526
+ └── contact/
527
+ └── index.vue → /contact, /it/contact, /fr/contact, /es/contact
528
+ ```
529
+
530
+ Per creare una pagina localizzata, basta creare i tuoi file Vue nella directory `pages/`:
531
+
532
+ ```vue fileName="pages/about.vue"
533
+ <script setup lang="ts">
534
+ import { useIntlayer } from "vue-intlayer";
535
+
536
+ const content = useIntlayer("about");
537
+ </script>
538
+
539
+ <template>
540
+ <div>
541
+ <h1>{{ content.title }}</h1>
542
+ <p>{{ content.description }}</p>
543
+ </div>
544
+ </template>
545
+ ```
546
+
547
+ Il modulo `nuxt-intlayer` farà automaticamente:
548
+
549
+ - Rilevamento della lingua preferita dell'utente
550
+ - Gestione del cambio di lingua tramite URL
551
+ - Impostazione dell'attributo `<html lang="">` appropriato
552
+ - Gestione dei cookie della lingua
553
+ - Reindirizzamento degli utenti all'URL localizzato appropriato
554
+
555
+ ### (Opzionale) Passo 8: Creazione di un componente Link Localizzato
556
+
557
+ Per garantire che la navigazione della tua applicazione rispetti la lingua corrente, puoi creare un componente personalizzato `LocalizedLink`. Questo componente aggiunge automaticamente il prefisso agli URL interni con la lingua corrente.
558
+
559
+ ```vue fileName="components/LocalizedLink.vue"
560
+ <template>
561
+ <NuxtLink :to="localizedHref" v-bind="$attrs">
562
+ <slot />
563
+ </NuxtLink>
564
+ </template>
565
+
566
+ <script setup lang="ts">
567
+ import { computed } from "vue";
568
+ import { getLocalizedUrl } from "intlayer";
569
+ import { useLocale } from "vue-intlayer";
570
+
571
+ const props = defineProps({
572
+ to: {
573
+ type: String,
574
+ required: true,
575
+ },
576
+ });
577
+
578
+ const { locale } = useLocale();
579
+
580
+ // Controlla se il link è esterno
581
+ const isExternalLink = computed(() => /^https?:\/\//.test(props.to || ""));
582
+
583
+ // Crea un href localizzato per i link interni
584
+ const localizedHref = computed(() =>
585
+ isExternalLink.value ? props.to : getLocalizedUrl(props.to, locale.value)
586
+ );
587
+ </script>
588
+ ```
589
+
590
+ Quindi utilizza questo componente in tutta la tua applicazione:
591
+
592
+ ```vue fileName="pages/index.vue"
593
+ <template>
594
+ <div>
595
+ <LocalizedLink to="/about">
596
+ {{ content.aboutLink }}
597
+ </LocalizedLink>
598
+
599
+ <LocalizedLink to="/it/contact">
600
+ {{ content.contactLink }}
601
+ </LocalizedLink>
602
+ </div>
603
+ </template>
604
+
605
+ <script setup lang="ts">
606
+ import { useIntlayer } from "vue-intlayer";
607
+ import LocalizedLink from "~/components/LocalizedLink.vue";
608
+
609
+ const content = useIntlayer("home");
610
+ </script>
611
+ ```
612
+
613
+ ### (Opzionale) Passo 9: Gestire Metadata e SEO
614
+
615
+ Nuxt offre eccellenti capacità SEO. Puoi utilizzare Intlayer per gestire i metadati localizzati:
616
+
617
+ ```vue fileName="pages/about.vue"
618
+ <script setup lang="ts">
619
+ import { useSeoMeta } from "nuxt/app";
620
+ import { getIntlayer } from "intlayer";
621
+ import { useLocale } from "vue-intlayer";
622
+
623
+ const { locale } = useLocale();
624
+ const content = getIntlayer("about-meta", locale.value);
625
+
626
+ useSeoMeta({
627
+ title: content.title,
628
+ description: content.description,
629
+ });
630
+ </script>
631
+
632
+ <template>
633
+ <div>
634
+ <h1>{{ content.pageTitle }}</h1>
635
+ <p>{{ content.pageContent }}</p>
636
+ </div>
637
+ </template>
638
+ ```
639
+
640
+ Crea la dichiarazione di contenuto corrispondente:
641
+
642
+ ```typescript fileName="pages/about-meta.content.ts" contentDeclarationFormat="typescript"
643
+ import { t, type Dictionary } from "intlayer";
644
+ import type { useSeoMeta } from "nuxt/app";
645
+
646
+ const aboutMetaContent = {
647
+ key: "about-meta",
648
+ content: {
649
+ title: t({
650
+ it: "Chi Siamo - La Mia Azienda",
651
+ en: "About Us - My Company",
652
+ fr: "À Propos - Ma Société",
653
+ es: "Acerca de Nosotros - Mi Empresa",
654
+ }),
655
+ description: t({
656
+ it: "Scopri di più sulla nostra azienda e sulla nostra missione",
657
+ en: "Learn more about our company and our mission",
658
+ fr: "En savoir plus sur notre société et notre mission",
659
+ es: "Conozca más sobre nuestra empresa y nuestra misión",
660
+ }),
661
+ },
662
+ } satisfies Dictionary<Parameters<typeof useSeoMeta>[0]>;
663
+
664
+ export default aboutMetaContent;
665
+ ```
666
+
667
+ ```typescript fileName="pages/about-meta.content.mjs" contentDeclarationFormat="esm"
668
+ import { t } from "intlayer";
669
+
670
+ /** @type {import('intlayer').Dictionary} */
671
+ const aboutMetaContent = {
672
+ key: "about-meta",
673
+ content: {
674
+ title: t({
675
+ it: "Chi Siamo - La Mia Azienda",
676
+ en: "About Us - My Company",
677
+ fr: "À Propos - Ma Société",
678
+ es: "Acerca de Nosotros - Mi Empresa",
679
+ }),
680
+ description: t({
681
+ it: "Scopri di più sulla nostra azienda e sulla nostra missione",
682
+ en: "Learn more about our company and our mission",
683
+ fr: "En savoir plus sur notre société et notre mission",
684
+ es: "Conozca más sobre nuestra empresa y nuestra misión",
685
+ }),
686
+ },
687
+ };
688
+
689
+ export default aboutMetaContent;
690
+ ```
691
+
692
+ ```typescript fileName="pages/about-meta.content.js" contentDeclarationFormat="cjs"
693
+ const { t } = require("intlayer");
694
+
695
+ /** @type {import('intlayer').Dictionary} */
696
+ const aboutMetaContent = {
697
+ key: "about-meta",
698
+ content: {
699
+ title: t({
700
+ it: "Chi Siamo - La Mia Azienda",
701
+ en: "About Us - My Company",
702
+ fr: "À Propos - Ma Société",
703
+ es: "Acerca de Nosotros - Mi Empresa",
704
+ }),
705
+ description: t({
706
+ it: "Scopri di più sulla nostra azienda e sulla nostra missione",
707
+ en: "Learn more about our company and our mission",
708
+ fr: "En savoir plus sur notre société et notre mission",
709
+ es: "Conozca más sobre nuestra empresa y nuestra misión",
710
+ }),
711
+ },
712
+ };
713
+
714
+ module.exports = aboutMetaContent;
715
+ ```
716
+
717
+ ```json fileName="pages/about-meta.content.json" contentDeclarationFormat="json"
718
+ {
719
+ "key": "about-meta",
720
+ "content": {
721
+ "title": {
722
+ "nodeType": "translation",
723
+ "translations": {
724
+ "it": "Chi Siamo - La Mia Azienda",
725
+ "en": "About Us - My Company",
726
+ "fr": "À Propos - Ma Société",
727
+ "es": "Acerca de Nosotros - Mi Empresa"
728
+ }
729
+ },
730
+ "description": {
731
+ "nodeType": "translation",
732
+ "translations": {
733
+ "it": "Scopri di più sulla nostra azienda e sulla nostra missione",
734
+ "en": "Learn more about our company and our mission",
735
+ "fr": "En savoir plus sur notre société et notre mission",
736
+ "es": "Conozca más sobre nuestra empresa y nuestra misión"
737
+ }
738
+ }
739
+ }
740
+ }
741
+ ```
742
+
743
+ ### Configurare TypeScript
744
+
745
+ Intlayer utilizza l'estensione dei moduli per sfruttare i vantaggi di TypeScript e rendere il tuo codice più robusto.
746
+
747
+ ![alt text](https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png)
748
+
749
+ ![alt text](https://github.com/aymericzip/intlayer/blob/main/docs/assets/translation_error.png)
750
+
751
+ Assicurati che la configurazione di TypeScript includa i tipi generati automaticamente.
752
+
753
+ ```json5 fileName="tsconfig.json"
754
+ {
755
+ // ... Le tue configurazioni TypeScript esistenti
756
+ "include": [
757
+ // ... Le tue configurazioni TypeScript esistenti
758
+ ".intlayer/**/*.ts", // Includi i tipi generati automaticamente
759
+ ],
760
+ }
761
+ ```
762
+
763
+ ### Configurazione Git
764
+
765
+ Si consiglia di ignorare i file generati da Intlayer. Questo ti permette di evitare di commetterli nel tuo repository Git.
766
+
767
+ Per fare ciò, puoi aggiungere le seguenti istruzioni al tuo file `.gitignore`:
768
+
769
+ ```plaintext fileName=".gitignore"
770
+ # Ignora i file generati da Intlayer
771
+ .intlayer
772
+ ```
773
+
774
+ ### Estensione VS Code
775
+
776
+ Per migliorare la tua esperienza di sviluppo con Intlayer, puoi installare l'estensione ufficiale **Intlayer VS Code Extension**.
777
+
778
+ [Installa dal VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
779
+
780
+ Questa estensione offre:
781
+
782
+ - **Autocompletamento** per le chiavi di traduzione.
783
+ - **Rilevamento errori in tempo reale** per traduzioni mancanti.
784
+ - **Anteprime inline** del contenuto tradotto.
785
+ - **Azioni rapide** per creare e aggiornare facilmente le traduzioni.
786
+
787
+ Per maggiori dettagli su come utilizzare l'estensione, consulta la [documentazione dell'estensione Intlayer VS Code](https://intlayer.org/doc/vs-code-extension).
788
+
789
+ ---
790
+
791
+ ### Approfondimenti
792
+
793
+ ## Per approfondire, puoi implementare l'[editor visivo](https://github.com/aymericzip/intlayer/blob/main/docs/it/intlayer_visual_editor.md) o esternalizzare i tuoi contenuti utilizzando il [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/it/intlayer_CMS.md).