@intlayer/docs 7.5.9 → 7.5.11

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 (196) hide show
  1. package/README.md +9 -2
  2. package/dist/cjs/generated/docs.entry.cjs +57 -0
  3. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  4. package/dist/esm/generated/docs.entry.mjs +57 -0
  5. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  6. package/dist/types/generated/docs.entry.d.ts +3 -0
  7. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  8. package/docs/ar/cli/ci.md +137 -0
  9. package/docs/ar/cli/index.md +7 -1
  10. package/docs/ar/cli/list.md +39 -2
  11. package/docs/ar/cli/list_projects.md +131 -0
  12. package/docs/ar/cli/push.md +1 -1
  13. package/docs/ar/configuration.md +3 -3
  14. package/docs/ar/interest_of_intlayer.md +1 -1
  15. package/docs/ar/intlayer_CMS.md +25 -5
  16. package/docs/ar/intlayer_with_express.md +1 -0
  17. package/docs/ar/intlayer_with_fastify.md +516 -0
  18. package/docs/ar/readme.md +1 -1
  19. package/docs/de/cli/ci.md +137 -0
  20. package/docs/de/cli/index.md +7 -1
  21. package/docs/de/cli/list.md +39 -2
  22. package/docs/de/cli/list_projects.md +130 -0
  23. package/docs/de/cli/push.md +1 -1
  24. package/docs/de/configuration.md +3 -3
  25. package/docs/de/interest_of_intlayer.md +1 -1
  26. package/docs/de/intlayer_CMS.md +25 -5
  27. package/docs/de/intlayer_with_express.md +1 -0
  28. package/docs/de/intlayer_with_fastify.md +449 -0
  29. package/docs/de/readme.md +1 -1
  30. package/docs/en/cli/ci.md +137 -0
  31. package/docs/en/cli/index.md +14 -1
  32. package/docs/en/cli/list.md +39 -2
  33. package/docs/en/cli/list_projects.md +128 -0
  34. package/docs/en/cli/push.md +1 -1
  35. package/docs/en/configuration.md +3 -3
  36. package/docs/en/interest_of_intlayer.md +2 -2
  37. package/docs/en/intlayer_CMS.md +25 -5
  38. package/docs/en/intlayer_with_express.md +1 -0
  39. package/docs/en/intlayer_with_fastify.md +439 -0
  40. package/docs/en/readme.md +3 -1
  41. package/docs/en-GB/cli/ci.md +137 -0
  42. package/docs/en-GB/cli/index.md +7 -1
  43. package/docs/en-GB/cli/list.md +39 -2
  44. package/docs/en-GB/cli/list_projects.md +130 -0
  45. package/docs/en-GB/cli/push.md +1 -1
  46. package/docs/en-GB/configuration.md +3 -3
  47. package/docs/en-GB/interest_of_intlayer.md +1 -1
  48. package/docs/en-GB/intlayer_CMS.md +25 -5
  49. package/docs/en-GB/intlayer_with_express.md +1 -0
  50. package/docs/en-GB/intlayer_with_fastify.md +445 -0
  51. package/docs/en-GB/readme.md +3 -1
  52. package/docs/es/cli/ci.md +137 -0
  53. package/docs/es/cli/index.md +7 -1
  54. package/docs/es/cli/list.md +39 -2
  55. package/docs/es/cli/list_projects.md +130 -0
  56. package/docs/es/cli/push.md +1 -1
  57. package/docs/es/configuration.md +3 -3
  58. package/docs/es/interest_of_intlayer.md +1 -1
  59. package/docs/es/intlayer_CMS.md +25 -5
  60. package/docs/es/intlayer_with_express.md +1 -0
  61. package/docs/es/intlayer_with_fastify.md +480 -0
  62. package/docs/es/readme.md +1 -1
  63. package/docs/fr/cli/ci.md +137 -0
  64. package/docs/fr/cli/index.md +7 -1
  65. package/docs/fr/cli/list.md +39 -2
  66. package/docs/fr/cli/list_projects.md +131 -0
  67. package/docs/fr/cli/push.md +1 -1
  68. package/docs/fr/configuration.md +3 -3
  69. package/docs/fr/interest_of_intlayer.md +1 -1
  70. package/docs/fr/intlayer_CMS.md +25 -5
  71. package/docs/fr/intlayer_with_express.md +1 -0
  72. package/docs/fr/intlayer_with_fastify.md +439 -0
  73. package/docs/fr/readme.md +1 -1
  74. package/docs/hi/cli/ci.md +137 -0
  75. package/docs/hi/cli/index.md +7 -1
  76. package/docs/hi/cli/list.md +38 -1
  77. package/docs/hi/cli/list_projects.md +130 -0
  78. package/docs/hi/cli/push.md +1 -1
  79. package/docs/hi/configuration.md +3 -3
  80. package/docs/hi/interest_of_intlayer.md +1 -1
  81. package/docs/hi/intlayer_CMS.md +25 -5
  82. package/docs/hi/intlayer_with_express.md +1 -0
  83. package/docs/hi/intlayer_with_fastify.md +540 -0
  84. package/docs/hi/readme.md +1 -1
  85. package/docs/id/cli/ci.md +137 -0
  86. package/docs/id/cli/index.md +7 -1
  87. package/docs/id/cli/list.md +38 -1
  88. package/docs/id/cli/list_projects.md +128 -0
  89. package/docs/id/cli/push.md +1 -1
  90. package/docs/id/configuration.md +3 -3
  91. package/docs/id/interest_of_intlayer.md +1 -1
  92. package/docs/id/intlayer_CMS.md +25 -5
  93. package/docs/id/intlayer_with_express.md +1 -0
  94. package/docs/id/intlayer_with_fastify.md +470 -0
  95. package/docs/id/readme.md +1 -1
  96. package/docs/it/cli/ci.md +137 -0
  97. package/docs/it/cli/index.md +7 -1
  98. package/docs/it/cli/list.md +39 -2
  99. package/docs/it/cli/list_projects.md +130 -0
  100. package/docs/it/cli/push.md +1 -1
  101. package/docs/it/configuration.md +3 -3
  102. package/docs/it/interest_of_intlayer.md +1 -1
  103. package/docs/it/intlayer_CMS.md +25 -5
  104. package/docs/it/intlayer_with_express.md +1 -0
  105. package/docs/it/intlayer_with_fastify.md +445 -0
  106. package/docs/it/readme.md +1 -1
  107. package/docs/ja/cli/ci.md +137 -0
  108. package/docs/ja/cli/index.md +7 -1
  109. package/docs/ja/cli/list.md +38 -1
  110. package/docs/ja/cli/list_projects.md +136 -0
  111. package/docs/ja/cli/push.md +1 -1
  112. package/docs/ja/configuration.md +3 -3
  113. package/docs/ja/interest_of_intlayer.md +1 -1
  114. package/docs/ja/intlayer_CMS.md +25 -5
  115. package/docs/ja/intlayer_with_express.md +1 -0
  116. package/docs/ja/intlayer_with_fastify.md +516 -0
  117. package/docs/ja/readme.md +1 -1
  118. package/docs/ko/cli/ci.md +137 -0
  119. package/docs/ko/cli/index.md +7 -1
  120. package/docs/ko/cli/list.md +38 -1
  121. package/docs/ko/cli/list_projects.md +128 -0
  122. package/docs/ko/cli/push.md +1 -1
  123. package/docs/ko/configuration.md +3 -3
  124. package/docs/ko/interest_of_intlayer.md +1 -1
  125. package/docs/ko/intlayer_CMS.md +25 -5
  126. package/docs/ko/intlayer_with_express.md +1 -0
  127. package/docs/ko/intlayer_with_fastify.md +463 -0
  128. package/docs/ko/readme.md +1 -1
  129. package/docs/pl/cli/ci.md +137 -0
  130. package/docs/pl/cli/index.md +7 -1
  131. package/docs/pl/cli/list.md +39 -2
  132. package/docs/pl/cli/list_projects.md +130 -0
  133. package/docs/pl/cli/push.md +1 -1
  134. package/docs/pl/configuration.md +3 -3
  135. package/docs/pl/interest_of_intlayer.md +1 -1
  136. package/docs/pl/intlayer_CMS.md +25 -5
  137. package/docs/pl/intlayer_with_express.md +1 -0
  138. package/docs/pl/intlayer_with_fastify.md +457 -0
  139. package/docs/pl/readme.md +1 -1
  140. package/docs/pt/cli/ci.md +137 -0
  141. package/docs/pt/cli/index.md +7 -1
  142. package/docs/pt/cli/list.md +39 -2
  143. package/docs/pt/cli/list_projects.md +134 -0
  144. package/docs/pt/cli/push.md +1 -1
  145. package/docs/pt/configuration.md +3 -3
  146. package/docs/pt/interest_of_intlayer.md +1 -1
  147. package/docs/pt/intlayer_CMS.md +25 -5
  148. package/docs/pt/intlayer_with_express.md +1 -0
  149. package/docs/pt/intlayer_with_fastify.md +502 -0
  150. package/docs/pt/readme.md +1 -1
  151. package/docs/ru/cli/ci.md +137 -0
  152. package/docs/ru/cli/index.md +7 -1
  153. package/docs/ru/cli/list.md +39 -2
  154. package/docs/ru/cli/list_projects.md +130 -0
  155. package/docs/ru/cli/push.md +1 -1
  156. package/docs/ru/configuration.md +3 -3
  157. package/docs/ru/interest_of_intlayer.md +1 -1
  158. package/docs/ru/intlayer_CMS.md +25 -5
  159. package/docs/ru/intlayer_with_express.md +1 -0
  160. package/docs/ru/intlayer_with_fastify.md +468 -0
  161. package/docs/ru/readme.md +1 -1
  162. package/docs/tr/cli/ci.md +137 -0
  163. package/docs/tr/cli/index.md +7 -1
  164. package/docs/tr/cli/list.md +39 -2
  165. package/docs/tr/cli/list_projects.md +134 -0
  166. package/docs/tr/cli/push.md +1 -1
  167. package/docs/tr/configuration.md +3 -3
  168. package/docs/tr/interest_of_intlayer.md +1 -1
  169. package/docs/tr/intlayer_CMS.md +25 -5
  170. package/docs/tr/intlayer_with_express.md +1 -0
  171. package/docs/tr/intlayer_with_fastify.md +471 -0
  172. package/docs/tr/readme.md +1 -1
  173. package/docs/vi/cli/ci.md +137 -0
  174. package/docs/vi/cli/index.md +7 -1
  175. package/docs/vi/cli/list.md +38 -1
  176. package/docs/vi/cli/list_projects.md +130 -0
  177. package/docs/vi/cli/push.md +1 -1
  178. package/docs/vi/configuration.md +3 -3
  179. package/docs/vi/interest_of_intlayer.md +1 -1
  180. package/docs/vi/intlayer_CMS.md +25 -5
  181. package/docs/vi/intlayer_with_express.md +1 -0
  182. package/docs/vi/intlayer_with_fastify.md +490 -0
  183. package/docs/vi/readme.md +1 -1
  184. package/docs/zh/cli/ci.md +137 -0
  185. package/docs/zh/cli/index.md +7 -1
  186. package/docs/zh/cli/list.md +38 -1
  187. package/docs/zh/cli/list_projects.md +130 -0
  188. package/docs/zh/cli/push.md +1 -1
  189. package/docs/zh/configuration.md +3 -3
  190. package/docs/zh/interest_of_intlayer.md +1 -1
  191. package/docs/zh/intlayer_CMS.md +25 -5
  192. package/docs/zh/intlayer_with_express.md +1 -0
  193. package/docs/zh/intlayer_with_fastify.md +451 -0
  194. package/docs/zh/readme.md +1 -1
  195. package/package.json +6 -6
  196. package/src/generated/docs.entry.ts +57 -0
