@intlayer/docs 7.0.4-canary.0 → 7.0.4

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 (107) hide show
  1. package/blog/ar/intlayer_with_i18next.md +68 -106
  2. package/blog/ar/intlayer_with_next-i18next.md +84 -288
  3. package/blog/ar/intlayer_with_next-intl.md +58 -337
  4. package/blog/ar/intlayer_with_react-i18next.md +68 -290
  5. package/blog/ar/intlayer_with_react-intl.md +63 -266
  6. package/blog/de/intlayer_with_i18next.md +77 -97
  7. package/blog/de/intlayer_with_next-i18next.md +69 -296
  8. package/blog/de/intlayer_with_next-intl.md +59 -340
  9. package/blog/de/intlayer_with_react-i18next.md +68 -290
  10. package/blog/de/intlayer_with_react-intl.md +62 -264
  11. package/blog/en/intlayer_with_i18next.md +36 -1638
  12. package/blog/en/intlayer_with_next-i18next.md +22 -847
  13. package/blog/en/intlayer_with_next-intl.md +32 -1053
  14. package/blog/en/intlayer_with_react-i18next.md +38 -764
  15. package/blog/en/intlayer_with_react-intl.md +42 -1018
  16. package/blog/en-GB/intlayer_with_i18next.md +67 -103
  17. package/blog/en-GB/intlayer_with_next-i18next.md +71 -292
  18. package/blog/en-GB/intlayer_with_next-intl.md +58 -337
  19. package/blog/en-GB/intlayer_with_react-i18next.md +67 -289
  20. package/blog/en-GB/intlayer_with_react-intl.md +61 -264
  21. package/blog/es/intlayer_with_i18next.md +67 -103
  22. package/blog/es/intlayer_with_next-i18next.md +71 -296
  23. package/blog/es/intlayer_with_next-intl.md +57 -338
  24. package/blog/es/intlayer_with_react-i18next.md +68 -290
  25. package/blog/es/intlayer_with_react-intl.md +62 -265
  26. package/blog/fr/intlayer_with_i18next.md +66 -104
  27. package/blog/fr/intlayer_with_next-i18next.md +82 -285
  28. package/blog/fr/intlayer_with_next-intl.md +57 -338
  29. package/blog/fr/intlayer_with_react-i18next.md +67 -289
  30. package/blog/fr/intlayer_with_react-intl.md +61 -264
  31. package/blog/hi/intlayer_with_i18next.md +68 -104
  32. package/blog/hi/intlayer_with_next-i18next.md +74 -299
  33. package/blog/hi/intlayer_with_next-intl.md +57 -239
  34. package/blog/hi/intlayer_with_react-i18next.md +69 -291
  35. package/blog/hi/intlayer_with_react-intl.md +65 -268
  36. package/blog/id/intlayer_with_i18next.md +126 -0
  37. package/blog/id/intlayer_with_next-i18next.md +142 -0
  38. package/blog/id/intlayer_with_next-intl.md +113 -0
  39. package/blog/id/intlayer_with_react-i18next.md +124 -0
  40. package/blog/id/intlayer_with_react-intl.md +122 -0
  41. package/blog/it/intlayer_with_i18next.md +67 -103
  42. package/blog/it/intlayer_with_next-i18next.md +71 -296
  43. package/blog/it/intlayer_with_next-intl.md +57 -338
  44. package/blog/it/intlayer_with_react-i18next.md +68 -290
  45. package/blog/it/intlayer_with_react-intl.md +62 -265
  46. package/blog/ja/intlayer_with_i18next.md +68 -103
  47. package/blog/ja/intlayer_with_next-i18next.md +85 -283
  48. package/blog/ja/intlayer_with_next-intl.md +58 -336
  49. package/blog/ja/intlayer_with_react-i18next.md +68 -290
  50. package/blog/ja/intlayer_with_react-intl.md +62 -264
  51. package/blog/ko/intlayer_with_i18next.md +80 -96
  52. package/blog/ko/intlayer_with_next-i18next.md +85 -287
  53. package/blog/ko/intlayer_with_next-intl.md +68 -327
  54. package/blog/ko/intlayer_with_react-i18next.md +68 -290
  55. package/blog/ko/intlayer_with_react-intl.md +64 -266
  56. package/blog/pl/intlayer_with_i18next.md +126 -0
  57. package/blog/pl/intlayer_with_next-i18next.md +142 -0
  58. package/blog/pl/intlayer_with_next-intl.md +111 -0
  59. package/blog/pl/intlayer_with_react-i18next.md +124 -0
  60. package/blog/pl/intlayer_with_react-intl.md +122 -0
  61. package/blog/pt/intlayer_with_i18next.md +67 -103
  62. package/blog/pt/intlayer_with_next-i18next.md +72 -293
  63. package/blog/pt/intlayer_with_next-intl.md +57 -256
  64. package/blog/pt/intlayer_with_react-i18next.md +104 -78
  65. package/blog/pt/intlayer_with_react-intl.md +62 -266
  66. package/blog/ru/intlayer_with_i18next.md +66 -104
  67. package/blog/ru/intlayer_with_next-i18next.md +71 -296
  68. package/blog/ru/intlayer_with_next-intl.md +58 -337
  69. package/blog/ru/intlayer_with_react-i18next.md +68 -290
  70. package/blog/ru/intlayer_with_react-intl.md +62 -265
  71. package/blog/tr/intlayer_with_i18next.md +71 -107
  72. package/blog/tr/intlayer_with_next-i18next.md +72 -297
  73. package/blog/tr/intlayer_with_next-intl.md +58 -339
  74. package/blog/tr/intlayer_with_react-i18next.md +69 -291
  75. package/blog/tr/intlayer_with_react-intl.md +63 -285
  76. package/blog/vi/intlayer_with_i18next.md +126 -0
  77. package/blog/vi/intlayer_with_next-i18next.md +142 -0
  78. package/blog/vi/intlayer_with_next-intl.md +111 -0
  79. package/blog/vi/intlayer_with_react-i18next.md +124 -0
  80. package/blog/vi/intlayer_with_react-intl.md +122 -0
  81. package/blog/zh/intlayer_with_i18next.md +67 -102
  82. package/blog/zh/intlayer_with_next-i18next.md +72 -296
  83. package/blog/zh/intlayer_with_next-intl.md +58 -336
  84. package/blog/zh/intlayer_with_react-i18next.md +68 -290
  85. package/blog/zh/intlayer_with_react-intl.md +63 -106
  86. package/docs/ar/plugins/sync-json.md +244 -0
  87. package/docs/de/plugins/sync-json.md +244 -0
  88. package/docs/en/intlayer_cli.md +25 -0
  89. package/docs/en/intlayer_with_nextjs_14.md +2 -0
  90. package/docs/en/intlayer_with_nextjs_15.md +2 -0
  91. package/docs/en/intlayer_with_nextjs_16.md +2 -0
  92. package/docs/en/plugins/sync-json.md +1 -1
  93. package/docs/en-GB/plugins/sync-json.md +244 -0
  94. package/docs/es/plugins/sync-json.md +244 -0
  95. package/docs/fr/plugins/sync-json.md +244 -0
  96. package/docs/hi/plugins/sync-json.md +244 -0
  97. package/docs/id/plugins/sync-json.md +244 -0
  98. package/docs/it/plugins/sync-json.md +244 -0
  99. package/docs/ja/plugins/sync-json.md +244 -0
  100. package/docs/ko/plugins/sync-json.md +244 -0
  101. package/docs/pl/plugins/sync-json.md +244 -0
  102. package/docs/pt/plugins/sync-json.md +244 -0
  103. package/docs/ru/plugins/sync-json.md +244 -0
  104. package/docs/tr/plugins/sync-json.md +245 -0
  105. package/docs/vi/plugins/sync-json.md +244 -0
  106. package/docs/zh/plugins/sync-json.md +244 -0
  107. package/package.json +14 -14
