@intlayer/docs 7.0.0-canary.1 → 7.0.0-canary.3

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 (43) hide show
  1. package/dist/cjs/common.cjs.map +1 -1
  2. package/dist/esm/common.mjs.map +1 -1
  3. package/dist/types/common.d.ts +5 -0
  4. package/dist/types/common.d.ts.map +1 -1
  5. package/docs/ar/intlayer_with_nextjs_16.md +1652 -0
  6. package/docs/ar/releases/v7.md +486 -0
  7. package/docs/de/intlayer_with_nextjs_16.md +1662 -0
  8. package/docs/de/releases/v7.md +503 -0
  9. package/docs/en/intlayer_with_nextjs_15.md +5 -2
  10. package/docs/en/intlayer_with_nextjs_16.md +4 -4
  11. package/docs/en-GB/intlayer_with_nextjs_16.md +1642 -0
  12. package/docs/en-GB/releases/v7.md +486 -0
  13. package/docs/es/intlayer_with_nextjs_16.md +1670 -0
  14. package/docs/es/releases/v7.md +503 -0
  15. package/docs/fr/intlayer_with_nextjs_16.md +1692 -0
  16. package/docs/fr/releases/v7.md +504 -0
  17. package/docs/hi/intlayer_with_nextjs_16.md +1618 -0
  18. package/docs/hi/releases/v7.md +486 -0
  19. package/docs/id/intlayer_with_nextjs_16.md +1604 -0
  20. package/docs/id/releases/v7.md +503 -0
  21. package/docs/it/intlayer_with_nextjs_16.md +1600 -0
  22. package/docs/it/releases/v7.md +505 -0
  23. package/docs/ja/intlayer_CMS.md +0 -9
  24. package/docs/ja/intlayer_with_nextjs_16.md +1788 -0
  25. package/docs/ja/releases/v7.md +504 -0
  26. package/docs/ko/intlayer_with_nextjs_16.md +1641 -0
  27. package/docs/ko/releases/v7.md +504 -0
  28. package/docs/pl/intlayer_with_nextjs_16.md +1645 -0
  29. package/docs/pl/releases/v7.md +486 -0
  30. package/docs/pt/intlayer_with_nextjs_16.md +1646 -0
  31. package/docs/pt/introduction.md +0 -15
  32. package/docs/pt/releases/v7.md +486 -0
  33. package/docs/ru/intlayer_with_nextjs_16.md +1610 -0
  34. package/docs/ru/releases/v7.md +486 -0
  35. package/docs/tr/intlayer_with_nextjs_16.md +1599 -0
  36. package/docs/tr/releases/v7.md +486 -0
  37. package/docs/vi/intlayer_with_nextjs_16.md +1597 -0
  38. package/docs/vi/releases/v7.md +486 -0
  39. package/docs/zh/intlayer_CMS.md +0 -23
  40. package/docs/zh/intlayer_with_nextjs_16.md +1628 -0
  41. package/docs/zh/releases/v7.md +487 -0
  42. package/package.json +14 -14
  43. package/src/common.ts +5 -0
