@intlayer/docs 8.4.5 → 8.4.7

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 (56) 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/dist/cjs/generated/docs.entry.cjs +20 -0
  12. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  13. package/dist/esm/generated/docs.entry.mjs +20 -0
  14. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  15. package/dist/types/generated/docs.entry.d.ts +1 -0
  16. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  17. package/docs/ar/intlayer_with_storybook.md +521 -0
  18. package/docs/bn/intlayer_with_hono.md +428 -0
  19. package/docs/de/intlayer_with_storybook.md +521 -0
  20. package/docs/en/configuration.md +160 -508
  21. package/docs/en/intlayer_with_storybook.md +521 -0
  22. package/docs/en-GB/intlayer_with_storybook.md +521 -0
  23. package/docs/es/configuration.md +387 -754
  24. package/docs/es/intlayer_with_storybook.md +521 -0
  25. package/docs/fr/configuration.md +384 -757
  26. package/docs/fr/intlayer_with_storybook.md +521 -0
  27. package/docs/hi/intlayer_with_storybook.md +521 -0
  28. package/docs/id/intlayer_with_storybook.md +521 -0
  29. package/docs/it/intlayer_with_storybook.md +521 -0
  30. package/docs/ja/intlayer_with_storybook.md +521 -0
  31. package/docs/ko/intlayer_with_storybook.md +521 -0
  32. package/docs/pl/intlayer_with_storybook.md +521 -0
  33. package/docs/pt/intlayer_with_storybook.md +521 -0
  34. package/docs/ru/intlayer_with_storybook.md +521 -0
  35. package/docs/tr/intlayer_with_storybook.md +521 -0
  36. package/docs/uk/intlayer_with_storybook.md +521 -0
  37. package/docs/ur/intlayer_with_hono.md +428 -0
  38. package/docs/vi/intlayer_with_storybook.md +521 -0
  39. package/docs/zh/intlayer_with_storybook.md +521 -0
  40. package/package.json +6 -6
  41. package/src/generated/docs.entry.ts +20 -0
  42. package/docs/ar/configuration.md +0 -1124
  43. package/docs/de/configuration.md +0 -1296
  44. package/docs/en-GB/configuration.md +0 -1123
  45. package/docs/hi/configuration.md +0 -1118
  46. package/docs/id/configuration.md +0 -1235
  47. package/docs/it/configuration.md +0 -1301
  48. package/docs/ja/configuration.md +0 -1121
  49. package/docs/ko/configuration.md +0 -1121
  50. package/docs/pl/configuration.md +0 -1226
  51. package/docs/pt/configuration.md +0 -1293
  52. package/docs/ru/configuration.md +0 -1112
  53. package/docs/tr/configuration.md +0 -1114
  54. package/docs/uk/configuration.md +0 -1241
  55. package/docs/vi/configuration.md +0 -1263
  56. package/docs/zh/configuration.md +0 -1115
@@ -14,6 +14,9 @@ slugs:
14
14
  - concept
15
15
  - configuration
16
16
  history:
17
+ - version: 8.4.0
18
+ date: 2026-03-20
19
+ changes: Add object per-locale notation for 'compiler.output' and 'dictionary.fill'
17
20
  - version: 8.3.0
18
21
  date: 2026-03-11
19
22
  changes: Move 'baseDir' from 'content' to 'system' config
@@ -272,7 +275,7 @@ const config: IntlayerConfig = {
272
275
  watch: true,
273
276
 
274
277
  /**
275
- * Command to format newly created / updated .content files.
278
+ * Command to format newly created <br/> updated .content files.
276
279
  */
277
280
  formatCommand: 'npx prettier --write "{{file}}"',
278
281
  },
@@ -560,35 +563,12 @@ The following sections describe the various configuration settings available for
560
563
 
561
564
  Defines settings related to internationalization, including available locales and the default locale for the application.
562
565
 
