@intlayer/docs 5.5.9 → 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 +5 -5
  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,792 @@
1
+ # Começando com a Internacionalização (i18n) com Intlayer e Nuxt
2
+
3
+ Veja [Modelo de Aplicação](https://github.com/aymericzip/intlayer-nuxt-template) no GitHub.
4
+
5
+ ## O que é o Intlayer?
6
+
7
+ **Intlayer** é uma biblioteca de internacionalização (i18n) inovadora e de código aberto, projetada para simplificar o suporte multilíngue em aplicações web modernas.
8
+
9
+ Com o Intlayer, você pode:
10
+
11
+ - **Gerenciar traduções facilmente** usando dicionários declarativos no nível do componente.
12
+ - **Localizar dinamicamente metadados**, rotas e conteúdo.
13
+ - **Garantir suporte ao TypeScript** com tipos autogerados, melhorando a autocompletação e a detecção de erros.
14
+ - **Aproveitar recursos avançados**, como detecção dinâmica de localidade e troca de idiomas.
15
+
16
+ ---
17
+
18
+ ## Guia Passo a Passo para Configurar o Intlayer em uma Aplicação Nuxt
19
+
20
+ ### Passo 1: Instalar Dependências
21
+
22
+ Instale os pacotes necessários 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
+ O pacote principal que fornece ferramentas de internacionalização para gerenciamento de configuração, tradução, [declaração de conteúdo](https://github.com/aymericzip/intlayer/blob/main/docs/pt/dictionary/get_started.md), transpilação e [comandos CLI](https://github.com/aymericzip/intlayer/blob/main/docs/pt/intlayer_cli.md).
42
+
43
+ - **vue-intlayer**
44
+ O pacote que integra o Intlayer com a aplicação Vue. Ele fornece os composables para os componentes Vue.
45
+
46
+ - **nuxt-intlayer**
47
+ O módulo Nuxt que integra o Intlayer com aplicações Nuxt. Ele fornece configuração automática, middleware para detecção de localidade, gerenciamento de cookies e redirecionamento de URLs.
48
+
49
+ ### Passo 2: Configuração do seu projeto
50
+
51
+ Crie um arquivo de configuração para configurar os idiomas da sua aplicação:
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
+ // Seus outros idiomas
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
+ // Seus outros idiomas
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
+ // Seus outros idiomas
101
+ ],
102
+ defaultLocale: Locales.ENGLISH,
103
+ },
104
+ };
105
+
106
+ module.exports = config;
107
+ ```
108
+
109
+ > Através deste arquivo de configuração, você pode configurar URLs localizados, redirecionamento de middleware, nomes de cookies, a localização e extensão de suas declarações de conteúdo, desativar logs do Intlayer no console e muito mais. Para uma lista completa de parâmetros disponíveis, consulte a [documentação de configuração](https://github.com/aymericzip/intlayer/blob/main/docs/pt/configuration.md).
110
+
111
+ ### Passo 3: Integrar o Intlayer na Configuração do Nuxt
112
+
113
+ Adicione o módulo intlayer à sua configuração Nuxt:
114
+
115
+ ```typescript fileName="nuxt.config.ts"
116
+ import { defineNuxtConfig } from "nuxt/config";
117
+
118
+ export default defineNuxtConfig({
119
+ // ... Sua configuração Nuxt existente
120
+ modules: ["nuxt-intlayer"],
121
+ });
122
+ ```
123
+
124
+ > O módulo `nuxt-intlayer` lida automaticamente com a integração do Intlayer com o Nuxt. Ele configura a construção da declaração de conteúdo, monitora arquivos no modo de desenvolvimento, fornece middleware para detecção de localidade e gerencia o roteamento localizado.
125
+
126
+ ### Passo 4: Declarar Seu Conteúdo
127
+
128
+ Crie e gerencie suas declarações de conteúdo para armazenar traduções:
129
+
130
+ ```tsx fileName="components/helloWorld.content.ts" contentDeclarationFormat="typescript"
131
+ import { t, type Dictionary } from "intlayer";
132
+
133
+ const helloWorldContent = {
134
+ key: "helloworld",
135
+ content: {
136
+ count: t({
137
+ pt: "a contagem é ",
138
+ en: "count is ",
139
+ fr: "le compte est ",
140
+ es: "el recuento es ",
141
+ }),
142
+ edit: t({
143
+ pt: "Edite <code>components/HelloWorld.vue</code> e salve para testar o HMR",
144
+ en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
145
+ fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
146
+ es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
147
+ }),
148
+ checkOut: t({
149
+ pt: "Confira ",
150
+ en: "Check out ",
151
+ fr: "Vérifiez ",
152
+ es: "Compruebe ",
153
+ }),
154
+ nuxtIntlayer: t({
155
+ pt: "Documentação do Nuxt Intlayer",
156
+ en: "Nuxt Intlayer documentation",
157
+ fr: "Documentation de Nuxt Intlayer",
158
+ es: "Documentación de Nuxt Intlayer",
159
+ }),
160
+ learnMore: t({
161
+ pt: "Saiba mais sobre o Nuxt na ",
162
+ en: "Learn more about Nuxt in the ",
163
+ fr: "En savoir plus sur Nuxt dans la ",
164
+ es: "Aprenda más sobre Nuxt en la ",
165
+ }),
166
+ nuxtDocs: t({
167
+ pt: "Documentação do Nuxt",
168
+ en: "Nuxt Documentation",
169
+ fr: "Documentation Nuxt",
170
+ es: "Documentación de Nuxt",
171
+ }),
172
+ readTheDocs: t({
173
+ pt: "Clique no logotipo do Nuxt para saber mais",
174
+ en: "Click on the Nuxt logo to learn more",
175
+ fr: "Cliquez sur le logo Nuxt pour en savoir plus",
176
+ es: "Haga clic en el logotipo de Nuxt para obtener más información",
177
+ }),
178
+ },
179
+ } satisfies Dictionary;
180
+
181
+ export default helloWorldContent;
182
+ ```
183
+
184
+ ```javascript fileName="components/helloWorld.content.mjs" contentDeclarationFormat="esm"
185
+ import { t } from "intlayer";
186
+
187
+ /** @type {import('intlayer').Dictionary} */
188
+ const helloWorldContent = {
189
+ key: "helloworld",
190
+ content: {
191
+ count: t({
192
+ pt: "a contagem é ",
193
+ en: "count is ",
194
+ fr: "le compte est ",
195
+ es: "el recuento es ",
196
+ }),
197
+ edit: t({
198
+ pt: "Edite <code>components/HelloWorld.vue</code> e salve para testar o HMR",
199
+ en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
200
+ fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
201
+ es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
202
+ }),
203
+ checkOut: t({
204
+ pt: "Confira ",
205
+ en: "Check out ",
206
+ fr: "Vérifiez ",
207
+ es: "Compruebe ",
208
+ }),
209
+ nuxtIntlayer: t({
210
+ pt: "Documentação do Nuxt Intlayer",
211
+ en: "Nuxt Intlayer documentation",
212
+ fr: "Documentation de Nuxt Intlayer",
213
+ es: "Documentación de Nuxt Intlayer",
214
+ }),
215
+ learnMore: t({
216
+ pt: "Saiba mais sobre o Nuxt na ",
217
+ en: "Learn more about Nuxt in the ",
218
+ fr: "En savoir plus sur Nuxt dans la ",
219
+ es: "Aprenda más sobre Nuxt en la ",
220
+ }),
221
+ nuxtDocs: t({
222
+ pt: "Documentação do Nuxt",
223
+ en: "Nuxt Documentation",
224
+ fr: "Documentation Nuxt",
225
+ es: "Documentación de Nuxt",
226
+ }),
227
+ readTheDocs: t({
228
+ pt: "Clique no logotipo do Nuxt para saber mais",
229
+ en: "Click on the Nuxt logo to learn more",
230
+ fr: "Cliquez sur le logo Nuxt pour en savoir plus",
231
+ es: "Haga clic en el logotipo de Nuxt para obtener más información",
232
+ }),
233
+ },
234
+ };
235
+
236
+ export default helloWorldContent;
237
+ ```
238
+
239
+ ```javascript fileName="components/helloWorld.content.cjs" contentDeclarationFormat="commonjs"
240
+ const { t } = require("intlayer");
241
+
242
+ /** @type {import('intlayer').Dictionary} */
243
+ const helloWorldContent = {
244
+ key: "helloworld",
245
+ content: {
246
+ count: t({
247
+ pt: "a contagem é ",
248
+ en: "count is ",
249
+ fr: "le compte est ",
250
+ es: "el recuento es ",
251
+ }),
252
+ edit: t({
253
+ pt: "Edite <code>components/HelloWorld.vue</code> e salve para testar o HMR",
254
+ en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
255
+ fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
256
+ es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
257
+ }),
258
+ checkOut: t({
259
+ pt: "Confira ",
260
+ en: "Check out ",
261
+ fr: "Vérifiez ",
262
+ es: "Compruebe ",
263
+ }),
264
+ nuxtIntlayer: t({
265
+ pt: "Documentação do Nuxt Intlayer",
266
+ en: "Nuxt Intlayer documentation",
267
+ fr: "Documentation de Nuxt Intlayer",
268
+ es: "Documentación de Nuxt Intlayer",
269
+ }),
270
+ learnMore: t({
271
+ pt: "Saiba mais sobre o Nuxt na ",
272
+ en: "Learn more about Nuxt in the ",
273
+ fr: "En savoir plus sur Nuxt dans la ",
274
+ es: "Aprenda más sobre Nuxt en la ",
275
+ }),
276
+ nuxtDocs: t({
277
+ pt: "Documentação do Nuxt",
278
+ en: "Nuxt Documentation",
279
+ fr: "Documentation Nuxt",
280
+ es: "Documentación de Nuxt",
281
+ }),
282
+ readTheDocs: t({
283
+ pt: "Clique no logotipo do Nuxt para saber mais",
284
+ en: "Click on the Nuxt logo to learn more",
285
+ fr: "Cliquez sur le logo Nuxt pour en savoir plus",
286
+ es: "Haga clic en el logotipo de Nuxt para obtener más información",
287
+ }),
288
+ },
289
+ };
290
+
291
+ module.exports = helloWorldContent;
292
+ ```
293
+
294
+ ```json fileName="components/helloWorld.content.json" contentDeclarationFormat="json"
295
+ {
296
+ "$schema": "https://intlayer.org/schema.json",
297
+ "key": "helloworld",
298
+ "content": {
299
+ "count": {
300
+ "nodeType": "translation",
301
+ "translation": {
302
+ "pt": "o contador é ",
303
+ "en": "count is ",
304
+ "fr": "le compte est ",
305
+ "es": "el recuento es "
306
+ }
307
+ },
308
+ "edit": {
309
+ "nodeType": "translation",
310
+ "translation": {
311
+ "pt": "Edite <code>components/HelloWorld.vue</code> e salve para testar o HMR",
312
+ "en": "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
313
+ "fr": "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
314
+ "es": "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR"
315
+ }
316
+ },
317
+ "checkOut": {
318
+ "nodeType": "translation",
319
+ "translation": {
320
+ "pt": "Confira ",
321
+ "en": "Check out ",
322
+ "fr": "Vérifiez ",
323
+ "es": "Compruebe "
324
+ }
325
+ },
326
+ "nuxtIntlayer": {
327
+ "nodeType": "translation",
328
+ "translation": {
329
+ "pt": "documentação do Nuxt Intlayer",
330
+ "en": "Nuxt Intlayer documentation",
331
+ "fr": "Documentation de Nuxt Intlayer",
332
+ "es": "Documentación de Nuxt Intlayer"
333
+ }
334
+ },
335
+ "learnMore": {
336
+ "nodeType": "translation",
337
+ "translation": {
338
+ "pt": "Saiba mais sobre o Nuxt na ",
339
+ "en": "Learn more about Nuxt in the ",
340
+ "fr": "En savoir plus sur Nuxt dans la ",
341
+ "es": "Aprenda más sobre Nuxt en la "
342
+ }
343
+ },
344
+ "nuxtDocs": {
345
+ "nodeType": "translation",
346
+ "translation": {
347
+ "pt": "Documentação do Nuxt",
348
+ "en": "Nuxt Documentation",
349
+ "fr": "Documentation Nuxt",
350
+ "es": "Documentación de Nuxt"
351
+ }
352
+ },
353
+ "readTheDocs": {
354
+ "nodeType": "translation",
355
+ "translation": {
356
+ "pt": "Clique no logotipo do Nuxt para saber mais",
357
+ "en": "Click on the Nuxt logo to learn more",
358
+ "fr": "Cliquez sur le logo Nuxt pour en savoir plus",
359
+ "es": "Haga clic en el logotipo de Nuxt para obtener más información"
360
+ }
361
+ }
362
+ }
363
+ }
364
+ ```
365
+
366
+ > Suas declarações de conteúdo podem ser definidas em qualquer lugar do seu aplicativo, desde que estejam incluídas no diretório `contentDir` (por padrão, `./src`). E correspondam à extensão do arquivo de declaração de conteúdo (por padrão, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
367
+
368
+ > Para mais detalhes, consulte a [documentação de declaração de conteúdo](https://github.com/aymericzip/intlayer/blob/main/docs/pt/dictionary/get_started.md).
369
+
370
+ ### Etapa 5: Utilize o Intlayer no Seu Código
371
+
372
+ Acesse seus dicionários de conteúdo em todo o aplicativo Nuxt usando o composable `useIntlayer`:
373
+
374
+ ```vue fileName="components/HelloWorld.vue"
375
+ <script setup lang="ts">
376
+ import { ref } from "vue";
377
+ import { useIntlayer } from "vue-intlayer";
378
+
379
+ defineProps({
380
+ msg: String,
381
+ });
382
+
383
+ const {
384
+ count,
385
+ edit,
386
+ checkOut,
387
+ nuxtIntlayer,
388
+ learnMore,
389
+ nuxtDocs,
390
+ readTheDocs,
391
+ } = useIntlayer("helloworld");
392
+ const countRef = ref(0);
393
+ </script>
394
+
395
+ <template>
396
+ <h1>{{ msg }}</h1>
397
+
398
+ <div class="card">
399
+ <button type="button" @click="countRef++">
400
+ <count />
401
+ {{ countRef }}
402
+ </button>
403
+ <p v-html="edit"></p>
404
+ </div>
405
+
406
+ <p>
407
+ <checkOut />
408
+ <a href="https://nuxt.com/docs/getting-started/introduction" target="_blank"
409
+ >Nuxt</a
410
+ >, <nuxtIntlayer />
411
+ </p>
412
+ <p>
413
+ <learnMore />
414
+ <a href="https://nuxt.com" target="_blank"><nuxtDocs /></a>.
415
+ </p>
416
+ <p class="read-the-docs"><readTheDocs /></p>
417
+ <p class="read-the-docs">{{ readTheDocs }}</p>
418
+ </template>
419
+ ```
420
+
421
+ #### Acessando Conteúdo no Intlayer
422
+
423
+ O Intlayer oferece duas APIs para acessar seu conteúdo:
424
+
425
+ - **Sintaxe baseada em componentes** (recomendada):
426
+ Use a sintaxe `<myContent />` ou `<Component :is="myContent" />` para renderizar o conteúdo como um Nó do Intlayer. Isso se integra perfeitamente ao [Editor Visual](https://github.com/aymericzip/intlayer/blob/main/docs/pt/intlayer_visual_editor.md) e ao [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/pt/intlayer_CMS.md).
427
+
428
+ - **Sintaxe baseada em strings**:
429
+ Use `{{ myContent }}` para renderizar o conteúdo como texto simples, sem suporte ao Editor Visual.
430
+
431
+ - **Sintaxe HTML bruta**:
432
+ Use `<div v-html="myContent" />` para renderizar o conteúdo como HTML bruto, sem suporte ao Editor Visual.
433
+
434
+ - **Sintaxe de desestruturação**:
435
+ O composable `useIntlayer` retorna um Proxy com o conteúdo. Este proxy pode ser desestruturado para acessar o conteúdo mantendo a reatividade.
436
+ - Use `const content = useIntlayer("myContent");` e `{{ content.myContent }}` / `<content.myContent />`.
437
+ - Ou use `const { myContent } = useIntlayer("myContent");` e `{{ myContent }}` / `<myContent />` para desestruturar o conteúdo.
438
+
439
+ ### (Opcional) Etapa 6: Alterar o idioma do seu conteúdo
440
+
441
+ Para alterar o idioma do seu conteúdo, você pode usar a função `setLocale` fornecida pelo composable `useLocale`. Essa função permite definir o idioma do aplicativo e atualizar o conteúdo de acordo.
442
+
443
+ Crie um componente para alternar entre idiomas:
444
+
445
+ ```vue fileName="components/LocaleSwitcher.vue"
446
+ <template>
447
+ <div class="locale-switcher">
448
+ <select v-model="selectedLocale" @change="changeLocale">
449
+ <option v-for="loc in availableLocales" :key="loc" :value="loc">
450
+ {{ getLocaleName(loc) }}
451
+ </option>
452
+ </select>
453
+ </div>
454
+ </template>
455
+
456
+ <script setup lang="ts">
457
+ import { ref, watch } from "vue";
458
+ import { getLocaleName } from "intlayer";
459
+ import { useLocale } from "vue-intlayer";
460
+
461
+ // Obter informações de localidade e função setLocale
462
+ const { locale, availableLocales, setLocale } = useLocale();
463
+
464
+ // Acompanhar o idioma selecionado com um ref
465
+ const selectedLocale = ref(locale.value);
466
+
467
+ // Atualizar o idioma quando a seleção mudar
468
+ const changeLocale = () => setLocale(selectedLocale.value);
469
+
470
+ // Manter o selectedLocale sincronizado com o idioma global
471
+ watch(
472
+ () => locale.value,
473
+ (newLocale) => {
474
+ selectedLocale.value = newLocale;
475
+ }
476
+ );
477
+ </script>
478
+ </template>
479
+
480
+ <style scoped>
481
+ .locale-switcher {
482
+ margin: 1rem 0;
483
+ }
484
+
485
+ select {
486
+ padding: 0.5rem;
487
+ border-radius: 0.25rem;
488
+ border: 1px solid #ccc;
489
+ }
490
+ </style>
491
+ ```
492
+
493
+ Em seguida, use este componente em suas páginas ou layout:
494
+
495
+ ```vue fileName="app.vue"
496
+ <script setup lang="ts">
497
+ import { useIntlayer } from "vue-intlayer";
498
+ import LocaleSwitcher from "~/components/LocaleSwitcher.vue";
499
+
500
+ const content = useIntlayer("app"); // Criar arquivo de declaração relacionado ao intlayer
501
+ </script>
502
+
503
+ <template>
504
+ <div>
505
+ <header>
506
+ <LocaleSwitcher />
507
+ </header>
508
+ <main>
509
+ <NuxtPage />
510
+ </main>
511
+ </div>
512
+ </template>
513
+ ```
514
+
515
+ ### (Opcional) Etapa 7: Adicionar Roteamento Localizado ao seu aplicativo
516
+
517
+ O Nuxt lida automaticamente com o roteamento localizado ao usar o módulo `nuxt-intlayer`. Isso cria rotas para cada idioma automaticamente com base na estrutura do diretório de páginas.
518
+
519
+ Exemplo:
520
+
521
+ ```plaintext
522
+ pages/
523
+ ├── index.vue → /, /pt, /es
524
+ ├── about.vue → /about, /pt/about, /es/about
525
+ └── contact/
526
+ └── index.vue → /contact, /pt/contact, /es/contact
527
+ ```
528
+
529
+ Para criar uma página localizada, basta criar seus arquivos Vue no diretório `pages/`:
530
+
531
+ ```vue fileName="pages/about.vue"
532
+ <script setup lang="ts">
533
+ import { useIntlayer } from "vue-intlayer";
534
+
535
+ const content = useIntlayer("about");
536
+ </script>
537
+
538
+ <template>
539
+ <div>
540
+ <h1>{{ content.title }}</h1>
541
+ <p>{{ content.description }}</p>
542
+ </div>
543
+ </template>
544
+ ```
545
+
546
+ O módulo `nuxt-intlayer` automaticamente:
547
+
548
+ - Detecta o idioma preferido do usuário
549
+ - Lida com a troca de idioma via URL
550
+ - Define o atributo `<html lang="">` apropriado
551
+ - Gerencia cookies de idioma
552
+ - Redireciona os usuários para a URL localizada apropriada
553
+
554
+ ### (Opcional) Etapa 8: Criar um Componente de Link Localizado
555
+
556
+ Para garantir que a navegação do seu aplicativo respeite o idioma atual, você pode criar um componente personalizado `LocalizedLink`. Este componente automaticamente prefixa URLs internos com o idioma atual.
557
+
558
+ ```vue fileName="components/LocalizedLink.vue"
559
+ <template>
560
+ <NuxtLink :to="localizedHref" v-bind="$attrs">
561
+ <slot />
562
+ </NuxtLink>
563
+ </template>
564
+
565
+ <script setup lang="ts">
566
+ import { computed } from "vue";
567
+ import { getLocalizedUrl } from "intlayer";
568
+ import { useLocale } from "vue-intlayer";
569
+
570
+ const props = defineProps({
571
+ to: {
572
+ type: String,
573
+ required: true,
574
+ },
575
+ });
576
+
577
+ const { locale } = useLocale();
578
+
579
+ // Verificar se o link é externo
580
+ const isExternalLink = computed(() => /^https?:\/\//.test(props.to || ""));
581
+
582
+ // Criar um href localizado para links internos
583
+ const localizedHref = computed(() =>
584
+ isExternalLink.value ? props.to : getLocalizedUrl(props.to, locale.value)
585
+ );
586
+ </script>
587
+ ```
588
+
589
+ Em seguida, use este componente em todo o seu aplicativo:
590
+
591
+ ```vue fileName="pages/index.vue"
592
+ <template>
593
+ <div>
594
+ <LocalizedLink to="/about">
595
+ {{ content.aboutLink }}
596
+ </LocalizedLink>
597
+
598
+ <LocalizedLink to="/pt/contact">
599
+ {{ content.contactLink }}
600
+ </LocalizedLink>
601
+ </div>
602
+ </template>
603
+
604
+ <script setup lang="ts">
605
+ import { useIntlayer } from "vue-intlayer";
606
+ import LocalizedLink from "~/components/LocalizedLink.vue";
607
+
608
+ const content = useIntlayer("home");
609
+ </script>
610
+ ```
611
+
612
+ ### (Opcional) Passo 9: Gerenciar Metadados e SEO
613
+
614
+ O Nuxt oferece excelentes capacidades de SEO. Você pode usar o Intlayer para gerenciar metadados localizados:
615
+
616
+ ```vue fileName="pages/about.vue"
617
+ <script setup lang="ts">
618
+ import { useSeoMeta } from "nuxt/app";
619
+ import { getIntlayer } from "intlayer";
620
+ import { useLocale } from "vue-intlayer";
621
+
622
+ const { locale } = useLocale();
623
+ const content = getIntlayer("about-meta", locale.value);
624
+
625
+ useSeoMeta({
626
+ title: content.title,
627
+ description: content.description,
628
+ });
629
+ </script>
630
+
631
+ <template>
632
+ <div>
633
+ <h1>{{ content.pageTitle }}</h1>
634
+ <p>{{ content.pageContent }}</p>
635
+ </div>
636
+ </template>
637
+ ```
638
+
639
+ Crie a declaração de conteúdo correspondente:
640
+
641
+ ```typescript fileName="pages/about-meta.content.ts" contentDeclarationFormat="typescript"
642
+ import { t, type Dictionary } from "intlayer";
643
+ import type { useSeoMeta } from "nuxt/app";
644
+
645
+ const aboutMetaContent = {
646
+ key: "about-meta",
647
+ content: {
648
+ title: t({
649
+ pt: "Sobre Nós - Minha Empresa",
650
+ en: "About Us - My Company",
651
+ fr: "À Propos - Ma Société",
652
+ es: "Acerca de Nosotros - Mi Empresa",
653
+ }),
654
+ description: t({
655
+ pt: "Saiba mais sobre nossa empresa e nossa missão",
656
+ en: "Learn more about our company and our mission",
657
+ fr: "En savoir plus sur notre société et notre mission",
658
+ es: "Conozca más sobre nuestra empresa y nuestra misión",
659
+ }),
660
+ },
661
+ } satisfies Dictionary<Parameters<typeof useSeoMeta>[0]>;
662
+
663
+ export default aboutMetaContent;
664
+ ```
665
+
666
+ ```typescript fileName="pages/about-meta.content.mjs" contentDeclarationFormat="esm"
667
+ import { t } from "intlayer";
668
+
669
+ /** @type {import('intlayer').Dictionary} */
670
+ const aboutMetaContent = {
671
+ key: "about-meta",
672
+ content: {
673
+ title: t({
674
+ pt: "Sobre Nós - Minha Empresa",
675
+ en: "About Us - My Company",
676
+ fr: "À Propos - Ma Société",
677
+ es: "Acerca de Nosotros - Mi Empresa",
678
+ }),
679
+ description: t({
680
+ pt: "Saiba mais sobre nossa empresa e nossa missão",
681
+ en: "Learn more about our company and our mission",
682
+ fr: "En savoir plus sur notre société et notre mission",
683
+ es: "Conozca más sobre nuestra empresa y nuestra misión",
684
+ }),
685
+ },
686
+ };
687
+
688
+ export default aboutMetaContent;
689
+ ```
690
+
691
+ ```typescript fileName="pages/about-meta.content.js" contentDeclarationFormat="cjs"
692
+ const { t } = require("intlayer");
693
+
694
+ /** @type {import('intlayer').Dictionary} */
695
+ const aboutMetaContent = {
696
+ key: "about-meta",
697
+ content: {
698
+ title: t({
699
+ pt: "Sobre Nós - Minha Empresa",
700
+ en: "About Us - My Company",
701
+ fr: "À Propos - Ma Société",
702
+ es: "Acerca de Nosotros - Mi Empresa",
703
+ }),
704
+ description: t({
705
+ pt: "Saiba mais sobre nossa empresa e nossa missão",
706
+ en: "Learn more about our company and our mission",
707
+ fr: "En savoir plus sur notre société et notre mission",
708
+ es: "Conozca más sobre nuestra empresa y nuestra misión",
709
+ }),
710
+ },
711
+ };
712
+
713
+ module.exports = aboutMetaContent;
714
+ ```
715
+
716
+ ```json fileName="pages/about-meta.content.json" contentDeclarationFormat="json"
717
+ {
718
+ "key": "about-meta",
719
+ "content": {
720
+ "title": {
721
+ "nodeType": "translation",
722
+ "translations": {
723
+ "pt": "Sobre Nós - Minha Empresa",
724
+ "en": "About Us - My Company",
725
+ "fr": "À Propos - Ma Société",
726
+ "es": "Acerca de Nosotros - Mi Empresa"
727
+ }
728
+ },
729
+ "description": {
730
+ "nodeType": "translation",
731
+ "translations": {
732
+ "pt": "Saiba mais sobre nossa empresa e nossa missão",
733
+ "en": "Learn more about our company and our mission",
734
+ "fr": "En savoir plus sur notre société et notre mission",
735
+ "es": "Conozca más sobre nuestra empresa y nuestra misión"
736
+ }
737
+ }
738
+ }
739
+ }
740
+ ```
741
+
742
+ ### Configurar TypeScript
743
+
744
+ O Intlayer utiliza a ampliação de módulos para aproveitar os benefícios do TypeScript e tornar sua base de código mais robusta.
745
+
746
+ ![alt text](https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png)
747
+
748
+ ![alt text](https://github.com/aymericzip/intlayer/blob/main/docs/assets/translation_error.png)
749
+
750
+ Certifique-se de que sua configuração do TypeScript inclua os tipos gerados automaticamente.
751
+
752
+ ```json5 fileName="tsconfig.json"
753
+ {
754
+ // ... Suas configurações existentes do TypeScript
755
+ "include": [
756
+ // ... Suas configurações existentes do TypeScript
757
+ ".intlayer/**/*.ts", // Inclua os tipos gerados automaticamente
758
+ ],
759
+ }
760
+ ```
761
+
762
+ ### Configuração do Git
763
+
764
+ Recomenda-se ignorar os arquivos gerados pelo Intlayer. Isso permite evitar que eles sejam adicionados ao seu repositório Git.
765
+
766
+ Para fazer isso, você pode adicionar as seguintes instruções ao seu arquivo `.gitignore`:
767
+
768
+ ```plaintext fileName=".gitignore"
769
+ # Ignore os arquivos gerados pelo Intlayer
770
+ .intlayer
771
+ ```
772
+
773
+ ### Extensão do VS Code
774
+
775
+ Para melhorar sua experiência de desenvolvimento com o Intlayer, você pode instalar a **Extensão Oficial do Intlayer para VS Code**.
776
+
777
+ [Instale no VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
778
+
779
+ Esta extensão oferece:
780
+
781
+ - **Autocompletar** para chaves de tradução.
782
+ - **Detecção de erros em tempo real** para traduções ausentes.
783
+ - **Pré-visualizações inline** de conteúdo traduzido.
784
+ - **Ações rápidas** para criar e atualizar traduções facilmente.
785
+
786
+ Para mais detalhes sobre como usar a extensão, consulte a [documentação da Extensão do Intlayer para VS Code](https://intlayer.org/doc/vs-code-extension).
787
+
788
+ ---
789
+
790
+ ### Vá Além
791
+
792
+ ## Para ir além, você pode implementar o [editor visual](https://github.com/aymericzip/intlayer/blob/main/docs/pt/intlayer_visual_editor.md) ou externalizar seu conteúdo usando o [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/pt/intlayer_CMS.md).