@intlayer/docs 8.4.6 → 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.
- package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/id/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/uk/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/vi/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/docs/en/configuration.md +115 -137
- package/docs/es/configuration.md +14 -6
- package/docs/fr/configuration.md +14 -6
- package/package.json +6 -6
- package/docs/ar/configuration.md +0 -922
- package/docs/bn/configuration.md +0 -922
- package/docs/de/configuration.md +0 -922
- package/docs/en-GB/configuration.md +0 -922
- package/docs/hi/configuration.md +0 -922
- package/docs/id/configuration.md +0 -922
- package/docs/it/configuration.md +0 -923
- package/docs/ja/configuration.md +0 -922
- package/docs/ko/configuration.md +0 -922
- package/docs/pl/configuration.md +0 -922
- package/docs/pt/configuration.md +0 -922
- package/docs/ru/configuration.md +0 -943
- package/docs/tr/configuration.md +0 -922
- package/docs/uk/configuration.md +0 -922
- package/docs/ur/configuration.md +0 -922
- package/docs/vi/configuration.md +0 -922
- package/docs/zh/configuration.md +0 -922
package/docs/en/configuration.md
CHANGED
|
@@ -275,7 +275,7 @@ const config: IntlayerConfig = {
|
|
|
275
275
|
watch: true,
|
|
276
276
|
|
|
277
277
|
/**
|
|
278
|
-
* Command to format newly created
|
|
278
|
+
* Command to format newly created <br/> updated .content files.
|
|
279
279
|
*/
|
|
280
280
|
formatCommand: 'npx prettier --write "{{file}}"',
|
|
281
281
|
},
|
|
@@ -563,12 +563,12 @@ The following sections describe the various configuration settings available for
|
|
|
563
563
|
|
|
564
564
|
Defines settings related to internationalization, including available locales and the default locale for the application.
|
|
565
565
|
|
|
566
|
-
| Field | Type |
|
|
567
|
-
| ----------------- | ---------- |
|
|
568
|
-
| `locales` |
|
|
569
|
-
| `requiredLocales` |
|
|
570
|
-
| `strictMode` |
|
|
571
|
-
| `defaultLocale` |
|
|
566
|
+
| Field | Description | Type | Default | Example | Note |
|
|
567
|
+
| ----------------- | ---------------------------------------------------------------------------- | ---------- | ------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
568
|
+
| `locales` | The list of supported locales in the application. | `string[]` | `[Locales.ENGLISH]` | `['en', 'fr', 'es']` | |
|
|
569
|
+
| `requiredLocales` | The list of required locales in the application. | `string[]` | `[]` | `[]` | • If empty, all locales are required in `strict` mode.<br/>• Ensure required locales are also defined in the `locales` field. |
|
|
570
|
+
| `strictMode` | Ensure strong implementations of internationalized content using TypeScript. | `string` | `'inclusive'` | | • If `"strict"`: the `t` function requires each declared locale to be defined — throws an error if one is missing or undeclared.<br/>• If `"inclusive"`: warns on missing locales but accepts undeclared ones that exist.<br/>• If `"loose"`: accepts any existing locale. |
|
|
571
|
+
| `defaultLocale` | The default locale used as a fallback if the requested locale is not found. | `string` | `Locales.ENGLISH` | `'en'` | Used to determine the locale when none is specified in the URL, cookie, or header. |
|
|
572
572
|
|
|
573
573
|
---
|
|
574
574
|
|
|
@@ -576,31 +576,31 @@ Defines settings related to internationalization, including available locales an
|
|
|
576
576
|
|
|
577
577
|
Defines settings related to the integrated editor, including server port and active status.
|
|
578
578
|
|
|
579
|
-
| Field | Type
|
|
580
|
-
| ---------------------------- |
|
|
581
|
-
| `applicationURL` |
|
|
582
|
-
| `port` |
|
|
583
|
-
| `editorURL` |
|
|
584
|
-
| `cmsURL` |
|
|
585
|
-
| `backendURL` |
|
|
586
|
-
| `enabled` |
|
|
587
|
-
| `clientId` |
|
|
588
|
-
| `clientSecret` |
|
|
589
|
-
| `dictionaryPriorityStrategy` |
|
|
590
|
-
| `liveSync` |
|
|
591
|
-
| `liveSyncPort` |
|
|
592
|
-
| `liveSyncURL` |
|
|
579
|
+
| Field | Description | Type | Default | Example | Note |
|
|
580
|
+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
581
|
+
| `applicationURL` | The URL of the application. | `string` | `undefined` | `'http://localhost:3000'` <br/> `'https://example.com'` <br/> `process.env.INTLAYER_EDITOR_URL` | • Used to restrict the origin of the editor for security reasons.<br/>• If set to `'*'`, the editor is accessible from any origin. |
|
|
582
|
+
| `port` | The port used by the visual editor server. | `number` | `8000` | | |
|
|
583
|
+
| `editorURL` | The URL of the editor server. | `string` | `'http://localhost:8000'` | `'http://localhost:3000'` <br/> `'https://example.com'` <br/> `process.env.INTLAYER_EDITOR_URL` | • Used to restrict the origins that can interact with the application.<br/>• If set to `'*'`, accessible from any origin.<br/>• Should be set if port is changed or editor is hosted on a different domain. |
|
|
584
|
+
| `cmsURL` | The URL of the Intlayer CMS. | `string` | `'https://app.intlayer.org'` | `'https://app.intlayer.org'` | |
|
|
585
|
+
| `backendURL` | The URL of the backend server. | `string` | `https://back.intlayer.org` | `http://localhost:4000` | |
|
|
586
|
+
| `enabled` | Indicates if the application interacts with the visual editor. | `boolean` | `false` | `process.env.NODE_ENV !== 'production'` | • If `false`, the editor cannot interact with the application.<br/>• Disabling for specific environments enforces security. |
|
|
587
|
+
| `clientId` | Allows intlayer packages to authenticate with the backend using oAuth2. To get an access token, go to [intlayer.org/project](https://app.intlayer.org/project). | `string` | <br/> `undefined` | `undefined` | | Keep secret; store in environment variables. |
|
|
588
|
+
| `clientSecret` | Allows intlayer packages to authenticate with the backend using oAuth2. To get an access token, go to [intlayer.org/project](https://app.intlayer.org/project). | `string` | <br/> `undefined` | `undefined` | | Keep secret; store in environment variables. |
|
|
589
|
+
| `dictionaryPriorityStrategy` | Strategy to prioritize dictionaries when both local and distant are present. | `string` | `'local_first'` | `'distant_first'` | • `'distant_first'`: prioritizes distant over local.<br/>• `'local_first'`: prioritizes local over distant. |
|
|
590
|
+
| `liveSync` | Indicates if the app server should hot reload content when a change is detected on the CMS <br/> Visual Editor <br/> Backend. | `boolean` | `true` | `true` | • When a dictionary is added/updated, the app updates page content.<br/>• Live sync externalizes content to another server, which may slightly impact performance.<br/>• Recommend hosting both on the same machine. |
|
|
591
|
+
| `liveSyncPort` | The port of the live sync server. | `number` | `4000` | `4000` | |
|
|
592
|
+
| `liveSyncURL` | The URL of the live sync server. | `string` | `'http://localhost:{liveSyncPort}'` | `'https://example.com'` | Points to localhost by default; can be changed for a remote live sync server. |
|
|
593
593
|
|
|
594
594
|
### Routing Configuration
|
|
595
595
|
|
|
596
596
|
Settings that control routing behavior, including URL structure, locale storage, and middleware handling.
|
|
597
597
|
|
|
598
|
-
| Field | Type
|
|
599
|
-
| ---------- |
|
|
600
|
-
| `mode` | `'prefix-no-default' | 'prefix-all' | 'no-prefix' | 'search-params'`
|
|
601
|
-
| `storage` | `false | 'cookie' | 'localStorage' | 'sessionStorage' | 'header' | CookiesAttributes | StorageAttributes | Array` |
|
|
602
|
-
| `basePath` |
|
|
603
|
-
| `rewrite` |
|
|
598
|
+
| Field | Description | Type | Default | Example | Note |
|
|
599
|
+
| ---------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
600
|
+
| `mode` | URL routing mode for locale handling. | `'prefix-no-default'` | <br/> `'prefix-all'` | <br/> `'no-prefix'` | <br/> `'search-params'` | `'prefix-no-default'` | `'prefix-no-default'`: `/dashboard` (en) or `/fr/dashboard` (fr). `'prefix-all'`: `/en/dashboard`. `'no-prefix'`: locale handled via other means. `'search-params'`: `/dashboard?locale=fr` | Does not impact cookie or locale storage management. |
|
|
601
|
+
| `storage` | Configuration for storing the locale in the client. | `false` | <br/> `'cookie'` | <br/> `'localStorage'` | <br/> `'sessionStorage'` | <br/> `'header'` | <br/> `CookiesAttributes` | <br/> `StorageAttributes` | <br/> `Array` | `['cookie', 'header']` | `'localStorage'` <br/> `[{ type: 'cookie', name: 'custom-locale', secure: true }]` | See Storage Options table below. |
|
|
602
|
+
| `basePath` | The base path for the application URLs. | `string` | `''` | `'/my-app'` | If app is at `https://example.com/my-app, basePath is `'/my-app'` and URLs become `https://example.com/my-app/en`. |
|
|
603
|
+
| `rewrite` | Custom URL rewriting rules that override the default routing mode for specific paths. Supports `[param]` dynamic parameters. | `Record<string, StrictModeLocaleMap<string>>` | `undefined` | See example below | • Rewrite rules take precedence over `mode`.<br/>• Works with Next.js and Vite.<br/>• `getLocalizedUrl()` automatically applies matching rules.<br/>• See [Custom URL Rewrites](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/custom_url_rewrites.md). |
|
|
604
604
|
|
|
605
605
|
**`rewrite` example**:
|
|
606
606
|
|
|
@@ -626,35 +626,35 @@ routing: {
|
|
|
626
626
|
|
|
627
627
|
#### Storage Options
|
|
628
628
|
|
|
629
|
-
| Value | Description |
|
|
630
|
-
| ------------------ |
|
|
631
|
-
| `'cookie'` |
|
|
632
|
-
| `'localStorage'` |
|
|
633
|
-
| `'sessionStorage'` |
|
|
634
|
-
| `'header'` |
|
|
629
|
+
| Value | Note | Description |
|
|
630
|
+
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
631
|
+
| `'cookie'` | • For GDPR compliance, ensure proper user consent.<br/>• Customizable via `CookiesAttributes` (`{ type: 'cookie', name: 'custom-locale', secure: true, httpOnly: false }`). | Stores locale in cookies — accessible on both client and server side. |
|
|
632
|
+
| `'localStorage'` | • No expiration unless explicitly cleared.<br/>• Intlayer proxy cannot access it.<br/>• Customizable via `StorageAttributes` (`{ type: 'localStorage', name: 'custom-locale' }`). | Stores locale in the browser without expiration — client side only. |
|
|
633
|
+
| `'sessionStorage'` | • Cleared when tab/window is closed.<br/>• Intlayer proxy cannot access it.<br/>• Customizable via `StorageAttributes` (`{ type: 'sessionStorage', name: 'custom-locale' }`). | Stores locale for the duration of the page session — client side only. |
|
|
634
|
+
| `'header'` | • Useful for API calls.<br/>• Client side cannot access it.<br/>• Customizable via `StorageAttributes` (`{ type: 'header', name: 'custom-locale' }`). | Stores or transmits locale via HTTP headers — server side only. |
|
|
635
635
|
|
|
636
636
|
#### Cookie Attributes
|
|
637
637
|
|
|
638
638
|
When using cookie storage, you can configure additional cookie attributes:
|
|
639
639
|
|
|
640
|
-
| Field |
|
|
641
|
-
| ---------- |
|
|
642
|
-
| `name` |
|
|
643
|
-
| `domain` |
|
|
644
|
-
| `path` |
|
|
645
|
-
| `secure` |
|
|
646
|
-
| `httpOnly` |
|
|
647
|
-
| `sameSite` | `'strict' | 'lax' | 'none'` |
|
|
648
|
-
| `expires` |
|
|
640
|
+
| Field | Description | Type |
|
|
641
|
+
| ---------- | --------------------------------------------- | ----------------------------------------------------- |
|
|
642
|
+
| `name` | Cookie name. Default: `'INTLAYER_LOCALE'` | `string` |
|
|
643
|
+
| `domain` | Cookie domain. Default: `undefined` | `string` |
|
|
644
|
+
| `path` | Cookie path. Default: `undefined` | `string` |
|
|
645
|
+
| `secure` | Require HTTPS. Default: `undefined` | `boolean` |
|
|
646
|
+
| `httpOnly` | HTTP-only flag. Default: `undefined` | `boolean` |
|
|
647
|
+
| `sameSite` | SameSite policy. | `'strict'` | <br/> `'lax'` | <br/> `'none'` |
|
|
648
|
+
| `expires` | Expiration date or days. Default: `undefined` | `Date` | <br/> `number` |
|
|
649
649
|
|
|
650
650
|
#### Locale Storage Attributes
|
|
651
651
|
|
|
652
652
|
When using localStorage or sessionStorage:
|
|
653
653
|
|
|
654
|
-
| Field |
|
|
655
|
-
| ------ |
|
|
656
|
-
| `type` | `'localStorage' | 'sessionStorage'` |
|
|
657
|
-
| `name` |
|
|
654
|
+
| Field | Description | Type |
|
|
655
|
+
| ------ | ---------------------------------------------- | ------------------------------------------------ |
|
|
656
|
+
| `type` | Storage type. | `'localStorage'` | <br/> `'sessionStorage'` |
|
|
657
|
+
| `name` | Storage key name. Default: `'INTLAYER_LOCALE'` | `string` |
|
|
658
658
|
|
|
659
659
|
#### Configuration Examples
|
|
660
660
|
|
|
@@ -795,14 +795,14 @@ export default config;
|
|
|
795
795
|
|
|
796
796
|
Settings related to content handling within the application, including directory names, file extensions, and derived configurations.
|
|
797
797
|
|
|
798
|
-
| Field | Type |
|
|
799
|
-
| ---------------- | ---------- |
|
|
800
|
-
| `watch` |
|
|
801
|
-
| `fileExtensions` |
|
|
802
|
-
| `contentDir` |
|
|
803
|
-
| `codeDir` |
|
|
804
|
-
| `excludedPath` |
|
|
805
|
-
| `formatCommand` |
|
|
798
|
+
| Field | Description | Type | Default | Example | Note |
|
|
799
|
+
| ---------------- | ---------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
800
|
+
| `watch` | Indicates if Intlayer should watch for changes in content declaration files to rebuild dictionaries. | `boolean` | `true` | | |
|
|
801
|
+
| `fileExtensions` | File extensions to look for when building dictionaries. | `string[]` | `['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.json5', '.content.jsonc', '.content.tsx', '.content.jsx']` | `['.data.ts', '.data.js', '.data.json']` | Customizing can help avoid conflicts. |
|
|
802
|
+
| `contentDir` | Directory path where content definition files (`.content.*`) are stored. | `string[]` | `['.']` | `['src', '../../ui-library', require.resolve("@my-package/content")]` | Used to watch for content files to rebuild dictionaries. |
|
|
803
|
+
| `codeDir` | Directory path where the code is stored, relative to the base directory. | `string[]` | `['.']` | `['src', '../../ui-library']` | • Used to watch for code files to transform (prune, optimize).<br/>• Keeping separate from `contentDir` can improve build performance. |
|
|
804
|
+
| `excludedPath` | Directories excluded from content search. | `string[]` | `['**/node_modules/**', '**/dist/**', '**/build/**', '**/.intlayer/**', '**/.next/**', '**/.nuxt/**', '**/.expo/**', '**/.vercel/**', '**/.turbo/**', '**/.tanstack/**']` | | Not yet used; planned for future implementation. |
|
|
805
|
+
| `formatCommand` | Command to format content files when Intlayer writes them locally. | `string` | `undefined` | `'npx prettier --write "{{file}}" --log-level silent'` (Prettier), `'npx biome format "{{file}}" --write --log-level none'` (Biome), `'npx eslint --fix "{{file}}" --quiet'` (ESLint) | • `{{file}}` is replaced with the file path.<br/>• If not set, Intlayer auto-detects (tries prettier, biome, eslint). |
|
|
806
806
|
|
|
807
807
|
---
|
|
808
808
|
|
|
@@ -810,16 +810,16 @@ Settings related to content handling within the application, including directory
|
|
|
810
810
|
|
|
811
811
|
Settings related to internal paths and output results of Intlayer. These settings are typically internal and should not need to be modified by the user.
|
|
812
812
|
|
|
813
|
-
| Field | Type |
|
|
814
|
-
| ------------------------- | -------- |
|
|
815
|
-
| `baseDir` |
|
|
816
|
-
| `dictionariesDir` |
|
|
817
|
-
| `moduleAugmentationDir` |
|
|
818
|
-
| `unmergedDictionariesDir` |
|
|
819
|
-
| `typesDir` |
|
|
820
|
-
| `mainDir` |
|
|
821
|
-
| `configDir` |
|
|
822
|
-
| `cacheDir` |
|
|
813
|
+
| Field | Description | Type | Default | Example | Note |
|
|
814
|
+
| ------------------------- | ------------------------------------------------------------------------------------- | -------- | --------------------------------- | -------------------- | ------------------------------------------------- |
|
|
815
|
+
| `baseDir` | The base directory for the project. | `string` | `process.cwd()` | `'/path/to/project'` | Used to resolve all Intlayer-related directories. |
|
|
816
|
+
| `dictionariesDir` | The directory path for storing localization dictionaries. | `string` | `'.intlayer/dictionary'` | | |
|
|
817
|
+
| `moduleAugmentationDir` | Directory for module augmentation, allowing better IDE suggestions and type checking. | `string` | `'.intlayer/types'` | `'intlayer-types'` | Be sure to include this in `tsconfig.json`. |
|
|
818
|
+
| `unmergedDictionariesDir` | The directory for storing unmerged dictionaries. | `string` | `'.intlayer/unmerged_dictionary'` | | |
|
|
819
|
+
| `typesDir` | The directory for storing dictionary types. | `string` | `'.intlayer/types'` | | |
|
|
820
|
+
| `mainDir` | The directory where main application files are stored. | `string` | `'.intlayer/main'` | | |
|
|
821
|
+
| `configDir` | The directory where configuration files are stored. | `string` | `'.intlayer/config'` | | |
|
|
822
|
+
| `cacheDir` | The directory where cache files are stored. | `string` | `'.intlayer/cache'` | | |
|
|
823
823
|
|
|
824
824
|
### Dictionary Configuration
|
|
825
825
|
|
|
@@ -832,20 +832,20 @@ This dictionary configuration serves two main purposes:
|
|
|
832
832
|
|
|
833
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).
|
|
834
834
|
|
|
835
|
-
| Field | Type
|
|
836
|
-
| --------------------------- |
|
|
837
|
-
| `fill` | `boolean | FilePathPattern | Partial<Record<Locale, boolean | FilePathPattern>>` |
|
|
838
|
-
| `description` |
|
|
839
|
-
| `locale` | |
|
|
840
|
-
| `contentAutoTransformation` |
|
|
841
|
-
| `location` |
|
|
842
|
-
| `importMode` | `'static' | 'dynamic' | 'fetch'` |
|
|
843
|
-
| `priority` |
|
|
844
|
-
| `live` |
|
|
845
|
-
| `schema` |
|
|
846
|
-
| `title` |
|
|
847
|
-
| `tags` |
|
|
848
|
-
| `version` |
|
|
835
|
+
| Field | Description | Type | Default | Example | Note |
|
|
836
|
+
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
837
|
+
| `fill` | Controls how auto-fill (AI translation) output files are generated. | `boolean` | <br/> `FilePathPattern` | <br/> `Partial<Record<Locale, boolean | FilePathPattern>>` | `true` | `{ en: '/locales/en/{{key}}.json', fr: ({ key }) => '/locales/fr/${key}.json', es: false }` | • `true`: default path (same file as source).<br/>• `false`: disable.<br/>• String/function template generates per-locale files.<br/>• Object per-locale: each locale maps to its own pattern; `false` skips that locale.<br/>• Including `{{locale}}` triggers per-locale generation.<br/>• Dictionary-level `fill` always takes priority over this global config. |
|
|
838
|
+
| `description` | Helps understand the purpose of the dictionary in the editor and CMS. Also used as context for AI translation generation. | `string` | `undefined` | `'User profile section'` | |
|
|
839
|
+
| `locale` | Transforms the dictionary into a per-locale format. Each field declared becomes a translation node. If absent, the dictionary is treated as multilingual. | `LocalesValues` | `undefined` | `'en'` | Use this when the dictionary is specific to a single locale rather than containing translations for multiple locales. |
|
|
840
|
+
| `contentAutoTransformation` | Automatically transforms content strings into typed nodes (markdown, HTML, or insertion). | `boolean` | <br/> `{ markdown?: boolean; html?: boolean; insertion?: boolean }` | `false` | `true` | • Markdown: `### Title` → `md('### Title')`.<br/>• HTML: `<div>Title</div>` → `html('<div>Title</div>')`.<br/>• Insertion: `Hello {{name}}` → `insert('Hello {{name}}')`. |
|
|
841
|
+
| `location` | Indicates where dictionary files are stored and their CMS synchronization mode. | `'local'` | <br/> `'remote'` | <br/> `'hybrid'` | <br/> `'plugin'` | <br/> `string` | `'local'` | `'hybrid'` | • `'local'`: managed locally only.<br/>• `'remote'`: managed remotely only (CMS).<br/>• `'hybrid'`: managed both locally and remotely.<br/>• `'plugin'` or custom string: managed by a plugin or custom source. |
|
|
842
|
+
| `importMode` | Controls how dictionaries are imported. | `'static'` | <br/> `'dynamic'` | <br/> `'fetch'` | `'static'` | `'dynamic'` | • `'static'`: imported statically (replaces `useIntlayer` with `useDictionary`).<br/>• `'dynamic'`: imported dynamically via Suspense (replaces with `useDictionaryDynamic`).<br/>• `'fetch'`: fetched via live sync API; falls back to `'dynamic'` on failure.<br/>• Relies on `@intlayer/babel` and `@intlayer/swc` plugins.<br/>• Keys must be declared statically.<br/>• Ignored if `optimize` is disabled.<br/>• Does not affect `getIntlayer`, `getDictionary`, `useDictionary`, etc. |
|
|
843
|
+
| `priority` | Priority of the dictionary. Higher values take precedence over lower ones when resolving conflicts between dictionaries. | `number` | `undefined` | `1` | |
|
|
844
|
+
| `live` | Deprecated — use `importMode: 'fetch'` instead. Indicated whether dictionary content was fetched dynamically via the live sync API. | `boolean` | `undefined` | | Renamed to `importMode: 'fetch'` in v8.0.0. |
|
|
845
|
+
| `schema` | Auto-generated by Intlayer for JSON schema validation. | `'https://intlayer.org/schema.json'` | auto-generated | | Do not modify manually. |
|
|
846
|
+
| `title` | Helps identify the dictionary in the editor and CMS. | `string` | `undefined` | `'User Profile'` | |
|
|
847
|
+
| `tags` | Categorizes dictionaries and provides context or instructions for the editor and AI. | `string[]` | `undefined` | `['user', 'profile']` | |
|
|
848
|
+
| `version` | Version of the remote dictionary; helps track which version is currently in use. | `string` | `undefined` | `'1.0.0'` | • Manageable on the CMS.<br/>• Do not modify locally. |
|
|
849
849
|
|
|
850
850
|
**`fill` example**:
|
|
851
851
|
|
|
@@ -865,10 +865,10 @@ dictionary: {
|
|
|
865
865
|
|
|
866
866
|
Settings that control the logger, including the prefix to use.
|
|
867
867
|
|
|
868
|
-
| Field | Type
|
|
869
|
-
| -------- |
|
|
870
|
-
| `mode` | `'default' | 'verbose' | 'disabled'` |
|
|
871
|
-
| `prefix` |
|
|
868
|
+
| Field | Description | Type | Default | Example | Note |
|
|
869
|
+
| -------- | --------------------------------- | -------------------------------------------------------------- | --------------- | ---------------------- | ---------------------------------------------------------------------------------------------- |
|
|
870
|
+
| `mode` | Indicates the mode of the logger. | `'default'` | <br/> `'verbose'` | <br/> `'disabled'` | `'default'` | `'verbose'` | • `'verbose'`: logs more info for debugging.<br/>• `'disabled'`: disables the logger entirely. |
|
|
871
|
+
| `prefix` | The prefix of the logger. | `string` | `'[intlayer] '` | `'[my custom prefix] '` | |
|
|
872
872
|
|
|
873
873
|
### AI Configuration
|
|
874
874
|
|
|
@@ -899,15 +899,15 @@ Intlayer supports multiple AI providers for enhanced flexibility and choice. Cur
|
|
|
899
899
|
- **Together.ai**
|
|
900
900
|
- **ollama**
|
|
901
901
|
|
|
902
|
-
| Field | Type
|
|
903
|
-
| -------------------- |
|
|
904
|
-
| `provider` |
|
|
905
|
-
| `model` |
|
|
906
|
-
| `temperature` |
|
|
907
|
-
| `apiKey` |
|
|
908
|
-
| `applicationContext` |
|
|
909
|
-
| `baseURL` |
|
|
910
|
-
| `dataSerialization` |
|
|
902
|
+
| Field | Description | Type | Default | Example | Note |
|
|
903
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
904
|
+
| `provider` | The provider to use for the AI features of Intlayer. | `'openai'` | <br/> `'anthropic'` | <br/> `'mistral'` | <br/> `'deepseek'` | <br/> `'gemini'` | <br/> `'ollama'` | <br/> `'openrouter'` | <br/> `'alibaba'` | <br/> `'fireworks'` | <br/> `'groq'` | <br/> `'huggingface'` | <br/> `'bedrock'` | <br/> `'googleaistudio'` | <br/> `'googlevertex'` | <br/> `'togetherai'` | `undefined` | `'anthropic'` | Different providers require different API keys and have different pricing. |
|
|
905
|
+
| `model` | The model to use for AI features. | `string` | None | `'gpt-4o-2024-11-20'` | Specific model varies by provider. |
|
|
906
|
+
| `temperature` | Controls the randomness of AI responses. | `number` | None | `0.1` | Higher temperature = more creative and less predictable. |
|
|
907
|
+
| `apiKey` | Your API key for the selected provider. | `string` | None | `process.env.OPENAI_API_KEY` | Keep secret; store in environment variables. |
|
|
908
|
+
| `applicationContext` | Additional context about your application to help the AI generate more accurate translations (domain, audience, tone, terminology). | `string` | None | `'My application context'` | Can be used to add rules (e.g. `"You should not transform urls"`). |
|
|
909
|
+
| `baseURL` | The base URL for the AI API. | `string` | None | `'https://api.openai.com/v1'` <br/> `'http://localhost:5000'` | Can point to a local or custom AI API endpoint. |
|
|
910
|
+
| `dataSerialization` | Data serialization format for AI features. | `'json'` | <br/> `'toon'` | `undefined` | `'toon'` | • `'json'`: standard, reliable; uses more tokens.<br/>• `'toon'`: fewer tokens, less consistent.<br/>• Additional parameters are passed to the AI model as context (reasoning effort, verbosity, etc.). |
|
|
911
911
|
|
|
912
912
|
### Build Configuration
|
|
913
913
|
|
|
@@ -919,13 +919,13 @@ Build options apply to the `@intlayer/babel` and `@intlayer/swc` plugins.
|
|
|
919
919
|
|
|
920
920
|
> When optimized, Intlayer will replace dictionary calls to optimize chunking, so the final bundle only imports dictionaries that are actually used.
|
|
921
921
|
|
|
922
|
-
| Field | Type
|
|
923
|
-
| ----------------- |
|
|
924
|
-
| `mode` | `'auto' | 'manual'` |
|
|
925
|
-
| `optimize` |
|
|
926
|
-
| `checkTypes` |
|
|
927
|
-
| `outputFormat` | `('esm' | 'cjs')[]`
|
|
928
|
-
| `traversePattern` |
|
|
922
|
+
| Field | Description | Type | Default | Example | Note |
|
|
923
|
+
| ----------------- | -------------------------------------------------------------------- | -------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
924
|
+
| `mode` | Controls the mode of the build. | `'auto'` | <br/> `'manual'` | `'auto'` | `'manual'` | • `'auto'`: build enabled automatically when the application is built.<br/>• `'manual'`: only runs when the build command is executed.<br/>• Can be used to disable dictionary builds (e.g. to avoid running in Node.js environments). |
|
|
925
|
+
| `optimize` | Controls whether the build should be optimized. | `boolean` | `undefined` | `process.env.NODE_ENV === 'production'` | • If unset, optimization is triggered on framework build (Vite/Next.js).<br/>• `true` forces optimization including dev mode.<br/>• `false` disables it.<br/>• When enabled, replaces dictionary calls to optimize chunking — only used dictionaries are imported.<br/>• Relies on `@intlayer/babel` and `@intlayer/swc` plugins.<br/>• Keys must be declared statically. |
|
|
926
|
+
| `checkTypes` | Indicates if the build should check TypeScript types and log errors. | `boolean` | `false` | | Can slow down the build. |
|
|
927
|
+
| `outputFormat` | Controls the output format of the dictionaries. | `('esm' | 'cjs')[]` | `['esm', 'cjs']` | `['cjs']` | |
|
|
928
|
+
| `traversePattern` | Patterns defining which files to traverse during optimization. | `string[]` | `['**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}', '!**/node_modules/**', '!**/dist/**', '!**/.intlayer/**', '!**/*.config.*', '!**/*.test.*', '!**/*.spec.*', '!**/*.stories.*']` | `['src/**/*.{ts,tsx}', '../ui-library/**/*.{ts,tsx}', '!**/node_modules/**']` | • Limit optimization to relevant files to improve build performance.<br/>• Ignored if `optimize` is disabled.<br/>• Uses glob pattern. |
|
|
929
929
|
|
|
930
930
|
---
|
|
931
931
|
|
|
@@ -933,47 +933,25 @@ Build options apply to the `@intlayer/babel` and `@intlayer/swc` plugins.
|
|
|
933
933
|
|
|
934
934
|
Settings that control the Intlayer compiler, which extracts dictionaries straight from your components.
|
|
935
935
|
|
|
936
|
-
| Field | Type
|
|
937
|
-
| --------------------- |
|
|
938
|
-
| `enabled` |
|
|
939
|
-
| `dictionaryKeyPrefix` |
|
|
940
|
-
| `saveComponents` |
|
|
941
|
-
| `
|
|
942
|
-
| `
|
|
943
|
-
| `
|
|
944
|
-
| `noMetadata` | `boolean` | If `true`, the compiler omits dictionary metadata (key, content wrapper) from the output. Default: `false` | | Useful for i18next or ICU MessageFormat JSON outputs. Works well with `loadJSON` plugin. |
|
|
936
|
+
| Field | Description | Type | Default | Example | Note |
|
|
937
|
+
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
938
|
+
| `enabled` | Indicates if the compiler should be enabled to extract dictionaries. | `boolean` | <br/> `'build-only'` | `true` | `'build-only'` | `'build-only'` skips the compiler during development to speed up builds; only runs on build commands. |
|
|
939
|
+
| `dictionaryKeyPrefix` | Prefix for the extracted dictionary keys. | `string` | `''` | `'my-key-'` | Added to the generated key (based on file name) to prevent conflicts. |
|
|
940
|
+
| `saveComponents` | Indicates if components should be saved after being transformed. | `boolean` | `false` | | • If `true`, replaces original files with transformed files.<br/>• The compiler can then be removed after one run. |
|
|
941
|
+
| `output` | Defines the output file path. Replaces `outputDir`. Supports template variables: `{{fileName}}`, <br/> `{{key}}`, <br/> `{{locale}}`, <br/> `{{extension}}`, <br/> `{{componentFileName}}`, <br/> `{{componentExtension}}`, <br/> `{{format}}`, <br/> `{{componentFormat}}`, <br/> `{{componentDirPath}}`. | `boolean` | <br/> `FilePathPattern` | <br/> `Partial<Record<Locale, boolean | FilePathPattern>>` | `undefined` | `'./{{fileName}}{{extension}}'` <br/> `'/locales/{{locale}}/{{key}}.json'` <br/> `{ en: ({ key }) => './locales/en/${key}.json', fr: '...', es: false }` | • `./` paths resolve relative to the component directory.<br/>• `/` paths resolve relative to the project root.<br/>• Including `{{locale}}` generates separate per-locale dictionaries.<br/>• Supports per-locale object notation; `false` skips that locale. |
|
|
942
|
+
| `noMetadata` | If `true`, the compiler omits dictionary metadata (key, content wrapper) from the output. | `boolean` | `false` | `false` → `{"key":"my-key","content":{"key":"value"}}` <br/> `true` → `{"key":"value"}` | • Useful for i18next or ICU MessageFormat JSON outputs.<br/>• Works well with `loadJSON` plugin. |
|
|
943
|
+
| `dictionaryKeyPrefix` | Dictionary key prefix | `string` | `''` | | Add an optional prefix for the extracted dictionary keys |
|
|
945
944
|
|
|
946
|
-
|
|
945
|
+
### Custom Schemas
|
|
947
946
|
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
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>` |
|
|
951
950
|
|
|
952
|
-
|
|
953
|
-
output: {
|
|
954
|
-
en: ({ key }) => `./locales/en/${key}.json`,
|
|
955
|
-
fr: '/locales/fr/{{key}}.content.json',
|
|
956
|
-
es: false, // skip Spanish
|
|
957
|
-
}
|
|
958
|
-
```
|
|
959
|
-
|
|
960
|
-
**`noMetadata` example**:
|
|
961
|
-
|
|
962
|
-
If `true`:
|
|
963
|
-
|
|
964
|
-
```json
|
|
965
|
-
{
|
|
966
|
-
"key": "value"
|
|
967
|
-
}
|
|
968
|
-
```
|
|
951
|
+
---
|
|
969
952
|
|
|
970
|
-
|
|
953
|
+
### Plugins
|
|
971
954
|
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
"content": {
|
|
976
|
-
"key": "value"
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
```
|
|
955
|
+
| Field | Description | Type |
|
|
956
|
+
| --------- | ------------------------------------- | ------------------ |
|
|
957
|
+
| `plugins` | Liste des plugins Intlayer à activer. | `IntlayerPlugin[]` |
|