563
- #### Properties
564
-
565
- - **locales**:
566
- - _Type_: `string[]`
567
- - _Default_: `[Locales.ENGLISH]`
568
- - _Description_: The list of supported locales in the application.
569
- - _Example_: `['en', 'fr', 'es']`
570
-
571
- - **requiredLocales**:
572
- - _Type_: `string[]`
573
- - _Default_: `[]`
574
- - _Description_: The list of required locales in the application.
575
- - _Example_: `[]`
576
- - _Note_: If empty, all locales are required in `strict` mode.
577
- - _Note_: Ensure required locales are also defined in the `locales` field.
578
- - **strictMode**:
579
- - _Type_: `string`
580
- - _Default_: `inclusive`
581
- - _Description_: Ensure strong implementations of internationalized content using typescript.
582
- - _Note_: If set to "strict", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.
583
- - _Note_: If set to "inclusive", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exists.
584
- - _Note_: If set to "loose", the translation `t` function will accept any existing locale.
585
-
586
- - **defaultLocale**:
587
- - _Type_: `string`
588
- - _Default_: `Locales.ENGLISH`
589
- - _Description_: The default locale used as a fallback if the requested locale is not found.
590
- - _Example_: `'en'`
591
- - _Note_: This is used to determine the locale when none 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. |
592
572
 
593
573
  ---
594
574
 
@@ -596,198 +576,85 @@ Defines settings related to internationalization, including available locales an
596
576
 
597
577
  Defines settings related to the integrated editor, including server port and active status.
598
578
 
599
- #### Properties
600
-
601
- - **applicationURL**:
602
- - _Type_: `string`
603
- - _Default_: `''`
604
- - _Description_: The URL of the application. Used to restrict the origin of the editor for security reasons.
605
- - _Example_:
606
- - `'http://localhost:3000'`
607
- - `'https://example.com'`
608
- - `process.env.INTLAYER_EDITOR_URL`
609
- - _Note_: The URL of the application. Used to restrict the origin of the editor for security reasons. If set to `'*'`, the editor is accessible from any origin.
610
-
611
- - **port**:
612
- - _Type_: `number`
613
- - _Default_: `8000`
614
- - _Description_: The port used by the visual editor server.
615
-
616
- - **editorURL**:
617
- - _Type_: `string`
618
- - _Default_: `'http://localhost:8000'`
619
- - _Description_: The URL of the editor server. Used to restrict the origin of the editor for security reasons.
620
- - `'http://localhost:3000'`
621
- - `'https://example.com'`
622
- - `process.env.INTLAYER_EDITOR_URL`
623
- - _Note_: The URL of the editor server to reach from the application. Used to restrict the origins that can interact with the application for security reasons. If set to `'*'`, the editor is accessible from any origin. Should be set if port is changed, or if the editor is hosted on a different domain.
624
-
625
- - **cmsURL**:
626
- - _Type_: `string`
627
- - _Default_: `'https://intlayer.org'`
628
- - _Description_: The URL of the Intlayer CMS.
629
- - _Example_: `'https://intlayer.org'`
630
- - _Note_: The URL of the Intlayer CMS.
631
-
632
- - **backendURL**:
633
- - _Type_: `string`
634
- - _Default_: `https://back.intlayer.org`
635
- - _Description_: The URL of the backend server.
636
- - _Example_: `http://localhost:4000`
637
-
638
- - **enabled**:
639
- - _Type_: `boolean`
640
- - _Default_: `true`
641
- - _Description_: Indicates if the application interact with the visual editor.
642
- - _Example_: `process.env.NODE_ENV !== 'production'`
643
- - _Note_: If true, the editor will be able to interact with the application. If false, the editor will not be able to interact with the application. In any case, the editor can only be enabled by the visual editor. Disabling the editor for specific environments is a way to enforce the security.
644
-
645
- - **clientId**:
646
- - _Type_: `string` | `undefined`
647
- - _Default_: `undefined`
648
- - _Description_: clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication. An access token is used to authenticate the user related to the project. To get an access token, go to https://app.intlayer.org/project and create an account.
649
- - _Example_: `true`
650
- - _Note_: Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.
651
-
652
- - **clientSecret**:
653
- - _Type_: `string` | `undefined`
654
- - _Default_: `undefined`
655
- - _Description_: clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication. An access token is used to authenticate the user related to the project. To get an access token, go to https://app.intlayer.org/project and create an account.
656
- - _Example_: `true`
657
- - _Note_: Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.
658
-
659
- - **dictionaryPriorityStrategy**:
660
- - _Type_: `string`
661
- - _Default_: `'local_first'`
662
- - _Description_: The strategy to prioritize dictionaries in the case of both local and distant dictionaries being present. If set to `'distant_first'`, the application will prioritize distant dictionaries over local dictionaries. If set to `'local_first'`, the application will prioritize local dictionaries over distant dictionaries.
663
- - _Example_: `'distant_first'`
664
-
665
- - **liveSync**:
666
- - _Type_: `boolean`
667
- - _Default_: `true`
668
- - _Description_: Indicates if the application server should hot reload the content of the application when a change is detected on the CMS / Visual Editor / Backend.
669
- - _Example_: `true`
670
- - _Note_: For example, when a new dictionary is added or updated, the application will update the content to display in the page.
671
- - _Note_: Live sync need to externalize the content of the application to another server. That means that it can slightly impact the performance of the application. To limit this, we recommand to host the application and the live sync server on the same machine. Also, the combination of live sync and `optimize` can apply a consequent number of requests to the live sync server. Depending of your infrastructure, we recommand to test both options and their combination.
672
-
673
- - **liveSyncPort**:
674
- - _Type_: `number`
675
- - _Default_: `4000`
676
- - _Description_: The port of the live sync server.
677
- - _Example_: `4000`
678
- - _Note_: The port of the live sync server.
679
-
680
- - **liveSyncURL**:
681
- - _Type_: `string`
682
- - _Default_: `'http://localhost:{liveSyncPort}'`
683
- - _Description_: The URL of the live sync server.
684
- - _Example_: `'https://example.com'`
685
- - _Note_: Point to localhost by default but can be changed to any URL in the case of a remote live sync server.
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. |
686
593
 
