@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,480 @@
1
+ ---
2
+ createdAt: 2025-12-30
3
+ updatedAt: 2025-12-30
4
+ title: Cómo traducir tu backend con Fastify – guía i18n 2026
5
+ description: Descubre cómo hacer tu backend con Fastify multilingüe. Sigue la documentación para internacionalizar (i18n) y traducirlo.
6
+ keywords:
7
+ - Internacionalización
8
+ - Documentación
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: Agregar comando init
22
+ - version: 7.6.0
23
+ date: 2025-12-31
24
+ changes: Historial inicial
25
+ ---
26
+
27
+ # Traduce tu backend de Fastify usando Intlayer | Internacionalización (i18n)
28
+
29
+ `fastify-intlayer` es un potente plugin de internacionalización (i18n) para aplicaciones Fastify, diseñado para hacer que tus servicios backend sean accesibles globalmente proporcionando respuestas localizadas basadas en las preferencias del cliente.
30
+
31
+ ### Casos de uso prácticos
32
+
33
+ - **Mostrar errores del backend en el idioma del usuario**: Cuando ocurre un error, mostrar mensajes en la lengua nativa del usuario mejora la comprensión y reduce la frustración. Esto es especialmente útil para mensajes de error dinámicos que podrían mostrarse en componentes frontend como toasts o modales.
34
+
35
+ `fastify-intlayer` es un potente plugin de internacionalización (i18n) para aplicaciones Fastify, diseñado para hacer que tus servicios backend sean accesibles globalmente proporcionando respuestas localizadas según las preferencias del cliente.
36
+
37
+ ### Casos de uso prácticos
38
+
39
+ - **Mostrar errores del backend en el idioma del usuario**: Cuando ocurre un error, mostrar mensajes en la lengua nativa del usuario mejora la comprensión y reduce la frustración. Esto es especialmente útil para mensajes de error dinámicos que podrían mostrarse en componentes front-end como toasts o modals.
40
+ - **Recuperar contenido multilingüe**: Para aplicaciones que obtienen contenido de una base de datos, la internacionalización garantiza que puedas servir ese contenido en varios idiomas. Esto es crucial para plataformas como sitios de comercio electrónico o sistemas de gestión de contenido que necesitan mostrar descripciones de productos, artículos y otros contenidos en el idioma preferido por el usuario.
41
+ - **Enviar correos electrónicos multilingües**: Ya sean correos transaccionales, campañas de marketing o notificaciones, enviar correos en el idioma del destinatario puede aumentar significativamente el compromiso y la efectividad.
42
+ - **Notificaciones push multilingües**: Para aplicaciones móviles, enviar notificaciones push en el idioma preferido del usuario puede mejorar la interacción y la retención. Este toque personal puede hacer que las notificaciones se sientan más relevantes y accionables.
43
+ - **Otras comunicaciones**: Cualquier forma de comunicación desde el backend, como mensajes SMS, alertas del sistema o actualizaciones de la interfaz de usuario, se beneficia de estar en el idioma del usuario, garantizando claridad y mejorando la experiencia de usuario en general.
44
+
45
+ Al internacionalizar el backend, tu aplicación no solo respeta las diferencias culturales, sino que también se alinea mejor con las necesidades del mercado global, convirtiéndolo en un paso clave para escalar tus servicios a nivel mundial.
46
+
47
+ ## Primeros pasos
48
+
49
+ ### Instalación
50
+
51
+ Para comenzar a usar `fastify-intlayer`, instala el paquete usando npm:
52
+
53
+ ```bash packageManager="npm"
54
+ npm install intlayer fastify-intlayer
55
+ npx intlayer init
56
+
57
+ ```
58
+
59
+ ```bash packageManager="pnpm"
60
+ pnpm add intlayer fastify-intlayer
61
+ pnpm intlayer init
62
+
63
+ ```
64
+
65
+ ```bash packageManager="yarn"
66
+ yarn add intlayer fastify-intlayer
67
+ yarn intlayer init
68
+
69
+ ```
70
+
71
+ ```bash packageManager="bun"
72
+ bun add intlayer fastify-intlayer
73
+ bunx intlayer init
74
+
75
+ ```
76
+
77
+ ### Configuración
78
+
79
+ Configura los ajustes de internacionalización creando un archivo `intlayer.config.ts` en la raíz de tu proyecto:
80
+
81
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
82
+ import { Locales, type IntlayerConfig } from "intlayer";
83
+
84
+ const config: IntlayerConfig = {
85
+ internationalization: {
86
+ locales: [
87
+ Locales.ENGLISH,
88
+ Locales.FRENCH,
89
+ Locales.SPANISH_MEXICO,
90
+ Locales.SPANISH_SPAIN,
91
+ ],
92
+ defaultLocale: Locales.ENGLISH,
93
+ },
94
+ };
95
+
96
+ export default config;
97
+ defaultLocale: Locales.ENGLISH,
98
+ },
99
+ };
100
+
101
+ export default config;
102
+ ```
103
+
104
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
105
+ import { Locales } from "intlayer";
106
+
107
+ /** @type {import('intlayer').IntlayerConfig} */
108
+ const config = {
109
+ internationalization: {
110
+ locales: [
111
+ Locales.ENGLISH,
112
+ Locales.FRENCH,
113
+ Locales.SPANISH_MEXICO,
114
+ Locales.SPANISH_SPAIN,
115
+ ],
116
+ defaultLocale: Locales.ENGLISH,
117
+ },
118
+ };
119
+
120
+ export default config;
121
+ ```
122
+
123
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
124
+ const { Locales } = require("intlayer");
125
+
126
+ /** @type {import('intlayer').IntlayerConfig} */
127
+ const config = {
128
+ internationalization: {
129
+ locales: [
130
+ Locales.ENGLISH,
131
+ Locales.FRENCH,
132
+ Locales.SPANISH_MEXICO,
133
+ Locales.SPANISH_SPAIN,
134
+ ],
135
+ defaultLocale: Locales.ENGLISH,
136
+ },
137
+ };
138
+
139
+ module.exports = config;
140
+ ```
141
+
142
+ ### Declara tu contenido
143
+
144
+ Crea y gestiona tus declaraciones de contenido para almacenar traducciones:
145
+
146
+ ```typescript fileName="src/index.content.ts" contentDeclarationFormat="typescript"
147
+ import { t, type Dictionary } from "intlayer";
148
+
149
+ const indexContent = {
150
+ key: "index",
151
+ content: {
152
+ exampleOfContent: t({
153
+ es: "Ejemplo de contenido devuelto en español",
154
+ en: "Example of returned content in English",
155
+ fr: "Exemple de contenu renvoyé en français",
156
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
157
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
158
+ }),
159
+ },
160
+ } satisfies Dictionary;
161
+
162
+ export default indexContent;
163
+ ```
164
+
165
+ ```javascript fileName="src/index.content.mjs" contentDeclarationFormat="esm"
166
+ import { t } from "intlayer";
167
+
168
+ /** @type {import('intlayer').Dictionary} */
169
+ const indexContent = {
170
+ key: "index",
171
+ content: {
172
+ exampleOfContent: t({
173
+ es: "Ejemplo de contenido devuelto en español",
174
+ en: "Example of returned content in English",
175
+ fr: "Exemple de contenu renvoyé en français",
176
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
177
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
178
+ }),
179
+ },
180
+ };
181
+
182
+ export default indexContent;
183
+ ```
184
+
185
+ ```javascript fileName="src/index.content.cjs" contentDeclarationFormat="commonjs"
186
+ const { t } = require("intlayer");
187
+
188
+ /** @type {import('intlayer').Dictionary} */
189
+ const indexContent = {
190
+ key: "index",
191
+ content: {
192
+ exampleOfContent: t({
193
+ es: "Ejemplo de contenido devuelto en español",
194
+ en: "Example of returned content in English",
195
+ fr: "Exemple de contenu renvoyé en français",
196
+ "es": "Ejemplo de contenido devuelto en español",
197
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
198
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
199
+ }),
200
+ },
201
+ };
202
+
203
+ module.exports = indexContent;
204
+ ```
205
+
206
+ ```json fileName="src/index.content.json" contentDeclarationFormat="json"
207
+ {
208
+ "$schema": "https://intlayer.org/schema.json",
209
+ "key": "index",
210
+ "content": {
211
+ "exampleOfContent": {
212
+ "nodeType": "translation",
213
+ "translation": {
214
+ "es": "Ejemplo de contenido devuelto en español",
215
+ "en": "Example of returned content in English",
216
+ "fr": "Exemple de contenu renvoyé en français",
217
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
218
+ "es-MX": "Ejemplo de contenido devuelto en español (México)"
219
+ }
220
+ }
221
+ }
222
+ }
223
+ ```
224
+
225
+ > Tus declaraciones de contenido pueden definirse en cualquier parte de tu aplicación siempre que se incluyan en el directorio `contentDir` (por defecto, `./src`). Y que coincidan con la extensión de archivo de declaración de contenido (por defecto, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
226
+
227
+ > Para más detalles, consulta la [documentación de declaración de contenido](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/dictionary/content_file.md).
228
+
229
+ ### Configuración de la aplicación Fastify
230
+
231
+ Configura tu aplicación Fastify para usar `fastify-intlayer`:
232
+
233
+ ```typescript fileName="src/index.ts" codeFormat="typescript"
234
+ import Fastify from "fastify";
235
+ import { intlayer, t, getDictionary, getIntlayer } from "fastify-intlayer";
236
+ import dictionaryExample from "./index.content";
237
+
238
+ const fastify = Fastify({ logger: true });
239
+
240
+ // Cargar el plugin de internacionalización
241
+ await fastify.register(intlayer);
242
+
243
+ // Rutas
244
+ fastify.get("/t_example", async (_req, reply) => {
245
+ return t({
246
+ es: "Ejemplo de contenido devuelto en español",
247
+ en: "Example of returned content in English",
248
+ fr: "Exemple de contenu renvoyé en français",
249
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
250
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
251
+ });
252
+ });
253
+
254
+ fastify.get("/getIntlayer_example", async (_req, reply) => {
255
+ return getIntlayer("index").exampleOfContent;
256
+ });
257
+
258
+ fastify.get("/getDictionary_example", async (_req, reply) => {
259
+ return getDictionary(dictionaryExample).exampleOfContent;
260
+ });
261
+
262
+ // Iniciar servidor
263
+ const start = async () => {
264
+ try {
265
+ await fastify.listen({ port: 3000 });
266
+ } catch (err) {
267
+ fastify.log.error(err);
268
+ process.exit(1);
269
+ }
270
+ };
271
+
272
+ start();
273
+ ```
274
+
275
+ ```javascript fileName="src/index.mjs" codeFormat="esm"
276
+ import Fastify from "fastify";
277
+ import { intlayer, t, getDictionary, getIntlayer } from "fastify-intlayer";
278
+ import dictionaryExample from "./index.content";
279
+
280
+ const fastify = Fastify({ logger: true });
281
+
282
+ // Cargar plugin de internacionalización
283
+ await fastify.register(intlayer);
284
+
285
+ // Rutas
286
+ fastify.get("/t_example", async (_req, reply) => {
287
+ return t({
288
+ es: "Ejemplo de contenido devuelto en español",
289
+ en: "Example of returned content in English",
290
+ fr: "Exemple de contenu renvoyé en français",
291
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
292
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
293
+ });
294
+ });
295
+
296
+ fastify.get("/getIntlayer_example", async (_req, reply) => {
297
+ return getIntlayer("index").exampleOfContent;
298
+ });
299
+
300
+ fastify.get("/getDictionary_example", async (_req, reply) => {
301
+ return getDictionary(dictionaryExample).exampleOfContent;
302
+ });
303
+
304
+ // Iniciar servidor
305
+ const start = async () => {
306
+ try {
307
+ await fastify.listen({ port: 3000 });
308
+ } catch (err) {
309
+ fastify.log.error(err);
310
+ process.exit(1);
311
+ }
312
+ };
313
+
314
+ start();
315
+ ```
316
+
317
+ ```javascript fileName="src/index.cjs" codeFormat="commonjs"
318
+ const Fastify = require("fastify");
319
+ const { intlayer, t, getDictionary, getIntlayer } = require("fastify-intlayer");
320
+ const dictionaryExample = require("./index.content");
321
+
322
+ const fastify = Fastify({ logger: true });
323
+
324
+ // Envoltorio para iniciar el servidor con async/await
325
+ const start = async () => {
326
+ try {
327
+ // Cargar el plugin de internacionalización
328
+ await fastify.register(intlayer);
329
+
330
+ // Rutas
331
+ fastify.get("/t_example", async (_req, reply) => {
332
+ return t({
333
+ es: "Ejemplo de contenido devuelto en español",
334
+ en: "Example of returned content in English",
335
+ fr: "Exemple de contenu renvoyé en français",
336
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
337
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
338
+ });
339
+ });
340
+
341
+ fastify.get("/getIntlayer_example", async (_req, reply) => {
342
+ return getIntlayer("index").exampleOfContent;
343
+ });
344
+
345
+ fastify.get("/getDictionary_example", async (_req, reply) => {
346
+ return getDictionary(dictionaryExample).exampleOfContent;
347
+ });
348
+
349
+ await fastify.listen({ port: 3000 });
350
+ } catch (err) {
351
+ fastify.log.error(err);
352
+ process.exit(1);
353
+ }
354
+ };
355
+
356
+ start();
357
+ ```
358
+
359
+ ### Compatibilidad
360
+
361
+ `fastify-intlayer` es completamente compatible con:
362
+
363
+ - [`react-intlayer`](<https://www.google.com/search?q=%5Bhttps://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/react-intlayer/index.md%5D(https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/react-intlayer/index.md)>) para aplicaciones React
364
+ - [`next-intlayer`](<https://www.google.com/search?q=%5Bhttps://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/next-intlayer/index.md%5D(https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/next-intlayer/index.md)>) para aplicaciones Next.js
365
+
366
+ - [`react-intlayer`](<https://www.google.com/search?q=%5Bhttps://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/react-intlayer/index.md%5D(https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/react-intlayer/index.md)>) para aplicaciones React
367
+ - [`next-intlayer`](<https://www.google.com/search?q=%5Bhttps://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/next-intlayer/index.md%5D(https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/next-intlayer/index.md)>) para aplicaciones Next.js
368
+ - [`vite-intlayer`](<https://www.google.com/search?q=%5Bhttps://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/vite-intlayer/index.md%5D(https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/packages/vite-intlayer/index.md)>) para aplicaciones Vite
369
+
370
+ También funciona sin problemas con cualquier solución de internacionalización en diversos entornos, incluidos navegadores y solicitudes API. Puedes personalizar el middleware para detectar la locale a través de headers o cookies:
371
+
372
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
373
+ import { Locales, type IntlayerConfig } from "intlayer";
374
+
375
+ const config: IntlayerConfig = {
376
+ // ... Otras opciones de configuración
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.mjs" codeFormat="esm"
387
+ import { Locales } from "intlayer";
388
+
389
+ /** @type {import('intlayer').IntlayerConfig} */
390
+ const config = {
391
+ // ... Otras opciones de configuración
392
+ middleware: {
393
+ headerName: "my-locale-header",
394
+ cookieName: "my-locale-cookie",
395
+ },
396
+ };
397
+
398
+ export default config;
399
+ ```
400
+
401
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
402
+ const { Locales } = require("intlayer");
403
+
404
+ /** @type {import('intlayer').IntlayerConfig} */
405
+ const config = {
406
+ // ... Otras opciones de configuración
407
+ middleware: {
408
+ headerName: "my-locale-header",
409
+ cookieName: "my-locale-cookie",
410
+ },
411
+ };
412
+
413
+ module.exports = config;
414
+ ```
415
+
416
+ Por defecto, `fastify-intlayer` interpretará la cabecera `Accept-Language` para determinar el idioma preferido del cliente.
417
+
418
+ > Para más información sobre la configuración y temas avanzados, visita nuestra [documentación](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/configuration.md).
419
+
420
+ ### Configurar TypeScript
421
+
422
+ `fastify-intlayer` aprovecha las robustas capacidades de TypeScript para mejorar el proceso de internacionalización. El tipado estático de TypeScript garantiza que cada clave de traducción esté incluida, reduciendo el riesgo de traducciones faltantes y mejorando la mantenibilidad.
423
+
424
+ Asegúrate de que los tipos autogenerados (por defecto en ./types/intlayer.d.ts) estén incluidos en tu archivo tsconfig.json.
425
+
426
+ ```json5 fileName="tsconfig.json"
427
+ {
428
+ // ... Tus configuraciones existentes de TypeScript
429
+ "include": [
430
+ // ... Tus configuraciones existentes de TypeScript
431
+ ".intlayer/**/*.ts", // Incluir los tipos autogenerados
432
+ ],
433
+ }
434
+ ```
435
+
436
+ ### Extensión de VS Code
437
+
438
+ Para mejorar tu experiencia de desarrollo con Intlayer, puedes instalar la extensión oficial **Intlayer VS Code Extension**.
439
+
440
+ [Instalar desde el Marketplace de VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
441
+
442
+ Esta extensión proporciona:
443
+
444
+ - **Autocompletion** para las claves de traducción.
445
+ - **Detección de errores en tiempo real** para traducciones faltantes.
446
+ - **Vistas previas en línea** del contenido traducido.
447
+ - **Acciones rápidas** para crear y actualizar traducciones fácilmente.
448
+
449
+ Para más detalles sobre cómo usar la extensión, consulta la [documentación de la Extensión de VS Code de Intlayer](https://intlayer.org/doc/vs-code-extension).
450
+
451
+ ### Configuración de Git
452
+
453
+ Se recomienda ignorar los archivos generados por Intlayer. Esto te permite evitar comprometerlos en tu repositorio Git.
454
+
455
+ ### Extensión de VS Code
456
+
457
+ Para mejorar tu experiencia de desarrollo con Intlayer, puedes instalar la **Extensión oficial de Intlayer para VS Code**.
458
+
459
+ [Instalar desde el Marketplace de VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
460
+
461
+ Esta extensión proporciona:
462
+
463
+ - **Autocompletado** para claves de traducción.
464
+ - **Detección de errores en tiempo real** para traducciones faltantes.
465
+ - **Previsualizaciones en línea** del contenido traducido.
466
+ - **Acciones rápidas** para crear y actualizar traducciones fácilmente.
467
+
468
+ Para más detalles sobre cómo usar la extensión, consulta la [documentación de la Extensión Intlayer para VS Code](https://intlayer.org/doc/vs-code-extension).
469
+
470
+ ### Configuración de Git
471
+
472
+ Se recomienda ignorar los archivos generados por Intlayer. Esto te permite evitar confirmarlos en tu repositorio Git.
473
+
474
+ Para ello, puedes agregar las siguientes instrucciones a tu archivo `.gitignore`:
475
+
476
+ ```plaintext fileName=".gitignore"
477
+ # Ignorar los archivos generados por Intlayer
478
+ .intlayer
479
+
480
+ ```
package/docs/es/readme.md CHANGED
@@ -50,7 +50,7 @@ Con **archivos de contenido por localidad**, **autocompletado en TypeScript**, *
50
50
  | Característica | Descripción |
51
51
  | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
52
  | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Compatibilidad entre Frameworks**<br><br>Intlayer es compatible con todos los principales frameworks y bibliotecas, incluyendo Next.js, React, Vite, Vue.js, Nuxt, Preact, Express y más. |
53
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.png?raw=true" alt="Feature" width="700"> | **Gestión de Contenido Potenciada por JavaScript**<br><br>Aprovecha la flexibilidad de JavaScript para definir y gestionar tu contenido de manera eficiente. <br><br> - [Declaración de contenido](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"> | **Gestión de Contenido Potenciada por JavaScript**<br><br>Aprovecha la flexibilidad de JavaScript para definir y gestionar tu contenido de manera eficiente. <br><br> - [Declaración de contenido](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"> | **Archivo de Declaración de Contenido por Localidad**<br><br>Acelera tu desarrollo declarando tu contenido una vez, antes de la generación automática.<br><br> - [Archivo de Declaración de Contenido por Localidad](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"> | **Entorno con Tipos Seguros**<br><br>Aprovecha TypeScript para asegurar que tus definiciones de contenido y código estén libres de errores, además de beneficiarte de la autocompletación en el IDE.<br><br> - [Configuración de 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"> | **Configuración Simplificada**<br><br>Ponte en marcha rápidamente con una configuración mínima. Ajusta fácilmente los ajustes para internacionalización, enrutamiento, IA, compilación y manejo de contenido.<br><br> - [Explora la integración 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: Commande CI
5
+ description: Apprenez à utiliser la commande Intlayer CI pour exécuter des commandes Intlayer avec des identifiants auto-injectés dans les pipelines CI/CD et les monorepos.
6
+ keywords:
7
+ - CI
8
+ - CI/CD
9
+ - Automatisation
10
+ - Monorepo
11
+ - Identifiants
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: Ajouter la commande CI
23
+ ---
24
+
25
+ # Commande CI
26
+
27
+ ```bash
28
+ npx intlayer ci <command...>
29
+ ```
30
+
31
+ La commande CI est conçue pour l'automatisation et les pipelines CI/CD. Elle injecte automatiquement les identifiants à partir de la variable d'environnement `INTLAYER_PROJECT_CREDENTIALS` et peut exécuter des commandes Intlayer sur plusieurs projets dans un monorepo.
32
+
33
+ ## Fonctionnement
34
+
35
+ La commande CI fonctionne en deux modes :
36
+
37
+ 1. **Mode projet unique** : Si le répertoire de travail actuel correspond à l'un des chemins de projet dans `INTLAYER_PROJECT_CREDENTIALS`, elle exécute la commande uniquement pour ce projet spécifique.
38
+
39
+ 2. **Mode itération** : Si aucun contexte de projet spécifique n'est détecté, elle itère sur tous les projets configurés et exécute la commande pour chacun d'eux.
40
+
41
+ ## Variable d'environnement
42
+
43
+ La commande nécessite que la variable d'environnement `INTLAYER_PROJECT_CREDENTIALS` soit définie. Cette variable doit contenir un objet JSON mappant les chemins de projet à leurs identifiants :
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
+ ## Détection du gestionnaire de paquets
59
+
60
+ La commande CI détecte automatiquement le gestionnaire de paquets utilisé (npm, yarn, pnpm ou bun) en fonction de la variable d'environnement `npm_config_user_agent` et utilise la commande appropriée pour exécuter Intlayer.
61
+
62
+ ## Arguments
63
+
64
+ - **`<command...>`** : La commande Intlayer à exécuter (par exemple, `fill`, `push`, `build`). Vous pouvez passer n'importe quelle commande Intlayer et ses arguments.
65
+
66
+ > Exemple : `npx intlayer ci fill --verbose`
67
+ >
68
+ > Exemple : `npx intlayer ci push`
69
+ >
70
+ > Exemple : `npx intlayer ci build`
71
+
72
+ ## Exemples
73
+
74
+ ### Exécuter une commande en mode projet unique
75
+
76
+ Si vous êtes dans un répertoire de projet qui correspond à l'un des chemins dans `INTLAYER_PROJECT_CREDENTIALS` :
77
+
78
+ ```bash
79
+ cd packages/app
80
+ npx intlayer ci fill
81
+ ```
82
+
83
+ Cela exécutera la commande `fill` avec les identifiants automatiquement injectés pour le projet `packages/app`.
84
+
85
+ ### Exécuter une commande sur tous les projets
86
+
87
+ Si vous êtes dans un répertoire qui ne correspond à aucun chemin de projet, la commande itérera sur tous les projets configurés :
88
+
89
+ ```bash
90
+ cd /path/to/monorepo
91
+ npx intlayer ci push
92
+ ```
93
+
94
+ Cela exécutera la commande `push` pour chaque projet configuré dans `INTLAYER_PROJECT_CREDENTIALS`.
95
+
96
+ ### Passer des drapeaux supplémentaires
97
+
98
+ Vous pouvez passer n'importe quels drapeaux à la commande Intlayer sous-jacente :
99
+
100
+ ```bash
101
+ npx intlayer ci fill --verbose --mode complete
102
+ ```
103
+
104
+ ### Utilisation dans les pipelines CI/CD
105
+
106
+ Dans votre configuration CI/CD (par exemple, GitHub Actions, GitLab CI), définissez `INTLAYER_PROJECT_CREDENTIALS` comme secret :
107
+
108
+ ```yaml
109
+ # Exemple GitHub Actions
110
+ env:
111
+ INTLAYER_PROJECT_CREDENTIALS: ${{ secrets.INTLAYER_PROJECT_CREDENTIALS }}
112
+
113
+ steps:
114
+ - name: Remplir les dictionnaires
115
+ run: npx intlayer ci fill
116
+ ```
117
+
118
+ ## Gestion des erreurs
119
+
120
+ - Si `INTLAYER_PROJECT_CREDENTIALS` n'est pas définie, la commande se terminera avec une erreur.
121
+ - Si `INTLAYER_PROJECT_CREDENTIALS` n'est pas un JSON valide, la commande se terminera avec une erreur.
122
+ - Si un chemin de projet n'existe pas, il sera ignoré avec un avertissement.
123
+ - Si un projet échoue, la commande se terminera avec un code de statut non nul.
124
+
125
+ ## Cas d'utilisation
126
+
127
+ - **Automatisation de monorepo** : Exécuter des commandes Intlayer sur plusieurs projets dans un monorepo
128
+ - **Pipelines CI/CD** : Automatiser la gestion des dictionnaires dans les workflows d'intégration continue
129
+ - **Opérations en masse** : Effectuer la même opération sur plusieurs projets Intlayer à la fois
130
+ - **Gestion des secrets** : Gérer de manière sécurisée les identifiants pour plusieurs projets en utilisant des variables d'environnement
131
+
132
+ ## Bonnes pratiques de sécurité
133
+
134
+ - Stockez `INTLAYER_PROJECT_CREDENTIALS` comme secrets chiffrés dans votre plateforme CI/CD
135
+ - Ne commitez jamais les identifiants dans le contrôle de version
136
+ - Utilisez des identifiants spécifiques à l'environnement pour différents environnements de déploiement
137
+ - Faites tourner les identifiants régulièrement
@@ -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: Découvrez comment utiliser le CLI Intlayer pour gérer votre site web multilingue. Suivez les étapes de cette documentation en ligne pour configurer votre projet en quelques minutes.
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: Ajout de la commande projects list
20
23
  - version: 7.5.9
21
24
  date: 2025-12-30
22
25
  changes: Ajout de la commande init
@@ -119,6 +122,7 @@ Pour voir comment configurer les locales disponibles, ou d'autres paramètres, r
119
122
  - **[Construire les dictionnaires](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/cli/build.md)** - Construisez vos dictionnaires à partir des fichiers de déclaration de contenu
120
123
  - **[Surveiller les dictionnaires](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/cli/watch.md)** - Surveillez les changements et construisez automatiquement les dictionnaires
121
124
  - **[Vérifier la version CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/cli/version.md)** - Vérifiez la version installée de la CLI Intlayer
125
+ - **[Lister les projets](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/cli/list_projects.md)** - Listez tous les projets Intlayer dans un répertoire ou un dépôt git
122
126
 
123
127
  ### Gestion des dictionnaires
124
128
 
@@ -166,6 +170,7 @@ Pour voir comment configurer les locales disponibles, ou d'autres paramètres, r
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 @@ Pour voir comment configurer les locales disponibles, ou d'autres paramètres, r
175
180
  >
176
181
  > - `npx intlayer list` au lieu de `npx intlayer content list`
177
182
  > - `npx intlayer test` au lieu de `npx intlayer content test`
183
+ > - `npx intlayer projects-list` ou `npx intlayer pl` au lieu de `npx intlayer projects list`