@@ -0,0 +1,445 @@
1
+ ---
2
+ createdAt: 2025-12-30
3
+ updatedAt: 2025-12-30
4
+ title: Come tradurre il tuo backend Fastify – Guida i18n 2026
5
+ description: Scopri come rendere il tuo backend Fastify multilingue. Segui la documentazione per internazionalizzare (i18n) e tradurlo.
6
+ keywords:
7
+ - Internazionalizzazione
8
+ - Documentazione
9
+ - Intlayer
10
+ - Fastify
11
+ - JavaScript
12
+ - Backend
13
+ slugs:
14
+ - doc
15
+ - environment
16
+ - fastify
17
+ applicationTemplate: https://github.com/aymericzip/intlayer-fastify-template
18
+ history:
19
+ - version: 7.6.0
20
+ date: 2025-12-31
21
+ changes: Add init command
22
+ - version: 7.6.0
23
+ date: 2025-12-31
24
+ changes: Init history
25
+ ---
26
+
27
+ # Traduci il tuo backend Fastify utilizzando Intlayer | Internazionalizzazione (i18n)
28
+
29
+ `fastify-intlayer` è un plugin di internazionalizzazione (i18n) potente per le applicazioni Fastify, progettato per rendere i tuoi servizi backend accessibili a livello globale fornendo risposte localizzate in base alle preferenze del client.
30
+
31
+ ### Casi d'uso pratici
32
+
33
+ - **Mostrare gli errori del backend nella lingua dell'utente**: Quando si verifica un errore, mostrare i messaggi nella lingua nativa dell'utente migliora la comprensione e riduce la frustrazione. Questo è particolarmente utile per i messaggi di errore dinamici che potrebbero essere mostrati in componenti front-end come toast o modal.
34
+ - **Recuperare contenuti multilingue**: Per applicazioni che estraggono contenuti da un database, l'internazionalizzazione garantisce la possibilità di servire tali contenuti in più lingue. Questo è fondamentale per piattaforme come siti di e-commerce o sistemi di gestione dei contenuti che devono mostrare descrizioni di prodotti, articoli e altri contenuti nella lingua preferita dall'utente.
35
+ - **Invio di email multilingue**: Sia che si tratti di email transazionali, campagne di marketing o notifiche, inviare le email nella lingua del destinatario può aumentare significativamente il coinvolgimento e l'efficacia.
36
+ - **Notifiche push multilingue**: Per le applicazioni mobili, inviare notifiche push nella lingua preferita dall'utente può migliorare l'interazione e la retention. Questo tocco personale può rendere le notifiche più rilevanti e facilmente azionabili.
37
+ - **Altre comunicazioni**: Qualsiasi forma di comunicazione dal backend, come SMS, avvisi di sistema o aggiornamenti dell'interfaccia utente, trae vantaggio dall'essere nella lingua dell'utente, garantendo chiarezza e migliorando l'esperienza utente complessiva.
38
+
39
+ Internationalizzando il backend, la tua applicazione non solo rispetta le differenze culturali ma si allinea anche meglio alle esigenze dei mercati globali, diventando così un passaggio chiave per scalare i tuoi servizi a livello mondiale.
40
+
41
+ ## Per iniziare
42
+
43
+ ### Installazione
44
+
45
+ Per iniziare a utilizzare `fastify-intlayer`, installa il pacchetto usando npm:
46
+
47
+ ```bash packageManager="npm"
48
+ npm install intlayer fastify-intlayer
49
+ npx intlayer init
50
+
51
+ ```
52
+
53
+ ```bash packageManager="pnpm"
54
+ pnpm add intlayer fastify-intlayer
55
+ pnpm intlayer init
56
+
57
+ ```
58
+
59
+ ```bash packageManager="yarn"
60
+ yarn add intlayer fastify-intlayer
61
+ yarn intlayer init
62
+
63
+ ```
64
+
65
+ ```bash packageManager="bun"
66
+ bun add intlayer fastify-intlayer
67
+ bunx intlayer init
68
+
69
+ ```
70
+
71
+ ### Configurazione
72
+
73
+ Configura le impostazioni di internazionalizzazione creando un file `intlayer.config.ts` nella root del tuo progetto:
74
+
75
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
76
+ import { Locales, type IntlayerConfig } from "intlayer";
77
+
78
+ const config: IntlayerConfig = {
79
+ internationalization: {
80
+ locales: [
81
+ Locales.ENGLISH,
82
+ Locales.FRENCH,
83
+ Locales.SPANISH_MEXICO,
84
+ Locales.SPANISH_SPAIN,
85
+ ],
86
+ defaultLocale: Locales.ENGLISH,
87
+ },
88
+ };
89
+
90
+ export default config;
91
+ ```
92
+
93
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
94
+ import { Locales } from "intlayer";
95
+
96
+ /** @type {import('intlayer').IntlayerConfig} */
97
+ const config = {
98
+ internationalization: {
99
+ locales: [
100
+ Locales.ENGLISH,
101
+ Locales.FRENCH,
102
+ Locales.SPANISH_MEXICO,
103
+ Locales.SPANISH_SPAIN,
104
+ ],
105
+ defaultLocale: Locales.ENGLISH,
106
+ },
107
+ };
108
+
109
+ export default config;
110
+ ```
111
+
112
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
113
+ const { Locales } = require("intlayer");
114
+
115
+ /** @type {import('intlayer').IntlayerConfig} */
116
+ const config = {
117
+ internationalization: {
118
+ locales: [
119
+ Locales.ENGLISH,
120
+ Locales.FRENCH,
121
+ Locales.SPANISH_MEXICO,
122
+ Locales.SPANISH_SPAIN,
123
+ ],
124
+ defaultLocale: Locales.ENGLISH,
125
+ },
126
+ };
127
+
128
+ module.exports = config;
129
+ ```
130
+
131
+ ### Dichiarare il contenuto
132
+
133
+ Crea e gestisci le dichiarazioni di contenuto per memorizzare le traduzioni:
134
+
135
+ ```typescript fileName="src/index.content.ts" contentDeclarationFormat="typescript"
136
+ import { t, type Dictionary } from "intlayer";
137
+
138
+ const indexContent = {
139
+ key: "index",
140
+ content: {
141
+ exampleOfContent: t({
142
+ it: "Esempio di contenuto restituito in italiano",
143
+ en: "Example of returned content in English",
144
+ fr: "Exemple de contenu renvoyé en français",
145
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
146
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
147
+ }),
148
+ },
149
+ } satisfies Dictionary;
150
+
151
+ export default indexContent;
152
+ ```
153
+
154
+ ```javascript fileName="src/index.content.mjs" contentDeclarationFormat="esm"
155
+ import { t } from "intlayer";
156
+
157
+ /** @type {import('intlayer').Dictionary} */
158
+ const indexContent = {
159
+ key: "index",
160
+ content: {
161
+ exampleOfContent: t({
162
+ it: "Esempio di contenuto restituito in italiano",
163
+ en: "Example of returned content in English",
164
+ fr: "Exemple de contenu renvoyé en français",
165
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
166
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
167
+ }),
168
+ },
169
+ };
170
+
171
+ export default indexContent;
172
+ ```
173
+
174
+ ```javascript fileName="src/index.content.cjs" contentDeclarationFormat="commonjs"
175
+ const { t } = require("intlayer");
176
+
177
+ /** @type {import('intlayer').Dictionary} */
178
+ const indexContent = {
179
+ key: "index",
180
+ content: {
181
+ exampleOfContent: t({
182
+ it: "Esempio di contenuto restituito in italiano",
183
+ en: "Example of returned content in English",
184
+ fr: "Exemple de contenu renvoyé en français",
185
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
186
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
187
+ }),
188
+ },
189
+ };
190
+
191
+ module.exports = indexContent;
192
+ ```
193
+
194
+ ```json fileName="src/index.content.json" contentDeclarationFormat="json"
195
+ {
196
+ "$schema": "https://intlayer.org/schema.json",
197
+ "key": "index",
198
+ "content": {
199
+ "exampleOfContent": {
200
+ "nodeType": "translation",
201
+ "translation": {
202
+ "it": "Esempio di contenuto restituito in italiano",
203
+ "en": "Example of returned content in English",
204
+ "fr": "Exemple de contenu renvoyé en français",
205
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
206
+ "es-MX": "Ejemplo de contenido devuelto en español (México)"
207
+ }
208
+ }
209
+ }
210
+ }
211
+ ```
212
+
213
+ > Le tue dichiarazioni di contenuto possono essere definite ovunque nella tua applicazione purché siano incluse nella directory `contentDir` (per impostazione predefinita, `./src`). E corrispondano all'estensione dei file di dichiarazione del contenuto (per impostazione predefinita, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
214
+
215
+ > Per maggiori dettagli, consulta la [documentazione sulle dichiarazioni di contenuto](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/dictionary/content_file.md).
216
+
217
+ ### Impostazione dell'applicazione Fastify
218
+
219
+ Configura la tua applicazione Fastify per usare `fastify-intlayer`:
220
+
221
+ ```typescript fileName="src/index.ts" codeFormat="typescript"
222
+ import Fastify from "fastify";
223
+ import { intlayer, t, getDictionary, getIntlayer } from "fastify-intlayer";
224
+ import dictionaryExample from "./index.content";
225
+
226
+ const fastify = Fastify({ logger: true });
227
+
228
+ // Carica il plugin di internazionalizzazione
229
+ await fastify.register(intlayer);
230
+
231
+ // Rotte
232
+ fastify.get("/t_example", async (_req, reply) => {
233
+ return t({
234
+ it: "Esempio di contenuto restituito in italiano",
235
+ en: "Example of returned content in English",
236
+ fr: "Exemple de contenu renvoyé en français",
237
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
238
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
239
+ });
240
+ });
241
+
242
+ fastify.get("/getIntlayer_example", async (_req, reply) => {
243
+ return getIntlayer("index").exampleOfContent;
244
+ });
245
+
246
+ fastify.get("/getDictionary_example", async (_req, reply) => {
247
+ return getDictionary(dictionaryExample).exampleOfContent;
248
+ });
249
+
250
+ // Avvia il server
251
+ const start = async () => {
252
+ try {
253
+ await fastify.listen({ port: 3000 });
254
+ } catch (err) {
255
+ fastify.log.error(err);
256
+ process.exit(1);
257
+ }
258
+ };
259
+
260
+ start();
261
+ ```
262
+
263
+ ```javascript fileName="src/index.mjs" codeFormat="esm"
264
+ import Fastify from "fastify";
265
+ import { intlayer, t, getDictionary, getIntlayer } from "fastify-intlayer";
266
+ import dictionaryExample from "./index.content";
267
+
268
+ const fastify = Fastify({ logger: true });
269
+
270
+ // Carica il plugin di internazionalizzazione
271
+ await fastify.register(intlayer);
272
+
273
+ // Rotte
274
+ fastify.get("/t_example", async (_req, reply) => {
275
+ return t({
276
+ it: "Esempio di contenuto restituito in italiano",
277
+ en: "Example of returned content in English",
278
+ fr: "Exemple de contenu renvoyé en français",
279
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
280
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
281
+ });
282
+ });
283
+
284
+ fastify.get("/getIntlayer_example", async (_req, reply) => {
285
+ return getIntlayer("index").exampleOfContent;
286
+ });
287
+
288
+ fastify.get("/getDictionary_example", async (_req, reply) => {
289
+ return getDictionary(dictionaryExample).exampleOfContent;
290
+ });
291
+
292
+ // Avvia il server
293
+ const start = async () => {
294
+ try {
295
+ await fastify.listen({ port: 3000 });
296
+ } catch (err) {
297
+ fastify.log.error(err);
298
+ process.exit(1);
299
+ }
300
+ };
301
+
302
+ start();
303
+ ```
304
+
305
+ ```javascript fileName="src/index.cjs" codeFormat="commonjs"
306
+ const Fastify = require("fastify");
307
+ const { intlayer, t, getDictionary, getIntlayer } = require("fastify-intlayer");
308
+ const dictionaryExample = require("./index.content");
309
+
310
+ const fastify = Fastify({ logger: true });
311
+
312
+ // Wrapper per l'avvio del server con async/await
313
+ const start = async () => {
314
+ try {
315
+ // Carica il plugin di internazionalizzazione
316
+ await fastify.register(intlayer);
317
+
318
+ // Rotte
319
+ fastify.get("/t_example", async (_req, reply) => {
320
+ return t({
321
+ it: "Esempio di contenuto restituito in italiano",
322
+ en: "Example of returned content in English",
323
+ fr: "Exemple de contenu renvoyé en français",
324
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
325
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
326
+ });
327
+ });
328
+
329
+ fastify.get("/getIntlayer_example", async (_req, reply) => {
330
+ return getIntlayer("index").exampleOfContent;
331
+ });
332
+
333
+ fastify.get("/getDictionary_example", async (_req, reply) => {
334
+ return getDictionary(dictionaryExample).exampleOfContent;
335
+ });
336
+
337
+ await fastify.listen({ port: 3000 });
338
+ } catch (err) {
339
+ fastify.log.error(err);
340
+ process.exit(1);
341
+ }
342
+ };
343
+
344
+ start();
345
+ ```
346
+
347
+ ### Compatibilità
348
+
349
+ `fastify-intlayer` è completamente compatibile con:
350
+
351
+ - [`react-intlayer`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/packages/react-intlayer/index.md) per applicazioni React
352
+ - [`next-intlayer`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/packages/next-intlayer/index.md) per applicazioni Next.js
353
+ - [`vite-intlayer`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/packages/vite-intlayer/index.md) per applicazioni Vite
354
+
355
+ Funziona anche perfettamente con qualsiasi soluzione di internazionalizzazione in diversi ambienti, inclusi browser e richieste API. Puoi personalizzare il middleware per rilevare la locale tramite header o cookie:
356
+
357
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
358
+ import { Locales, type IntlayerConfig } from "intlayer";
359
+
360
+ const config: IntlayerConfig = {
361
+ // ... Altre opzioni di configurazione
362
+ middleware: {
363
+ headerName: "my-locale-header",
364
+ cookieName: "my-locale-cookie",
365
+ },
366
+ };
367
+
368
+ export default config;
369
+ ```
370
+
371
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
372
+ import { Locales } from "intlayer";
373
+
374
+ /** @type {import('intlayer').IntlayerConfig} */
375
+ const config = {
376
+ // ... Altre opzioni di configurazione
377
+ middleware: {
378
+ headerName: "my-locale-header",
379
+ cookieName: "my-locale-cookie",
380
+ },
381
+ };
382
+
383
+ export default config;
384
+ ```
385
+
386
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
387
+ const { Locales } = require("intlayer");
388
+
389
+ /** @type {import('intlayer').IntlayerConfig} */
390
+ const config = {
391
+ // ... Altre opzioni di configurazione
392
+ middleware: {
393
+ headerName: "my-locale-header",
394
+ cookieName: "my-locale-cookie",
395
+ },
396
+ };
397
+
398
+ module.exports = config;
399
+ ```
400
+
401
+ Per impostazione predefinita, `fastify-intlayer` interpreterà l'intestazione `Accept-Language` per determinare la lingua preferita del client.
402
+
403
+ > Per ulteriori informazioni sulla configurazione e argomenti avanzati, visita la nostra [documentazione](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/configuration.md).
404
+
405
+ ### Configurare TypeScript
406
+
407
+ `fastify-intlayer` sfrutta le robuste capacità di TypeScript per migliorare il processo di internazionalizzazione. Il typing statico di TypeScript garantisce che ogni chiave di traduzione sia conteggiata, riducendo il rischio di traduzioni mancanti e migliorando la manutenibilità.
408
+
409
+ Assicurati che i tipi autogenerati (per impostazione predefinita in ./types/intlayer.d.ts) siano inclusi nel tuo file tsconfig.json.
410
+
411
+ ```json5 fileName="tsconfig.json"
412
+ {
413
+ // ... Le tue configurazioni TypeScript esistenti
414
+ "include": [
415
+ // ... Le tue configurazioni TypeScript esistenti
416
+ ".intlayer/**/*.ts", // Includi i tipi auto-generati
417
+ ],
418
+ }
419
+ ```
420
+
421
+ ### Estensione per VS Code
422
+
423
+ Per migliorare la tua esperienza di sviluppo con Intlayer, puoi installare l'**Estensione Intlayer per VS Code** ufficiale.
424
+
425
+ [Installa dal VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
426
+
427
+ Questa estensione offre:
428
+
429
+ - **Completamento automatico** per le chiavi di traduzione.
430
+ - **Rilevamento degli errori in tempo reale** per traduzioni mancanti.
431
+ - **Anteprime inline** dei contenuti tradotti.
432
+ - **Azioni rapide** per creare e aggiornare facilmente le traduzioni.
433
+
434
+ Per maggiori dettagli su come usare l'estensione, consulta la [documentazione dell'Estensione Intlayer per VS Code](https://intlayer.org/doc/vs-code-extension).
435
+
436
+ ### Configurazione Git
437
+
438
+ È consigliabile ignorare i file generati da Intlayer. Questo ti permette di evitare di commetterli nel tuo repository Git.
439
+
440
+ Per farlo, puoi aggiungere le seguenti istruzioni al file `.gitignore`:
441
+
442
+ ```plaintext fileName=".gitignore"
443
+ # Ignora i file generati da Intlayer
444
+ .intlayer
445
+ ```
package/docs/it/readme.md CHANGED
@@ -50,7 +50,7 @@ Con **file di contenuto per ogni locale**, **autocompletamento TypeScript**, **d
50
50
  | Caratteristica | Descrizione |
51
51
  | --------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
52
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Supporto Cross-Framework**<br><br>Intlayer è compatibile con tutti i principali framework e librerie, inclusi Next.js, React, Vite, Vue.js, Nuxt, Preact, Express e altri ancora. |
53
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.png?raw=true" alt="Feature" width="700"> | **Gestione dei Contenuti con JavaScript**<br><br>Sfrutta la flessibilità di JavaScript per definire e gestire i tuoi contenuti in modo efficiente. <br><br> - [Dichiarazione dei contenuti](https://intlayer.org/doc/concept/content) |
53
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **Gestione dei Contenuti con JavaScript**<br><br>Sfrutta la flessibilità di JavaScript per definire e gestire i tuoi contenuti in modo efficiente. <br><br> - [Dichiarazione dei contenuti](https://intlayer.org/doc/concept/content) |
54
54
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **File di Dichiarazione dei Contenuti per Locale**<br><br>Accelera il tuo sviluppo dichiarando i contenuti una sola volta, prima della generazione automatica.<br><br> - [File di Dichiarazione dei Contenuti per Locale](https://intlayer.org/doc/concept/per-locale-file) |
55
55
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Ambiente Type-Safe**<br><br>Sfrutta TypeScript per garantire che le definizioni dei tuoi contenuti e il codice siano privi di errori, beneficiando anche dell'autocompletamento nell'IDE.<br><br> - [Configurazione di TypeScript](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
56
56
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Configurazione Semplificata**<br><br>Avvia rapidamente con una configurazione minima. Regola facilmente le impostazioni per l'internazionalizzazione, il routing, l'IA, la build e la gestione dei contenuti.<br><br> - [Esplora l'integrazione con Next.js](https://intlayer.org/doc/environment/nextjs) |
@@ -0,0 +1,137 @@
1
+ ---
2
+ createdAt: 2026-01-06
3
+ updatedAt: 2026-01-06
4
+ title: CIコマンド
5
+ description: CI/CDパイプラインとモノレポで自動注入された認証情報を使用してIntlayerコマンドを実行する方法を学びます。
6
+ keywords:
7
+ - CI
8
+ - CI/CD
9
+ - 自動化
10
+ - モノレポ
11
+ - 認証情報
12
+ - CLI
13
+ - Intlayer
14
+ slugs:
15
+ - doc
16
+ - concept
17
+ - cli
18
+ - ci
19
+ history:
20
+ - version: 7.5.11
21
+ date: 2026-01-06
22
+ changes: CIコマンドを追加
23
+ ---
24
+
25
+ # CIコマンド
26
+
27
+ ```bash
28
+ npx intlayer ci <command...>
29
+ ```
30
+
31
+ CIコマンドは、自動化とCI/CDパイプライン用に設計されています。`INTLAYER_PROJECT_CREDENTIALS`環境変数から認証情報を自動的に注入し、モノレポ内の複数のプロジェクトでIntlayerコマンドを実行できます。
32
+
33
+ ## 動作方法
34
+
35
+ CIコマンドは2つのモードで動作します:
36
+
37
+ 1. **単一プロジェクトモード**: 現在の作業ディレクトリが`INTLAYER_PROJECT_CREDENTIALS`内のプロジェクトパスのいずれかと一致する場合、その特定のプロジェクトに対してのみコマンドを実行します。
38
+
39
+ 2. **反復モード**: 特定のプロジェクトコンテキストが検出されない場合、すべての設定済みプロジェクトを反復処理し、それぞれに対してコマンドを実行します。
40
+
41
+ ## 環境変数
42
+
43
+ コマンドには`INTLAYER_PROJECT_CREDENTIALS`環境変数の設定が必要です。この変数には、プロジェクトパスを認証情報にマッピングするJSONオブジェクトが含まれている必要があります:
44
+
45
+ ```json
46
+ {
47
+ "packages/app": {
48
+ "clientId": "your-client-id-1",
49
+ "clientSecret": "your-client-secret-1"
50
+ },
51
+ "packages/admin": {
52
+ "clientId": "your-client-id-2",
53
+ "clientSecret": "your-client-secret-2"
54
+ }
55
+ }
56
+ ```
57
+
58
+ ## パッケージマネージャーの検出
59
+
60
+ CIコマンドは、`npm_config_user_agent`環境変数に基づいて使用されているパッケージマネージャー(npm、yarn、pnpm、またはbun)を自動的に検出し、Intlayerを実行するために適切なコマンドを使用します。
61
+
62
+ ## 引数
63
+
64
+ - **`<command...>`**: 実行するIntlayerコマンド(例:`fill`、`push`、`build`)。任意のIntlayerコマンドとその引数を渡すことができます。
65
+
66
+ > 例: `npx intlayer ci fill --verbose`
67
+ >
68
+ > 例: `npx intlayer ci push`
69
+ >
70
+ > 例: `npx intlayer ci build`
71
+
72
+ ## 例
73
+
74
+ ### 単一プロジェクトモードでコマンドを実行
75
+
76
+ `INTLAYER_PROJECT_CREDENTIALS`内のパスのいずれかと一致するプロジェクトディレクトリにいる場合:
77
+
78
+ ```bash
79
+ cd packages/app
80
+ npx intlayer ci fill
81
+ ```
82
+
83
+ これにより、`packages/app`プロジェクトの認証情報が自動的に注入されて`fill`コマンドが実行されます。
84
+
85
+ ### すべてのプロジェクトでコマンドを実行
86
+
87
+ プロジェクトパスと一致しないディレクトリにいる場合、コマンドはすべての設定済みプロジェクトを反復処理します:
88
+
89
+ ```bash
90
+ cd /path/to/monorepo
91
+ npx intlayer ci push
92
+ ```
93
+
94
+ これにより、`INTLAYER_PROJECT_CREDENTIALS`で設定された各プロジェクトに対して`push`コマンドが実行されます。
95
+
96
+ ### 追加のフラグを渡す
97
+
98
+ 基になるIntlayerコマンドに任意のフラグを渡すことができます:
99
+
100
+ ```bash
101
+ npx intlayer ci fill --verbose --mode complete
102
+ ```
103
+
104
+ ### CI/CDパイプラインで使用
105
+
106
+ CI/CD設定(例:GitHub Actions、GitLab CI)で、`INTLAYER_PROJECT_CREDENTIALS`をシークレットとして設定します:
107
+
108
+ ```yaml
109
+ # GitHub Actionsの例
110
+ env:
111
+ INTLAYER_PROJECT_CREDENTIALS: ${{ secrets.INTLAYER_PROJECT_CREDENTIALS }}
112
+
113
+ steps:
114
+ - name: 辞書を埋める
115
+ run: npx intlayer ci fill
116
+ ```
117
+
118
+ ## エラーハンドリング
119
+
120
+ - `INTLAYER_PROJECT_CREDENTIALS`が設定されていない場合、コマンドはエラーで終了します。
121
+ - `INTLAYER_PROJECT_CREDENTIALS`が有効なJSONでない場合、コマンドはエラーで終了します。
122
+ - プロジェクトパスが存在しない場合、警告とともにスキップされます。
123
+ - いずれかのプロジェクトが失敗した場合、コマンドは非ゼロのステータスコードで終了します。
124
+
125
+ ## 使用例
126
+
127
+ - **モノレポの自動化**: モノレポ内の複数のプロジェクトでIntlayerコマンドを実行
128
+ - **CI/CDパイプライン**: 継続的インテグレーションワークフローでの辞書管理の自動化
129
+ - **一括操作**: 複数のIntlayerプロジェクトに対して同じ操作を一度に実行
130
+ - **シークレット管理**: 環境変数を使用して複数のプロジェクトの認証情報を安全に管理
131
+
132
+ ## セキュリティのベストプラクティス
133
+
134
+ - CI/CDプラットフォームで`INTLAYER_PROJECT_CREDENTIALS`を暗号化されたシークレットとして保存
135
+ - 認証情報をバージョン管理にコミットしない
136
+ - 異なるデプロイ環境に対して環境固有の認証情報を使用
137
+ - 定期的に認証情報をローテーション
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2024-08-11
3
- updatedAt: 2025-12-30
3
+ updatedAt: 2026-01-06
4
4
  title: CLI
5
5
  description: Intlayer CLIを使用して多言語ウェブサイトを管理する方法を紹介します。このオンラインドキュメントの手順に従って、数分でプロジェクトをセットアップしましょう。
6
6
  keywords:
@@ -17,6 +17,9 @@ slugs:
17
17
  - concept
18
18
  - cli
19
19
  history:
20
+ - version: 7.5.11
21
+ date: 2026-01-06
22
+ changes: projects listコマンドを追加
20
23
  - version: 7.5.9
21
24
  date: 2025-12-30
22
25
  changes: initコマンドを追加
@@ -119,6 +122,7 @@ Intlayer は複数の設定ファイル形式をサポートしています:
119
122
  - **[辞書のビルド](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/cli/build.md)** - コンテンツ宣言ファイルから辞書をビルドします
120
123
  - **[辞書の監視](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/cli/watch.md)** - 変更を監視し、自動的に辞書をビルドします
121
124
  - **[CLI バージョンの確認](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/cli/version.md)** - インストールされている Intlayer CLI のバージョンを確認します
125
+ - **[プロジェクトの一覧表示](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/cli/list_projects.md)** - ディレクトリまたはgitリポジトリ内のすべてのIntlayerプロジェクトを一覧表示します
122
126
 
123
127
  ### 辞書管理
124
128
 
@@ -166,6 +170,7 @@ Intlayer は複数の設定ファイル形式をサポートしています:
166
170
  "intlayer:list": "npx intlayer content list",
167
171
  "intlayer:test": "npx intlayer content test",
168
172
  "intlayer:transform": "npx intlayer transform",
173
+ "intlayer:projects": "npx intlayer projects list",
169
174
  "intlayer:doc:translate": "npx intlayer doc translate",
170
175
  "intlayer:doc:review": "npx intlayer doc review"
171
176
  }
@@ -175,3 +180,4 @@ Intlayer は複数の設定ファイル形式をサポートしています:
175
180
  >
176
181
  > - `npx intlayer list` は `npx intlayer content list` の代わりに使用可能
177
182
  > - `npx intlayer test` は `npx intlayer content test` の代わりに使用可能
183
+ > - `npx intlayer projects-list` または `npx intlayer pl` は `npx intlayer projects list` の代わりに使用可能