687
594
  ### Routing Configuration
688
595
 
689
596
  Settings that control routing behavior, including URL structure, locale storage, and middleware handling.
690
597
 
691
- #### Properties
692
-
693
- - **mode**:
694
- - _Type_: `'prefix-no-default' | 'prefix-all' | 'no-prefix' | 'search-params'`
695
- - _Default_: `'prefix-no-default'`
696
- - _Description_: URL routing mode for locale handling.
697
- - _Examples_:
698
- - `'prefix-no-default'`: `/dashboard` (en) or `/fr/dashboard` (fr)
699
- - `'prefix-all'`: `/en/dashboard` (en) or `/fr/dashboard` (fr)
700
- - `'no-prefix'`: `/dashboard` (locale handled via other means)
701
- - `'search-params'`: `/dashboard?locale=fr`
702
- - _Note_: This setting does not impact cookie or locale storage management.
703
-
704
- - **storage**:
705
- - _Type_: `false | 'cookie' | 'localStorage' | 'sessionStorage' | 'header' | CookiesAttributes | StorageAttributes | Array`
706
- - _Default_: `['cookie', 'header']`
707
- - _Description_: Configuration for storing the locale in the client.
708
-
709
- - **cookie**:
710
- - _Description_: Stores data in cookies, small pieces of data stored on the client's browser, accessible on both client and server side.
711
- - _Note_: For GDPR compliant storage, ensure proper user consent before usage.
712
- - _Note_: Cookies parameters are customizable if set as CookiesAttributes (`{ type: 'cookie', name: 'custom-locale', secure: true, httpOnly: false }`).
713
-
714
- - **localStorage**:
715
- - _Description_: Stores data in the browser without expiration dates, allowing for data persistence across sessions, accessible only on the client side.
716
- - _Note_: Ideal for storing long-term data but mindful of the privacy and security implications due to non-expiring nature unless explicitly cleared.
717
- - _Note_: Locale storage is only accessible on the client side, the intlayer proxy will not be able to access it.
718
- - _Note_: Locale storage parameters are customizable if set as StorageAttributes (`{ type: 'localStorage', name: 'custom-locale' }`).
719
-
720
- - **sessionStorage**:
721
- - _Description_: Stores data for the duration of a page session, meaning it gets cleared once the tab or window is closed, accessible only on the client side.
722
- - _Note_: Suitable for temporary data storage for each session.
723
- - _Note_: Locale storage is only accessible on the client side, the intlayer proxy will not be able to access it.
724
- - _Note_: Locale storage parameters are customizable if set as StorageAttributes (`{ type: 'sessionStorage', name: 'custom-locale' }`).
725
-
726
- - **header**:
727
- - _Description_: Utilizes HTTP headers to store or transmit locale data, suitable for server-side language determination.
728
- - _Note_: Useful in API calls for maintaining consistent language settings across requests.
729
- - _Note_: Header is only accessible on the server side, the client side will not be able to access it.
730
- - _Note_: Header name is customizable if set as StorageAttributes (`{ type: 'header', name: 'custom-locale' }`).
731
-
732
- - **basePath**:
733
- - _Type_: `string`
734
- - _Default_: `''`
735
- - _Description_: The base path for the application URLs.
736
- - _Example_: `'/my-app'`
737
- - _Note_:
738
- - If the application is hosted at `https://example.com/my-app`
739
- - The base path is `'/my-app'`
740
- - The URL will be `https://example.com/my-app/en`
741
- - If the base path is not set, the URL will be `https://example.com/en`
742
-
743
- - **rewrite**:
744
- - _Type_: `Record<string, StrictModeLocaleMap<string>>`
745
- - _Default_: `undefined`
746
- - _Description_: Custom URL rewriting rules that override the default routing mode for specific paths. Allows you to define locale-specific paths that differ from the standard routing behavior. Supports dynamic route parameters using `[param]` syntax.
747
- - _Example_:
748
- ```typescript
749
- routing: {
750
- mode: "prefix-no-default", // Fallback strategy
751
- rewrite: nextjsRewrite({
752
- "/about": {
753
- en: "/about",
754
- fr: "/a-propos",
755
- },
756
- "/product/[slug]": {
757
- en: "/product/[slug]",
758
- fr: "/produit/[slug]",
759
- },
760
- "/blog/[category]/[id]": {
761
- en: "/blog/[category]/[id]",
762
- fr: "/journal/[category]/[id]",
763
- },
764
- }),
765
- }
766
- ```
767
- - _Note_: The rewrite rules take precedence over the default `mode` behavior. If a path matches a rewrite rule, the localized path from the rewrite configuration will be used instead of the standard locale prefixing.
768
- - _Note_: Dynamic route parameters are supported using bracket notation (e.g., `[slug]`, `[id]`). The parameter values are automatically extracted from the URL and interpolated into the rewritten path.
769
- - _Note_: Works with both Next.js and Vite applications. The middleware/proxy will automatically rewrite incoming requests to match the internal route structure.
770
- - _Note_: When generating URLs with `getLocalizedUrl()`, the rewrite rules are automatically applied if they match the provided path.
771
- - _Reference_: For more information, see [Custom URL Rewrites](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/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
+
605
+ **`rewrite` example**:
606
+
607
+ ```typescript
608
+ routing: {
609
+ mode: "prefix-no-default", // Fallback strategy
610
+ rewrite: nextjsRewrite({
611
+ "/about": {
612
+ en: "/about",
613
+ fr: "/a-propos",
614
+ },
615
+ "/product/[slug]": {
616
+ en: "/product/[slug]",
617
+ fr: "/produit/[slug]",
618
+ },
619
+ "/blog/[category]/[id]": {
620
+ en: "/blog/[category]/[id]",
621
+ fr: "/journal/[category]/[id]",
622
+ },
623
+ }),
624
+ }
625
+ ```
626
+
627
+ #### Storage Options
628
+
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. |
772
635
 
773
636
  #### Cookie Attributes
774
637
 
775
638
  When using cookie storage, you can configure additional cookie attributes:
776
639
 
777
- - **name**: Cookie name (default: `'INTLAYER_LOCALE'`)
778
- - **domain**: Cookie domain (default: undefined)
779
- - **path**: Cookie path (default: undefined)
780
- - **secure**: Require HTTPS (default: undefined)
781
- - **httpOnly**: HTTP-only flag (default: undefined)
782
- - **sameSite**: SameSite policy (`'strict' | 'lax' | 'none'`)
783
- - **expires**: Expiration date or 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` |
784
649
 
785
650
  #### Locale Storage Attributes
786
651
 
787
652
  When using localStorage or sessionStorage:
788
653
 
789
- - **type**: Storage type (`'localStorage' | 'sessionStorage'`)
790
- - **name**: 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` |
791
658
 
792
659
  #### Configuration Examples
793
660
 
@@ -928,49 +795,14 @@ export default config;
928
795
 
929
796
  Settings related to content handling within the application, including directory names, file extensions, and derived configurations.
930
797
 
931
- #### Properties
932
-
933
- - **watch**:
934
- - _Type_: `boolean`
935
- - _Default_: `process.env.NODE_ENV === 'development'`
936
- - _Description_: Indicates if Intlayer should watch for changes in the content declaration files in the app to rebuild the related dictionaries.
937
-
938
- - **fileExtensions**:
939
- - _Type_: `string[]`
940
- - _Default_: `['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.json5', '.content.jsonc', '.content.tsx', '.content.jsx']`
941
- - _Description_: File extensions to look for when building dictionaries.
942
- - _Example_: `['.data.ts', '.data.js', '.data.json']`
943
- - _Note_: Customizing file extensions can help avoid conflicts.
944
-
945
- - **contentDir**:
946
- - _Type_: `string[]`
947
- - _Default_: `['.']`
948
- - _Example_: `['src', '../../ui-library', require.resolve("@my-package/content")]`
949
- - _Description_: The directory path where content definition files (`.content.*`) are stored.
950
- - _Note_: This is used to watch for content files to rebuild dictionaries.
951
-
952
- - **codeDir**:
953
- - _Type_: `string[]`
954
- - _Default_: `['.']`
955
- - _Example_: `['src', '../../ui-library']`
956
- - _Description_: The directory path where the code is stored, relative to the base directory.
957
- - _Note_: This is used to watch for code files to transform (prune, optimize). Keeping this separate from `contentDir` can improve build performance by avoiding unnecessary scans of content files.
958
-
959
- - **excludedPath**:
960
- - _Type_: `string[]`
961
- - _Default_: `['**/node_modules/**', '**/dist/**', '**/build/**', '**/.intlayer/**', '**/.next/**', '**/.nuxt/**', '**/.expo/**', '**/.vercel/**', '**/.turbo/**', '**/.tanstack/**']`
962
- - _Description_: Directories excluded from content search.
963
- - _Note_: This setting is not yet used, but planned for future implementation.
964
-
965
- - **formatCommand**:
966
- - _Type_: `string`
967
- - _Default_: `undefined`
968
- - _Description_: The command to format the content. When intlayer write your .content files locally, this command will be used to format the content.
969
- - _Example_: `'npx prettier --write "{{file}}" --log-level silent'` Using Prettier
970
- - _Example_: `'npx biome format "{{file}}" --write --log-level none'` Using Biome
971
- - _Example_: `'npx eslint --fix "{{file}}" --quiet'` Using ESLint
972
- - _Note_: Intlayer will replace the {{file}} with the path of the file to format.
973
- - _Note_: If not set, Intlayer will try to detect the format command automatically. By trying to resolve the following commands: prettier, biome, eslint.
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). |
974
806
 
