@intlayer/docs 8.4.6 → 8.4.8
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.
- package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/id/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/uk/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/vi/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/docs/ar/configuration.md +300 -264
- package/docs/cs/configuration.md +958 -0
- package/docs/de/configuration.md +285 -249
- package/docs/en/configuration.md +115 -137
- package/docs/en-GB/configuration.md +272 -237
- package/docs/es/configuration.md +161 -125
- package/docs/fr/configuration.md +137 -101
- package/docs/it/configuration.md +294 -259
- package/docs/ja/configuration.md +269 -233
- package/docs/nl/configuration.md +958 -0
- package/docs/pt/configuration.md +311 -275
- package/docs/ru/configuration.md +287 -272
- package/docs/tr/configuration.md +265 -229
- package/package.json +6 -6
- package/docs/bn/configuration.md +0 -922
- package/docs/hi/configuration.md +0 -922
- package/docs/id/configuration.md +0 -922
- package/docs/ko/configuration.md +0 -922
- package/docs/pl/configuration.md +0 -922
- package/docs/uk/configuration.md +0 -922
- package/docs/ur/configuration.md +0 -922
- package/docs/vi/configuration.md +0 -922
- package/docs/zh/configuration.md +0 -922
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2024-08-13
|
|
3
|
-
updatedAt: 2026-03-
|
|
3
|
+
updatedAt: 2026-03-12
|
|
4
4
|
title: Configuration
|
|
5
|
-
description: Learn how to configure Intlayer for your application. Understand the various settings and options available to
|
|
5
|
+
description: Learn how to configure Intlayer for your application. Understand the various settings and options available to customize Intlayer to your needs.
|
|
6
6
|
keywords:
|
|
7
7
|
- Configuration
|
|
8
8
|
- Settings
|
|
9
|
-
-
|
|
9
|
+
- Customization
|
|
10
10
|
- Intlayer
|
|
11
11
|
- Options
|
|
12
12
|
slugs:
|
|
@@ -16,86 +16,86 @@ slugs:
|
|
|
16
16
|
history:
|
|
17
17
|
- version: 8.4.0
|
|
18
18
|
date: 2026-03-20
|
|
19
|
-
changes:
|
|
19
|
+
changes: Add object per-locale notation for 'compiler.output' and 'dictionary.fill'
|
|
20
20
|
- version: 8.3.0
|
|
21
21
|
date: 2026-03-11
|
|
22
|
-
changes:
|
|
22
|
+
changes: Move 'baseDir' from 'content' to 'system' config
|
|
23
23
|
- version: 8.2.0
|
|
24
24
|
date: 2026-03-09
|
|
25
|
-
changes:
|
|
25
|
+
changes: Update compiler options, add 'output' and 'noMetadata' support
|
|
26
26
|
- version: 8.1.7
|
|
27
27
|
date: 2026-02-25
|
|
28
|
-
changes:
|
|
28
|
+
changes: Update compiler options
|
|
29
29
|
- version: 8.1.5
|
|
30
30
|
date: 2026-02-23
|
|
31
|
-
changes:
|
|
31
|
+
changes: Add compiler option 'build-only', and dictionary prefix
|
|
32
32
|
- version: 8.0.6
|
|
33
33
|
date: 2026-02-12
|
|
34
|
-
changes:
|
|
34
|
+
changes: Add support for Open Router, Alibaba, Amazon, Google Vertex Bedrock, Fireworks, Groq, Hugging Face, and Together.ai providers
|
|
35
35
|
- version: 8.0.5
|
|
36
36
|
date: 2026-02-06
|
|
37
|
-
changes:
|
|
37
|
+
changes: Add `dataSerialization` to the AI configuration
|
|
38
38
|
- version: 8.0.0
|
|
39
39
|
date: 2026-01-24
|
|
40
|
-
changes:
|
|
40
|
+
changes: Rename `live` import mode to `fetch` to better describe the underlying mechanism.
|
|
41
41
|
- version: 8.0.0
|
|
42
42
|
date: 2026-01-22
|
|
43
|
-
changes:
|
|
43
|
+
changes: Move `importMode` build configuration to `dictionary` configuration.
|
|
44
44
|
- version: 8.0.0
|
|
45
45
|
date: 2026-01-22
|
|
46
|
-
changes:
|
|
46
|
+
changes: Add `rewrite` option to the routing configuration
|
|
47
47
|
- version: 8.0.0
|
|
48
48
|
date: 2026-01-18
|
|
49
|
-
changes:
|
|
49
|
+
changes: Separate system configuration from content configuration. Move internal paths to `system` property. Add `codeDir` to separate content files from code transformation.
|
|
50
50
|
- version: 8.0.0
|
|
51
51
|
date: 2026-01-18
|
|
52
|
-
changes:
|
|
52
|
+
changes: Add `location` and `schema` dictionary options
|
|
53
53
|
- version: 7.5.1
|
|
54
54
|
date: 2026-01-10
|
|
55
|
-
changes:
|
|
55
|
+
changes: Add support for JSON5 and JSONC file formats
|
|
56
56
|
- version: 7.5.0
|
|
57
57
|
date: 2025-12-17
|
|
58
|
-
changes:
|
|
58
|
+
changes: Add `buildMode` option
|
|
59
59
|
- version: 7.0.0
|
|
60
60
|
date: 2025-10-25
|
|
61
|
-
changes:
|
|
61
|
+
changes: Add `dictionary` configuration
|
|
62
62
|
- version: 7.0.0
|
|
63
63
|
date: 2025-10-21
|
|
64
|
-
changes:
|
|
64
|
+
changes: Replace `middleware` by `routing` configuration
|
|
65
65
|
- version: 7.0.0
|
|
66
66
|
date: 2025-10-12
|
|
67
|
-
changes:
|
|
67
|
+
changes: Add `formatCommand` option
|
|
68
68
|
- version: 6.2.0
|
|
69
69
|
date: 2025-10-12
|
|
70
|
-
changes:
|
|
70
|
+
changes: Update `excludedPath` option
|
|
71
71
|
- version: 6.0.2
|
|
72
72
|
date: 2025-09-23
|
|
73
|
-
changes:
|
|
73
|
+
changes: Add `outputFormat` option
|
|
74
74
|
- version: 6.0.0
|
|
75
75
|
date: 2025-09-21
|
|
76
|
-
changes:
|
|
76
|
+
changes: Remove `dictionaryOutput` field and `i18nextResourcesDir` field
|
|
77
77
|
- version: 6.0.0
|
|
78
78
|
date: 2025-09-16
|
|
79
|
-
changes:
|
|
79
|
+
changes: Add `live` import mode
|
|
80
80
|
- version: 6.0.0
|
|
81
81
|
date: 2025-09-04
|
|
82
|
-
changes:
|
|
82
|
+
changes: Replace `hotReload` field by `liveSync` and add `liveSyncPort` and `liveSyncURL` fields
|
|
83
83
|
- version: 5.6.1
|
|
84
84
|
date: 2025-07-25
|
|
85
|
-
changes:
|
|
85
|
+
changes: Replace `activateDynamicImport` with `importMode` option
|
|
86
86
|
- version: 5.6.0
|
|
87
87
|
date: 2025-07-13
|
|
88
|
-
changes:
|
|
88
|
+
changes: Change default contentDir from `['src']` to `['.']`
|
|
89
89
|
- version: 5.5.11
|
|
90
90
|
date: 2025-06-29
|
|
91
|
-
changes:
|
|
91
|
+
changes: Add `docs` commands
|
|
92
92
|
---
|
|
93
93
|
|
|
94
94
|
# Intlayer Configuration Documentation
|
|
95
95
|
|
|
96
96
|
## Overview
|
|
97
97
|
|
|
98
|
-
Intlayer configuration files allow
|
|
98
|
+
Intlayer configuration files allow customization of various aspects of the plugin, such as internationalization, middleware, and content handling. This document provides a detailed description of each property in the configuration.
|
|
99
99
|
|
|
100
100
|
---
|
|
101
101
|
|
|
@@ -105,9 +105,9 @@ Intlayer configuration files allow you to customise various aspects of the plugi
|
|
|
105
105
|
|
|
106
106
|
---
|
|
107
107
|
|
|
108
|
-
##
|
|
108
|
+
## Configuration File Support
|
|
109
109
|
|
|
110
|
-
Intlayer accepts
|
|
110
|
+
Intlayer accepts JSON, JS, MJS, and TS configuration file formats:
|
|
111
111
|
|
|
112
112
|
- `intlayer.config.ts`
|
|
113
113
|
- `intlayer.config.js`
|
|
@@ -120,7 +120,7 @@ Intlayer accepts configuration file formats including JSON, JS, MJS, and TS:
|
|
|
120
120
|
|
|
121
121
|
---
|
|
122
122
|
|
|
123
|
-
##
|
|
123
|
+
## Example config file
|
|
124
124
|
|
|
125
125
|
````typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
126
126
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
@@ -128,30 +128,30 @@ import { nextjsRewrite } from "intlayer/routing";
|
|
|
128
128
|
import { z } from "zod";
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
* Example Intlayer configuration file
|
|
131
|
+
* Example Intlayer configuration file showing all available options.
|
|
132
132
|
*/
|
|
133
133
|
const config: IntlayerConfig = {
|
|
134
134
|
/**
|
|
135
|
-
* Configuration for
|
|
135
|
+
* Configuration for internationalization settings.
|
|
136
136
|
*/
|
|
137
137
|
internationalization: {
|
|
138
138
|
/**
|
|
139
|
-
* List of locales
|
|
139
|
+
* List of supported locales in the application.
|
|
140
140
|
* Default: [Locales.ENGLISH]
|
|
141
141
|
*/
|
|
142
142
|
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
* List of
|
|
146
|
-
* If empty, all locales are
|
|
145
|
+
* List of required locales that must be defined in every dictionary.
|
|
146
|
+
* If empty, all locales are required in `strict` mode.
|
|
147
147
|
* Default: []
|
|
148
148
|
*/
|
|
149
149
|
requiredLocales: [Locales.ENGLISH],
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
|
-
*
|
|
153
|
-
* - "strict":
|
|
154
|
-
* - "inclusive":
|
|
152
|
+
* Strictness level for internationalized content.
|
|
153
|
+
* - "strict": Errors if any declared locale is missing or undeclared.
|
|
154
|
+
* - "inclusive": Warnings if a declared locale is missing.
|
|
155
155
|
* - "loose": Accepts any existing locale.
|
|
156
156
|
* Default: "inclusive"
|
|
157
157
|
*/
|
|
@@ -165,37 +165,37 @@ const config: IntlayerConfig = {
|
|
|
165
165
|
},
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
* Settings
|
|
168
|
+
* Settings that control dictionary operations and fallback behavior.
|
|
169
169
|
*/
|
|
170
170
|
dictionary: {
|
|
171
171
|
/**
|
|
172
172
|
* Controls how dictionaries are imported.
|
|
173
173
|
* - "static": Statically imported at build time.
|
|
174
174
|
* - "dynamic": Dynamically imported using Suspense.
|
|
175
|
-
* - "fetch":
|
|
175
|
+
* - "fetch": Fetched dynamically via the live sync API.
|
|
176
176
|
* Default: "static"
|
|
177
177
|
*/
|
|
178
178
|
importMode: "static",
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
|
-
* Strategy
|
|
182
|
-
* Can be a boolean
|
|
181
|
+
* Strategy for auto-filling missing translations using AI.
|
|
182
|
+
* Can be a boolean or a path pattern to store filled content.
|
|
183
183
|
* Default: true
|
|
184
184
|
*/
|
|
185
185
|
fill: true,
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
|
-
* Physical location of dictionary files.
|
|
188
|
+
* Physical location of the dictionary files.
|
|
189
189
|
* - "local": Stored in the local filesystem.
|
|
190
190
|
* - "remote": Stored in the Intlayer CMS.
|
|
191
|
-
* - "hybrid": Stored
|
|
192
|
-
* - "plugin" (or any custom string): Provided by a plugin or custom source.
|
|
191
|
+
* - "hybrid": Stored in the local filesystem and the Intlayer CMS.
|
|
192
|
+
* - "plugin" (or any custom string): Provided by a plugin or a custom source.
|
|
193
193
|
* Default: "local"
|
|
194
194
|
*/
|
|
195
195
|
location: "local",
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
|
-
* Whether
|
|
198
|
+
* Whether to automatically transform content (e.g., Markdown to HTML).
|
|
199
199
|
* Default: false
|
|
200
200
|
*/
|
|
201
201
|
contentAutoTransformation: false,
|
|
@@ -207,29 +207,29 @@ const config: IntlayerConfig = {
|
|
|
207
207
|
routing: {
|
|
208
208
|
/**
|
|
209
209
|
* Locale routing strategy.
|
|
210
|
-
* - "prefix-no-default":
|
|
211
|
-
* - "prefix-all":
|
|
212
|
-
* - "no-prefix": No locale in URL.
|
|
213
|
-
* - "search-params":
|
|
210
|
+
* - "prefix-no-default": Prefix all except the default locale (e.g., /dashboard, /fr/dashboard).
|
|
211
|
+
* - "prefix-all": Prefix all locales (e.g., /en/dashboard, /fr/dashboard).
|
|
212
|
+
* - "no-prefix": No locale in the URL.
|
|
213
|
+
* - "search-params": Use ?locale=...
|
|
214
214
|
* Default: "prefix-no-default"
|
|
215
215
|
*/
|
|
216
216
|
mode: "prefix-no-default",
|
|
217
217
|
|
|
218
218
|
/**
|
|
219
|
-
* Where to store the user
|
|
219
|
+
* Where to store the user's selected locale.
|
|
220
220
|
* Options: 'cookie', 'localStorage', 'sessionStorage', 'header', or an array of these.
|
|
221
221
|
* Default: ['cookie', 'header']
|
|
222
222
|
*/
|
|
223
223
|
storage: ["cookie", "header"],
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
|
-
* Base path for application URLs.
|
|
226
|
+
* Base path for the application URLs.
|
|
227
227
|
* Default: ""
|
|
228
228
|
*/
|
|
229
229
|
basePath: "",
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
|
-
* Custom URL
|
|
232
|
+
* Custom URL rewriting rules for locale-specific paths.
|
|
233
233
|
*/
|
|
234
234
|
rewrite: nextjsRewrite({
|
|
235
235
|
"/[locale]/about": {
|
|
@@ -240,11 +240,11 @@ const config: IntlayerConfig = {
|
|
|
240
240
|
},
|
|
241
241
|
|
|
242
242
|
/**
|
|
243
|
-
* Settings
|
|
243
|
+
* Settings for finding and processing content files.
|
|
244
244
|
*/
|
|
245
245
|
content: {
|
|
246
246
|
/**
|
|
247
|
-
* File extensions for
|
|
247
|
+
* File extensions to scan for dictionaries.
|
|
248
248
|
* Default: ['.content.ts', '.content.js', '.content.json', etc.]
|
|
249
249
|
*/
|
|
250
250
|
fileExtensions: [".content.ts", ".content.js", ".content.json"],
|
|
@@ -256,26 +256,26 @@ const config: IntlayerConfig = {
|
|
|
256
256
|
contentDir: ["src"],
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
|
-
*
|
|
260
|
-
* Used for build
|
|
259
|
+
* Directories where source code is located.
|
|
260
|
+
* Used for build optimization and code transformation.
|
|
261
261
|
* Default: ["."]
|
|
262
262
|
*/
|
|
263
263
|
codeDir: ["src"],
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
|
-
* Patterns
|
|
266
|
+
* Patterns to exclude from scanning.
|
|
267
267
|
* Default: ['node_modules', '.intlayer', etc.]
|
|
268
268
|
*/
|
|
269
269
|
excludedPath: ["node_modules"],
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
|
-
* Whether to
|
|
272
|
+
* Whether to watch for changes and rebuild dictionaries in development.
|
|
273
273
|
* Default: true in development
|
|
274
274
|
*/
|
|
275
275
|
watch: true,
|
|
276
276
|
|
|
277
277
|
/**
|
|
278
|
-
* Command
|
|
278
|
+
* Command to format newly created <br/> updated .content files.
|
|
279
279
|
*/
|
|
280
280
|
formatCommand: 'npx prettier --write "{{file}}"',
|
|
281
281
|
},
|
|
@@ -291,7 +291,7 @@ const config: IntlayerConfig = {
|
|
|
291
291
|
enabled: true,
|
|
292
292
|
|
|
293
293
|
/**
|
|
294
|
-
*
|
|
294
|
+
* URL of your application for origin validation.
|
|
295
295
|
* Default: ""
|
|
296
296
|
*/
|
|
297
297
|
applicationURL: "http://localhost:3000",
|
|
@@ -321,14 +321,14 @@ const config: IntlayerConfig = {
|
|
|
321
321
|
backendURL: "https://back.intlayer.org",
|
|
322
322
|
|
|
323
323
|
/**
|
|
324
|
-
* Whether to enable real-time content
|
|
324
|
+
* Whether to enable real-time content synchronization.
|
|
325
325
|
* Default: false
|
|
326
326
|
*/
|
|
327
327
|
liveSync: true,
|
|
328
328
|
},
|
|
329
329
|
|
|
330
330
|
/**
|
|
331
|
-
* AI-
|
|
331
|
+
* AI-powered translation and generation settings.
|
|
332
332
|
*/
|
|
333
333
|
ai: {
|
|
334
334
|
/**
|
|
@@ -339,7 +339,7 @@ const config: IntlayerConfig = {
|
|
|
339
339
|
provider: "openai",
|
|
340
340
|
|
|
341
341
|
/**
|
|
342
|
-
* Model
|
|
342
|
+
* Model to use from the selected provider.
|
|
343
343
|
*/
|
|
344
344
|
model: "gpt-4o",
|
|
345
345
|
|
|
@@ -349,21 +349,21 @@ const config: IntlayerConfig = {
|
|
|
349
349
|
apiKey: process.env.OPENAI_API_KEY,
|
|
350
350
|
|
|
351
351
|
/**
|
|
352
|
-
* Global context to guide AI in generating translations.
|
|
352
|
+
* Global context to guide the AI in generating translations.
|
|
353
353
|
*/
|
|
354
354
|
applicationContext: "This is a travel booking application.",
|
|
355
355
|
|
|
356
356
|
/**
|
|
357
|
-
* Base URL for AI API.
|
|
357
|
+
* Base URL for the AI API.
|
|
358
358
|
*/
|
|
359
359
|
baseURL: "http://localhost:3000",
|
|
360
360
|
|
|
361
361
|
/**
|
|
362
|
-
* Data
|
|
362
|
+
* Data serialization
|
|
363
363
|
*
|
|
364
364
|
* Options:
|
|
365
|
-
* - "json":
|
|
366
|
-
* - "toon":
|
|
365
|
+
* - "json": Standard, reliable; uses more tokens.
|
|
366
|
+
* - "toon": Fewer tokens, less consistent than JSON.
|
|
367
367
|
*
|
|
368
368
|
* Default: "json"
|
|
369
369
|
*/
|
|
@@ -371,19 +371,19 @@ const config: IntlayerConfig = {
|
|
|
371
371
|
},
|
|
372
372
|
|
|
373
373
|
/**
|
|
374
|
-
* Build and
|
|
374
|
+
* Build and optimization settings.
|
|
375
375
|
*/
|
|
376
376
|
build: {
|
|
377
377
|
/**
|
|
378
378
|
* Build execution mode.
|
|
379
|
-
* - "auto":
|
|
380
|
-
* - "manual": Requires
|
|
379
|
+
* - "auto": Automatic build during app build.
|
|
380
|
+
* - "manual": Requires explicit build command.
|
|
381
381
|
* Default: "auto"
|
|
382
382
|
*/
|
|
383
383
|
mode: "auto",
|
|
384
384
|
|
|
385
385
|
/**
|
|
386
|
-
* Whether to
|
|
386
|
+
* Whether to optimize the final bundle by pruning unused dictionaries.
|
|
387
387
|
* Default: true in production
|
|
388
388
|
*/
|
|
389
389
|
optimize: true,
|
|
@@ -395,7 +395,7 @@ const config: IntlayerConfig = {
|
|
|
395
395
|
outputFormat: ["cjs", "esm"],
|
|
396
396
|
|
|
397
397
|
/**
|
|
398
|
-
* Indicates
|
|
398
|
+
* Indicates if the build should check TypeScript types.
|
|
399
399
|
* Default: false
|
|
400
400
|
*/
|
|
401
401
|
checkTypes: false,
|
|
@@ -408,8 +408,8 @@ const config: IntlayerConfig = {
|
|
|
408
408
|
/**
|
|
409
409
|
* Logging level.
|
|
410
410
|
* - "default": Standard logging.
|
|
411
|
-
* - "verbose":
|
|
412
|
-
* - "disabled":
|
|
411
|
+
* - "verbose": Detailed debug logging.
|
|
412
|
+
* - "disabled": No logging.
|
|
413
413
|
* Default: "default"
|
|
414
414
|
*/
|
|
415
415
|
mode: "default",
|
|
@@ -422,16 +422,16 @@ const config: IntlayerConfig = {
|
|
|
422
422
|
},
|
|
423
423
|
|
|
424
424
|
/**
|
|
425
|
-
* System
|
|
425
|
+
* System configuration (Advanced use cases)
|
|
426
426
|
*/
|
|
427
427
|
system: {
|
|
428
428
|
/**
|
|
429
|
-
* Directory for storing
|
|
429
|
+
* Directory for storing localization dictionaries.
|
|
430
430
|
*/
|
|
431
431
|
dictionariesDir: ".intlayer/dictionary",
|
|
432
432
|
|
|
433
433
|
/**
|
|
434
|
-
* Directory for
|
|
434
|
+
* Directory for module augmentation.
|
|
435
435
|
*/
|
|
436
436
|
moduleAugmentationDir: ".intlayer/types",
|
|
437
437
|
|
|
@@ -446,7 +446,7 @@ const config: IntlayerConfig = {
|
|
|
446
446
|
typesDir: ".intlayer/types",
|
|
447
447
|
|
|
448
448
|
/**
|
|
449
|
-
* Directory where
|
|
449
|
+
* Directory where main application files are stored.
|
|
450
450
|
*/
|
|
451
451
|
mainDir: ".intlayer/main",
|
|
452
452
|
|
|
@@ -462,32 +462,32 @@ const config: IntlayerConfig = {
|
|
|
462
462
|
},
|
|
463
463
|
|
|
464
464
|
/**
|
|
465
|
-
* Compiler
|
|
465
|
+
* Compiler configuration (Advanced use cases)
|
|
466
466
|
*/
|
|
467
467
|
compiler: {
|
|
468
468
|
/**
|
|
469
|
-
* Indicates
|
|
469
|
+
* Indicates if the compiler should be enabled.
|
|
470
470
|
*
|
|
471
|
-
* - false:
|
|
472
|
-
* - true:
|
|
473
|
-
* - "build-only":
|
|
471
|
+
* - false: Disable the compiler.
|
|
472
|
+
* - true: Enable the compiler.
|
|
473
|
+
* - "build-only": Skip the compiler during development and speed up start times.
|
|
474
474
|
*
|
|
475
475
|
* Default: false
|
|
476
476
|
*/
|
|
477
477
|
enabled: true,
|
|
478
478
|
|
|
479
479
|
/**
|
|
480
|
-
* Defines
|
|
480
|
+
* Defines the output files path. Replaces `outputDir`.
|
|
481
481
|
*
|
|
482
482
|
* - `./` paths are resolved relative to the component directory.
|
|
483
483
|
* - `/` paths are resolved relative to the project root (`baseDir`).
|
|
484
484
|
*
|
|
485
|
-
* - Including `{{locale}}` variable in path will trigger the
|
|
485
|
+
* - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
|
|
486
486
|
*
|
|
487
487
|
* Example:
|
|
488
488
|
* ```ts
|
|
489
489
|
* {
|
|
490
|
-
* // Create
|
|
490
|
+
* // Create Multilingual .content.ts files close to the component
|
|
491
491
|
* output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
492
492
|
*
|
|
493
493
|
* // output: './{{fileName}}{{extension}}', // Equivalent using template string
|
|
@@ -496,7 +496,7 @@ const config: IntlayerConfig = {
|
|
|
496
496
|
*
|
|
497
497
|
* ```ts
|
|
498
498
|
* {
|
|
499
|
-
* // Create
|
|
499
|
+
* // Create centralize per-locale JSON at the root of the project
|
|
500
500
|
* output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
|
|
501
501
|
*
|
|
502
502
|
* // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string
|
|
@@ -504,37 +504,37 @@ const config: IntlayerConfig = {
|
|
|
504
504
|
* ```
|
|
505
505
|
*
|
|
506
506
|
* Variable list:
|
|
507
|
-
* - `fileName`:
|
|
508
|
-
* - `key`:
|
|
509
|
-
* - `locale`:
|
|
510
|
-
* - `extension`:
|
|
511
|
-
* - `componentFileName`:
|
|
512
|
-
* - `componentExtension`:
|
|
513
|
-
* - `format`:
|
|
514
|
-
* - `componentFormat`:
|
|
515
|
-
* - `componentDirPath`:
|
|
507
|
+
* - `fileName`: The name of the file.
|
|
508
|
+
* - `key`: The key of the content.
|
|
509
|
+
* - `locale`: The locale of the content.
|
|
510
|
+
* - `extension`: The extension of the file.
|
|
511
|
+
* - `componentFileName`: The name of the component file.
|
|
512
|
+
* - `componentExtension`: The extension of the component file.
|
|
513
|
+
* - `format`: The format of the dictionary.
|
|
514
|
+
* - `componentFormat`: The format of the component dictionary.
|
|
515
|
+
* - `componentDirPath`: The directory path of the component.
|
|
516
516
|
*/
|
|
517
517
|
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
518
518
|
|
|
519
519
|
/**
|
|
520
|
-
* Indicates
|
|
521
|
-
*
|
|
520
|
+
* Indicates if the components should be saved after being transformed.
|
|
521
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
522
522
|
*/
|
|
523
523
|
saveComponents: false,
|
|
524
524
|
|
|
525
525
|
/**
|
|
526
|
-
*
|
|
526
|
+
* Inset only content into the generated file. Useful for per-locale i18next or ICU MessageFormat JSON outputs.
|
|
527
527
|
*/
|
|
528
528
|
noMetadata: false,
|
|
529
529
|
|
|
530
530
|
/**
|
|
531
531
|
* Dictionary key prefix
|
|
532
532
|
*/
|
|
533
|
-
dictionaryKeyPrefix: "", // Add an optional prefix
|
|
533
|
+
dictionaryKeyPrefix: "", // Add an optional prefix for the extracted dictionary keys
|
|
534
534
|
},
|
|
535
535
|
|
|
536
536
|
/**
|
|
537
|
-
* Custom schemas
|
|
537
|
+
* Custom schemas to validate the dictionaries content.
|
|
538
538
|
*/
|
|
539
539
|
schemas: {
|
|
540
540
|
"my-schema": z.object({
|
|
@@ -555,54 +555,54 @@ export default config;
|
|
|
555
555
|
|
|
556
556
|
## Configuration Reference
|
|
557
557
|
|
|
558
|
-
The following sections describe the various configuration settings available
|
|
558
|
+
The following sections describe the various configuration settings available for Intlayer.
|
|
559
559
|
|
|
560
560
|
---
|
|
561
561
|
|
|
562
|
-
###
|
|
562
|
+
### Internationalization Configuration
|
|
563
563
|
|
|
564
|
-
Defines settings related to
|
|
564
|
+
Defines settings related to internationalization, including available locales and the default locale for the application.
|
|
565
565
|
|
|
566
|
-
| Field | Type |
|
|
567
|
-
| ----------------- | ---------- |
|
|
568
|
-
| `locales` |
|
|
569
|
-
| `requiredLocales` |
|
|
570
|
-
| `strictMode` |
|
|
571
|
-
| `defaultLocale` |
|
|
566
|
+
| Field | Description | Type | Default | Example | Note |
|
|
567
|
+
| ----------------- | ---------------------------------------------------------------------------- | ---------- | ------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
568
|
+
| `locales` | The list of supported locales in the application. | `string[]` | `[Locales.ENGLISH]` | `['en', 'fr', 'es']` | |
|
|
569
|
+
| `requiredLocales` | The list of required locales in the application. | `string[]` | `[]` | `[]` | • If empty, all locales are required in `strict` mode.<br/>• Ensure required locales are also defined in the `locales` field. |
|
|
570
|
+
| `strictMode` | Ensure strong implementations of internationalized content using TypeScript. | `string` | `'inclusive'` | | • If `"strict"`: the `t` function requires each declared locale to be defined — throws an error if one is missing or undeclared.<br/>• If `"inclusive"`: warns on missing locales but accepts undeclared ones that exist.<br/>• If `"loose"`: accepts any existing locale. |
|
|
571
|
+
| `defaultLocale` | The default locale used as a fallback if the requested locale is not found. | `string` | `Locales.ENGLISH` | `'en'` | Used to determine the locale when none is specified in the URL, cookie, or header. |
|
|
572
572
|
|
|
573
573
|
---
|
|
574
574
|
|
|
575
575
|
### Editor Configuration
|
|
576
576
|
|
|
577
|
-
Defines settings related to the integrated editor, including server port and
|
|
578
|
-
|
|
579
|
-
| Field | Type
|
|
580
|
-
| ---------------------------- |
|
|
581
|
-
| `applicationURL` |
|
|
582
|
-
| `port` |
|
|
583
|
-
| `editorURL` |
|
|
584
|
-
| `cmsURL` |
|
|
585
|
-
| `backendURL` |
|
|
586
|
-
| `enabled` |
|
|
587
|
-
| `clientId` |
|
|
588
|
-
| `clientSecret` |
|
|
589
|
-
| `dictionaryPriorityStrategy` |
|
|
590
|
-
| `liveSync` |
|
|
591
|
-
| `liveSyncPort` |
|
|
592
|
-
| `liveSyncURL` |
|
|
577
|
+
Defines settings related to the integrated editor, including server port and active status.
|
|
578
|
+
|
|
579
|
+
| Field | Description | Type | Default | Example | Note |
|
|
580
|
+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
581
|
+
| `applicationURL` | The URL of the application. | `string` | `undefined` | `'http://localhost:3000'` <br/> `'https://example.com'` <br/> `process.env.INTLAYER_EDITOR_URL` | • Used to restrict the origin of the editor for security reasons.<br/>• If set to `'*'`, the editor is accessible from any origin. |
|
|
582
|
+
| `port` | The port used by the visual editor server. | `number` | `8000` | | |
|
|
583
|
+
| `editorURL` | The URL of the editor server. | `string` | `'http://localhost:8000'` | `'http://localhost:3000'` <br/> `'https://example.com'` <br/> `process.env.INTLAYER_EDITOR_URL` | • Used to restrict the origins that can interact with the application.<br/>• If set to `'*'`, accessible from any origin.<br/>• Should be set if port is changed or editor is hosted on a different domain. |
|
|
584
|
+
| `cmsURL` | The URL of the Intlayer CMS. | `string` | `'https://app.intlayer.org'` | `'https://app.intlayer.org'` | |
|
|
585
|
+
| `backendURL` | The URL of the backend server. | `string` | `https://back.intlayer.org` | `http://localhost:4000` | |
|
|
586
|
+
| `enabled` | Indicates if the application interacts with the visual editor. | `boolean` | `false` | `process.env.NODE_ENV !== 'production'` | • If `false`, the editor cannot interact with the application.<br/>• Disabling for specific environments enforces security. |
|
|
587
|
+
| `clientId` | Allows intlayer packages to authenticate with the backend using oAuth2. To get an access token, go to [intlayer.org/project](https://app.intlayer.org/project). | `string` | <br/> `undefined` | `undefined` | | Keep secret; store in environment variables. |
|
|
588
|
+
| `clientSecret` | Allows intlayer packages to authenticate with the backend using oAuth2. To get an access token, go to [intlayer.org/project](https://app.intlayer.org/project). | `string` | <br/> `undefined` | `undefined` | | Keep secret; store in environment variables. |
|
|
589
|
+
| `dictionaryPriorityStrategy` | Strategy to prioritize dictionaries when both local and distant are present. | `string` | `'local_first'` | `'distant_first'` | • `'distant_first'`: prioritizes distant over local.<br/>• `'local_first'`: prioritizes local over distant. |
|
|
590
|
+
| `liveSync` | Indicates if the app server should hot reload content when a change is detected on the CMS <br/> Visual Editor <br/> Backend. | `boolean` | `true` | `true` | • When a dictionary is added/updated, the app updates page content.<br/>• Live sync externalizes content to another server, which may slightly impact performance.<br/>• Recommend hosting both on the same machine. |
|
|
591
|
+
| `liveSyncPort` | The port of the live sync server. | `number` | `4000` | `4000` | |
|
|
592
|
+
| `liveSyncURL` | The URL of the live sync server. | `string` | `'http://localhost:{liveSyncPort}'` | `'https://example.com'` | Points to localhost by default; can be changed for a remote live sync server. |
|
|
593
593
|
|
|
594
594
|
### Routing Configuration
|
|
595
595
|
|
|
596
|
-
Settings that control routing
|
|
596
|
+
Settings that control routing behavior, including URL structure, locale storage, and middleware handling.
|
|
597
597
|
|
|
598
|
-
| Field | Type
|
|
599
|
-
| ---------- |
|
|
600
|
-
| `mode` | `'prefix-no-default' | 'prefix-all' | 'no-prefix' | 'search-params'`
|
|
601
|
-
| `storage` | `false | 'cookie' | 'localStorage' | 'sessionStorage' | 'header' | CookiesAttributes | StorageAttributes | Array` |
|
|
602
|
-
| `basePath` |
|
|
603
|
-
| `rewrite` |
|
|
598
|
+
| Field | Description | Type | Default | Example | Note |
|
|
599
|
+
| ---------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
600
|
+
| `mode` | URL routing mode for locale handling. | `'prefix-no-default'` | <br/> `'prefix-all'` | <br/> `'no-prefix'` | <br/> `'search-params'` | `'prefix-no-default'` | `'prefix-no-default'`: `/dashboard` (en) or `/fr/dashboard` (fr). `'prefix-all'`: `/en/dashboard`. `'no-prefix'`: locale handled via other means. `'search-params'`: `/dashboard?locale=fr` | Does not impact cookie or locale storage management. |
|
|
601
|
+
| `storage` | Configuration for storing the locale in the client. | `false` | <br/> `'cookie'` | <br/> `'localStorage'` | <br/> `'sessionStorage'` | <br/> `'header'` | <br/> `CookiesAttributes` | <br/> `StorageAttributes` | <br/> `Array` | `['cookie', 'header']` | `'localStorage'` <br/> `[{ type: 'cookie', name: 'custom-locale', secure: true }]` | See Storage Options table below. |
|
|
602
|
+
| `basePath` | The base path for the application URLs. | `string` | `''` | `'/my-app'` | If app is at `https://example.com/my-app, basePath is `'/my-app'` and URLs become `https://example.com/my-app/en`. |
|
|
603
|
+
| `rewrite` | Custom URL rewriting rules that override the default routing mode for specific paths. Supports `[param]` dynamic parameters. | `Record<string, StrictModeLocaleMap<string>>` | `undefined` | See example below | • Rewrite rules take precedence over `mode`.<br/>• Works with Next.js and Vite.<br/>• `getLocalizedUrl()` automatically applies matching rules.<br/>• See [Custom URL Rewrites](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/custom_url_rewrites.md). |
|
|
604
604
|
|
|
605
|
-
**`rewrite`
|
|
605
|
+
**`rewrite` example**:
|
|
606
606
|
|
|
607
607
|
```typescript
|
|
608
608
|
routing: {
|
|
@@ -626,35 +626,35 @@ routing: {
|
|
|
626
626
|
|
|
627
627
|
#### Storage Options
|
|
628
628
|
|
|
629
|
-
| Value | Description |
|
|
630
|
-
| ------------------ |
|
|
631
|
-
| `'cookie'` |
|
|
632
|
-
| `'localStorage'` |
|
|
633
|
-
| `'sessionStorage'` |
|
|
634
|
-
| `'header'` |
|
|
629
|
+
| Value | Note | Description |
|
|
630
|
+
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
631
|
+
| `'cookie'` | • For GDPR compliance, ensure proper user consent.<br/>• Customizable via `CookiesAttributes` (`{ type: 'cookie', name: 'custom-locale', secure: true, httpOnly: false }`). | Stores locale in cookies — accessible on both client and server side. |
|
|
632
|
+
| `'localStorage'` | • No expiration unless explicitly cleared.<br/>• Intlayer proxy cannot access it.<br/>• Customizable via `StorageAttributes` (`{ type: 'localStorage', name: 'custom-locale' }`). | Stores locale in the browser without expiration — client side only. |
|
|
633
|
+
| `'sessionStorage'` | • Cleared when tab/window is closed.<br/>• Intlayer proxy cannot access it.<br/>• Customizable via `StorageAttributes` (`{ type: 'sessionStorage', name: 'custom-locale' }`). | Stores locale for the duration of the page session — client side only. |
|
|
634
|
+
| `'header'` | • Useful for API calls.<br/>• Client side cannot access it.<br/>• Customizable via `StorageAttributes` (`{ type: 'header', name: 'custom-locale' }`). | Stores or transmits locale via HTTP headers — server side only. |
|
|
635
635
|
|
|
636
636
|
#### Cookie Attributes
|
|
637
637
|
|
|
638
638
|
When using cookie storage, you can configure additional cookie attributes:
|
|
639
639
|
|
|
640
|
-
| Field |
|
|
641
|
-
| ---------- |
|
|
642
|
-
| `name` |
|
|
643
|
-
| `domain` |
|
|
644
|
-
| `path` |
|
|
645
|
-
| `secure` |
|
|
646
|
-
| `httpOnly` |
|
|
647
|
-
| `sameSite` | `'strict' | 'lax' | 'none'` |
|
|
648
|
-
| `expires` |
|
|
640
|
+
| Field | Description | Type |
|
|
641
|
+
| ---------- | --------------------------------------------- | ----------------------------------------------------- |
|
|
642
|
+
| `name` | Cookie name. Default: `'INTLAYER_LOCALE'` | `string` |
|
|
643
|
+
| `domain` | Cookie domain. Default: `undefined` | `string` |
|
|
644
|
+
| `path` | Cookie path. Default: `undefined` | `string` |
|
|
645
|
+
| `secure` | Require HTTPS. Default: `undefined` | `boolean` |
|
|
646
|
+
| `httpOnly` | HTTP-only flag. Default: `undefined` | `boolean` |
|
|
647
|
+
| `sameSite` | SameSite policy. | `'strict'` | <br/> `'lax'` | <br/> `'none'` |
|
|
648
|
+
| `expires` | Expiration date or days. Default: `undefined` | `Date` | <br/> `number` |
|
|
649
649
|
|
|
650
650
|
#### Locale Storage Attributes
|
|
651
651
|
|
|
652
652
|
When using localStorage or sessionStorage:
|
|
653
653
|
|
|
654
|
-
| Field |
|
|
655
|
-
| ------ |
|
|
656
|
-
| `type` | `'localStorage' | 'sessionStorage'` |
|
|
657
|
-
| `name` |
|
|
654
|
+
| Field | Description | Type |
|
|
655
|
+
| ------ | ---------------------------------------------- | ------------------------------------------------ |
|
|
656
|
+
| `type` | Storage type. | `'localStorage'` | <br/> `'sessionStorage'` |
|
|
657
|
+
| `name` | Storage key name. Default: `'INTLAYER_LOCALE'` | `string` |
|
|
658
658
|
|
|
659
659
|
#### Configuration Examples
|
|
660
660
|
|
|
@@ -755,7 +755,7 @@ const config: IntlayerConfig = {
|
|
|
755
755
|
export default config;
|
|
756
756
|
```
|
|
757
757
|
|
|
758
|
-
**Custom URL
|
|
758
|
+
**Custom URL Rewriting with Dynamic Routes**:
|
|
759
759
|
|
|
760
760
|
```typescript
|
|
761
761
|
// intlayer.config.ts
|
|
@@ -767,7 +767,7 @@ const config: IntlayerConfig = {
|
|
|
767
767
|
defaultLocale: "en",
|
|
768
768
|
},
|
|
769
769
|
routing: {
|
|
770
|
-
mode: "prefix-no-default", // Fallback for paths
|
|
770
|
+
mode: "prefix-no-default", // Fallback for non-rewritten paths
|
|
771
771
|
storage: "cookie",
|
|
772
772
|
rewrite: nextjsRewrite({
|
|
773
773
|
"/about": {
|
|
@@ -793,36 +793,59 @@ export default config;
|
|
|
793
793
|
|
|
794
794
|
### Content Configuration
|
|
795
795
|
|
|
796
|
-
Settings
|
|
796
|
+
Settings related to content handling within the application, including directory names, file extensions, and derived configurations.
|
|
797
797
|
|
|
798
|
-
| Field | Type |
|
|
799
|
-
| ---------------- | ---------- |
|
|
800
|
-
| `watch` |
|
|
801
|
-
| `fileExtensions` |
|
|
802
|
-
| `contentDir` |
|
|
803
|
-
| `codeDir` |
|
|
804
|
-
| `excludedPath` |
|
|
805
|
-
| `formatCommand` | `string` |
|
|
798
|
+
| Field | Description | Type | Default | Example | Note |
|
|
799
|
+
| ---------------- | ---------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
800
|
+
| `watch` | Indicates if Intlayer should watch for changes in content declaration files to rebuild dictionaries. | `boolean` | `true` | | |
|
|
801
|
+
| `fileExtensions` | File extensions to look for when building dictionaries. | `string[]` | `['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.json5', '.content.jsonc', '.content.tsx', '.content.jsx']` | `['.data.ts', '.data.js', '.data.json']` | Customizing can help avoid conflicts. |
|
|
802
|
+
| `contentDir` | Directory path where content definition files (`.content.*`) are stored. | `string[]` | `['.']` | `['src', '../../ui-library', require.resolve("@my-package/content")]` | Used to watch for content files to rebuild dictionaries. |
|
|
803
|
+
| `codeDir` | Directory path where the code is stored, relative to the base directory. | `string[]` | `['.']` | `['src', '../../ui-library']` | • Used to watch for code files to transform (prune, optimize).<br/>• Keeping separate from `contentDir` can improve build performance. |
|
|
804
|
+
| `excludedPath` | Directories excluded from content search. | `string[]` | `['**/node_modules/**', '**/dist/**', '**/build/**', '**/.intlayer/**', '**/.next/**', '**/.nuxt/**', '**/.expo/**', '**/.vercel/**', '**/.turbo/**', '**/.tanstack/**']` | | Not yet used; planned for future implementation. |
|
|
805
|
+
| `formatCommand` | Command to format content files when Intlayer writes them locally. | `string` | `undefined` | `'npx prettier --write "{{file}}" --log-level silent'` (Prettier), `'npx biome format "{{file}}" --write --log-level none'` (Biome), `'npx eslint --fix "{{file}}" --quiet'` (ESLint) | • `{{file}}` is replaced with the file path.<br/>• If not set, Intlayer auto-detects (tries prettier, biome, eslint). |
|
|
806
806
|
|
|
807
807
|
---
|
|
808
808
|
|
|
809
|
+
### System Configuration
|
|
810
|
+
|
|
811
|
+
Settings related to internal paths and output results of Intlayer. These settings are typically internal and should not need to be modified by the user.
|
|
812
|
+
|
|
813
|
+
| Field | Description | Type | Default | Example | Note |
|
|
814
|
+
| ------------------------- | ------------------------------------------------------------------------------------- | -------- | --------------------------------- | -------------------- | ------------------------------------------------- |
|
|
815
|
+
| `baseDir` | The base directory for the project. | `string` | `process.cwd()` | `'/path/to/project'` | Used to resolve all Intlayer-related directories. |
|
|
816
|
+
| `dictionariesDir` | The directory path for storing localization dictionaries. | `string` | `'.intlayer/dictionary'` | | |
|
|
817
|
+
| `moduleAugmentationDir` | Directory for module augmentation, allowing better IDE suggestions and type checking. | `string` | `'.intlayer/types'` | `'intlayer-types'` | Be sure to include this in `tsconfig.json`. |
|
|
818
|
+
| `unmergedDictionariesDir` | The directory for storing unmerged dictionaries. | `string` | `'.intlayer/unmerged_dictionary'` | | |
|
|
819
|
+
| `typesDir` | The directory for storing dictionary types. | `string` | `'.intlayer/types'` | | |
|
|
820
|
+
| `mainDir` | The directory where main application files are stored. | `string` | `'.intlayer/main'` | | |
|
|
821
|
+
| `configDir` | The directory where configuration files are stored. | `string` | `'.intlayer/config'` | | |
|
|
822
|
+
| `cacheDir` | The directory where cache files are stored. | `string` | `'.intlayer/cache'` | | |
|
|
823
|
+
|
|
809
824
|
### Dictionary Configuration
|
|
810
825
|
|
|
811
|
-
Settings that control dictionary operations, including auto-
|
|
826
|
+
Settings that control dictionary operations, including auto-fill behavior and content generation.
|
|
812
827
|
|
|
813
|
-
This dictionary configuration
|
|
828
|
+
This dictionary configuration serves two main purposes:
|
|
814
829
|
|
|
815
|
-
1. **Default
|
|
816
|
-
2. **Fallback
|
|
830
|
+
1. **Default Values**: Define default values when creating content declaration files
|
|
831
|
+
2. **Fallback Behavior**: Provide fallback values when specific fields are not defined, allowing you to define dictionary operation behavior globally
|
|
817
832
|
|
|
818
|
-
For more information
|
|
833
|
+
For more information about content declaration files and how configuration values are applied, see the [Content File Documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md).
|
|
819
834
|
|
|
820
|
-
| Field | Type
|
|
821
|
-
| --------------------------- |
|
|
822
|
-
| `fill` | `boolean | FilePathPattern | Partial<Record<Locale, boolean | FilePathPattern>>` |
|
|
823
|
-
| `
|
|
824
|
-
| `
|
|
825
|
-
| `contentAutoTransformation` |
|
|
835
|
+
| Field | Description | Type | Default | Example | Note |
|
|
836
|
+
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
837
|
+
| `fill` | Controls how auto-fill (AI translation) output files are generated. | `boolean` | <br/> `FilePathPattern` | <br/> `Partial<Record<Locale, boolean | FilePathPattern>>` | `true` | `{ en: '/locales/en/{{key}}.json', fr: ({ key }) => '/locales/fr/${key}.json', es: false }` | • `true`: default path (same file as source).<br/>• `false`: disable.<br/>• String/function template generates per-locale files.<br/>• Object per-locale: each locale maps to its own pattern; `false` skips that locale.<br/>• Including `{{locale}}` triggers per-locale generation.<br/>• Dictionary-level `fill` always takes priority over this global config. |
|
|
838
|
+
| `description` | Helps understand the purpose of the dictionary in the editor and CMS. Also used as context for AI translation generation. | `string` | `undefined` | `'User profile section'` | |
|
|
839
|
+
| `locale` | Transforms the dictionary into a per-locale format. Each field declared becomes a translation node. If absent, the dictionary is treated as multilingual. | `LocalesValues` | `undefined` | `'en'` | Use this when the dictionary is specific to a single locale rather than containing translations for multiple locales. |
|
|
840
|
+
| `contentAutoTransformation` | Automatically transforms content strings into typed nodes (markdown, HTML, or insertion). | `boolean` | <br/> `{ markdown?: boolean; html?: boolean; insertion?: boolean }` | `false` | `true` | • Markdown: `### Title` → `md('### Title')`.<br/>• HTML: `<div>Title</div>` → `html('<div>Title</div>')`.<br/>• Insertion: `Hello {{name}}` → `insert('Hello {{name}}')`. |
|
|
841
|
+
| `location` | Indicates where dictionary files are stored and their CMS synchronization mode. | `'local'` | <br/> `'remote'` | <br/> `'hybrid'` | <br/> `'plugin'` | <br/> `string` | `'local'` | `'hybrid'` | • `'local'`: managed locally only.<br/>• `'remote'`: managed remotely only (CMS).<br/>• `'hybrid'`: managed both locally and remotely.<br/>• `'plugin'` or custom string: managed by a plugin or custom source. |
|
|
842
|
+
| `importMode` | Controls how dictionaries are imported. | `'static'` | <br/> `'dynamic'` | <br/> `'fetch'` | `'static'` | `'dynamic'` | • `'static'`: imported statically (replaces `useIntlayer` with `useDictionary`).<br/>• `'dynamic'`: imported dynamically via Suspense (replaces with `useDictionaryDynamic`).<br/>• `'fetch'`: fetched via live sync API; falls back to `'dynamic'` on failure.<br/>• Relies on `@intlayer/babel` and `@intlayer/swc` plugins.<br/>• Keys must be declared statically.<br/>• Ignored if `optimize` is disabled.<br/>• Does not affect `getIntlayer`, `getDictionary`, `useDictionary`, etc. |
|
|
843
|
+
| `priority` | Priority of the dictionary. Higher values take precedence over lower ones when resolving conflicts between dictionaries. | `number` | `undefined` | `1` | |
|
|
844
|
+
| `live` | Deprecated — use `importMode: 'fetch'` instead. Indicated whether dictionary content was fetched dynamically via the live sync API. | `boolean` | `undefined` | | Renamed to `importMode: 'fetch'` in v8.0.0. |
|
|
845
|
+
| `schema` | Auto-generated by Intlayer for JSON schema validation. | `'https://intlayer.org/schema.json'` | auto-generated | | Do not modify manually. |
|
|
846
|
+
| `title` | Helps identify the dictionary in the editor and CMS. | `string` | `undefined` | `'User Profile'` | |
|
|
847
|
+
| `tags` | Categorizes dictionaries and provides context or instructions for the editor and AI. | `string[]` | `undefined` | `['user', 'profile']` | |
|
|
848
|
+
| `version` | Version of the remote dictionary; helps track which version is currently in use. | `string` | `undefined` | `'1.0.0'` | • Manageable on the CMS.<br/>• Do not modify locally. |
|
|
826
849
|
|
|
827
850
|
**`fill` example**:
|
|
828
851
|
|
|
@@ -838,85 +861,97 @@ dictionary: {
|
|
|
838
861
|
|
|
839
862
|
---
|
|
840
863
|
|
|
841
|
-
###
|
|
864
|
+
### Logger Configuration
|
|
842
865
|
|
|
843
|
-
|
|
866
|
+
Settings that control the logger, including the prefix to use.
|
|
844
867
|
|
|
845
|
-
| Field
|
|
846
|
-
|
|
|
847
|
-
| `
|
|
848
|
-
| `
|
|
849
|
-
| `apiKey` | `string` | API key for the selected provider. | `process.env.OPENAI_API_KEY` | |
|
|
850
|
-
| `applicationContext` | `string` | Extra context about your app to improve AI translation accuracy. | `'A learning platform for children.'` | |
|
|
851
|
-
| `baseURL` | `string` | Optional base URL for API calls. | | Useful if you are using a proxy or local AI deployment. |
|
|
852
|
-
| `dataSerialization` | `'json' | 'toon'` | Defines how data is sent to the AI. Default: `'json'` | `'json'` | `'json'`: more robust and accurate. `'toon'`: uses fewer tokens but might be less stable. |
|
|
868
|
+
| Field | Description | Type | Default | Example | Note |
|
|
869
|
+
| -------- | --------------------------------- | -------------------------------------------------------------- | --------------- | ---------------------- | ---------------------------------------------------------------------------------------------- |
|
|
870
|
+
| `mode` | Indicates the mode of the logger. | `'default'` | <br/> `'verbose'` | <br/> `'disabled'` | `'default'` | `'verbose'` | • `'verbose'`: logs more info for debugging.<br/>• `'disabled'`: disables the logger entirely. |
|
|
871
|
+
| `prefix` | The prefix of the logger. | `string` | `'[intlayer] '` | `'[my custom prefix] '` | |
|
|
853
872
|
|
|
854
|
-
|
|
873
|
+
### AI Configuration
|
|
855
874
|
|
|
856
|
-
|
|
875
|
+
Settings that control the AI features of Intlayer, including the provider, model, and API key.
|
|
876
|
+
|
|
877
|
+
This configuration is optional if you're registered on the [Intlayer Dashboard](https://app.intlayer.org/project) using an access key. Intlayer will automatically manage the most efficient and cost-effective AI solution for your needs. Using the default options ensures better long-term maintainability as Intlayer continuously updates to use the most relevant models.
|
|
878
|
+
|
|
879
|
+
If you prefer to use your own API key or specific model, you can define your custom AI configuration.
|
|
880
|
+
This AI configuration will be used globally across your Intlayer environment. CLI commands will use these settings as defaults for the commands (e.g. `fill`), as well as the SDK, Visual Editor, and CMS. You can override these default values for specific use cases using command parameters.
|
|
881
|
+
|
|
882
|
+
Intlayer supports multiple AI providers for enhanced flexibility and choice. Currently supported providers are:
|
|
883
|
+
|
|
884
|
+
- **OpenAI** (default)
|
|
885
|
+
- **Anthropic Claude**
|
|
886
|
+
- **Mistral AI**
|
|
887
|
+
- **DeepSeek**
|
|
888
|
+
- **Google Gemini**
|
|
889
|
+
- **Google AI Studio**
|
|
890
|
+
- **Google Vertex**
|
|
891
|
+
- **Meta Llama**
|
|
892
|
+
- **Ollama**
|
|
893
|
+
- **OpenRouter**
|
|
894
|
+
- **Alibaba Cloud**
|
|
895
|
+
- **Fireworks**
|
|
896
|
+
- **Hugging Face**
|
|
897
|
+
- **Groq**
|
|
898
|
+
- **Amazon Bedrock**
|
|
899
|
+
- **Together.ai**
|
|
900
|
+
- **ollama**
|
|
901
|
+
|
|
902
|
+
| Field | Description | Type | Default | Example | Note |
|
|
903
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
904
|
+
| `provider` | The provider to use for the AI features of Intlayer. | `'openai'` | <br/> `'anthropic'` | <br/> `'mistral'` | <br/> `'deepseek'` | <br/> `'gemini'` | <br/> `'ollama'` | <br/> `'openrouter'` | <br/> `'alibaba'` | <br/> `'fireworks'` | <br/> `'groq'` | <br/> `'huggingface'` | <br/> `'bedrock'` | <br/> `'googleaistudio'` | <br/> `'googlevertex'` | <br/> `'togetherai'` | `undefined` | `'anthropic'` | Different providers require different API keys and have different pricing. |
|
|
905
|
+
| `model` | The model to use for AI features. | `string` | None | `'gpt-4o-2024-11-20'` | Specific model varies by provider. |
|
|
906
|
+
| `temperature` | Controls the randomness of AI responses. | `number` | None | `0.1` | Higher temperature = more creative and less predictable. |
|
|
907
|
+
| `apiKey` | Your API key for the selected provider. | `string` | None | `process.env.OPENAI_API_KEY` | Keep secret; store in environment variables. |
|
|
908
|
+
| `applicationContext` | Additional context about your application to help the AI generate more accurate translations (domain, audience, tone, terminology). | `string` | None | `'My application context'` | Can be used to add rules (e.g. `"You should not transform urls"`). |
|
|
909
|
+
| `baseURL` | The base URL for the AI API. | `string` | None | `'https://api.openai.com/v1'` <br/> `'http://localhost:5000'` | Can point to a local or custom AI API endpoint. |
|
|
910
|
+
| `dataSerialization` | Data serialization format for AI features. | `'json'` | <br/> `'toon'` | `undefined` | `'toon'` | • `'json'`: standard, reliable; uses more tokens.<br/>• `'toon'`: fewer tokens, less consistent.<br/>• Additional parameters are passed to the AI model as context (reasoning effort, verbosity, etc.). |
|
|
857
911
|
|
|
858
|
-
|
|
912
|
+
### Build Configuration
|
|
859
913
|
|
|
860
|
-
|
|
861
|
-
| -------------- | ------------------------ | ------------------------------------------------------------------------------------------------------- | ------- | ---- |
|
|
862
|
-
| `mode` | `'auto' | 'manual'` | Indicates whether Intlayer should run automatically during the app's pre-build steps. Default: `'auto'` | | |
|
|
863
|
-
| `optimize` | `boolean` | Indicates whether compiled dictionaries should be optimised for runtime. Default: `true` in production | | |
|
|
864
|
-
| `outputFormat` | `('cjs' | 'esm')[]` | Output format for generated dictionary files. Default: `['cjs', 'esm']` | | |
|
|
865
|
-
| `checkTypes` | `boolean` | Indicates whether Intlayer should check types in the generated files. Default: `false` | | |
|
|
914
|
+
Settings that control how Intlayer optimizes and builds your application's internationalization.
|
|
866
915
|
|
|
867
|
-
|
|
916
|
+
Build options apply to the `@intlayer/babel` and `@intlayer/swc` plugins.
|
|
868
917
|
|
|
869
|
-
|
|
918
|
+
> In development mode, Intlayer uses static imports for dictionaries to simplify the development experience.
|
|
870
919
|
|
|
871
|
-
|
|
920
|
+
> When optimized, Intlayer will replace dictionary calls to optimize chunking, so the final bundle only imports dictionaries that are actually used.
|
|
872
921
|
|
|
873
|
-
| Field
|
|
874
|
-
|
|
|
875
|
-
| `
|
|
876
|
-
| `
|
|
877
|
-
| `
|
|
878
|
-
| `
|
|
879
|
-
| `
|
|
880
|
-
| `configDir` | `string` | Compiled configuration files directory. | `'.intlayer/config'` |
|
|
881
|
-
| `cacheDir` | `string` | Cache files directory. | `'.intlayer/cache'` |
|
|
922
|
+
| Field | Description | Type | Default | Example | Note |
|
|
923
|
+
| ----------------- | -------------------------------------------------------------------- | -------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
924
|
+
| `mode` | Controls the mode of the build. | `'auto'` | <br/> `'manual'` | `'auto'` | `'manual'` | • `'auto'`: build enabled automatically when the application is built.<br/>• `'manual'`: only runs when the build command is executed.<br/>• Can be used to disable dictionary builds (e.g. to avoid running in Node.js environments). |
|
|
925
|
+
| `optimize` | Controls whether the build should be optimized. | `boolean` | `undefined` | `process.env.NODE_ENV === 'production'` | • If unset, optimization is triggered on framework build (Vite/Next.js).<br/>• `true` forces optimization including dev mode.<br/>• `false` disables it.<br/>• When enabled, replaces dictionary calls to optimize chunking — only used dictionaries are imported.<br/>• Relies on `@intlayer/babel` and `@intlayer/swc` plugins.<br/>• Keys must be declared statically. |
|
|
926
|
+
| `checkTypes` | Indicates if the build should check TypeScript types and log errors. | `boolean` | `false` | | Can slow down the build. |
|
|
927
|
+
| `outputFormat` | Controls the output format of the dictionaries. | `('esm' | 'cjs')[]` | `['esm', 'cjs']` | `['cjs']` | |
|
|
928
|
+
| `traversePattern` | Patterns defining which files to traverse during optimization. | `string[]` | `['**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}', '!**/node_modules/**', '!**/dist/**', '!**/.intlayer/**', '!**/*.config.*', '!**/*.test.*', '!**/*.spec.*', '!**/*.stories.*']` | `['src/**/*.{ts,tsx}', '../ui-library/**/*.{ts,tsx}', '!**/node_modules/**']` | • Limit optimization to relevant files to improve build performance.<br/>• Ignored if `optimize` is disabled.<br/>• Uses glob pattern. |
|
|
882
929
|
|
|
883
930
|
---
|
|
884
931
|
|
|
885
932
|
### Compiler Configuration
|
|
886
933
|
|
|
887
|
-
Settings
|
|
888
|
-
|
|
889
|
-
| Field | Type | Description | Default |
|
|
890
|
-
| --------------------- | ------------------------ | ---------------------------------------------------------------------------------------- | ------- |
|
|
891
|
-
| `enabled` | `boolean` | Indicates whether the compiler is active. | `false` |
|
|
892
|
-
| `output` | `string | Function` | Output path for extracted dictionaries. | |
|
|
893
|
-
| `saveComponents` | `boolean` | Indicates whether original source files should be overwritten with transformed versions. | `false` |
|
|
894
|
-
| `noMetadata` | `boolean` | If `true`, the compiler will not include metadata in the generated files. | `false` |
|
|
895
|
-
| `dictionaryKeyPrefix` | `string` | Optional dictionary key prefix. | `''` |
|
|
896
|
-
|
|
897
|
-
---
|
|
898
|
-
|
|
899
|
-
### Logger Configuration
|
|
900
|
-
|
|
901
|
-
Settings for customising Intlayer log output.
|
|
934
|
+
Settings that control the Intlayer compiler, which extracts dictionaries straight from your components.
|
|
902
935
|
|
|
903
|
-
| Field
|
|
904
|
-
|
|
|
905
|
-
| `
|
|
906
|
-
| `
|
|
907
|
-
|
|
908
|
-
|
|
936
|
+
| Field | Description | Type | Default | Example | Note |
|
|
937
|
+
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
938
|
+
| `enabled` | Indicates if the compiler should be enabled to extract dictionaries. | `boolean` | <br/> `'build-only'` | `true` | `'build-only'` | `'build-only'` skips the compiler during development to speed up builds; only runs on build commands. |
|
|
939
|
+
| `dictionaryKeyPrefix` | Prefix for the extracted dictionary keys. | `string` | `''` | `'my-key-'` | Added to the generated key (based on file name) to prevent conflicts. |
|
|
940
|
+
| `saveComponents` | Indicates if components should be saved after being transformed. | `boolean` | `false` | | • If `true`, replaces original files with transformed files.<br/>• The compiler can then be removed after one run. |
|
|
941
|
+
| `output` | Defines the output file path. Replaces `outputDir`. Supports template variables: `{{fileName}}`, <br/> `{{key}}`, <br/> `{{locale}}`, <br/> `{{extension}}`, <br/> `{{componentFileName}}`, <br/> `{{componentExtension}}`, <br/> `{{format}}`, <br/> `{{componentFormat}}`, <br/> `{{componentDirPath}}`. | `boolean` | <br/> `FilePathPattern` | <br/> `Partial<Record<Locale, boolean | FilePathPattern>>` | `undefined` | `'./{{fileName}}{{extension}}'` <br/> `'/locales/{{locale}}/{{key}}.json'` <br/> `{ en: ({ key }) => './locales/en/${key}.json', fr: '...', es: false }` | • `./` paths resolve relative to the component directory.<br/>• `/` paths resolve relative to the project root.<br/>• Including `{{locale}}` generates separate per-locale dictionaries.<br/>• Supports per-locale object notation; `false` skips that locale. |
|
|
942
|
+
| `noMetadata` | If `true`, the compiler omits dictionary metadata (key, content wrapper) from the output. | `boolean` | `false` | `false` → `{"key":"my-key","content":{"key":"value"}}` <br/> `true` → `{"key":"value"}` | • Useful for i18next or ICU MessageFormat JSON outputs.<br/>• Works well with `loadJSON` plugin. |
|
|
943
|
+
| `dictionaryKeyPrefix` | Dictionary key prefix | `string` | `''` | | Add an optional prefix for the extracted dictionary keys |
|
|
909
944
|
|
|
910
945
|
### Custom Schemas
|
|
911
946
|
|
|
912
|
-
| Field | Type |
|
|
913
|
-
| --------- |
|
|
914
|
-
| `schemas` |
|
|
947
|
+
| Field | Description | Type |
|
|
948
|
+
| --------- | --------------------------------------------------------------------------------- | --------------------------- |
|
|
949
|
+
| `schemas` | Permet de définir des schémas Zod pour valider la structure de vos dictionnaires. | `Record<string, ZodSchema>` |
|
|
915
950
|
|
|
916
951
|
---
|
|
917
952
|
|
|
918
953
|
### Plugins
|
|
919
954
|
|
|
920
|
-
| Field | Type |
|
|
921
|
-
| --------- |
|
|
922
|
-
| `plugins` |
|
|
955
|
+
| Field | Description | Type |
|
|
956
|
+
| --------- | ------------------------------------- | ------------------ |
|
|
957
|
+
| `plugins` | Liste des plugins Intlayer à activer. | `IntlayerPlugin[]` |
|