@@ -1,363 +1,142 @@
1
1
  ---
2
2
  createdAt: 2025-08-23
3
- updatedAt: 2025-08-23
3
+ updatedAt: 2025-10-29
4
4
  title: Intlayer e next-i18next
5
- description: Integre o Intlayer com o next-i18next para um aplicativo Next.js
5
+ description: Integre o Intlayer com next-i18next para uma solução abrangente de internacionalização Next.js
6
6
  keywords:
7
7
  - i18next
8
8
  - next-i18next
9
9
  - Intlayer
10
10
  - Internacionalização
11
- - Blogumentação
11
+ - Blog
12
12
  - Next.js
13
13
  - JavaScript
14
14
  - React
15
15
  slugs:
16
16
  - blog
17
17
  - intlayer-with-next-i18next
18
+ history:
19
+ - version: 7.0.0
20
+ date: 2025-10-29
21
+ changes: Mudança para o plugin syncJSON e reescrita abrangente
18
22
  ---
19
23
 
20
- # Next.js Internacionalização (i18n) com next-i18next e Intlayer
24
+ # Internacionalização (i18n) Next.js com next-i18next e Intlayer
21
25
 
22
- Tanto next-i18next quanto Intlayer são frameworks de internacionalização (i18n) de código aberto projetados para aplicações Next.js. Eles são amplamente utilizados para gerenciar traduções, localização e troca de idiomas em projetos de software.
26
+ ## Índice
23
27
 