975
807
  ---
976
808
 
@@ -978,51 +810,16 @@ Settings related to content handling within the application, including directory
978
810
 
979
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.
980
812
 
981
- #### Properties
982
-
983
- - **baseDir**:
984
- - _Type_: `string`
985
- - _Default_: `process.cwd()`
986
- - _Description_: The base directory for the project.
987
- - _Example_: `'/path/to/project'`
988
- - _Note_: This is used to resolve all Intlayer-related directories.
989
-
990
- - **dictionariesDir**:
991
- - _Type_: `string`
992
- - _Default_: `'.intlayer/dictionary'`
993
- - _Description_: The directory path for storing localization dictionaries.
994
-
995
- - **moduleAugmentationDir**:
996
- - _Type_: `string`
997
- - _Default_: `'.intlayer/types'`
998
- - _Description_: Directory for module augmentation, allowing better IDE suggestions and type checking.
999
- - _Example_: `'intlayer-types'`
1000
- - _Note_: Be sure to include this in `tsconfig.json`.
1001
-
1002
- - **unmergedDictionariesDir**:
1003
- - _Type_: `string`
1004
- - _Default_: `'.intlayer/unmerged_dictionary'`
1005
- - _Description_: The directory for storing unmerged dictionaries.
1006
-
1007
- - **typesDir**:
1008
- - _Type_: `string`
1009
- - _Default_: `'.intlayer/types'`
1010
- - _Description_: The directory for storing dictionary types.
1011
-
1012
- - **mainDir**:
1013
- - _Type_: `string`
1014
- - _Default_: `'.intlayer/main'`
1015
- - _Description_: The directory where main application files are stored.
1016
-
1017
- - **configDir**:
1018
- - _Type_: `string`
1019
- - _Default_: `'.intlayer/config'`
1020
- - _Description_: The directory where the configuration files are stored.
1021
-
1022
- - **cacheDir**:
1023
- - _Type_: `string`
1024
- - _Default_: `'.intlayer/cache'`
1025
- - _Description_: The directory where the cache files are stored.
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'` | | |
1026
823
 
