@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,731 @@
1
+ # Comenzando con la Internacionalización (i18n) con Intlayer y Nuxt
2
+
3
+ Consulta [Plantilla de Aplicación](https://github.com/aymericzip/intlayer-nuxt-template) en GitHub.
4
+
5
+ ## ¿Qué es Intlayer?
6
+
7
+ **Intlayer** es una biblioteca innovadora y de código abierto para la internacionalización (i18n) diseñada para simplificar el soporte multilingüe en aplicaciones web modernas.
8
+
9
+ Con Intlayer, puedes:
10
+
11
+ - **Gestionar traducciones fácilmente** utilizando diccionarios declarativos a nivel de componente.
12
+ - **Localizar dinámicamente metadatos**, rutas y contenido.
13
+ - **Garantizar soporte para TypeScript** con tipos autogenerados, mejorando la autocompletación y la detección de errores.
14
+ - **Beneficiarte de características avanzadas**, como la detección y el cambio dinámico de locales.
15
+
16
+ ---
17
+
18
+ ## Guía Paso a Paso para Configurar Intlayer en una Aplicación Nuxt
19
+
20
+ ### Paso 1: Instalar Dependencias
21
+
22
+ Instala los paquetes necesarios usando 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
+ El paquete principal que proporciona herramientas de internacionalización para la gestión de configuración, traducción, [declaración de contenido](https://github.com/aymericzip/intlayer/blob/main/docs/es/dictionary/get_started.md), transpilación y [comandos CLI](https://github.com/aymericzip/intlayer/blob/main/docs/es/intlayer_cli.md).
42
+
43
+ - **vue-intlayer**
44
+ El paquete que integra Intlayer con aplicaciones Vue. Proporciona composables para los componentes Vue.
45
+
46
+ - **nuxt-intlayer**
47
+ El módulo de Nuxt que integra Intlayer con aplicaciones Nuxt. Proporciona configuración automática, middleware para la detección de locales, gestión de cookies y redirección de URLs.
48
+
49
+ ### Paso 2: Configuración de tu proyecto
50
+
51
+ Crea un archivo de configuración para configurar los idiomas de tu aplicación:
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
+ // Tus otros locales
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
+ // Tus otros locales
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
+ // Tus otros locales
101
+ ],
102
+ defaultLocale: Locales.ENGLISH,
103
+ },
104
+ };
105
+
106
+ module.exports = config;
107
+ ```
108
+
109
+ > A través de este archivo de configuración, puedes configurar URLs localizadas, redirección de middleware, nombres de cookies, la ubicación y extensión de tus declaraciones de contenido, desactivar los registros de Intlayer en la consola y más. Para una lista completa de parámetros disponibles, consulta la [documentación de configuración](https://github.com/aymericzip/intlayer/blob/main/docs/es/configuration.md).
110
+
111
+ ### Paso 3: Integrar Intlayer en tu Configuración de Nuxt
112
+
113
+ Agrega el módulo intlayer a tu configuración de Nuxt:
114
+
115
+ ```typescript fileName="nuxt.config.ts"
116
+ import { defineNuxtConfig } from "nuxt/config";
117
+
118
+ export default defineNuxtConfig({
119
+ // ... Tu configuración existente de Nuxt
120
+ modules: ["nuxt-intlayer"],
121
+ });
122
+ ```
123
+
124
+ > El módulo `nuxt-intlayer` maneja automáticamente la integración de Intlayer con Nuxt. Configura la construcción de declaraciones de contenido, monitorea archivos en modo de desarrollo, proporciona middleware para la detección de locales y gestiona el enrutamiento localizado.
125
+
126
+ ### Paso 4: Declarar tu Contenido
127
+
128
+ Crea y gestiona tus declaraciones de contenido para almacenar traducciones:
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({ es: "el recuento es ", en: "count is ", fr: "le compte est " }),
137
+ edit: t({
138
+ es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
139
+ en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
140
+ fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
141
+ }),
142
+ checkOut: t({ es: "Compruebe ", en: "Check out ", fr: "Vérifiez " }),
143
+ nuxtIntlayer: t({
144
+ es: "Documentación de Nuxt Intlayer",
145
+ en: "Nuxt Intlayer documentation",
146
+ fr: "Documentation de Nuxt Intlayer",
147
+ }),
148
+ learnMore: t({
149
+ es: "Aprenda más sobre Nuxt en la ",
150
+ en: "Learn more about Nuxt in the ",
151
+ fr: "En savoir plus sur Nuxt dans la ",
152
+ }),
153
+ nuxtDocs: t({
154
+ es: "Documentación de Nuxt",
155
+ en: "Nuxt Documentation",
156
+ fr: "Documentation Nuxt",
157
+ }),
158
+ readTheDocs: t({
159
+ es: "Haga clic en el logotipo de Nuxt para obtener más información",
160
+ en: "Click on the Nuxt logo to learn more",
161
+ fr: "Cliquez sur le logo Nuxt pour en savoir plus",
162
+ }),
163
+ },
164
+ } satisfies Dictionary;
165
+
166
+ export default helloWorldContent;
167
+ ```
168
+
169
+ ```javascript fileName="components/helloWorld.content.mjs" contentDeclarationFormat="esm"
170
+ import { t } from "intlayer";
171
+
172
+ /** @type {import('intlayer').Dictionary} */
173
+ const helloWorldContent = {
174
+ key: "helloworld",
175
+ content: {
176
+ count: t({ es: "el recuento es ", en: "count is ", fr: "le compte est " }),
177
+ edit: t({
178
+ es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
179
+ en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
180
+ fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
181
+ }),
182
+ checkOut: t({ es: "Compruebe ", en: "Check out ", fr: "Vérifiez " }),
183
+ nuxtIntlayer: t({
184
+ es: "Documentación de Nuxt Intlayer",
185
+ en: "Nuxt Intlayer documentation",
186
+ fr: "Documentation de Nuxt Intlayer",
187
+ }),
188
+ learnMore: t({
189
+ es: "Aprenda más sobre Nuxt en la ",
190
+ en: "Learn more about Nuxt in the ",
191
+ fr: "En savoir plus sur Nuxt dans la ",
192
+ }),
193
+ nuxtDocs: t({
194
+ es: "Documentación de Nuxt",
195
+ en: "Nuxt Documentation",
196
+ fr: "Documentation Nuxt",
197
+ }),
198
+ readTheDocs: t({
199
+ es: "Haga clic en el logotipo de Nuxt para obtener más información",
200
+ en: "Click on the Nuxt logo to learn more",
201
+ fr: "Cliquez sur le logo Nuxt pour en savoir plus",
202
+ }),
203
+ },
204
+ };
205
+
206
+ export default helloWorldContent;
207
+ ```
208
+
209
+ ```javascript fileName="components/helloWorld.content.cjs" contentDeclarationFormat="commonjs"
210
+ const { t } = require("intlayer");
211
+
212
+ /** @type {import('intlayer').Dictionary} */
213
+ const helloWorldContent = {
214
+ key: "helloworld",
215
+ content: {
216
+ count: t({ es: "el recuento es ", en: "count is ", fr: "le compte est " }),
217
+ edit: t({
218
+ es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
219
+ en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
220
+ fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
221
+ }),
222
+ checkOut: t({ es: "Compruebe ", en: "Check out ", fr: "Vérifiez " }),
223
+ nuxtIntlayer: t({
224
+ es: "Documentación de Nuxt Intlayer",
225
+ en: "Nuxt Intlayer documentation",
226
+ fr: "Documentation de Nuxt Intlayer",
227
+ }),
228
+ learnMore: t({
229
+ es: "Aprenda más sobre Nuxt en la ",
230
+ en: "Learn more about Nuxt in the ",
231
+ fr: "En savoir plus sur Nuxt dans la ",
232
+ }),
233
+ nuxtDocs: t({
234
+ es: "Documentación de Nuxt",
235
+ en: "Nuxt Documentation",
236
+ fr: "Documentation Nuxt",
237
+ }),
238
+ readTheDocs: t({
239
+ es: "Haga clic en el logotipo de Nuxt para obtener más información",
240
+ en: "Click on the Nuxt logo to learn more",
241
+ fr: "Cliquez sur le logo Nuxt pour en savoir plus",
242
+ }),
243
+ },
244
+ };
245
+
246
+ module.exports = helloWorldContent;
247
+ ```
248
+
249
+ ```json fileName="components/helloWorld.content.json" contentDeclarationFormat="json"
250
+ {
251
+ "$schema": "https://intlayer.org/schema.json",
252
+ "key": "helloworld",
253
+ "content": {
254
+ "count": {
255
+ "nodeType": "translation",
256
+ "translation": {
257
+ "en": "count is ",
258
+ "fr": "le compte est ",
259
+ "es": "el recuento es "
260
+ }
261
+ },
262
+ "edit": {
263
+ "nodeType": "translation",
264
+ "translation": {
265
+ "en": "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
266
+ "fr": "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
267
+ "es": "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR"
268
+ }
269
+ },
270
+ "checkOut": {
271
+ "nodeType": "translation",
272
+ "translation": {
273
+ "en": "Check out ",
274
+ "fr": "Vérifiez ",
275
+ "es": "Compruebe "
276
+ }
277
+ },
278
+ "nuxtIntlayer": {
279
+ "nodeType": "translation",
280
+ "translation": {
281
+ "en": "Nuxt Intlayer documentation",
282
+ "fr": "Documentation de Nuxt Intlayer",
283
+ "es": "Documentación de Nuxt Intlayer"
284
+ }
285
+ },
286
+ "learnMore": {
287
+ "nodeType": "translation",
288
+ "translation": {
289
+ "en": "Learn more about Nuxt in the ",
290
+ "fr": "En savoir plus sur Nuxt dans la ",
291
+ "es": "Aprenda más sobre Nuxt en la "
292
+ }
293
+ },
294
+ "nuxtDocs": {
295
+ "nodeType": "translation",
296
+ "translation": {
297
+ "en": "Nuxt Documentation",
298
+ "fr": "Documentation Nuxt",
299
+ "es": "Documentación de Nuxt"
300
+ }
301
+ },
302
+ "readTheDocs": {
303
+ "nodeType": "translation",
304
+ "translation": {
305
+ "en": "Click on the Nuxt logo to learn more",
306
+ "fr": "Cliquez sur le logo Nuxt pour en savoir plus",
307
+ "es": "Haga clic en el logotipo de Nuxt para obtener más información"
308
+ }
309
+ }
310
+ }
311
+ }
312
+ ```
313
+
314
+ > Sus declaraciones de contenido pueden definirse en cualquier lugar de su aplicación siempre que estén incluidas en el directorio `contentDir` (por defecto, `./src`). Y coincidan con la extensión del archivo de declaración de contenido (por defecto, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
315
+
316
+ > Para más detalles, consulte la [documentación de declaración de contenido](https://github.com/aymericzip/intlayer/blob/main/docs/es/dictionary/get_started.md).
317
+
318
+ ### Paso 5: Utilice Intlayer en su código
319
+
320
+ Acceda a sus diccionarios de contenido en toda su aplicación Nuxt utilizando el composable `useIntlayer`:
321
+
322
+ ```vue fileName="components/HelloWorld.vue"
323
+ <script setup lang="ts">
324
+ import { ref } from "vue";
325
+ import { useIntlayer } from "vue-intlayer";
326
+
327
+ defineProps({
328
+ msg: String,
329
+ });
330
+
331
+ const {
332
+ count,
333
+ edit,
334
+ checkOut,
335
+ nuxtIntlayer,
336
+ learnMore,
337
+ nuxtDocs,
338
+ readTheDocs,
339
+ } = useIntlayer("helloworld");
340
+ const countRef = ref(0);
341
+ </script>
342
+
343
+ <template>
344
+ <h1>{{ msg }}</h1>
345
+
346
+ <div class="card">
347
+ <button type="button" @click="countRef++">
348
+ <count />
349
+ {{ countRef }}
350
+ </button>
351
+ <p v-html="edit"></p>
352
+ </div>
353
+
354
+ <p>
355
+ <checkOut />
356
+ <a href="https://nuxt.com/docs/getting-started/introduction" target="_blank"
357
+ >Nuxt</a
358
+ >, <nuxtIntlayer />
359
+ </p>
360
+ <p>
361
+ <learnMore />
362
+ <a href="https://nuxt.com" target="_blank"><nuxtDocs /></a>.
363
+ </p>
364
+ <p class="read-the-docs"><readTheDocs /></p>
365
+ <p class="read-the-docs">{{ readTheDocs }}</p>
366
+ </template>
367
+ ```
368
+
369
+ #### Accediendo al contenido en Intlayer
370
+
371
+ Intlayer ofrece dos APIs para acceder a su contenido:
372
+
373
+ - **Sintaxis basada en componentes** (recomendada):
374
+ Utilice la sintaxis `<myContent />` o `<Component :is="myContent" />` para renderizar contenido como un Nodo de Intlayer. Esto se integra perfectamente con el [Editor Visual](https://github.com/aymericzip/intlayer/blob/main/docs/es/intlayer_visual_editor.md) y el [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/es/intlayer_CMS.md).
375
+
376
+ - **Sintaxis basada en cadenas**:
377
+ Utilice `{{ myContent }}` para renderizar el contenido como texto plano, sin soporte para el Editor Visual.
378
+
379
+ - **Sintaxis HTML en bruto**:
380
+ Utilice `<div v-html="myContent" />` para renderizar el contenido como HTML en bruto, sin soporte para el Editor Visual.
381
+
382
+ - **Sintaxis de desestructuración**:
383
+ El composable `useIntlayer` devuelve un Proxy con el contenido. Este proxy puede ser desestructurado para acceder al contenido manteniendo la reactividad.
384
+ - Utilice `const content = useIntlayer("myContent");` y `{{ content.myContent }}` / `<content.myContent />`.
385
+ - O utilice `const { myContent } = useIntlayer("myContent");` y `{{ myContent }}` / `<myContent/>` para desestructurar el contenido.
386
+
387
+ ### (Opcional) Paso 6: Cambiar el idioma de su contenido
388
+
389
+ Para cambiar el idioma de su contenido, puede usar la función `setLocale` proporcionada por el composable `useLocale`. Esta función le permite establecer la configuración regional de la aplicación y actualizar el contenido en consecuencia.
390
+
391
+ Cree un componente para cambiar entre idiomas:
392
+
393
+ ```vue fileName="components/LocaleSwitcher.vue"
394
+ <template>
395
+ <div class="locale-switcher">
396
+ <select v-model="selectedLocale" @change="changeLocale">
397
+ <option v-for="loc in availableLocales" :key="loc" :value="loc">
398
+ {{ getLocaleName(loc) }}
399
+ </option>
400
+ </select>
401
+ </div>
402
+ </template>
403
+
404
+ <script setup lang="ts">
405
+ import { ref, watch } from "vue";
406
+ import { getLocaleName } from "intlayer";
407
+ import { useLocale } from "vue-intlayer";
408
+
409
+ // Obtener información de configuración regional y función setLocale
410
+ const { locale, availableLocales, setLocale } = useLocale();
411
+
412
+ // Seguimiento de la configuración regional seleccionada con un ref
413
+ const selectedLocale = ref(locale.value);
414
+
415
+ // Actualizar la configuración regional cuando cambie la selección
416
+ const changeLocale = () => setLocale(selectedLocale.value);
417
+
418
+ // Mantener selectedLocale sincronizado con la configuración regional global
419
+ watch(
420
+ () => locale.value,
421
+ (newLocale) => {
422
+ selectedLocale.value = newLocale;
423
+ }
424
+ );
425
+ </script>
426
+ </template>
427
+
428
+ <style scoped>
429
+ .locale-switcher {
430
+ margin: 1rem 0;
431
+ }
432
+
433
+ select {
434
+ padding: 0.5rem;
435
+ border-radius: 0.25rem;
436
+ border: 1px solid #ccc;
437
+ }
438
+ </style>
439
+ ```
440
+
441
+ Luego, use este componente en sus páginas o diseño:
442
+
443
+ ```vue fileName="app.vue"
444
+ <script setup lang="ts">
445
+ import { useIntlayer } from "vue-intlayer";
446
+ import LocaleSwitcher from "~/components/LocaleSwitcher.vue";
447
+
448
+ const content = useIntlayer("app"); // Crear archivo de declaración de intlayer relacionado
449
+ </script>
450
+
451
+ <template>
452
+ <div>
453
+ <header>
454
+ <LocaleSwitcher />
455
+ </header>
456
+ <main>
457
+ <NuxtPage />
458
+ </main>
459
+ </div>
460
+ </template>
461
+ ```
462
+
463
+ ### (Opcional) Paso 7: Agregar enrutamiento localizado a su aplicación
464
+
465
+ Nuxt maneja automáticamente el enrutamiento localizado cuando se usa el módulo `nuxt-intlayer`. Esto crea rutas para cada idioma automáticamente según la estructura del directorio de sus páginas.
466
+
467
+ Ejemplo:
468
+
469
+ ```plaintext
470
+ pages/
471
+ ├── index.vue → /, /fr, /es
472
+ ├── about.vue → /about, /fr/about, /es/about
473
+ └── contact/
474
+ └── index.vue → /contact, /fr/contact, /es/contact
475
+ ```
476
+
477
+ Para crear una página localizada, simplemente cree sus archivos Vue en el directorio `pages/`:
478
+
479
+ ```vue fileName="pages/about.vue"
480
+ <script setup lang="ts">
481
+ import { useIntlayer } from "vue-intlayer";
482
+
483
+ const content = useIntlayer("about");
484
+ </script>
485
+
486
+ <template>
487
+ <div>
488
+ <h1>{{ content.title }}</h1>
489
+ <p>{{ content.description }}</p>
490
+ </div>
491
+ </template>
492
+ ```
493
+
494
+ El módulo `nuxt-intlayer` automáticamente:
495
+
496
+ - Detecta la configuración regional preferida del usuario
497
+ - Maneja el cambio de configuración regional a través de la URL
498
+ - Establece el atributo `<html lang="">` apropiado
499
+ - Administra cookies de configuración regional
500
+ - Redirige a los usuarios a la URL localizada correspondiente
501
+
502
+ ### (Opcional) Paso 8: Crear un componente de enlace localizado
503
+
504
+ Para garantizar que la navegación de su aplicación respete la configuración regional actual, puede crear un componente personalizado `LocalizedLink`. Este componente agrega automáticamente el prefijo de los URL internos con el idioma actual.
505
+
506
+ ```vue fileName="components/LocalizedLink.vue"
507
+ <template>
508
+ <NuxtLink :to="localizedHref" v-bind="$attrs">
509
+ <slot />
510
+ </NuxtLink>
511
+ </template>
512
+
513
+ <script setup lang="ts">
514
+ import { computed } from "vue";
515
+ import { getLocalizedUrl } from "intlayer";
516
+ import { useLocale } from "vue-intlayer";
517
+
518
+ const props = defineProps({
519
+ to: {
520
+ type: String,
521
+ required: true,
522
+ },
523
+ });
524
+
525
+ const { locale } = useLocale();
526
+
527
+ // Verificar si el enlace es externo
528
+ const isExternalLink = computed(() => /^https?:\/\//.test(props.to || ""));
529
+
530
+ // Crear un href localizado para enlaces internos
531
+ const localizedHref = computed(() =>
532
+ isExternalLink.value ? props.to : getLocalizedUrl(props.to, locale.value)
533
+ );
534
+ </script>
535
+ ```
536
+
537
+ Luego use este componente en toda su aplicación:
538
+
539
+ ```vue fileName="pages/index.vue"
540
+ <template>
541
+ <div>
542
+ <LocalizedLink to="/about">
543
+ {{ content.aboutLink }}
544
+ </LocalizedLink>
545
+
546
+ {{ content.contactLink }}
547
+ </LocalizedLink>
548
+ </div>
549
+ </template>
550
+
551
+ <script setup lang="ts">
552
+ import { useIntlayer } from "vue-intlayer";
553
+ import LocalizedLink from "~/components/LocalizedLink.vue";
554
+
555
+ const content = useIntlayer("home");
556
+ </script>
557
+ ```
558
+
559
+ ### (Opcional) Paso 9: Manejar Metadatos y SEO
560
+
561
+ Nuxt proporciona excelentes capacidades de SEO. Puedes usar Intlayer para manejar metadatos localizados:
562
+
563
+ ```vue fileName="pages/about.vue"
564
+ <script setup lang="ts">
565
+ import { useSeoMeta } from "nuxt/app";
566
+ import { getIntlayer } from "intlayer";
567
+ import { useLocale } from "vue-intlayer";
568
+
569
+ const { locale } = useLocale();
570
+ const content = getIntlayer("about-meta", locale.value);
571
+
572
+ useSeoMeta({
573
+ title: content.title,
574
+ description: content.description,
575
+ });
576
+ </script>
577
+
578
+ <template>
579
+ <div>
580
+ <h1>{{ content.pageTitle }}</h1>
581
+ <p>{{ content.pageContent }}</p>
582
+ </div>
583
+ </template>
584
+ ```
585
+
586
+ Crea la declaración de contenido correspondiente:
587
+
588
+ ```typescript fileName="pages/about-meta.content.ts" contentDeclarationFormat="typescript"
589
+ import { t, type Dictionary } from "intlayer";
590
+ import type { useSeoMeta } from "nuxt/app";
591
+
592
+ const aboutMetaContent = {
593
+ key: "about-meta",
594
+ content: {
595
+ title: t({
596
+ es: "Acerca de Nosotros - Mi Empresa",
597
+ en: "About Us - My Company",
598
+ fr: "À Propos - Ma Société",
599
+ }),
600
+ description: t({
601
+ es: "Conozca más sobre nuestra empresa y nuestra misión",
602
+ en: "Learn more about our company and our mission",
603
+ fr: "En savoir plus sur notre société et notre mission",
604
+ }),
605
+ },
606
+ } satisfies Dictionary<Parameters<typeof useSeoMeta>[0]>;
607
+
608
+ export default aboutMetaContent;
609
+ ```
610
+
611
+ ```typescript fileName="pages/about-meta.content.mjs" contentDeclarationFormat="esm"
612
+ import { t } from "intlayer";
613
+
614
+ /** @type {import('intlayer').Dictionary} */
615
+ const aboutMetaContent = {
616
+ key: "about-meta",
617
+ content: {
618
+ title: t({
619
+ en: "About Us - My Company",
620
+ fr: "À Propos - Ma Société",
621
+ es: "Acerca de Nosotros - Mi Empresa",
622
+ }),
623
+ description: t({
624
+ en: "Learn more about our company and our mission",
625
+ fr: "En savoir plus sur notre société et notre mission",
626
+ es: "Conozca más sobre nuestra empresa y nuestra misión",
627
+ }),
628
+ },
629
+ };
630
+
631
+ export default aboutMetaContent;
632
+ ```
633
+
634
+ ```typescript fileName="pages/about-meta.content.js" contentDeclarationFormat="cjs"
635
+ const { t } = require("intlayer");
636
+
637
+ /** @type {import('intlayer').Dictionary} */
638
+ const aboutMetaContent = {
639
+ key: "about-meta",
640
+ content: {
641
+ title: t({
642
+ en: "About Us - My Company",
643
+ fr: "À Propos - Ma Société",
644
+ es: "Acerca de Nosotros - Mi Empresa",
645
+ }),
646
+ description: t({
647
+ en: "Learn more about our company and our mission",
648
+ fr: "En savoir plus sur notre société et notre mission",
649
+ es: "Conozca más sobre nuestra empresa y nuestra misión",
650
+ }),
651
+ },
652
+ };
653
+
654
+ module.exports = aboutMetaContent;
655
+ ```
656
+
657
+ ```json fileName="pages/about-meta.content.json" contentDeclarationFormat="json"
658
+ {
659
+ "key": "about-meta",
660
+ "content": {
661
+ "title": {
662
+ "nodeType": "translation",
663
+ "translations": {
664
+ "en": "About Us - My Company",
665
+ "fr": "À Propos - Ma Société",
666
+ "es": "Acerca de Nosotros - Mi Empresa"
667
+ }
668
+ },
669
+ "description": {
670
+ "nodeType": "translation",
671
+ "translations": {
672
+ "en": "Learn more about our company and our mission",
673
+ "fr": "En savoir plus sur notre société et notre mission",
674
+ "es": "Conozca más sobre nuestra empresa y nuestra misión"
675
+ }
676
+ }
677
+ }
678
+ }
679
+ ```
680
+
681
+ ### Configurar TypeScript
682
+
683
+ Intlayer utiliza la ampliación de módulos para aprovechar los beneficios de TypeScript y fortalecer tu base de código.
684
+
685
+ ![alt text](https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png)
686
+
687
+ ![alt text](https://github.com/aymericzip/intlayer/blob/main/docs/assets/translation_error.png)
688
+
689
+ Asegúrate de que tu configuración de TypeScript incluya los tipos autogenerados.
690
+
691
+ ```json5 fileName="tsconfig.json"
692
+ {
693
+ // ... Tus configuraciones existentes de TypeScript
694
+ "include": [
695
+ // ... Tus configuraciones existentes de TypeScript
696
+ ".intlayer/**/*.ts", // Incluir los tipos autogenerados
697
+ ],
698
+ }
699
+ ```
700
+
701
+ ### Configuración de Git
702
+
703
+ Se recomienda ignorar los archivos generados por Intlayer. Esto te permite evitar comprometerlos en tu repositorio Git.
704
+
705
+ Para hacer esto, puedes agregar las siguientes instrucciones a tu archivo `.gitignore`:
706
+
707
+ ```plaintext fileName=".gitignore"
708
+ # Ignorar los archivos generados por Intlayer
709
+ .intlayer
710
+ ```
711
+
712
+ ### Extensión de VS Code
713
+
714
+ Para mejorar tu experiencia de desarrollo con Intlayer, puedes instalar la **Extensión Oficial de Intlayer para VS Code**.
715
+
716
+ [Instalar desde el Marketplace de VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
717
+
718
+ Esta extensión proporciona:
719
+
720
+ - **Autocompletado** para claves de traducción.
721
+ - **Detección de errores en tiempo real** para traducciones faltantes.
722
+ - **Previsualizaciones en línea** del contenido traducido.
723
+ - **Acciones rápidas** para crear y actualizar traducciones fácilmente.
724
+
725
+ Para más detalles sobre cómo usar la extensión, consulta la [documentación de la Extensión de Intlayer para VS Code](https://intlayer.org/doc/vs-code-extension).
726
+
727
+ ---
728
+
729
+ ### Ir Más Allá
730
+
731
+ Para ir más allá, puedes implementar el [editor visual](https://github.com/aymericzip/intlayer/blob/main/docs/es/intlayer_visual_editor.md) o externalizar tu contenido utilizando el [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/es/intlayer_CMS.md).