24
- Ambas as soluções incluem três noções principais:
28
+ <TOC/>
25
29
 
26
- 1. **Declaração de Conteúdo**: O método para definir o conteúdo traduzível de sua aplicação.
27
- - Nomeado `resource` no caso do `i18next`, a declaração de conteúdo é um objeto JSON estruturado contendo pares chave-valor para traduções em um ou mais idiomas. Veja a [documentação do i18next](https://www.i18next.com/translation-function/essentials) para mais informações.
28
- - Nomeada `content declaration file` no caso do `Intlayer`, a declaração de conteúdo pode ser um arquivo JSON, JS ou TS exportando os dados estruturados. Veja a [documentação do Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/doc/concept/content) para mais informações.
30
+ ## O que é next-i18next?
29
31
 
30
- 2. **Utilitários**: Ferramentas para construir e interpretar declarações de conteúdo na aplicação, como `getI18n()`, `useCurrentLocale()`, ou `useChangeLocale()` para next-i18next, e `useIntlayer()` ou `useLocale()` para Intlayer.
32
+ **next-i18next** é um dos frameworks de internacionalização (i18n) mais populares para aplicações Next.js. Construído sobre o poderoso ecossistema **i18next**, ele oferece uma solução abrangente para gerenciar traduções, localização e troca de idiomas em projetos Next.js.
31
33
 
32
- 3. **Plugins e Middleware**: Recursos para gerenciar redirecionamento de URL, otimização de pacotes e mais, como `next-i18next/middleware` para next-i18next ou `intlayerMiddleware` para Intlayer.
34
+ No entanto, o next-i18next apresenta alguns desafios:
33
35
 
34
- ## Intlayer vs. i18next: Principais Diferenças
36
+ - **Configuração complexa**: Configurar o next-i18next requer múltiplos arquivos de configuração e uma configuração cuidadosa das instâncias i18n no lado do servidor e do cliente.
37
+ - **Traduções dispersas**: Os arquivos de tradução geralmente são armazenados em diretórios separados dos componentes, dificultando a manutenção da consistência.
38
+ - **Gerenciamento manual de namespaces**: Os desenvolvedores precisam gerenciar manualmente os namespaces e garantir o carregamento adequado dos recursos de tradução.
39
+ - **Segurança de tipos limitada**: O suporte ao TypeScript requer configuração adicional e não fornece geração automática de tipos para traduções.
35
40
 
36
- Para explorar as diferenças entre i18next e Intlayer, confira nosso post de blog [next-i18next vs. next-intl vs. Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/blog/pt/i18next_vs_next-intl_vs_intlayer.md).
41
+ ## O que é o Intlayer?
37
42
 
38
- ## Como Gerar Dicionários do next-i18next com Intlayer
43
+ **Intlayer** é uma biblioteca inovadora e de código aberto para internacionalização, projetada para resolver as limitações das soluções tradicionais de i18n. Ela oferece uma abordagem moderna para o gerenciamento de conteúdo em aplicações Next.js.
39
44
 
40
- ### Por que Usar Intlayer com next-i18next?
45
+ Veja uma comparação concreta com o next-intl em nosso post no blog [next-i18next vs. next-intl vs. Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md).
41
46
 
42
- Os arquivos de declaração de conteúdo do Intlayer geralmente oferecem uma melhor experiência de desenvolvedor. Eles são mais flexíveis e manuteníveis devido a duas principais vantagens:
47
+ ## Por que combinar o Intlayer com o next-i18next?
43
48
 
44
- 1. **Colocação Flexível**: Um arquivo de declaração de conteúdo do Intlayer pode ser colocado em qualquer lugar na árvore de arquivos da aplicação, simplificando o gerenciamento de componentes duplicados ou excluídos sem deixar declarações de conteúdo não utilizadas.
49
+ Embora o Intlayer forneça uma excelente solução i18n independente (veja nosso [guia de integração com Next.js](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_with_nextjs_16.md)), você pode querer combiná-lo com o next-i18next por várias razões:
45
50
 
46
- Estruturas de arquivos de exemplo:
51
+ 1. **Base de código existente**: Você possui uma implementação estabelecida do next-i18next e deseja migrar gradualmente para a melhor experiência de desenvolvedor do Intlayer.
52
+ 2. **Requisitos legados**: Seu projeto requer compatibilidade com plugins ou fluxos de trabalho existentes do i18next.
53
+ 3. **Familiaridade da equipe**: Sua equipe está confortável com o next-i18next, mas deseja um melhor gerenciamento de conteúdo.
47
54
 
48
- ```bash codeFormat="typescript"
49
- .
50
- └── src
51
- └── components
52
- └── MyComponent
53
- ├── index.content.ts # Arquivo de declaração de conteúdo
54
- └── index.tsx
55
- ```
55
+ **Para isso, o Intlayer pode ser implementado como um adaptador para o next-i18next para ajudar a automatizar suas traduções JSON em CLI ou pipelines CI/CD, testar suas traduções e muito mais.**
56
56
 
57
- ```bash codeFormat="esm"
58
- .
59
- └── src
60
- └── components
61
- └── MyComponent
62
- ├── index.content.mjs # Arquivo de declaração de conteúdo
63
- └── index.mjx
64
- ```
57
+ Este guia mostra como aproveitar o sistema superior de declaração de conteúdo do Intlayer enquanto mantém a compatibilidade com o next-i18next.
65
58
 
66
- ```bash codeFormat="cjs"
67
- .
68
- └── src
69
- └── components
70
- └── MyComponent
71
- ├── index.content.cjs # Arquivo de declaração de conteúdo
72
- └── index.cjx
73
- ```
59
+ ---
74
60
 
75
- ```bash codeFormat="json"
76
- .
77
- └── src
78
- └── components
79
- └── MyComponent
80
- ├── index.content.json # Arquivo de declaração de conteúdo
81
- └── index.jsx
82
- ```
61
+ ## Guia Passo a Passo para Configurar o Intlayer com next-i18next
83
62
 
84
- 2. **Traduções Centralizadas**: O Intlayer armazena todas as traduções em um único arquivo, garantindo que nenhuma tradução esteja ausente. Ao usar TypeScript, traduções faltantes são automaticamente detectadas e relatadas como erros.
63
+ ### Passo 1: Instalar Dependências
85
64
 
86
- ### Instalação
65
+ Instale os pacotes necessários usando seu gerenciador de pacotes preferido:
87
66
 
88
67
  ```bash packageManager="npm"
89
- npm install intlayer i18next next-i18next i18next-resources-to-backend
90
- ```
91
-
92
- ```bash packageManager="yarn"
93
- yarn add intlayer i18next next-i18next i18next-resources-to-backend
68
+ npm install intlayer @intlayer/sync-json-plugin
94
69
  ```
95
70
 
96
71
  ```bash packageManager="pnpm"
97
- pnpm add intlayer i18next next-i18next i18next-resources-to-backend
72
+ pnpm add intlayer @intlayer/sync-json-plugin
98
73
  ```
99
74
 
100
- ### Configurando o Intlayer para Exportar Dicionários do i18next
101
-
102
- > Exportar recursos do i18next não garante compatibilidade 1:1 com outras estruturas. É recomendável aderir a uma configuração baseada no Intlayer para minimizar problemas.
103
-
104
- Para exportar recursos do i18next, configure o Intlayer em um arquivo `intlayer.config.ts`. Configurações de exemplo:
105
-
106
- ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
107
- import { Locales, type IntlayerConfig } from "intlayer";
75
+ ```bash packageManager="yarn"
76
+ yarn add intlayer @intlayer/sync-json-plugin
77
+ ```
108
78
 
109
- const config: IntlayerConfig = {
110
- internationalization: {
111
- locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
112
- defaultLocale: Locales.ENGLISH,
113
- },
114
- content: {
115
- dictionaryOutput: ["i18next"],
116
- i18nextResourcesDir: "./i18next/resources",
117
- },
118
- };
79
+ **Explicações dos pacotes:**
119
80
 
120
- export default config;
121
- ```
81
+ - **intlayer**: Biblioteca principal para declaração e gerenciamento de conteúdo
82
+ - **next-intlayer**: Camada de integração Next.js com plugins de build
83
+ - **i18next**: Framework principal de i18n
84
+ - **next-i18next**: Wrapper Next.js para i18next
85
+ - **i18next-resources-to-backend**: Carregamento dinâmico de recursos para i18next
86
+ - **@intlayer/sync-json-plugin**: Plugin para sincronizar declarações de conteúdo do Intlayer para o formato JSON do i18next
122
87
 
123
- ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
124
- import { Locales } from "intlayer";
88
+ ### Passo 2: Implemente o plugin Intlayer para encapsular o JSON
125
89
 
126
- /** @type {import('intlayer').IntlayerConfig} */
127
- const config = {
128
- internationalization: {
129
- locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
130
- defaultLocale: Locales.ENGLISH,
131
- },
132
- content: {
133
- dictionaryOutput: ["i18next"],
134
- i18nextResourcesDir: "./i18next/resources",
135
- },
136
- };
90
+ Crie um arquivo de configuração do Intlayer para definir os locais suportados:
137
91
 
138
- export default config;
139
- ```
92
+ **Se você também quiser exportar dicionários JSON para o i18next**, adicione o plugin `syncJSON`:
140
93
 
141
- ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
142
- const { Locales } = require("intlayer");
94
+ ```typescript fileName="intlayer.config.ts"
95
+ import { Locales, type IntlayerConfig } from "intlayer";
96
+ import { syncJSON } from "@intlayer/sync-json-plugin";
143
97
 
144
- /** @type {import('intlayer').IntlayerConfig} */
145
- const config = {
98
+ const config: IntlayerConfig = {
146
99
  internationalization: {
147
100
  locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
148
101
  defaultLocale: Locales.ENGLISH,
149
102
  },
150
- content: {
151
- dictionaryOutput: ["i18next"],
152
- i18nextResourcesDir: "./i18next/resources",
153
- },
154
- };
155
-
156
- module.exports = config;
157
- ```
158
-
159
- ### Importando Dicionários na Sua Configuração do i18next
160
-
161
- Para importar os recursos gerados em sua configuração do i18next, use `i18next-resources-to-backend`. Abaixo estão exemplos:
162
-
163
- ```typescript fileName="i18n/client.ts" codeFormat="typescript"
164
- import i18next from "i18next";
165
- import resourcesToBackend from "i18next-resources-to-backend";
166
-
167
- i18next.use(
168
- resourcesToBackend(
169
- (language: string, namespace: string) =>
170
- import(`../i18next/resources/${language}/${namespace}.json`)
171
- )
172
- );
173
- ```
174
-
175
- ```javascript fileName="i18n/client.mjs" codeFormat="esm"
176
- import i18next from "i18next";
177
- import resourcesToBackend from "i18next-resources-to-backend";
178
-
179
- i18next.use(
180
- resourcesToBackend(
181
- (language, namespace) =>
182
- import(`../i18next/resources/${language}/${namespace}.json`)
183
- )
184
- );
185
- ```
186
-
187
- ```javascript fileName="i18n/client.cjs" codeFormat="commonjs"
188
- const i18next = require("i18next");
189
- const resourcesToBackend = require("i18next-resources-to-backend");
190
-
191
- i18next.use(
192
- resourcesToBackend(
193
- (language, namespace) =>
194
- import(`../i18next/resources/${language}/${namespace}.json`)
195
- )
196
- );
197
- ```
198
-
199
- ### Declaração de Conteúdo
200
-
201
- Exemplos de arquivos de declaração de conteúdo em vários formatos:
202
-
203
- ```typescript fileName="**/*.content.ts" contentDeclarationFormat="typescript"
204
- import { t, type Dictionary } from "intlayer";
205
-
206
- const content = {
207
- key: "my-content",
208
- content: {
209
- myTranslatedContent: t({
210
- en: "Hello World",
211
- es: "Hola Mundo",
212
- fr: "Bonjour le monde",
213
- }),
214
- },
215
- } satisfies Dictionary;
216
-
217
- export default content;
218
- ```
219
-
220
- ```javascript fileName="**/*.content.mjs" contentDeclarationFormat="esm"
221
- import { t } from "intlayer";
222
-
223
- /** @type {import('intlayer').Dictionary} */
224
- const content = {
225
- key: "my-content",
226
- content: {
227
- myTranslatedContent: t({
228
- en: "Hello World",
229
- es: "Hola Mundo",
230
- fr: "Bonjour le monde",
231
- }),
232
- },
233
- };
234
- ```
235
-
236
- ```javascript fileName="**/*.content.cjs" contentDeclarationFormat="commonjs"
237
- const { t } = require("intlayer");
238
-
239
- module.exports = {
240
- key: "my-content",
241
- content: {
242
- myTranslatedContent: t({
243
- en: "Hello World",
244
- es: "Hola Mundo",
245
- fr: "Bonjour le monde",
103
+ plugins: [
104
+ syncJSON({
105
+ source: ({ key, locale }) => `./messages/${locale}/${key}.json`,
246
106
  }),
247
- },
107
+ ],
248
108
  };
249
- ```
250
109
 
251
- ```json fileName="**/*.content.json" contentDeclarationFormat="json"
252
- {
253
- "$schema": "https://intlayer.org/schema.json",
254
- "key": "my-content",
255
- "content": {
256
- "myTranslatedContent": {
257
- "nodeType": "translation",
258
- "translation": {
259
- "en": "Hello World",
260
- "fr": "Bonjour le monde",
261
- "es": "Hola Mundo"
262
- }
263
- }
264
- }
265
- }
266
- ```
267
-
268
- ### Construindo os Recursos do next-i18next
269
-
270
- Para construir os recursos do next-i18next, execute o seguinte comando:
271
-
272
- ```bash packageManager="npm"
273
- npx run intlayer build
274
- ```
275
-
276
- ```bash packageManager="yarn"
277
- yarn intlayer build
278
- ```
279
-
280
- ```bash packageManager="pnpm"
281
- pnpm intlayer build
282
- ```
283
-
284
- Isso irá gerar recursos no diretório `./i18next/resources`. A saída esperada:
285
-
286
- ```bash
287
- .
288
- └── i18next
289
- └── resources
290
- └── en
291
- └── my-content.json
292
- └── fr
293
- └── my-content.json
294
- └── es
295
- └── my-content.json
110
+ export default config;
296
111
  ```
297
112
 
298
- Nota: O namespace do i18next corresponde à chave de declaração do Intlayer.
113
+ O plugin `syncJSON` irá automaticamente encapsular o JSON. Ele irá ler e escrever os arquivos JSON sem alterar a arquitetura do conteúdo.
299
114
 
300
- ### Implementando o Plugin do Next.js
115
+ Se você quiser fazer coexistir esse JSON com os arquivos de declaração de conteúdo do intlayer (`.content` files), o Intlayer procederá da seguinte forma:
301
116
 
302
- Uma vez configurado, implemente o plugin do Next.js para reconstruir seus recursos do i18next sempre que os arquivos de declaração de conteúdo do Intlayer forem atualizados.
117
+ 1. carregar tanto os arquivos JSON quanto os arquivos de declaração de conteúdo e transformá-los em um dicionário do intlayer.
118
+ 2. se houver conflitos entre o JSON e os arquivos de declaração de conteúdo, o Intlayer irá proceder à mesclagem de todos esses dicionários. Dependendo da prioridade dos plugins e da do arquivo de declaração de conteúdo (todos são configuráveis).
303
119
 
304
- ```typescript fileName="next.config.mjs"
305
- import { withIntlayer } from "next-intlayer/server";
120
+ Se alterações forem feitas usando o CLI para traduzir o JSON, ou usando o CMS, o Intlayer atualizará o arquivo JSON com as novas traduções.
306
121
 
307
- /** @type {import('next').NextConfig} */
308
- const nextConfig = {};
309
-
310
- export default withIntlayer(nextConfig);
311
- ```
312
-
313
- ### Usando Conteúdo nos Componentes do Next.js
314
-
315
- Após implementar o plugin do Next.js, você pode usar o conteúdo em seus componentes:
316
-
317
- ```typescript fileName="src/components/myComponent/index.tsx" codeFormat="typescript"
318
- import type { FC } from "react";
319
- import { useTranslation } from "react-i18next";
122
+ ---
320
123
 
321
- const IndexPage: FC = () => {
322
- const { t } = useTranslation();
124
+ ## Configuração do Git
323
125
 
324
- return (
325
- <div>
326
- <h1>{t("my-content.title")}</h1>
327
- <p>{t("my-content.description")}</p>
328
- </div>
329
- );
330
- };
126
+ Exclua arquivos gerados do controle de versão:
331
127
 
332
- export default IndexPage;
128
+ ```plaintext fileName=".gitignore"
129
+ # Ignorar arquivos gerados pelo Intlayer
130
+ .intlayer
131
+ intl
333
132
  ```
334
133
 
335
- ```jsx fileName="src/components/myComponent/index.mjx" codeFormat="esm"
336
- import { useTranslation } from "react-i18next";
134
+ Esses arquivos são automaticamente regenerados durante o processo de build e não precisam ser comitados no seu repositório.
337
135
 
338
- const IndexPage = () => {
339
- const { t } = useTranslation();
136
+ ### Extensão VS Code
340
137
 
341
- return (
342
- <div>
343
- <h1>{t("my-content.title")}</h1>
344
- <p>{t("my-content.description")}</p>
345
- </div>
346
- );
347
- };
348
- ```
349
-
350
- ```jsx fileName="src/components/myComponent/index.cjx" codeFormat="commonjs"
351
- const { useTranslation } = require("react-i18next");
138
+ Para uma melhor experiência de desenvolvimento, instale a extensão oficial **Intlayer VS Code Extension**:
352
139
 
353
- const IndexPage = () => {
354
- const { t } = useTranslation();
140
+ [Instalar no VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
355
141
 
356
- return (
357
- <div>
358
- <h1>{t("my-content.title")}</h1>
359
- <p>{t("my-content.description")}</p>
360
- </div>
361
- );
362
- };
363
- ```
142
+ [Instalar no Marketplace do VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)