1027
824
  ### Dictionary Configuration
1028
825
 
@@ -1035,36 +832,32 @@ This dictionary configuration serves two main purposes:
1035
832
 
1036
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).
1037
834
 
1038
- #### Properties
1039
-
1040
- - **fill**
1041
- - **description**
1042
- - **locale**
1043
- - **contentAutoTransformation**:
1044
- - **location**
1045
- - **importMode**:
1046
- - _Type_: `'static' | 'dynamic' | 'fetch'`
1047
- - _Default_: `'static'`
1048
- - _Description_: Controls how dictionaries are imported.
1049
- - _Example_: `'dynamic'`
1050
- - _Note_: Available modes:
1051
- - "static": Dictionaries are imported statically. Replaces `useIntlayer` with `useDictionary`.
1052
- - "dynamic": Dictionaries are imported dynamically using Suspense. Replaces `useIntlayer` with `useDictionaryDynamic`.
1053
- - "fetch": Dictionaries are fetched dynamically using the live sync API. Replaces `useIntlayer` with `useDictionaryDynamic`.
1054
- - _Note_: Dynamic imports rely on Suspense and may slightly impact rendering performance.
1055
- - _Note_: If disabled all locales will be loaded at once, even if they are not used.
1056
- - _Note_: This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
1057
- - _Note_: Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
1058
- - _Note_: This option will be ignored if `optimize` is disabled.
1059
- - _Note_: If set to "fetch", only the dictionaries that are including remote content, and set as "fetch" flags will be transformed as fetch mode. Others will be imported dynamically as "dynamic" mode to optimize the number of fetch queries, and load performance.
1060
- - _Note_: Fetch mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as "dynamic" mode.
1061
- - _Note_: This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions.
1062
- - **priority**
1063
- - **live**
1064
- - **schema**
1065
- - **title**
1066
- - **tags**
1067
- - **version**
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. |
849
+
850
+ **`fill` example**:
851
+
852
+ ```ts
853
+ dictionary: {
854
+ fill: {
855
+ en: '/locales/en/{{key}}.content.json',
856
+ fr: ({ key }) => `/locales/fr/${key}.content.json`,
857
+ es: false,
858
+ }
859
+ }
860
+ ```
1068
861
 