@@ -0,0 +1,486 @@
1
+ ---
2
+ createdAt: 2025-09-22
3
+ updatedAt: 2025-09-23
4
+ title: New Intlayer v7 - What's new?
5
+ description: Discover what's new in Intlayer v7. Major improvements in performance, developer experience, and new features to enhance your internationalisation workflow.
6
+ keywords:
7
+ - Intlayer
8
+ - Localisation
9
+ - Development
10
+ - Performance
11
+ - Developer Experience
12
+ - Features
13
+ - React
14
+ - Next.js
15
+ - JavaScript
16
+ - TypeScript
17
+ slugs:
18
+ - doc
19
+ - releases
20
+ - v7
21
+ ---
22
+
23
+ # New Intlayer v7 - What's new?
24
+
25
+ Welcome to Intlayer v7! This major release introduces significant improvements in performance, type safety, and developer experience. Below are the highlights, with migration notes and practical examples.
26
+
27
+ ## Highlights
28
+
29
+ - Caching strategy for faster builds
30
+ - Improved TypeScript type generation with locale-specific types
31
+ - Bundle optimisation: Locales as strings instead of enum
32
+ - New routing modes: `prefix-no-default`, `prefix-all`, `no-prefix`, `search-params`
33
+ - GDPR-compliant locale storage with localStorage as default
34
+ - Flexible storage configuration: cookies, localStorage, sessionStorage, or multiple
35
+ - 30% smaller Visual Editor package size
36
+ - Enhanced middleware configuration options
37
+ - Updated fill command behaviour for better content management
38
+ - Enhanced stability with complete content declaration file updates
39
+ - Intelligent retry management for translation accuracy
40
+ - Parallelisation for faster translation processing
41
+ - Smart chunking to handle large files within AI context limits
42
+
43
+ ---
44
+
45
+ ## Performance: Caching for faster builds
46
+
47
+ Instead of rebuilding content declarations with esbuild on every build, v7 implements a caching strategy that speeds up the build process.
48
+
49
+ ```bash
50
+ npx intlayer build
51
+ ```
52
+
53
+ The new caching system:
54
+
55
+ - Stores compiled content declarations to avoid redundant processing
56
+ - Detects changes and rebuilds only modified files
57
+ - Significantly reduces build times for large projects
58
+
59
+ ---
60
+
61
+ ## TypeScript: Locale-specific type generation
62
+
63
+ TypeScript types are now generated per locale, providing stronger typing and eliminating union types across all locales.
64
+
65
+ **v6 behaviour:**
66
+
67
+ ```tsx
68
+ const content = getIntlayer("my-title-content", "en");
69
+ // typeof content = { title: "My title" } | { title: "Mon titre" } | { title: "Mi título" }
70
+ ```
71
+
72
+ **v7 behaviour:**
73
+
74
+ ```tsx
75
+ const content = getIntlayer("my-title-content", "en");
76
+ // typeof content = { title: "My title" }
77
+ ```
78
+
79
+ Benefits:
80
+
81
+ - More precise autocomplete in your IDE
82
+ - Better type safety with no cross-locale type pollution
83
+ - Improved performance by reducing type complexity
84
+
85
+ ---
86
+
87
+ ## Bundle optimisation: Locales as strings
88
+
89
+ The `Locales` type is no longer an enum, which means it is now fully tree-shakeable and will not bloat your bundle with thousands of unused locale records.
90
+
91
+ **v6:**
92
+
93
+ ```typescript
94
+ import { Locales } from "intlayer";
95
+ // Enum including all locales -> not tree-shakeable
96
+
97
+ const locale: Locales = Locales.ENGLISH;
98
+ ```
99
+
100
+ **v7:**
101
+
102
+ ```typescript
103
+ import { Locales, Locale } from "intlayer";
104
+ // String type -> fully tree-shakeable
105
+
106
+ const locale: Locale = Locales.ENGLISH;
107
+ ```
108
+
109
+ > Because `Locales` is not an enum anymore, you will have to change the type from `Locales` to `Locale` to get the locale as a type.
110
+
111
+ See the [implementation details](https://github.com/aymericzip/intlayer/blob/main/packages/%40intlayer/types/src/index.ts) for more information.
112
+
113
+ ---
114
+
115
+ ## New routing modes for greater flexibility
116
+
117
+ v7 introduces a unified `routing.mode` configuration that replaces the previous `prefixDefault` and `noPrefix` options, offering more granular control over URL structure.
118
+
119
+ ### Available routing modes
120
+
121
+ - **`prefix-no-default`** (default): Default locale has no prefix, other locales do
122
+ - `/dashboard` (en) or `/fr/dashboard` (fr)
123
+ - **`prefix-all`**: All locales have a prefix
124
+ - `/en/dashboard` (en) or `/fr/dashboard` (fr)
125
+ - **`no-prefix`**: No locale prefixes in URLs (locale handled via storage/headers)
126
+ - `/dashboard` for all locales
127
+ - **`search-params`**: Locale passed as a query parameter
128
+ - `/dashboard?locale=en` or `/dashboard?locale=fr`
129
+
130
+ ### Basic configuration
131
+
132
+ ```typescript
133
+ // intlayer.config.ts
134
+ export default {
135
+ internationalization: {
136
+ locales: ["en", "fr", "es"],
137
+ defaultLocale: "en",
138
+ },
139
+ routing: {
140
+ mode: "prefix-no-default", // default
141
+ },
142
+ };
143
+ ```
144
+
145
+ ---
146
+
147
+ ## GDPR compliance: localStorage / cookies storage
148
+
149
+ v7 prioritises user privacy by using `localStorage` as the default storage mechanism instead of cookies. This change helps with GDPR compliance by avoiding cookie consent requirements for locale preferences.
150
+
151
+ ### Storage configuration options
152
+
153
+ The new `routing.storage` field is also available in addition to the previous `middleware.cookieName` and `middleware.serverSetCookie` options, offering flexible storage configurations:
154
+
155
+ ```typescript
156
+ // Disable storage
157
+ storage: false
158
+
159
+ // Simple storage types
160
+ storage: 'cookie'
161
+ storage: 'localStorage'
162
+ storage: 'sessionStorage'
163
+
164
+ // Cookie with custom attributes
165
+ storage: {
166
+ type: 'cookie',
167
+ name: 'custom-locale',
168
+ domain: '.example.com',
169
+ secure: true,
170
+ sameSite: 'strict'
171
+ }
172
+
173
+ // localStorage with custom key
174
+ storage: {
175
+ type: 'localStorage',
176
+ name: 'custom-locale'
177
+ }
178
+
179
+ // Multiple storage types for redundancy
180
+ storage: ['cookie', 'localStorage']
181
+ ```
182
+
183
+ ### GDPR-compliant configuration example
184
+
185
+ For production applications that need to balance functionality with GDPR compliance:
186
+
187
+ ```typescript
188
+ // intlayer.config.ts
189
+ export default {
190
+ internationalization: {
191
+ locales: ["en", "fr", "es"],
192
+ defaultLocale: "en",
193
+ },
194
+ routing: {
195
+ mode: "prefix-no-default",
196
+ storage: [
197
+ {
198
+ type: "localStorage", // Primary storage (no consent needed)
199
+ name: "user-locale",
200
+ },
201
+ {
202
+ type: "cookie", // Optional cookie storage (requires consent)
203
+ name: "user-locale",
204
+ secure: true,
205
+ sameSite: "strict",
206
+ httpOnly: false,
207
+ },
208
+ ],
209
+ },
210
+ };
211
+ ```
212
+
213
+ ### Enable / disable the cookie storage
214
+
215
+ Example using React / Next.js:
216
+
217
+ Can be defined globally:
218
+
219
+ ```typescript
220
+ <IntlayerProvider isCookieEnabled={false}>
221
+ <App />
222
+ </IntlayerProvider>
223
+ ```
224
+
225
+ Can override it locally for each hook:
226
+
227
+ ```ts
228
+ const { setLocale } = useLocale({ isCookieEnabled: false });
229
+
230
+ setLocale("en");
231
+ ```
232
+
233
+ **Note:** Cookies are enabled by default.
234
+ **Note:** Check [GDPR cookie requirements](https://gdpr.eu/cookies/) for your specific use case.
235
+
236
+ ---
237
+
238
+ ## Visual Editor: 30% smaller package
239
+
240
+ The Visual Editor package has been optimised to be 30% smaller than the previous version, thanks to:
241
+
242
+ - Code editor performance improvements
243
+ - Removal of unnecessary dependencies on Intlayer core packages
244
+ - Better tree-shaking and module bundling
245
+
246
+ This results in faster download times and improved runtime performance for your application.
247
+
248
+ ---
249
+
250
+ ## Fill command: Updated behaviour for better content management
251
+
252
+ v7 introduces improved behaviour for the `fill` command, providing more predictable and flexible content management:
253
+
254
+ ### New fill behaviour
255
+
256
+ - **`fill: true`** - Rewrites the current file with filled content for all locales
257
+ - **`fill: "path/to/file"`** - Fills the specified file without modifying the current file
258
+ - **`fill: false`** - Disables auto-fill completely
259
+
260
+ ### Enhanced support for complex content structures
261
+
262
+ The fill command now supports complex content declaration structures, including:
263
+
264
+ - **Composed objects**: Content declarations that reference other objects
265
+ - **Destructured content**: Content that uses destructuring patterns
266
+ - **Nested references**: Objects that call each other in complex hierarchies
267
+ - **Dynamic content structures**: Content with conditional or computed properties
268
+
269
+ ### Benefits
270
+
271
+ - **Clearer intent**: The behaviour is now more explicit about what gets modified
272
+ - **Better separation**: Content files can be kept separate from filled translations
273
+ - **Improved workflow**: Developers have more control over where translations are stored
274
+ - **Complex structure support**: Handle sophisticated content architectures with multiple interconnected objects
275
+
276
+ ### Example usage
277
+
278
+ ```typescript
279
+ // Rewrite current file with all locales
280
+ const content = {
281
+ key: "example",
282
+ fill: true, // Rewrites this file
283
+ content: {
284
+ title: "Hello World",
285
+ },
286
+ };
287
+
288
+ // Fill separate file without modifying current file
289
+ const content = {
290
+ key: "example",
291
+ fill: "./translations.json", // Creates/updates translations.json
292
+ content: {
293
+ title: "Hello World",
294
+ },
295
+ };
296
+
297
+ // Disable auto-fill
298
+ const content = {
299
+ key: "example",
300
+ fill: false, // No auto-fill
301
+ content: {
302
+ title: "Hello World",
303
+ },
304
+ };
305
+
306
+ // Complex content structure with composed objects
307
+ const sharedContent = {
308
+ buttons: {
309
+ save: "Save",
310
+ cancel: "Cancel",
311
+ },
312
+ };
313
+
314
+ const content = {
315
+ key: "complex-example",
316
+ fill: true,
317
+ content: {
318
+ // References to other objects
319
+ sharedContent,
320
+
321
+ // Destructured content
322
+ ...sharedContent,
323
+
324
+ // Nested references
325
+ sections: [
326
+ {
327
+ ...sharedContent.buttons,
328
+ header: "Section 1",
329
+ },
330
+ ],
331
+ },
332
+ };
333
+ ```
334
+
335
+ ---
336
+
337
+ ## Enhanced stability and translation management
338
+
339
+ v7 introduces several improvements to make content translation more reliable and efficient:
340
+
341
+ ### Complete content declaration file updates
342
+
343
+ The system now updates `.content.{ts,js,cjs,mjs}` files rather than partial updates, ensuring:
344
+
345
+ - **Data integrity**: Complete file rewrites prevent partial updates that could corrupt content
346
+ - **Consistency**: All locales are updated atomically, maintaining synchronisation
347
+ - **Reliability**: Reduces the risk of incomplete or malformed content files
348
+
349
+ ### Intelligent retry management
350
+
351
+ New retry mechanisms prevent pushing content in incorrect formats, and avoid breaking the whole fill process if one request fails.
352
+
353
+ ### Parallelisation for faster processing
354
+
355
+ Translation operations now run in a queue to run them in parallel. This significantly speeds up the process.
356
+
357
+ ### Smart chunking for large files
358
+
359
+ Advanced chunking strategies handle large content files without exceeding AI context windows:
360
+
361
+ ### Example workflow
362
+
363
+ ```typescript
364
+ // Large content file gets automatically chunked
365
+ const content = {
366
+ key: "large-documentation",
367
+ fill: true,
368
+ content: {
369
+ // Large content automatically chunked for AI processing
370
+ introduction: "..." // 5000+ characters
371
+ sections: [
372
+ // Multiple large sections
373
+ ]
374
+ }
375
+ };
376
+ ```
377
+
378
+ The system automatically:
379
+
380
+ 1. Analyses content size and structure
381
+ 2. Chunks content appropriately
382
+ 3. Processes chunks in parallel
383
+ 4. Validates and retries if needed
384
+ 5. Reconstructs the complete file
385
+
386
+ ---
387
+
388
+ ## Migration notes from v6
389
+
390
+ ### Removed configurations
391
+
392
+ - **`middleware.cookieName`**: Replaced by `routing.storage`
393
+ - **`middleware.serverSetCookie`**: Replaced by `routing.storage`
394
+ - **`middleware.prefixDefault`**: Replaced by `routing.mode`
395
+ - **`middleware.noPrefix`**: Replaced by `routing.mode`
396
+
397
+ ### Migration mapping
398
+
399
+ #### Configuration mapping
400
+
401
+ | v6 Configuration | v7 Configuration |
402
+ | -------------------------- | ---------------------------------------------------- |
403
+ | `autoFill: xxx` | `fill: xxx` |
404
+ | `prefixDefault: false` | `mode: 'prefix-no-default'` |
405
+ | `prefixDefault: true` | `mode: 'prefix-all'` |
406
+ | `noPrefix: true` | `mode: 'no-prefix'` |
407
+ | `cookieName: 'my-locale'` | `storage: { type: 'cookie', name: 'my-locale' }` |
408
+ | `serverSetCookie: 'never'` | `storage: false` or remove cookie from storage array |
409
+
410
+ #### Example migration
411
+
412
+ **Before (v6):**
413
+
414
+ ```typescript
415
+ export default {
416
+ middleware: {
417
+ headerName: "x-intlayer-locale",
418
+ cookieName: "intlayer-locale",
419
+ prefixDefault: false,
420
+ basePath: "",
421
+ serverSetCookie: "always",
422
+ noPrefix: false,
423
+ },
424
+ };
425
+ ```
426
+
427
+ **After (v7):**
428
+
429
+ ```typescript
430
+ export default {
431
+ routing: {
432
+ mode: "prefix-no-default",
433
+ storage: "localStorage", // or 'cookie' if you require cookie storage
434
+ headerName: "x-intlayer-locale",
435
+ basePath: "",
436
+ detectLocaleOnPrefetchNoPrefix: false,
437
+ },
438
+ };
439
+ ```
440
+
441
+ #### Dictionary content mapping
442
+
443
+ | v6 Dictionary content | v7 Dictionary content |
444
+ | --------------------- | --------------------- |
445
+ | `autoFill: xxx` | `fill: xxx` |
446
+
447
+ #### Example migration
448
+
449
+ **Before (v6):**
450
+
451
+ ```typescript
452
+ const content = {
453
+ key: "example",
454
+ autoFill: true, // Rewrites this file
455
+ content: {
456
+ title: "Hello World",
457
+ },
458
+ };
459
+ ```
460
+
461
+ **After (v7):**
462
+
463
+ ```typescript
464
+ const content = {
465
+ key: "example",
466
+ fill: true, // Rewrites this file
467
+ content: {
468
+ title: "Hello World",
469
+ },
470
+ };
471
+ ```
472
+
473
+ ---
474
+
475
+ ## Migration notes from v5 to v6
476
+
477
+ Check the [migration notes from v5 to v6](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/releases/v6.md) for more information.
478
+
479
+ ---
480
+
481
+ ## Useful links
482
+
483
+ - [Configuration Reference](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/configuration.md)
484
+ - [Middleware Documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/packages/next-intlayer/index.md)
485
+ - [TypeScript Types](https://github.com/aymericzip/intlayer/blob/main/packages/%40intlayer/types/src/index.ts)
486
+ - [GDPR Cookie Guidelines](https://gdpr.eu/cookies/)