@intlayer/docs 7.0.0-canary.2 → 7.0.0
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/dist/cjs/common.cjs.map +1 -1
- package/dist/esm/common.mjs.map +1 -1
- package/dist/types/common.d.ts +5 -0
- package/dist/types/common.d.ts.map +1 -1
- package/docs/ar/configuration.md +0 -24
- package/docs/ar/intlayer_with_nextjs_16.md +1652 -0
- package/docs/ar/releases/v7.md +485 -0
- package/docs/de/configuration.md +0 -24
- package/docs/de/intlayer_with_nextjs_16.md +1662 -0
- package/docs/de/releases/v7.md +502 -0
- package/docs/en/autoFill.md +3 -1
- package/docs/en/configuration.md +53 -58
- package/docs/en/intlayer_with_nextjs_15.md +5 -2
- package/docs/en/intlayer_with_nextjs_16.md +4 -4
- package/docs/en/releases/v7.md +142 -2
- package/docs/en-GB/configuration.md +9 -30
- package/docs/en-GB/intlayer_with_nextjs_16.md +1642 -0
- package/docs/en-GB/releases/v7.md +485 -0
- package/docs/es/configuration.md +0 -24
- package/docs/es/intlayer_with_nextjs_16.md +1670 -0
- package/docs/es/releases/v7.md +502 -0
- package/docs/fr/configuration.md +0 -24
- package/docs/fr/intlayer_with_nextjs_16.md +1692 -0
- package/docs/fr/releases/v7.md +503 -0
- package/docs/hi/configuration.md +0 -24
- package/docs/hi/intlayer_with_nextjs_16.md +1618 -0
- package/docs/hi/releases/v7.md +485 -0
- package/docs/id/intlayer_with_nextjs_16.md +1604 -0
- package/docs/id/releases/v7.md +502 -0
- package/docs/it/configuration.md +0 -24
- package/docs/it/intlayer_with_nextjs_16.md +1600 -0
- package/docs/it/releases/v7.md +504 -0
- package/docs/ja/configuration.md +0 -24
- package/docs/ja/intlayer_CMS.md +0 -9
- package/docs/ja/intlayer_with_nextjs_16.md +1788 -0
- package/docs/ja/releases/v7.md +503 -0
- package/docs/ko/configuration.md +0 -24
- package/docs/ko/intlayer_with_nextjs_16.md +1641 -0
- package/docs/ko/releases/v7.md +503 -0
- package/docs/pl/intlayer_with_nextjs_16.md +1645 -0
- package/docs/pl/releases/v7.md +485 -0
- package/docs/pt/configuration.md +0 -24
- package/docs/pt/intlayer_with_nextjs_16.md +1646 -0
- package/docs/pt/introduction.md +0 -15
- package/docs/pt/releases/v7.md +485 -0
- package/docs/ru/configuration.md +0 -24
- package/docs/ru/intlayer_with_nextjs_16.md +1610 -0
- package/docs/ru/releases/v7.md +485 -0
- package/docs/tr/configuration.md +0 -24
- package/docs/tr/intlayer_with_nextjs_16.md +1599 -0
- package/docs/tr/releases/v7.md +485 -0
- package/docs/vi/intlayer_with_nextjs_16.md +1597 -0
- package/docs/vi/releases/v7.md +485 -0
- package/docs/zh/configuration.md +0 -24
- package/docs/zh/intlayer_CMS.md +0 -23
- package/docs/zh/intlayer_with_nextjs_16.md +1628 -0
- package/docs/zh/releases/v7.md +486 -0
- package/package.json +14 -14
- package/src/common.ts +5 -0
package/docs/en/configuration.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2024-08-13
|
|
3
|
-
updatedAt: 2025-10-
|
|
3
|
+
updatedAt: 2025-10-25
|
|
4
4
|
title: Configuration
|
|
5
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:
|
|
@@ -14,6 +14,9 @@ slugs:
|
|
|
14
14
|
- concept
|
|
15
15
|
- configuration
|
|
16
16
|
history:
|
|
17
|
+
- version: 7.0.0
|
|
18
|
+
date: 2025-10-25
|
|
19
|
+
changes: Add `dictionary` configuration
|
|
17
20
|
- version: 7.0.0
|
|
18
21
|
date: 2025-10-21
|
|
19
22
|
changes: Replace `middleware` by `routing` configuration
|
|
@@ -77,11 +80,14 @@ const config: IntlayerConfig = {
|
|
|
77
80
|
locales: [Locales.ENGLISH],
|
|
78
81
|
},
|
|
79
82
|
content: {
|
|
80
|
-
autoFill: "./{{fileName}}.content.json",
|
|
81
83
|
contentDir: ["src", "../ui-library"],
|
|
82
84
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
dictionary: {
|
|
86
|
+
fill: "./{{fileName}}.content.json",
|
|
87
|
+
},
|
|
88
|
+
routing: {
|
|
89
|
+
mode: "prefix-no-default",
|
|
90
|
+
storage: "cookie",
|
|
85
91
|
},
|
|
86
92
|
editor: {
|
|
87
93
|
applicationURL: "https://example.com",
|
|
@@ -109,8 +115,9 @@ const config = {
|
|
|
109
115
|
content: {
|
|
110
116
|
contentDir: ["src", "../ui-library"],
|
|
111
117
|
},
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
routing: {
|
|
119
|
+
mode: "prefix-no-default",
|
|
120
|
+
storage: "cookie",
|
|
114
121
|
},
|
|
115
122
|
editor: {
|
|
116
123
|
applicationURL: "https://example.com",
|
|
@@ -135,8 +142,12 @@ module.exports = config;
|
|
|
135
142
|
"content": {
|
|
136
143
|
"contentDir": ["src", "../ui-library"],
|
|
137
144
|
},
|
|
138
|
-
"
|
|
139
|
-
"
|
|
145
|
+
"dictionary": {
|
|
146
|
+
"fill": "./{{fileName}}.content.json",
|
|
147
|
+
},
|
|
148
|
+
"routing": {
|
|
149
|
+
"mode": "prefix-no-default",
|
|
150
|
+
"storage": "cookie",
|
|
140
151
|
},
|
|
141
152
|
"editor": {
|
|
142
153
|
"applicationURL": "https://example.com",
|
|
@@ -287,15 +298,6 @@ Defines settings related to the integrated editor, including server port and act
|
|
|
287
298
|
- _Example_: `'https://example.com'`
|
|
288
299
|
- _Note_: Point to localhost by default but can be changed to any URL in the case of a remote live sync server.
|
|
289
300
|
|
|
290
|
-
- **formatCommand**:
|
|
291
|
-
- _Type_: `string`
|
|
292
|
-
- _Default_: `undefined`
|
|
293
|
-
- _Description_: The command to format the content. When intlayer write your .content files locally, this command will be used to format the content.
|
|
294
|
-
- _Example_: `'npx prettier --write "{{file}}" --log-level silent'` Using Prettier
|
|
295
|
-
- _Example_: `'npx biome format "{{file}}" --write --log-level none'` Using Biome
|
|
296
|
-
- _Example_: `'npx eslint --fix "{{file}}" --quiet'` Using ESLint
|
|
297
|
-
- _Note_: Intlayer will replace the {{file}} with the path of the file to format.
|
|
298
|
-
|
|
299
301
|
### Routing Configuration
|
|
300
302
|
|
|
301
303
|
Settings that control routing behavior, including URL structure, locale storage, and middleware handling.
|
|
@@ -371,30 +373,6 @@ Settings that control routing behavior, including URL structure, locale storage,
|
|
|
371
373
|
- The URL will be `https://example.com/my-app/en`
|
|
372
374
|
- If the base path is not set, the URL will be `https://example.com/en`
|
|
373
375
|
|
|
374
|
-
- **detectLocaleOnPrefetchNoPrefix**:
|
|
375
|
-
- _Type_: `boolean`
|
|
376
|
-
- _Default_: `false`
|
|
377
|
-
- _Description_: Controls whether locale detection occurs during Next.js prefetch requests.
|
|
378
|
-
- _Example_: `true`
|
|
379
|
-
- _Note_: This setting affects how Next.js handles locale prefetching:
|
|
380
|
-
- **Example scenario:**
|
|
381
|
-
- User's browser language is `'fr'`
|
|
382
|
-
- Current page is `/fr/about`
|
|
383
|
-
- Link prefetches `/about`
|
|
384
|
-
- **With `detectLocaleOnPrefetchNoPrefix: true`:**
|
|
385
|
-
- Prefetch detects `'fr'` locale from browser
|
|
386
|
-
- Redirects prefetch to `/fr/about`
|
|
387
|
-
- **With `detectLocaleOnPrefetchNoPrefix: false` (default):**
|
|
388
|
-
- Prefetch uses default locale
|
|
389
|
-
- Redirects prefetch to `/en/about` (assuming `'en'` is default)
|
|
390
|
-
- **When to use `true`:**
|
|
391
|
-
- Your app uses non-localized internal links (e.g. `<a href="/about">`)
|
|
392
|
-
- You want consistent locale detection behavior between regular and prefetch requests
|
|
393
|
-
- **When to use `false` (default):**
|
|
394
|
-
- Your app uses locale-prefixed links (e.g. `<a href="/fr/about">`)
|
|
395
|
-
- You want to optimize prefetching performance
|
|
396
|
-
- You want to avoid potential redirect loops
|
|
397
|
-
|
|
398
376
|
#### Cookie Attributes
|
|
399
377
|
|
|
400
378
|
When using cookie storage, you can configure additional cookie attributes:
|
|
@@ -432,7 +410,6 @@ export default defineConfig({
|
|
|
432
410
|
storage: "localStorage",
|
|
433
411
|
headerName: "x-intlayer-locale",
|
|
434
412
|
basePath: "",
|
|
435
|
-
detectLocaleOnPrefetchNoPrefix: false,
|
|
436
413
|
},
|
|
437
414
|
});
|
|
438
415
|
```
|
|
@@ -463,7 +440,6 @@ export default defineConfig({
|
|
|
463
440
|
],
|
|
464
441
|
headerName: "x-intlayer-locale",
|
|
465
442
|
basePath: "",
|
|
466
|
-
detectLocaleOnPrefetchNoPrefix: false,
|
|
467
443
|
},
|
|
468
444
|
});
|
|
469
445
|
```
|
|
@@ -482,7 +458,6 @@ export default defineConfig({
|
|
|
482
458
|
storage: "localStorage",
|
|
483
459
|
headerName: "x-intlayer-locale",
|
|
484
460
|
basePath: "",
|
|
485
|
-
detectLocaleOnPrefetchNoPrefix: false,
|
|
486
461
|
},
|
|
487
462
|
});
|
|
488
463
|
```
|
|
@@ -504,7 +479,6 @@ export default defineConfig({
|
|
|
504
479
|
},
|
|
505
480
|
headerName: "x-custom-locale",
|
|
506
481
|
basePath: "/my-app",
|
|
507
|
-
detectLocaleOnPrefetchNoPrefix: true,
|
|
508
482
|
},
|
|
509
483
|
});
|
|
510
484
|
```
|
|
@@ -517,19 +491,6 @@ Settings related to content handling within the application, including directory
|
|
|
517
491
|
|
|
518
492
|
#### Properties
|
|
519
493
|
|
|
520
|
-
- **fill**:
|
|
521
|
-
- _Type_: `boolean | string | { [key in Locales]?: string }`
|
|
522
|
-
- _Default_: `undefined`
|
|
523
|
-
- _Description_: Indicate how the content should be automatically filled using AI. Can be declared globally in the `intlayer.config.ts` file.
|
|
524
|
-
- _Example_: true
|
|
525
|
-
- _Example_: `'./{{fileName}}.content.json'`
|
|
526
|
-
- _Example_: `{ fr: './{{fileName}}.fr.content.json', es: './{{fileName}}.es.content.json' }`
|
|
527
|
-
- _Note_: The auto fill configuration. It can be:
|
|
528
|
-
- `true`: Rewrites the current file with filled content for all locales
|
|
529
|
-
- `false`: Disables auto-fill completely
|
|
530
|
-
- `string`: Path to a single file or template with variables (fills the specified file without modifying the current one)
|
|
531
|
-
- `object`: Per-locale file paths
|
|
532
|
-
|
|
533
494
|
- **watch**:
|
|
534
495
|
- _Type_: `boolean`
|
|
535
496
|
- _Default_: `process.env.NODE_ENV === 'development'`
|
|
@@ -597,6 +558,40 @@ Settings related to content handling within the application, including directory
|
|
|
597
558
|
- _Description_: Directories excluded from content search.
|
|
598
559
|
- _Note_: This setting is not yet used, but planned for future implementation.
|
|
599
560
|
|
|
561
|
+
- **formatCommand**:
|
|
562
|
+
- _Type_: `string`
|
|
563
|
+
- _Default_: `undefined`
|
|
564
|
+
- _Description_: The command to format the content. When intlayer write your .content files locally, this command will be used to format the content.
|
|
565
|
+
- _Example_: `'npx prettier --write "{{file}}" --log-level silent'` Using Prettier
|
|
566
|
+
- _Example_: `'npx biome format "{{file}}" --write --log-level none'` Using Biome
|
|
567
|
+
- _Example_: `'npx eslint --fix "{{file}}" --quiet'` Using ESLint
|
|
568
|
+
- _Note_: Intlayer will replace the {{file}} with the path of the file to format.
|
|
569
|
+
- _Note_: If not set, Intlayer will try to detect the format command automatically. By trying to resolve the following commands: prettier, biome, eslint.
|
|
570
|
+
|
|
571
|
+
### Dictionary Configuration
|
|
572
|
+
|
|
573
|
+
Settings that control dictionary operations, including auto-fill behavior and content generation.
|
|
574
|
+
|
|
575
|
+
This dictionary configuration serves two main purposes:
|
|
576
|
+
|
|
577
|
+
1. **Default Values**: Define default values when creating content declaration files
|
|
578
|
+
2. **Fallback Behavior**: Provide fallback values when specific fields are not defined, allowing you to define dictionary operation behavior globally
|
|
579
|
+
|
|
580
|
+
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).
|
|
581
|
+
|
|
582
|
+
#### Properties
|
|
583
|
+
|
|
584
|
+
- **fill**
|
|
585
|
+
- **description**
|
|
586
|
+
- **locale**
|
|
587
|
+
- **priority**
|
|
588
|
+
- **live**
|
|
589
|
+
- **title**
|
|
590
|
+
- **tags**
|
|
591
|
+
- **version**
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
600
595
|
### Logger Configuration
|
|
601
596
|
|
|
602
597
|
Settings that control the logger, including the prefix to use.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
createdAt:
|
|
3
|
-
updatedAt: 2025-10-
|
|
2
|
+
createdAt: 2025-10-25
|
|
3
|
+
updatedAt: 2025-10-25
|
|
4
4
|
title: How to translate your Next.js 15 app – i18n guide 2025
|
|
5
5
|
description: Discover how to make your Next.js 15 website multilingual. Follow the documentation to internationalize (i18n) and translate it.
|
|
6
6
|
keywords:
|
|
@@ -18,6 +18,9 @@ slugs:
|
|
|
18
18
|
applicationTemplate: https://github.com/aymericzip/intlayer-next-15-template
|
|
19
19
|
youtubeVideo: https://www.youtube.com/watch?v=e_PPG7PTqGU
|
|
20
20
|
history:
|
|
21
|
+
- version: 7.0.0
|
|
22
|
+
date: 2025-10-25
|
|
23
|
+
changes: Added mention of `withIntlayerSync()` function
|
|
21
24
|
- version: 6.2.0
|
|
22
25
|
date: 2025-10-09
|
|
23
26
|
changes: Added docs for `useLocale` hook with `onLocaleChange` option
|
|
@@ -130,7 +130,7 @@ const config = {
|
|
|
130
130
|
module.exports = config;
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
> Through this configuration file, you can set up localized URLs,
|
|
133
|
+
> Through this configuration file, you can set up localized URLs, proxy redirection, cookie names, the location and extension of your content declarations, disable Intlayer logs in the console, and more. For a complete list of available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md).
|
|
134
134
|
|
|
135
135
|
### Step 3: Integrate Intlayer in Your Next.js Configuration
|
|
136
136
|
|
|
@@ -290,7 +290,7 @@ module.exports = LocaleLayout;
|
|
|
290
290
|
|
|
291
291
|
> The `[locale]` path segment is used to define the locale. Example: `/en-US/about` will refer to `en-US` and `/fr/about` to `fr`.
|
|
292
292
|
|
|
293
|
-
> At this stage, you will encounter the error: `Error: Missing <html> and <body> tags in the root layout.`. This is expected because the `/app/page.tsx` file is no longer in use and can be removed. Instead, the `[locale]` path segment will activate the `/app/[locale]/page.tsx` page. Consequently, pages will be accessible via paths like `/en`, `/fr`, `/es` in your browser. To set the default locale as the root page, refer to the `
|
|
293
|
+
> At this stage, you will encounter the error: `Error: Missing <html> and <body> tags in the root layout.`. This is expected because the `/app/page.tsx` file is no longer in use and can be removed. Instead, the `[locale]` path segment will activate the `/app/[locale]/page.tsx` page. Consequently, pages will be accessible via paths like `/en`, `/fr`, `/es` in your browser. To set the default locale as the root page, refer to the `proxy` setup in step 7.
|
|
294
294
|
|
|
295
295
|
Then, implement the `generateStaticParams` function in your application Layout.
|
|
296
296
|
|
|
@@ -637,7 +637,7 @@ const ServerComponentExample = () => {
|
|
|
637
637
|
|
|
638
638
|
### (Optional) Step 7: Configure Proxy for Locale Detection
|
|
639
639
|
|
|
640
|
-
Set up
|
|
640
|
+
Set up proxy to detect the user's preferred locale:
|
|
641
641
|
|
|
642
642
|
```typescript fileName="src/proxy.ts" codeFormat="typescript"
|
|
643
643
|
export { intlayerProxy as proxy } from "next-intlayer/proxy";
|
|
@@ -1488,7 +1488,7 @@ export const myServerAction = async () => {
|
|
|
1488
1488
|
|
|
1489
1489
|
> The `getLocale` function follows a cascading strategy to determine the user's locale:
|
|
1490
1490
|
>
|
|
1491
|
-
> 1. First, it checks the request headers for a locale value that may have been set by the
|
|
1491
|
+
> 1. First, it checks the request headers for a locale value that may have been set by the proxy
|
|
1492
1492
|
> 2. If no locale is found in headers, it looks for a locale stored in cookies
|
|
1493
1493
|
> 3. If no cookie is found, it attempts to detect the user's preferred language from their browser settings
|
|
1494
1494
|
> 4. As a last resort, it falls back to the application's configured default locale
|
package/docs/en/releases/v7.md
CHANGED
|
@@ -26,6 +26,7 @@ Welcome to Intlayer v7! This major release introduces significant improvements i
|
|
|
26
26
|
|
|
27
27
|
## Highlights
|
|
28
28
|
|
|
29
|
+
- Next.js 16 support
|
|
29
30
|
- Caching strategy for faster builds
|
|
30
31
|
- Improved TypeScript type generation with locale-specific types
|
|
31
32
|
- Bundle optimization: Locales as strings instead of enum
|
|
@@ -35,10 +36,12 @@ Welcome to Intlayer v7! This major release introduces significant improvements i
|
|
|
35
36
|
- 30% smaller Visual Editor package size
|
|
36
37
|
- Enhanced middleware configuration options
|
|
37
38
|
- Updated fill command behavior for better content management
|
|
39
|
+
- New dictionary configuration section for better organization
|
|
38
40
|
- Enhanced stability with complete content declaration file updates
|
|
39
41
|
- Intelligent retry management for translation accuracy
|
|
40
42
|
- Parallelization for faster translation processing
|
|
41
43
|
- Smart chunking to handle large files within AI context limits
|
|
44
|
+
- Automatic code formatting with configurable formatCommand
|
|
42
45
|
|
|
43
46
|
---
|
|
44
47
|
|
|
@@ -247,6 +250,127 @@ This results in faster download times and improved runtime performance for your
|
|
|
247
250
|
|
|
248
251
|
---
|
|
249
252
|
|
|
253
|
+
## Automatic Code Formatting: formatCommand configuration
|
|
254
|
+
|
|
255
|
+
v7 introduces the `formatCommand` option in the editor configuration, allowing you to automatically format content files when they are written by Intlayer. This ensures consistent code style and formatting across your content declaration files.
|
|
256
|
+
|
|
257
|
+
If not set, Intlayer will try to detect the format command automatically. By trying to resolve the following commands: prettier, biome, eslint.
|
|
258
|
+
|
|
259
|
+
### Configuration
|
|
260
|
+
|
|
261
|
+
The `formatCommand` option accepts a string template where `{{file}}` will be replaced with the actual file path:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// intlayer.config.ts
|
|
265
|
+
export default {
|
|
266
|
+
content: {
|
|
267
|
+
formatCommand: 'bun x biome format "{{file}}" --write --log-level none',
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Supported formatters
|
|
273
|
+
|
|
274
|
+
You can use any code formatter that accepts file paths as arguments:
|
|
275
|
+
|
|
276
|
+
**Using Biome:**
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
formatCommand: 'bun x biome format "{{file}}" --write --log-level none';
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**Using Prettier:**
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
formatCommand: 'npx prettier --write "{{file}}" --log-level silent';
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Using ESLint:**
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
formatCommand: 'npx eslint --fix "{{file}}" --quiet';
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Using Bun's built-in formatter:**
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
formatCommand: 'bun format "{{file}}"';
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Benefits
|
|
301
|
+
|
|
302
|
+
- **Consistent formatting**: All content files are automatically formatted according to your project's style guidelines
|
|
303
|
+
- **Developer experience**: No need to manually format files after Intlayer writes them
|
|
304
|
+
- **Team consistency**: Ensures all team members have the same formatting applied to content files
|
|
305
|
+
- **CI/CD integration**: Content files maintain consistent formatting in automated workflows
|
|
306
|
+
|
|
307
|
+
### How it works
|
|
308
|
+
|
|
309
|
+
When Intlayer writes or updates a content declaration file (`.content.ts`, `.content.js`, etc.), it automatically runs the specified format command on the file. The `{{file}}` placeholder is replaced with the actual file path, and the command is executed in the project's base directory.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Dictionary Configuration: Better organization and structure
|
|
314
|
+
|
|
315
|
+
v7 introduces a new dedicated `dictionary` configuration section that provides better organization for dictionary-related settings and improved content management.
|
|
316
|
+
|
|
317
|
+
### New dictionary configuration structure
|
|
318
|
+
|
|
319
|
+
The `fill` property has been moved from the `content` section to a new `dictionary` section, providing clearer separation of concerns:
|
|
320
|
+
|
|
321
|
+
**v6 configuration:**
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
export default {
|
|
325
|
+
content: {
|
|
326
|
+
autoFill: "./{{fileName}}.content.json",
|
|
327
|
+
contentDir: ["src"],
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**v7 configuration:**
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
export default {
|
|
336
|
+
content: {
|
|
337
|
+
contentDir: ["src"],
|
|
338
|
+
},
|
|
339
|
+
dictionary: {
|
|
340
|
+
fill: "./{{fileName}}.content.json",
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Benefits of the new structure
|
|
346
|
+
|
|
347
|
+
- **Clearer organization**: Dictionary-specific settings are now grouped together
|
|
348
|
+
- **Better separation of concerns**: Content discovery vs. dictionary operations are clearly separated
|
|
349
|
+
- **Enhanced maintainability**: Easier to understand and modify dictionary-related configurations
|
|
350
|
+
- **Future extensibility**: The dictionary section can accommodate additional dictionary-specific settings
|
|
351
|
+
- **Comprehensive dictionary management**: Includes properties like `title`, `live`, `priority`, `tags`, `version`, and `description` for creating and managing new dictionaries
|
|
352
|
+
|
|
353
|
+
### Configuration usage
|
|
354
|
+
|
|
355
|
+
The dictionary configuration serves two main purposes:
|
|
356
|
+
|
|
357
|
+
1. **Default Values**: Define default values when creating content declaration files
|
|
358
|
+
2. **Fallback Behavior**: Provide fallback values when specific fields are not defined, allowing you to define dictionary operation behavior globally
|
|
359
|
+
|
|
360
|
+
The dictionary section includes comprehensive properties for dictionary management:
|
|
361
|
+
|
|
362
|
+
- **`fill`**: Auto-fill behavior for content generation
|
|
363
|
+
- **`title`**: Default title for new dictionaries
|
|
364
|
+
- **`live`**: Live sync configuration for real-time updates
|
|
365
|
+
- **`priority`**: Priority settings for dictionary resolution
|
|
366
|
+
- **`tags`**: Default tags for content organization
|
|
367
|
+
- **`version`**: Version management for dictionary updates
|
|
368
|
+
- **`description`**: Default description for new content
|
|
369
|
+
|
|
370
|
+
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).
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
250
374
|
## Fill command: Updated behavior for better content management
|
|
251
375
|
|
|
252
376
|
v7 introduces improved behavior for the `fill` command, providing more predictable and flexible content management:
|
|
@@ -394,13 +518,17 @@ The system automatically:
|
|
|
394
518
|
- **`middleware.prefixDefault`**: Replaced by `routing.mode`
|
|
395
519
|
- **`middleware.noPrefix`**: Replaced by `routing.mode`
|
|
396
520
|
|
|
521
|
+
### New configurations
|
|
522
|
+
|
|
523
|
+
- **`editor.formatCommand`**: New option for automatic code formatting of content files
|
|
524
|
+
|
|
397
525
|
### Migration mapping
|
|
398
526
|
|
|
399
527
|
#### Configuration mapping
|
|
400
528
|
|
|
401
529
|
| v6 Configuration | v7 Configuration |
|
|
402
530
|
| -------------------------- | ---------------------------------------------------- |
|
|
403
|
-
| `autoFill: xxx`
|
|
531
|
+
| `content.autoFill: xxx` | `dictionary.fill: xxx` |
|
|
404
532
|
| `prefixDefault: false` | `mode: 'prefix-no-default'` |
|
|
405
533
|
| `prefixDefault: true` | `mode: 'prefix-all'` |
|
|
406
534
|
| `noPrefix: true` | `mode: 'no-prefix'` |
|
|
@@ -413,6 +541,10 @@ The system automatically:
|
|
|
413
541
|
|
|
414
542
|
```typescript
|
|
415
543
|
export default {
|
|
544
|
+
content: {
|
|
545
|
+
autoFill: "./{{fileName}}.content.json",
|
|
546
|
+
contentDir: ["src"],
|
|
547
|
+
},
|
|
416
548
|
middleware: {
|
|
417
549
|
headerName: "x-intlayer-locale",
|
|
418
550
|
cookieName: "intlayer-locale",
|
|
@@ -428,12 +560,20 @@ export default {
|
|
|
428
560
|
|
|
429
561
|
```typescript
|
|
430
562
|
export default {
|
|
563
|
+
content: {
|
|
564
|
+
contentDir: ["src"],
|
|
565
|
+
},
|
|
566
|
+
dictionary: {
|
|
567
|
+
fill: "./{{fileName}}.content.json",
|
|
568
|
+
},
|
|
431
569
|
routing: {
|
|
432
570
|
mode: "prefix-no-default",
|
|
433
571
|
storage: "localStorage", // or 'cookie' if you need cookie storage
|
|
434
572
|
headerName: "x-intlayer-locale",
|
|
435
573
|
basePath: "",
|
|
436
|
-
|
|
574
|
+
},
|
|
575
|
+
editor: {
|
|
576
|
+
formatCommand: 'bun x biome format "{{file}}" --write --log-level none', // Optional: automatic formatting
|
|
437
577
|
},
|
|
438
578
|
};
|
|
439
579
|
```
|
|
@@ -65,8 +65,9 @@ const config: IntlayerConfig = {
|
|
|
65
65
|
autoFill: "./{{fileName}}.content.json",
|
|
66
66
|
contentDir: ["src", "../ui-library"],
|
|
67
67
|
},
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
routing: {
|
|
69
|
+
mode: "prefix-no-default",
|
|
70
|
+
storage: "cookie",
|
|
70
71
|
},
|
|
71
72
|
editor: {
|
|
72
73
|
applicationURL: "https://example.com",
|
|
@@ -95,8 +96,9 @@ const config = {
|
|
|
95
96
|
content: {
|
|
96
97
|
contentDir: ["src", "../ui-library"],
|
|
97
98
|
},
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
routing: {
|
|
100
|
+
mode: "prefix-no-default",
|
|
101
|
+
storage: "cookie",
|
|
100
102
|
},
|
|
101
103
|
editor: {
|
|
102
104
|
applicationURL: "https://example.com",
|
|
@@ -121,8 +123,9 @@ module.exports = config;
|
|
|
121
123
|
"content": {
|
|
122
124
|
"contentDir": ["src", "../ui-library"],
|
|
123
125
|
},
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
+
"routing": {
|
|
127
|
+
"mode": "prefix-no-default",
|
|
128
|
+
"storage": "cookie",
|
|
126
129
|
},
|
|
127
130
|
"editor": {
|
|
128
131
|
"applicationURL": "https://example.com",
|
|
@@ -333,30 +336,6 @@ Settings that control middleware behaviour, including how the application handle
|
|
|
333
336
|
- If `noPrefix = false`: URL will be `https://example.com/my-app/en`
|
|
334
337
|
- If `noPrefix = true`: URL will be `https://example.com`
|
|
335
338
|
|
|
336
|
-
- **detectLocaleOnPrefetchNoPrefix**:
|
|
337
|
-
- _Type_: `boolean`
|
|
338
|
-
- _Default_: `false`
|
|
339
|
-
- _Description_: Controls whether locale detection occurs during Next.js prefetch requests.
|
|
340
|
-
- _Example_: `true`
|
|
341
|
-
- _Note_: This setting affects how Next.js handles locale prefetching:
|
|
342
|
-
- **Example scenario:**
|
|
343
|
-
- User's browser language is `'fr'`
|
|
344
|
-
- Current page is `/fr/about`
|
|
345
|
-
- Link prefetches `/about`
|
|
346
|
-
- **With `detectLocaleOnPrefetchNoPrefix: true`:**
|
|
347
|
-
- Prefetch detects `'fr'` locale from browser
|
|
348
|
-
- Redirects prefetch to `/fr/about`
|
|
349
|
-
- **With `detectLocaleOnPrefetchNoPrefix: false` (default):**
|
|
350
|
-
- Prefetch uses default locale
|
|
351
|
-
- Redirects prefetch to `/en/about` (assuming `'en'` is default)
|
|
352
|
-
- **When to use `true`:**
|
|
353
|
-
- Your app uses non-localised internal links (e.g. `<a href="/about">`)
|
|
354
|
-
- You want consistent locale detection behaviour between regular and prefetch requests
|
|
355
|
-
- **When to use `false` (default):**
|
|
356
|
-
- Your app uses locale-prefixed links (e.g. `<a href="/fr/about">`)
|
|
357
|
-
- You want to optimise prefetching performance
|
|
358
|
-
- You want to avoid potential redirect loops
|
|
359
|
-
|
|
360
339
|
---
|
|
361
340
|
|
|
362
341
|
### Content Configuration
|