1069
862
  ---
1070
863
 
@@ -1072,22 +865,10 @@ For more information about content declaration files and how configuration value
1072
865
 
1073
866
  Settings that control the logger, including the prefix to use.
1074
867
 
1075
- #### Properties
1076
-
1077
- - **mode**:
1078
- - _Type_: `string`
1079
- - _Default_: `default`
1080
- - _Description_: Indicates the mode of the logger.
1081
- - _Options_: `default`, `verbose`, `disabled`
1082
- - _Example_: `default`
1083
- - _Note_: The mode of the logger. Verbose mode will log more information, but can be used for debugging purposes. Disabled mode will disable the logger.
1084
-
1085
- - **prefix**:
1086
- - _Type_: `string`
1087
- - _Default_: `'[intlayer] '`
1088
- - _Description_: The prefix of the logger.
1089
- - _Example_: `'[my custom prefix] '`
1090
- - _Note_: The prefix of the logger.
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] '` | |
1091
872
 
1092
873
  ### AI Configuration
1093
874
 
@@ -1118,59 +899,15 @@ Intlayer supports multiple AI providers for enhanced flexibility and choice. Cur
1118
899
  - **Together.ai**
1119
900
  - **ollama**
1120
901
 
1121
- #### Properties
1122
-
1123
- - **provider**:
1124
- - _Type_: `string`
1125
- - _Default_: `'openai'`
1126
- - _Description_: The provider to use for the AI features of Intlayer.
1127
- - _Options_: `'openai'`, `'anthropic'`, `'mistral'`, `'deepseek'`, `'gemini'`, `'ollama'`, `'openrouter'`, `'alibaba'`, `'fireworks'`, `'groq'`, `'huggingface'`, `'bedrock'`, `'googleaistudio'`, `'googlevertex'`, `'togetherai'`
1128
- - _Example_: `'anthropic'`
1129
- - _Note_: Different providers may require different API keys and have different pricing models.
1130
-
1131
- - **model**:
1132
- - _Type_: `string`
1133
- - _Default_: None
1134
- - _Description_: The model to use for the AI features of Intlayer.
1135
- - _Example_: `'gpt-4o-2024-11-20'`
1136
- - _Note_: The specific model to use varies by provider.
1137
-
1138
- - **temperature**:
1139
- - _Type_: `number`
1140
- - _Default_: None
1141
- - _Description_: The temperature controls the randomness of the AI's responses.
1142
- - _Example_: `0.1`
1143
- - _Note_: A higher temperature will make the AI more creative and less predictable.
1144
-
1145
- - **apiKey**:
1146
- - _Type_: `string`
1147
- - _Default_: None
1148
- - _Description_: Your API key for the selected provider.
1149
- - _Example_: `process.env.OPENAI_API_KEY`
1150
- - _Note_: Important: API keys should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.
1151
-
1152
- - **applicationContext**:
1153
- - _Type_: `string`
1154
- - _Default_: None
1155
- - _Description_: Provides additional context about your application to the AI model, helping it generate more accurate and contextually appropriate translations. This can include information about your app's domain, target audience, tone, or specific terminology.
1156
- - _Note_: You can use it to add more rules to the AI model (e.g. "You should not transform urls").
1157
- - _Example_: `'My application context'`
1158
-
1159
- - **baseURL**:
1160
- - _Type_: `string`
1161
- - _Default_: None
1162
- - _Description_: The base URL for the AI API.
1163
- - _Example_: `'https://api.openai.com/v1'`
1164
- - _Example_: `'http://localhost:5000'`
1165
- - _Note_: Can be used to point to a local, or custom AI API endpoint.
1166
-
1167
- - **dataSerialization**:
1168
- - _Type_: `'json' | 'toon'`
1169
- - _Default_: `'json'`
1170
- - _Description_: The data serialization format to use for the AI features of Intlayer.
1171
- - _Example_: `'toon'`
1172
- - _Note_: `json`: Standard, reliable; uses more tokens. `toon`: Fewer tokens, less consistent than JSON.
1173
- > If you provide additional parameters, Intlayer will pass them to the AI model as context. It can be used to customize the reasoning effort, text verbosity, etc
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.). |
1174
911
 
