@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.
Files changed (33) hide show
  1. package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
  2. package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
  3. package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
  4. package/blog/id/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
  5. package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
  6. package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
  7. package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
  8. package/blog/uk/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
  9. package/blog/vi/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
  10. package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
  11. package/docs/ar/configuration.md +300 -264
  12. package/docs/cs/configuration.md +958 -0
  13. package/docs/de/configuration.md +285 -249
  14. package/docs/en/configuration.md +115 -137
  15. package/docs/en-GB/configuration.md +272 -237
  16. package/docs/es/configuration.md +161 -125
  17. package/docs/fr/configuration.md +137 -101
  18. package/docs/it/configuration.md +294 -259
  19. package/docs/ja/configuration.md +269 -233
  20. package/docs/nl/configuration.md +958 -0
  21. package/docs/pt/configuration.md +311 -275
  22. package/docs/ru/configuration.md +287 -272
  23. package/docs/tr/configuration.md +265 -229
  24. package/package.json +6 -6
  25. package/docs/bn/configuration.md +0 -922
  26. package/docs/hi/configuration.md +0 -922
  27. package/docs/id/configuration.md +0 -922
  28. package/docs/ko/configuration.md +0 -922
  29. package/docs/pl/configuration.md +0 -922
  30. package/docs/uk/configuration.md +0 -922
  31. package/docs/ur/configuration.md +0 -922
  32. package/docs/vi/configuration.md +0 -922
  33. package/docs/zh/configuration.md +0 -922
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  createdAt: 2024-08-13
3
- updatedAt: 2026-03-20
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 customise Intlayer according to your needs.
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
- - Customisation
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: Added per-locale object notation for 'compiler.output' and 'dictionary.fill'
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: Moved 'baseDir' from 'content' configuration to 'system' configuration
22
+ changes: Move 'baseDir' from 'content' to 'system' config
23
23
  - version: 8.2.0
24
24
  date: 2026-03-09
25
- changes: Updated compiler options, added support for 'output' and 'noMetadata'
25
+ changes: Update compiler options, add 'output' and 'noMetadata' support
26
26
  - version: 8.1.7
27
27
  date: 2026-02-25
28
- changes: Updated compiler options
28
+ changes: Update compiler options
29
29
  - version: 8.1.5
30
30
  date: 2026-02-23
31
- changes: Added compiler option 'build-only' and dictionary prefix
31
+ changes: Add compiler option 'build-only', and dictionary prefix
32
32
  - version: 8.0.6
33
33
  date: 2026-02-12
34
- changes: Added support for Open Router, Alibaba, Amazon, Google Vertex Bedrock, Fireworks, Groq, Hugging Face and Together.ai providers
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: Added `dataSerialization` to AI configuration
37
+ changes: Add `dataSerialization` to the AI configuration
38
38
  - version: 8.0.0
39
39
  date: 2026-01-24
40
- changes: Renamed import mode `live` to `fetch` to better describe the underlying mechanism.
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: Moved build configuration `importMode` to `dictionary` configuration.
43
+ changes: Move `importMode` build configuration to `dictionary` configuration.
44
44
  - version: 8.0.0
45
45
  date: 2026-01-22
46
- changes: Added `rewrite` option to routing configuration
46
+ changes: Add `rewrite` option to the routing configuration
47
47
  - version: 8.0.0
48
48
  date: 2026-01-18
49
- changes: Separated system configuration from content configuration. Moved internal paths to `system` property. Added `codeDir` to separate content files and code transformation.
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: Added dictionary options `location` and `schema`
52
+ changes: Add `location` and `schema` dictionary options
53
53
  - version: 7.5.1
54
54
  date: 2026-01-10
55
- changes: Added support for JSON5 and JSONC file formats
55
+ changes: Add support for JSON5 and JSONC file formats
56
56
  - version: 7.5.0
57
57
  date: 2025-12-17
58
- changes: Added `buildMode` option
58
+ changes: Add `buildMode` option
59
59
  - version: 7.0.0