1175
912
  ### Build Configuration
1176
913
 
@@ -1182,49 +919,13 @@ Build options apply to the `@intlayer/babel` and `@intlayer/swc` plugins.
1182
919
 
1183
920
  > When optimized, Intlayer will replace dictionary calls to optimize chunking, so the final bundle only imports dictionaries that are actually used.
1184
921
 
1185
- #### Properties
1186
-
1187
- - **mode**:
1188
- - _Type_: `'auto' | 'manual'`
1189
- - _Default_: `'auto'`
1190
- - _Description_: Controls the mode of the build.
1191
- - _Example_: `'manual'`
1192
- - _Note_: If 'auto', the build will be enabled automatically when the application is built.
1193
- - _Note_: If 'manual', the build will be set only when the build command is executed.
1194
- - _Note_: Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.
1195
-
1196
- - **optimize**:
1197
- - _Type_: `boolean`
1198
- - _Default_: `undefined`
1199
- - _Description_: Controls whether the build should be optimized.
1200
- - _Example_: `process.env.NODE_ENV === 'production'`
1201
- - _Note_: By default, the build optimization is not fixed. If not set, Intlayer will trigger the build optimization on the build of your application (vite / nextjs / etc). Setting it to `true` will force the build optimization, including during dev mode. Setting it to `false` will disable the build optimization.
1202
- - _Note_: When enabled, Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used. All imports will stay as static import to avoid async processing when loading the dictionaries.
1203
- - _Note_: Intlayer will replace all calls of `useIntlayer` with the defined mode by the `importMode` option and `getIntlayer` with `getDictionary`.
1204
- - _Note_: This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
1205
- - _Note_: Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
1206
-
1207
- - **checkTypes**:
1208
- - _Type_: `boolean`
1209
- - _Default_: `false`
1210
- - _Description_: Indicates if the build should check TypeScript types and log errors.
1211
- - _Note_: This can slow down the build.
1212
-
1213
- - **outputFormat**:
1214
- - _Type_: `('esm' | 'cjs')[]`
1215
- - _Default_: `['cjs', 'esm']`
1216
- - _Description_: Controls the output format of the dictionaries.
1217
- - _Example_: `'cjs'`
1218
- - _Note_: The output format of the dictionaries.
1219
-
1220
- - **traversePattern**:
1221
- - _Type_: `string[]`
1222
- - _Default_: `['**\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\/node_modules/**']`
1223
- - _Description_: Patterns that define which files should be traversed during optimization.
1224
- - _Example_: `['src/**\/*.{ts,tsx}', '../ui-library/**\/*.{ts,tsx}', '!**/node_modules/**']`
1225
- - _Note_: Use this to limit optimization to relevant code files and improve build performance.
1226
- - _Note_: This option will be ignored if `optimize` is disabled.
1227
- - _Note_: Use glob pattern.
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. |
1228
929
 
1229
930
  ---