60
60
  date: 2025-10-25
61
- changes: Added `dictionary` configuration
61
+ changes: Add `dictionary` configuration
62
62
  - version: 7.0.0
63
63
  date: 2025-10-21
64
- changes: Replaced `middleware` by `routing` configuration
64
+ changes: Replace `middleware` by `routing` configuration
65
65
  - version: 7.0.0
66
66
  date: 2025-10-12
67
- changes: Added `formatCommand` option
67
+ changes: Add `formatCommand` option
68
68
  - version: 6.2.0
69
69
  date: 2025-10-12
70
- changes: Updated `excludedPath` option
70
+ changes: Update `excludedPath` option
71
71
  - version: 6.0.2
72
72
  date: 2025-09-23
73
- changes: Added `outputFormat` option
73
+ changes: Add `outputFormat` option
74
74
  - version: 6.0.0
75
75
  date: 2025-09-21
76
- changes: Deleted `dictionaryOutput` field and `i18nextResourcesDir` field
76
+ changes: Remove `dictionaryOutput` field and `i18nextResourcesDir` field
77
77
  - version: 6.0.0
78
78
  date: 2025-09-16
79
- changes: Added `live` import mode
79
+ changes: Add `live` import mode
80
80
  - version: 6.0.0
81
81
  date: 2025-09-04
82
- changes: Replaced `hotReload` field with `liveSync` and added `liveSyncPort` and `liveSyncURL` fields
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: Replaced `activateDynamicImport` with `importMode` option
85
+ changes: Replace `activateDynamicImport` with `importMode` option
86
86
  - version: 5.6.0
87
87
  date: 2025-07-13
88
- changes: Changed default contentDir from `['src']` to `['.']`
88
+ changes: Change default contentDir from `['src']` to `['.']`
89
89
  - version: 5.5.11
90
90
  date: 2025-06-29
91
- changes: Added `docs` commands
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 you to customise various aspects of the plugin, such as internationalisation (internationalisation), middleware, and content handling. This documentation provides an in-depth description of each property in the configuration.
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
- ## Supported Configuration File Formats
108
+ ## Configuration File Support
109
109
 
110
- Intlayer accepts configuration file formats including JSON, JS, MJS, and TS:
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
- ## Configuration File Example
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 displaying all available options.
131
+ * Example Intlayer configuration file showing all available options.
132
132
  */