1230
931
 
@@ -1232,74 +933,25 @@ Build options apply to the `@intlayer/babel` and `@intlayer/swc` plugins.
1232
933
 
1233
934
  Settings that control the Intlayer compiler, which extracts dictionaries straight from your components.
1234
935
 
1235
- #### Properties
1236
-
1237
- - **enabled**:
1238
- - _Type_: `boolean | 'build-only'`
1239
- - _Default_: `true`
1240
- - _Description_: Indicates if the compiler should be enabled to extract the dictionaries.
1241
- - _Example_: `'build-only'`
1242
- - _Note_: Setting it to `'build-only'` will skip the compiler during development mode to speed up build times. It will only run on build commands.
1243
-
1244
- - **dictionaryKeyPrefix**:
1245
- - _Type_: `string`
1246
- - _Default_: `''`
1247
- - _Description_: Prefix for the extracted dictionary keys.
1248
- - _Example_: `'my-key-'`
1249
- - _Note_: When dictionaries are extracted, the key is generated based on the file name. This prefix is added to the generated key to prevent conflicts.
1250
-
1251
- - **saveComponents**:
1252
- - _Type_: `boolean`
1253
- - _Default_: `false`
1254
- - _Description_: Indicates if the components should be saved after being transformed.
1255
- - _Note_: If true, the compiler will replace the original files with the transformed files. That way, the compiler can be run only once to transform the app, and then it can be removed.
1256
-
1257
- - **transformPattern**:
1258
- - _Type_: `string | string[]`
1259
- - _Default_: `['**/*.{ts,tsx,jsx,js,cjs,mjs,svelte,vue}', '!**/node_modules/**']`
1260
- - _Description_: Patterns that define which files should be traversed during optimization.
1261
- - _Example_: `['src/**/*.{ts,tsx}', '!**/node_modules/**']`
1262
- - _Note_: Use this to limit optimization to relevant code files and improve build performance.
1263
-
1264
- - **excludePattern**:
1265
- - _Type_: `string | string[]`
1266
- - _Default_: `['**/node_modules/**']`
1267
- - _Description_: Patterns that define which files should be excluded during optimization.
1268
- - _Example_: `['**/node_modules/**', '!**/node_modules/react/**']`
1269
-
1270
- - **output**:
1271
- - _Type_: `FilePathPattern`
1272
- - _Default_: `undefined`
1273
- - _Description_: Defines the output files path. Replaces `outputDir`. Handles dynamic variables via template strings or a function. Supported variables: `{{fileName}}`, `{{key}}`, `{{locale}}`, `{{extension}}`, `{{componentFileName}}`, `{{componentExtension}}`, `{{format}}`, `{{componentFormat}}`, and `{{componentDirPath}}`.
1274
- - _Note_: `./` paths are resolved relative to the component directory. `/` paths are resolved relative to the project root (`baseDir`).
1275
- - _Note_: Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
1276
- - _Example_:
1277
- - **Multilingual files near component**:
1278
- - String: `'./{{fileName}}{{extension}}'`
1279
- - Function: `({ fileName, extension }) => \`./${fileName}${extension}``
1280
-
1281
- - **Centralized per-locale JSON**:
1282
- - String: `'/locales/{{locale}}/{{key}}.content.json'`
1283
- - Function: `({ key, locale }) => \`/locales/${locale}/${key}.content.json``
1284
-
1285
- - **noMetadata**:
1286
- - _Type_: `boolean`
1287
- - _Default_: `false`
1288
- - _Description_: Indicates if the metadata should be saved in the file. If true, the compiler will not save the metadata of the dictionaries (key, content wrapper). Useful for per-locale i18next or ICU MessageFormat JSON outputs.
1289
- - _Note_: Useful if used with `loadJSON` plugin.
1290
- - _Example_:
1291
- If `true`:
1292
- ```json
1293
- {
1294
- "key": "value"
1295
- }
1296
- ```
1297
- If `false`:
1298
- ```json
1299
- {
1300
- "key": "value",
1301
- "content": {
1302
- "key": "value"
1303
- }
1304
- }
1305
- ```
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 |
944
+
945
+ ### Custom Schemas
946
+
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>` |
950
+
951
+ ---
952
+
953
+ ### Plugins
954
+
955
+ | Field | Description | Type |
956
+ | --------- | ------------------------------------- | ------------------ |
957
+ | `plugins` | Liste des plugins Intlayer à activer. | `IntlayerPlugin[]` |