133
133
  const config: IntlayerConfig = {
134
134
  /**
135
- * Configuration for internationalisation settings.
135
+ * Configuration for internationalization settings.
136
136
  */
137
137
  internationalization: {
138
138
  /**
139
- * List of locales supported in the application.
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 mandatory locales that must be defined in each dictionary.
146
- * If empty, all locales are mandatory in `strict` mode.
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
- * Level of strictness for internationalised content.
153
- * - "strict": Error if any declared locale is missing or undeclared.
154
- * - "inclusive": Warning if a declared locale is missing.
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 controlling dictionary operations and fallback behaviour.
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": Dynamically fetched via the live sync API.
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 to fill missing translations automatically using AI.
182
- * Can be a boolean value or a path pattern to save the filled content.
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 both locally and in the Intlayer CMS.
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 the content should be automatically transformed (e.g. Markdown to HTML).
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": Prefixes all but the default locale (e.g. /dashboard, /fr/dashboard).
211
- * - "prefix-all": Prefixes all locales (e.g. /en/dashboard, /fr/dashboard).
212
- * - "no-prefix": No locale in URL.
213
- * - "search-params": Uses ?locale=...
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-selected locale.
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 rewrite rules for specific paths on a per-locale basis.
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 pertaining to finding and processing content files.
243
+ * Settings for finding and processing content files.
244
244
  */
245
245
  content: {
246
246
  /**
247
- * File extensions for scanning dictionaries.
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
- * Where the source code is located.
260
- * Used for build optimisation and code transformation.
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 excluded from scanning.
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 monitor changes and rebuild dictionaries during development.
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 used to format newly created / updated .content files.
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
- * The URL of your application for origin validation.
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 sync.
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-based translation and construction settings.
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 of the selected provider to use.
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 Serialization
362
+ * Data serialization
363
363
  *
364
364
  * Options:
365
- * - "json": Default, robust; consumes more tokens.
366
- * - "toon": Consumes fewer tokens, may not be as consistent as JSON.
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 optimisation settings.
374
+ * Build and optimization settings.
375
375
  */
376
376
  build: {
377
377
  /**
378
378
  * Build execution mode.
379
- * - "auto": Builds automatically during application build.
380
- * - "manual": Requires an explicit build command.
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 optimise final bundle by removing unused dictionaries.
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 whether the build should check TypeScript types.
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": In-depth debug logging.
412
- * - "disabled": Disables logging.
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 Configuration (For advanced use)
425
+ * System configuration (Advanced use cases)
426
426
  */
427
427
  system: {
428
428
  /**
429
- * Directory for storing localised dictionaries.
429
+ * Directory for storing localization dictionaries.
430
430
  */
431
431
  dictionariesDir: ".intlayer/dictionary",
432
432
 
433
433
  /**
434
- * Directory for TypeScript module augmentation.
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 the main application files are stored.
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 Configuration (For advanced use)
465
+ * Compiler configuration (Advanced use cases)
466
466
  */
467
467
  compiler: {
468
468
  /**
469
- * Indicates whether the compiler should be enabled.
469
+ * Indicates if the compiler should be enabled.
470
470
  *
471
- * - false: Disables the compiler.
472
- * - true: Enables the compiler.
473
- * - "build-only": Skips the compiler during development and speeds up startup time.
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 path for output files. Replaces `outputDir`.
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 creation of separate dictionaries per-language.
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 multilingual .content.ts files next to component
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 centralised JSON per language on project root
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`: File name.
508
- * - `key`: Content key.
509
- * - `locale`: Content locale.
510
- * - `extension`: File extension.
511
- * - `componentFileName`: Component file name.
512
- * - `componentExtension`: Component file extension.
513
- * - `format`: Dictionary format.
514
- * - `componentFormat`: Component dictionary format.
515
- * - `componentDirPath`: Component directory path.
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 whether components should be saved after being transformed.
521
- * In this way, the compiler can be run only once to transform the application and can then be removed.
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
- * Only insert content into the generated file. Useful for per-language JSON output for i18next or ICU MessageFormat.
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 to the extracted dictionary keys
533
+ dictionaryKeyPrefix: "", // Add an optional prefix for the extracted dictionary keys
534
534
  },
535
535
 
536
536
  /**
537
- * Custom schemas for validating dictionary content.
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 in Intlayer.
558
+ The following sections describe the various configuration settings available for Intlayer.
559
559
 
560
560
  ---
561
561
 
562
- ### Internationalisation Configuration
562
+ ### Internationalization Configuration
563
563
 
564
- Defines settings related to internationalisation, including available locales and the default locale for the application.
564
+ Defines settings related to internationalization, including available locales and the default locale for the application.
565
565
 
566
- | Field | Type | Description | Example | Note |
567
- | ----------------- | ---------- | -------------------------------------------------------------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
568
- | `locales` | `string[]` | List of locales supported in the application. Default: `[Locales.ENGLISH]` | `['en', 'fr', 'es']` | |
569
- | `requiredLocales` | `string[]` | List of mandatory locales in the application. Default: `[]` | `[]` | If empty, all locales are mandatory in `strict` mode. Ensure mandatory locales are also defined in the `locales` field. |
570
- | `strictMode` | `string` | Guarantees robust internationalised content implementation using TypeScript. Default: `inclusive` | | If `"strict"`: the `t` function requires every declared locale to be defined — throws an error if any are missing or undeclared. If `"inclusive"`: warns about missing locales but accepts existing undeclared ones. If `"loose"`: accepts any existing locale. |
571
- | `defaultLocale` | `string` | Default locale used as a fallback if the requested locale is not found. Default: `Locales.ENGLISH` | `'en'` | Used to determine the locale when no locale is specified in the URL, cookie, or header. |
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 activity state.
578
-
579
- | Field | Type | Description | Example | Note |
580
- | ---------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
581
- | `applicationURL` | `string` | The URL of your application. Default: `''` | `'http://localhost:3000'`, `'https://example.com'`, `process.env.INTLAYER_EDITOR_URL` | Used to restrict the origin of the editor for security reasons. If set to `'*'`, the editor can be accessed from any origin. |
582
- | `port` | `number` | Port used by the Visual Editor server. Default: `8000` | | |
583
- | `editorURL` | `string` | Editor server URL. Default: `'http://localhost:8000'` | `'http://localhost:3000'`, `'https://example.com'`, `process.env.INTLAYER_EDITOR_URL` | Used to restrict the origins that can interact with the application. If set to `'*'`, accessible from any origin. Must be set if changing the port or if the editor is hosted on a different domain. |
584
- | `cmsURL` | `string` | Intlayer CMS URL. Default: `'https://intlayer.org'` | `'https://intlayer.org'` | |
585
- | `backendURL` | `string` | Backend server URL. Default: `https://back.intlayer.org` | `http://localhost:4000` | |
586
- | `enabled` | `boolean` | Indicates whether the app will interact with the visual editor. Default: `true` | `process.env.NODE_ENV !== 'production'` | If `false`, the editor cannot interact with the app. Disabling it for specific environments strengthens security. |
587
- | `clientId` | `string &#124; undefined` | Enables intlayer packages to authenticate with the backend using oAuth2. To get an access token, go to [intlayer.org/project](https://app.intlayer.org/project). Default: `undefined` | | Keep secret; store in environment variables. |
588
- | `clientSecret` | `string &#124; undefined` | Enables intlayer packages to authenticate with the backend using oAuth2. To get an access token, go to [intlayer.org/project](https://app.intlayer.org/project). Default: `undefined` | | Keep secret; store in environment variables. |
589
- | `dictionaryPriorityStrategy` | `string` | Strategy for prioritising dictionaries when both local and distant dictionaries are present. Default: `'local_first'` | `'distant_first'` | `'distant_first'`: prioritises distant over local. `'local_first'`: prioritises local over distant. |
590
- | `liveSync` | `boolean` | Indicates whether the app server should hot-reload content when a change is detected on the CMS / Visual Editor / Backend. Default: `true` | `true` | When a dictionary is added/updated, the app updates the page content. Live sync outsources content to another server, which may slightly affect performance. It is recommended to host both on the same machine. |
591
- | `liveSyncPort` | `number` | Live sync server port. Default: `4000` | `4000` | |
592
- | `liveSyncURL` | `string` | Live sync server URL. Default: `'http://localhost:{liveSyncPort}'` | `'https://example.com'` | Points to localhost by default; can be changed to a remote live sync server. |
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` &#124; <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` &#124; <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 behaviour, including URL structure, locale storage, and middleware handling.
596
+ Settings that control routing behavior, including URL structure, locale storage, and middleware handling.
597
597
 
598
- | Field | Type | Description | Example | Note |
599
- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
600
- | `mode` | `'prefix-no-default' &#124; 'prefix-all' &#124; 'no-prefix' &#124; 'search-params'` | URL routing mode for locale handling. Default: `'prefix-no-default'` | `'prefix-no-default'`: `/dashboard` (en) or `/fr/dashboard` (fr). `'prefix-all'`: `/en/dashboard`. `'no-prefix'`: locale is handled by other means. `'search-params'`: `/dashboard?locale=fr` | Does not affect cookie or locale storage management. |
601
- | `storage` | `false &#124; 'cookie' &#124; 'localStorage' &#124; 'sessionStorage' &#124; 'header' &#124; CookiesAttributes &#124; StorageAttributes &#124; Array` | Configuration for storing the locale on the client. Default: `['cookie', 'header']` | `'localStorage'`, `[{ type: 'cookie', name: 'custom-locale', secure: true }]` | See the Storage Options table below. |
602
- | `basePath` | `string` | Base path for application URLs. Default: `''` | `'/my-app'` | If the app is at `https://example.com/my-app`, basePath is `'/my-app'` and URLs become `https://example.com/my-app/en`. |
603
- | `rewrite` | `Record<string, StrictModeLocaleMap<string>>` | Custom URL rewrite rules that override the default routing mode for specific paths. Supports dynamic parameters `[param]`. Default: `undefined` | See example below | Rewrite rules take priority over the `mode`. Works with Next.js and Vite. `getLocalizedUrl()` automatically applies matching rules. See [Custom URL Rewrites](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/custom_url_rewrites.md). |
598
+ | Field | Description | Type | Default | Example | Note |
599
+ | ---------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
600
+ | `mode` | URL routing mode for locale handling. | `'prefix-no-default'` &#124; <br/> `'prefix-all'` &#124; <br/> `'no-prefix'` &#124; <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` &#124; <br/> `'cookie'` &#124; <br/> `'localStorage'` &#124; <br/> `'sessionStorage'` &#124; <br/> `'header'` &#124; <br/> `CookiesAttributes` &#124; <br/> `StorageAttributes` &#124; <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` Example**:
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 | Note |
630
- | ------------------ | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
631
- | `'cookie'` | Stores locale in cookies — accessible by both client and server sides. | For GDPR compliance, ensure proper user consent is obtained. Customisable via `CookiesAttributes` (`{ type: 'cookie', name: 'custom-locale', secure: true, httpOnly: false }`). |
632
- | `'localStorage'` | Stores locale in the browser with no expiry date — client-side only. | Does not expire unless explicitly cleared. Intlayer proxy cannot access it. Customisable via `StorageAttributes` (`{ type: 'localStorage', name: 'custom-locale' }`). |
633
- | `'sessionStorage'` | Stores locale for the duration of the page session — client-side only. | Cleared when tab/window is closed. Intlayer proxy cannot access it. Customisable via `StorageAttributes` (`{ type: 'sessionStorage', name: 'custom-locale' }`). |
634
- | `'header'` | Stores or transmits locale via HTTP headers — server-side only. | Useful for API calls. Client-side cannot access it. Customisable via `StorageAttributes` (`{ type: 'header', name: 'custom-locale' }`). |
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 | Type | Description |
641
- | ---------- | ------------------------------------- | --------------------------------------------------- |
642
- | `name` | `string` | Cookie name. Default: `'INTLAYER_LOCALE'` |
643
- | `domain` | `string` | Cookie domain. Default: `undefined` |
644
- | `path` | `string` | Cookie path. Default: `undefined` |
645
- | `secure` | `boolean` | Requires HTTPS. Default: `undefined` |
646
- | `httpOnly` | `boolean` | HTTP-only flag. Default: `undefined` |
647
- | `sameSite` | `'strict' &#124; 'lax' &#124; 'none'` | SameSite policy. |
648
- | `expires` | `Date &#124; number` | Expiry date or number of days. Default: `undefined` |
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'` &#124; <br/> `'lax'` &#124; <br/> `'none'` |
648
+ | `expires` | Expiration date or days. Default: `undefined` | `Date` &#124; <br/> `number` |
649
649
 
650
650
  #### Locale Storage Attributes
651
651
 
652
652
  When using localStorage or sessionStorage:
653
653
 
654
- | Field | Type | Description |
655
- | ------ | ---------------------------------------- | ---------------------------------------------- |
656
- | `type` | `'localStorage' &#124; 'sessionStorage'` | Storage type. |
657
- | `name` | `string` | Storage key name. Default: `'INTLAYER_LOCALE'` |
654
+ | Field | Description | Type |
655
+ | ------ | ---------------------------------------------- | ------------------------------------------------ |
656
+ | `type` | Storage type. | `'localStorage'` &#124; <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 Rewrite with Dynamic Paths**:
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 not rewritten
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 pertaining to the processing of content within the application (directory names, file extensions, and derived configurations).
796
+ Settings related to content handling within the application, including directory names, file extensions, and derived configurations.
797
797
 
798
- | Field | Type | Description | Example | Note |
799
- | ---------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------- |
800
- | `watch` | `boolean` | Indicates whether Intlayer should watch for changes in content declaration files to rebuild dictionaries. Default: `process.env.NODE_ENV === 'development'` | | |
801
- | `fileExtensions` | `string[]` | File extensions used for scanning content declaration files. Default: `['.content.ts', '.content.js', '.content.mjs', '.content.cjs', '.content.json', '.content.json5', '.content.jsonc']` | `['.content.ts', '.content.js']` | |
802
- | `contentDir` | `string[]` | Paths to the directories where the content declaration files are located. Default: `['.']` | `['src/content']` | |
803
- | `codeDir` | `string[]` | Paths to the directories where your application's source code files are located. Default: `['.']` | `['src']` | Used to optimise the build and ensure that code transformation and hot reloading only apply to necessary files. |
804
- | `excludedPath` | `string[]` | Paths excluded from content scanning. Default: `['node_modules', '.intlayer', '.next', 'dist', 'build']` | `['src/styles']` | |
805
- | `formatCommand` | `string` | Command that will be run to format newly created or updated content files. Default: `undefined` | `'npx prettier --write "{{file}}"'` | Used during content extraction or through the visual editor. |
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-filling behaviour and content creation.
826
+ Settings that control dictionary operations, including auto-fill behavior and content generation.
812
827
 
813
- This dictionary configuration has two main purposes:
828
+ This dictionary configuration serves two main purposes:
814
829
 
815
- 1. **Default values**: Defining default values when creating content declaration files.
816
- 2. **Fallback behaviour**: Allows setting up the behaviour of dictionary operations globally, providing fallback values when specific fields are not defined.
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 on how content declaration files and configuration values are applied, see the [content file documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/dictionary/content_file.md).
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 | Description | Example | Note |
821
- | --------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
822
- | `fill` | `boolean &#124; FilePathPattern &#124; Partial<Record<Locale, boolean &#124; FilePathPattern>>` | Controls how auto-fill (AI translation) output files are generated. Default: `true` | See example below | `true`: default path (same file as source). `false`: disabled. String/function patterns generate files per language. Object per language: each language maps to its own pattern; `false` skips that language. Including a `{{locale}}` variable triggers per-language generation. Dictionary-level `fill` always takes precedence over this global configuration. |
823
- | `importMode` | `'static' &#124; 'dynamic' &#124; 'fetch'` | Controls how dictionaries are imported. Default: `'static'` | `'dynamic'` | `'static'`: Statically imported. `'dynamic'`: Dynamically imported via 'Suspense'. `'fetch'`: Dynamically fetched via 'Live Sync API'. Does not affect `getIntlayer`, `getDictionary`, `useDictionary`, etc. |
824
- | `location` | `'local' &#124; 'remote' &#124; 'hybrid' &#124; string` | Where dictionaries are stored. Default: `'local'` | `'remote'` | `'local'`: filesystem. `'remote'`: Intlayer CMS. `'hybrid'`: both. |
825
- | `contentAutoTransformation` | `boolean` | Indicates whether content files should be automatically transformed (e.g. from Markdown to HTML). Default: `false` | `true` | Useful for processing Markdown fields via @intlayer/markdown. |
835
+ | Field | Description | Type | Default | Example | Note |
836
+ | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
837
+ | `fill` | Controls how auto-fill (AI translation) output files are generated. | `boolean` &#124; <br/> `FilePathPattern` &#124; <br/> `Partial<Record<Locale, boolean &#124; 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` &#124; <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'` &#124; <br/> `'remote'` &#124; <br/> `'hybrid'` &#124; <br/> `'plugin'` &#124; <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'` &#124; <br/> `'dynamic'` &#124; <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
- ### AI Configuration
864
+ ### Logger Configuration
842
865
 
843
- Defines settings for Intlayer's AI-powered features, such as translation construction.
866
+ Settings that control the logger, including the prefix to use.
844
867
 
845
- | Field | Type | Description | Example | Note |
846
- | -------------------- | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------- | ----------------------------------------------------------------------------------------- |
847
- | `provider` | `string` | AI provider to use. | `'openai'`, `'anthropic'`, `'googlevertex'` | |
848
- | `model` | `string` | AI model to use. | `'gpt-4o'`, `'claude-3-5-sonnet-20240620'` | |
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' &#124; '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'` &#124; <br/> `'verbose'` &#124; <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
- ### Build Configuration
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'` &#124; <br/> `'anthropic'` &#124; <br/> `'mistral'` &#124; <br/> `'deepseek'` &#124; <br/> `'gemini'` &#124; <br/> `'ollama'` &#124; <br/> `'openrouter'` &#124; <br/> `'alibaba'` &#124; <br/> `'fireworks'` &#124; <br/> `'groq'` &#124; <br/> `'huggingface'` &#124; <br/> `'bedrock'` &#124; <br/> `'googleaistudio'` &#124; <br/> `'googlevertex'` &#124; <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'` &#124; <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
- Settings for the Intlayer build process and optimisations.
912
+ ### Build Configuration
859
913
 
860
- | Field | Type | Description | Example | Note |
861
- | -------------- | ------------------------ | ------------------------------------------------------------------------------------------------------- | ------- | ---- |
862
- | `mode` | `'auto' &#124; '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' &#124; '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
- ### System Configuration
918
+ > In development mode, Intlayer uses static imports for dictionaries to simplify the development experience.
870
919
 
871
- These settings are for advanced use cases and Intlayer's internal configuration.
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 | Type | Description | Default |
874
- | ------------------------- | -------- | ----------------------------------------- | --------------------------------- |
875
- | `dictionariesDir` | `string` | Compiled dictionaries directory. | `'.intlayer/dictionary'` |
876
- | `moduleAugmentationDir` | `string` | TypeScript module augmentation directory. | `'.intlayer/types'` |
877
- | `unmergedDictionariesDir` | `string` | Unmerged dictionaries directory. | `'.intlayer/unmerged_dictionary'` |
878
- | `typesDir` | `string` | Generated types directory. | `'.intlayer/types'` |
879
- | `mainDir` | `string` | Main Intlayer file directory. | `'.intlayer/main'` |
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'` &#124; <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' &#124; '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 for the Intlayer compiler (`intlayer compiler`).
888
-
889
- | Field | Type | Description | Default |
890
- | --------------------- | ------------------------ | ---------------------------------------------------------------------------------------- | ------- |
891
- | `enabled` | `boolean` | Indicates whether the compiler is active. | `false` |
892
- | `output` | `string &#124; 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 | Type | Description | Default |
904
- | -------- | ---------------------------------------------- | ------------------- | -------------- |
905
- | `mode` | `'default' &#124; 'verbose' &#124; 'disabled'` | Logging mode. | `'default'` |
906
- | `prefix` | `string` | Log message prefix. | `'[intlayer]'` |
907
-
908
- ---
936
+ | Field | Description | Type | Default | Example | Note |
937
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
938
+ | `enabled` | Indicates if the compiler should be enabled to extract dictionaries. | `boolean` &#124; <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` &#124; <br/> `FilePathPattern` &#124; <br/> `Partial<Record<Locale, boolean &#124; 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 | Description |
913
- | --------- | --------------------------- | ------------------------------------------------------------------------ |
914
- | `schemas` | `Record<string, ZodSchema>` | Allows defining Zod schemas for validating your dictionaries' structure. |
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 | Description |
921
- | --------- | ------------------ | ------------------------------------- |
922
- | `plugins` | `IntlayerPlugin[]` | List of Intlayer plugins to activate. |
955
+ | Field | Description | Type |
956
+ | --------- | ------------------------------------- | ------------------ |
957
+ | `plugins` | Liste des plugins Intlayer à activer. | `IntlayerPlugin[]` |