@intlayer/docs 8.3.0-canary.4 → 8.3.1
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/docs/ar/compiler.md +84 -49
- package/docs/ar/configuration.md +80 -37
- package/docs/ar/intlayer_with_nextjs_16.md +174 -1
- package/docs/ar/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ar/intlayer_with_react_router_v7.md +224 -1
- package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/ar/intlayer_with_svelte_kit.md +175 -2
- package/docs/ar/intlayer_with_tanstack.md +176 -1
- package/docs/ar/intlayer_with_vite+preact.md +174 -1
- package/docs/ar/intlayer_with_vite+react.md +174 -1
- package/docs/ar/intlayer_with_vite+solid.md +174 -1
- package/docs/ar/intlayer_with_vite+svelte.md +174 -1
- package/docs/ar/intlayer_with_vite+vue.md +174 -1
- package/docs/de/compiler.md +83 -48
- package/docs/de/configuration.md +434 -212
- package/docs/de/intlayer_with_nextjs_16.md +176 -1
- package/docs/de/intlayer_with_nextjs_compiler.md +106 -349
- package/docs/de/intlayer_with_react_router_v7.md +225 -2
- package/docs/de/intlayer_with_react_router_v7_fs_routes.md +221 -79
- package/docs/de/intlayer_with_svelte_kit.md +158 -2
- package/docs/de/intlayer_with_tanstack.md +159 -1
- package/docs/de/intlayer_with_vite+preact.md +157 -1
- package/docs/de/intlayer_with_vite+react.md +157 -1
- package/docs/de/intlayer_with_vite+solid.md +159 -3
- package/docs/de/intlayer_with_vite+svelte.md +157 -1
- package/docs/de/intlayer_with_vite+vue.md +157 -1
- package/docs/en/compiler.md +60 -33
- package/docs/en/configuration.md +80 -57
- package/docs/en/intlayer_with_nextjs_16.md +176 -0
- package/docs/en/intlayer_with_nextjs_compiler.md +179 -1
- package/docs/en/intlayer_with_react_router_v7.md +159 -0
- package/docs/en/intlayer_with_react_router_v7_fs_routes.md +159 -0
- package/docs/en/intlayer_with_svelte_kit.md +159 -0
- package/docs/en/intlayer_with_tanstack.md +160 -1
- package/docs/en/intlayer_with_vite+preact.md +159 -0
- package/docs/en/intlayer_with_vite+react.md +159 -0
- package/docs/en/intlayer_with_vite+solid.md +148 -27
- package/docs/en/intlayer_with_vite+svelte.md +159 -0
- package/docs/en/intlayer_with_vite+vue.md +142 -41
- package/docs/en-GB/compiler.md +66 -34
- package/docs/en-GB/configuration.md +78 -36
- package/docs/es/compiler.md +83 -48
- package/docs/es/configuration.md +429 -206
- package/docs/es/intlayer_with_adonisjs.md +1 -1
- package/docs/es/intlayer_with_express.md +1 -1
- package/docs/es/intlayer_with_fastify.md +1 -1
- package/docs/es/intlayer_with_hono.md +1 -1
- package/docs/es/intlayer_with_nestjs.md +1 -1
- package/docs/es/intlayer_with_nextjs_16.md +176 -3
- package/docs/es/intlayer_with_nextjs_compiler.md +175 -2
- package/docs/es/intlayer_with_nuxt.md +1 -1
- package/docs/es/intlayer_with_react_router_v7.md +227 -4
- package/docs/es/intlayer_with_react_router_v7_fs_routes.md +162 -4
- package/docs/es/intlayer_with_svelte_kit.md +158 -2
- package/docs/es/intlayer_with_tanstack.md +160 -2
- package/docs/es/intlayer_with_vite+preact.md +162 -6
- package/docs/es/intlayer_with_vite+react.md +160 -4
- package/docs/es/intlayer_with_vite+solid.md +163 -7
- package/docs/es/intlayer_with_vite+svelte.md +157 -1
- package/docs/es/intlayer_with_vite+vue.md +165 -9
- package/docs/fr/compiler.md +81 -46
- package/docs/fr/configuration.md +355 -134
- package/docs/fr/intlayer_with_adonisjs.md +1 -1
- package/docs/fr/intlayer_with_express.md +1 -1
- package/docs/fr/intlayer_with_fastify.md +1 -1
- package/docs/fr/intlayer_with_hono.md +1 -1
- package/docs/fr/intlayer_with_nestjs.md +1 -1
- package/docs/fr/intlayer_with_nextjs_16.md +183 -7
- package/docs/fr/intlayer_with_nextjs_compiler.md +179 -3
- package/docs/fr/intlayer_with_react_router_v7.md +229 -3
- package/docs/fr/intlayer_with_react_router_v7_fs_routes.md +237 -6
- package/docs/fr/intlayer_with_svelte_kit.md +158 -2
- package/docs/fr/intlayer_with_tanstack.md +159 -1
- package/docs/fr/intlayer_with_vite+preact.md +164 -8
- package/docs/fr/intlayer_with_vite+react.md +162 -6
- package/docs/fr/intlayer_with_vite+solid.md +163 -7
- package/docs/fr/intlayer_with_vite+svelte.md +157 -1
- package/docs/fr/intlayer_with_vite+vue.md +164 -8
- package/docs/hi/compiler.md +81 -46
- package/docs/hi/configuration.md +87 -44
- package/docs/hi/intlayer_with_nextjs_16.md +174 -1
- package/docs/hi/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/hi/intlayer_with_react_router_v7.md +224 -1
- package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/hi/intlayer_with_svelte_kit.md +158 -2
- package/docs/hi/intlayer_with_tanstack.md +159 -1
- package/docs/hi/intlayer_with_vite+preact.md +157 -1
- package/docs/hi/intlayer_with_vite+react.md +157 -1
- package/docs/hi/intlayer_with_vite+solid.md +157 -1
- package/docs/hi/intlayer_with_vite+svelte.md +157 -1
- package/docs/hi/intlayer_with_vite+vue.md +157 -1
- package/docs/id/compiler.md +84 -51
- package/docs/id/configuration.md +83 -45
- package/docs/id/intlayer_with_nextjs_16.md +174 -1
- package/docs/id/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/id/intlayer_with_react_router_v7.md +224 -1
- package/docs/id/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/id/intlayer_with_svelte_kit.md +158 -2
- package/docs/id/intlayer_with_tanstack.md +159 -1
- package/docs/id/intlayer_with_vite+preact.md +157 -1
- package/docs/id/intlayer_with_vite+react.md +157 -1
- package/docs/id/intlayer_with_vite+solid.md +157 -1
- package/docs/id/intlayer_with_vite+svelte.md +157 -1
- package/docs/id/intlayer_with_vite+vue.md +157 -1
- package/docs/it/compiler.md +81 -46
- package/docs/it/configuration.md +426 -204
- package/docs/it/intlayer_with_nextjs_16.md +174 -1
- package/docs/it/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/it/intlayer_with_react_router_v7.md +225 -2
- package/docs/it/intlayer_with_react_router_v7_fs_routes.md +226 -2
- package/docs/it/intlayer_with_svelte_kit.md +158 -2
- package/docs/it/intlayer_with_tanstack.md +159 -1
- package/docs/it/intlayer_with_vite+preact.md +157 -1
- package/docs/it/intlayer_with_vite+react.md +157 -1
- package/docs/it/intlayer_with_vite+solid.md +159 -3
- package/docs/it/intlayer_with_vite+svelte.md +157 -1
- package/docs/it/intlayer_with_vite+vue.md +157 -1
- package/docs/ja/compiler.md +94 -58
- package/docs/ja/configuration.md +88 -45
- package/docs/ja/intlayer_with_nextjs_16.md +174 -1
- package/docs/ja/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ja/intlayer_with_react_router_v7.md +184 -394
- package/docs/ja/intlayer_with_react_router_v7_fs_routes.md +226 -2
- package/docs/ja/intlayer_with_svelte_kit.md +119 -595
- package/docs/ja/intlayer_with_tanstack.md +131 -642
- package/docs/ja/intlayer_with_vite+preact.md +111 -1231
- package/docs/ja/intlayer_with_vite+react.md +129 -1304
- package/docs/ja/intlayer_with_vite+solid.md +159 -3
- package/docs/ja/intlayer_with_vite+svelte.md +157 -1
- package/docs/ja/intlayer_with_vite+vue.md +157 -1
- package/docs/ko/compiler.md +88 -52
- package/docs/ko/configuration.md +87 -44
- package/docs/ko/intlayer_with_nextjs_16.md +174 -1
- package/docs/ko/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ko/intlayer_with_react_router_v7.md +225 -2
- package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +226 -2
- package/docs/ko/intlayer_with_svelte_kit.md +158 -2
- package/docs/ko/intlayer_with_tanstack.md +159 -1
- package/docs/ko/intlayer_with_vite+preact.md +157 -1
- package/docs/ko/intlayer_with_vite+react.md +157 -1
- package/docs/ko/intlayer_with_vite+solid.md +159 -3
- package/docs/ko/intlayer_with_vite+svelte.md +157 -1
- package/docs/ko/intlayer_with_vite+vue.md +157 -1
- package/docs/pl/compiler.md +84 -51
- package/docs/pl/configuration.md +83 -37
- package/docs/pl/intlayer_with_nextjs_16.md +174 -1
- package/docs/pl/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/pl/intlayer_with_react_router_v7.md +224 -1
- package/docs/pl/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/pl/intlayer_with_svelte_kit.md +158 -2
- package/docs/pl/intlayer_with_tanstack.md +159 -1
- package/docs/pl/intlayer_with_vite+preact.md +157 -1
- package/docs/pl/intlayer_with_vite+react.md +157 -1
- package/docs/pl/intlayer_with_vite+solid.md +157 -1
- package/docs/pl/intlayer_with_vite+svelte.md +157 -1
- package/docs/pl/intlayer_with_vite+vue.md +157 -1
- package/docs/pt/compiler.md +81 -46
- package/docs/pt/configuration.md +404 -194
- package/docs/pt/intlayer_with_nextjs_16.md +174 -1
- package/docs/pt/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/pt/intlayer_with_react_router_v7.md +224 -1
- package/docs/pt/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/pt/intlayer_with_svelte_kit.md +158 -2
- package/docs/pt/intlayer_with_tanstack.md +159 -1
- package/docs/pt/intlayer_with_vite+preact.md +157 -1
- package/docs/pt/intlayer_with_vite+react.md +157 -1
- package/docs/pt/intlayer_with_vite+solid.md +157 -1
- package/docs/pt/intlayer_with_vite+svelte.md +157 -1
- package/docs/pt/intlayer_with_vite+vue.md +157 -1
- package/docs/ru/compiler.md +90 -57
- package/docs/ru/configuration.md +76 -46
- package/docs/ru/intlayer_with_nextjs_16.md +174 -1
- package/docs/ru/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ru/intlayer_with_react_router_v7.md +224 -1
- package/docs/ru/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/ru/intlayer_with_svelte_kit.md +158 -2
- package/docs/ru/intlayer_with_tanstack.md +159 -1
- package/docs/ru/intlayer_with_vite+preact.md +157 -1
- package/docs/ru/intlayer_with_vite+react.md +157 -1
- package/docs/ru/intlayer_with_vite+solid.md +157 -1
- package/docs/ru/intlayer_with_vite+svelte.md +157 -1
- package/docs/ru/intlayer_with_vite+vue.md +157 -1
- package/docs/tr/compiler.md +85 -52
- package/docs/tr/configuration.md +83 -40
- package/docs/tr/intlayer_with_nextjs_16.md +174 -1
- package/docs/tr/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/tr/intlayer_with_react_router_v7.md +224 -1
- package/docs/tr/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/tr/intlayer_with_svelte_kit.md +158 -2
- package/docs/tr/intlayer_with_tanstack.md +159 -1
- package/docs/tr/intlayer_with_vite+preact.md +157 -1
- package/docs/tr/intlayer_with_vite+react.md +157 -1
- package/docs/tr/intlayer_with_vite+solid.md +157 -1
- package/docs/tr/intlayer_with_vite+svelte.md +157 -1
- package/docs/tr/intlayer_with_vite+vue.md +157 -1
- package/docs/uk/compiler.md +96 -61
- package/docs/uk/configuration.md +83 -37
- package/docs/uk/intlayer_with_nextjs_16.md +174 -1
- package/docs/uk/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/uk/intlayer_with_react_router_v7.md +224 -1
- package/docs/uk/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/uk/intlayer_with_svelte_kit.md +157 -1
- package/docs/uk/intlayer_with_tanstack.md +159 -1
- package/docs/uk/intlayer_with_vite+preact.md +157 -1
- package/docs/uk/intlayer_with_vite+react.md +157 -1
- package/docs/uk/intlayer_with_vite+solid.md +157 -1
- package/docs/uk/intlayer_with_vite+svelte.md +157 -1
- package/docs/uk/intlayer_with_vite+vue.md +157 -1
- package/docs/vi/compiler.md +85 -50
- package/docs/vi/configuration.md +85 -39
- package/docs/vi/intlayer_with_nextjs_16.md +174 -1
- package/docs/vi/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/vi/intlayer_with_react_router_v7.md +224 -1
- package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/vi/intlayer_with_svelte_kit.md +158 -2
- package/docs/vi/intlayer_with_tanstack.md +159 -1
- package/docs/vi/intlayer_with_vite+preact.md +157 -1
- package/docs/vi/intlayer_with_vite+react.md +157 -1
- package/docs/vi/intlayer_with_vite+solid.md +157 -1
- package/docs/vi/intlayer_with_vite+svelte.md +157 -1
- package/docs/vi/intlayer_with_vite+vue.md +157 -1
- package/docs/zh/compiler.md +84 -49
- package/docs/zh/configuration.md +80 -37
- package/docs/zh/intlayer_with_adonisjs.md +1 -1
- package/docs/zh/intlayer_with_express.md +1 -1
- package/docs/zh/intlayer_with_fastify.md +1 -1
- package/docs/zh/intlayer_with_hono.md +1 -1
- package/docs/zh/intlayer_with_nestjs.md +1 -1
- package/docs/zh/intlayer_with_nextjs_16.md +174 -1
- package/docs/zh/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/zh/intlayer_with_react_router_v7.md +227 -4
- package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +228 -4
- package/docs/zh/intlayer_with_svelte_kit.md +158 -2
- package/docs/zh/intlayer_with_tanstack.md +159 -1
- package/docs/zh/intlayer_with_vite+preact.md +159 -3
- package/docs/zh/intlayer_with_vite+react.md +157 -1
- package/docs/zh/intlayer_with_vite+solid.md +161 -5
- package/docs/zh/intlayer_with_vite+svelte.md +157 -1
- package/docs/zh/intlayer_with_vite+vue.md +158 -2
- package/package.json +6 -6
package/docs/en/configuration.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2024-08-13
|
|
3
|
-
updatedAt: 2026-03-
|
|
3
|
+
updatedAt: 2026-03-12
|
|
4
4
|
title: Configuration
|
|
5
5
|
description: Learn how to configure Intlayer for your application. Understand the various settings and options available to customize Intlayer to your needs.
|
|
6
6
|
keywords:
|
|
@@ -15,7 +15,7 @@ slugs:
|
|
|
15
15
|
- configuration
|
|
16
16
|
history:
|
|
17
17
|
- version: 8.3.0
|
|
18
|
-
|
|
18
|
+
date: 2026-03-11
|
|
19
19
|
changes: Move 'baseDir' from 'content' to 'system' config
|
|
20
20
|
- version: 8.2.0
|
|
21
21
|
date: 2026-03-09
|
|
@@ -119,7 +119,7 @@ Intlayer accepts JSON, JS, MJS, and TS configuration file formats:
|
|
|
119
119
|
|
|
120
120
|
## Example config file
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
````typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
123
123
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
124
124
|
import { nextjsRewrite } from "intlayer/routing";
|
|
125
125
|
import { z } from "zod";
|
|
@@ -217,7 +217,7 @@ const config: IntlayerConfig = {
|
|
|
217
217
|
* Options: 'cookie', 'localStorage', 'sessionStorage', 'header', or an array of these.
|
|
218
218
|
* Default: ['cookie', 'header']
|
|
219
219
|
*/
|
|
220
|
-
storage: "cookie",
|
|
220
|
+
storage: ["cookie", "header"],
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
223
|
* Base path for the application URLs.
|
|
@@ -387,9 +387,9 @@ const config: IntlayerConfig = {
|
|
|
387
387
|
|
|
388
388
|
/**
|
|
389
389
|
* Output format for generated dictionary files.
|
|
390
|
-
* Default: ['
|
|
390
|
+
* Default: ['cjs', 'esm']
|
|
391
391
|
*/
|
|
392
|
-
outputFormat: ["esm"],
|
|
392
|
+
outputFormat: ["cjs", "esm"],
|
|
393
393
|
|
|
394
394
|
/**
|
|
395
395
|
* Indicates if the build should check TypeScript types.
|
|
@@ -464,43 +464,70 @@ const config: IntlayerConfig = {
|
|
|
464
464
|
compiler: {
|
|
465
465
|
/**
|
|
466
466
|
* Indicates if the compiler should be enabled.
|
|
467
|
-
*
|
|
467
|
+
*
|
|
468
|
+
* - false: Disable the compiler.
|
|
469
|
+
* - true: Enable the compiler.
|
|
470
|
+
* - "build-only": Skip the compiler during development and speed up start times.
|
|
471
|
+
*
|
|
472
|
+
* Default: false
|
|
468
473
|
*/
|
|
469
474
|
enabled: true,
|
|
470
475
|
|
|
471
476
|
/**
|
|
472
|
-
*
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
*
|
|
477
|
+
* Defines the output files path. Replaces `outputDir`.
|
|
478
|
+
*
|
|
479
|
+
* - `./` paths are resolved relative to the component directory.
|
|
480
|
+
* - `/` paths are resolved relative to the project root (`baseDir`).
|
|
481
|
+
*
|
|
482
|
+
* - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
|
|
483
|
+
*
|
|
484
|
+
* Example:
|
|
485
|
+
* ```ts
|
|
486
|
+
* {
|
|
487
|
+
* // Create Multilingual .content.ts files close to the component
|
|
488
|
+
* output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
489
|
+
*
|
|
490
|
+
* // output: './{{fileName}}{{extension}}', // Equivalent using template string
|
|
491
|
+
* }
|
|
492
|
+
* ```
|
|
493
|
+
*
|
|
494
|
+
* ```ts
|
|
495
|
+
* {
|
|
496
|
+
* // Create centralize per-locale JSON at the root of the project
|
|
497
|
+
* output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
|
|
498
|
+
*
|
|
499
|
+
* // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string
|
|
500
|
+
* }
|
|
501
|
+
* ```
|
|
502
|
+
*
|
|
503
|
+
* Variable list:
|
|
504
|
+
* - `fileName`: The name of the file.
|
|
505
|
+
* - `key`: The key of the content.
|
|
506
|
+
* - `locale`: The locale of the content.
|
|
507
|
+
* - `extension`: The extension of the file.
|
|
508
|
+
* - `componentFileName`: The name of the component file.
|
|
509
|
+
* - `componentExtension`: The extension of the component file.
|
|
510
|
+
* - `format`: The format of the dictionary.
|
|
511
|
+
* - `componentFormat`: The format of the component dictionary.
|
|
512
|
+
* - `componentDirPath`: The directory path of the component.
|
|
481
513
|
*/
|
|
482
|
-
|
|
514
|
+
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
483
515
|
|
|
484
516
|
/**
|
|
485
|
-
*
|
|
517
|
+
* Indicates if the components should be saved after being transformed.
|
|
518
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
486
519
|
*/
|
|
487
|
-
|
|
520
|
+
saveComponents: false,
|
|
488
521
|
|
|
489
522
|
/**
|
|
490
|
-
* Inset only content
|
|
523
|
+
* Inset only content into the generated file. Useful for per-locale i18next or ICU MessageFormat JSON outputs.
|
|
491
524
|
*/
|
|
492
525
|
noMetadata: false,
|
|
493
526
|
|
|
494
527
|
/**
|
|
495
528
|
* Dictionary key prefix
|
|
496
529
|
*/
|
|
497
|
-
dictionaryKeyPrefix: "", //
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Indicates if the components should be saved after being transformed.
|
|
501
|
-
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
502
|
-
*/
|
|
503
|
-
saveComponents: false,
|
|
530
|
+
dictionaryKeyPrefix: "", // Add an optional prefix for the extracted dictionary keys
|
|
504
531
|
},
|
|
505
532
|
|
|
506
533
|
/**
|
|
@@ -519,7 +546,7 @@ const config: IntlayerConfig = {
|
|
|
519
546
|
};
|
|
520
547
|
|
|
521
548
|
export default config;
|
|
522
|
-
|
|
549
|
+
````
|
|
523
550
|
|
|
524
551
|
---
|
|
525
552
|
|
|
@@ -537,7 +564,7 @@ Defines settings related to internationalization, including available locales an
|
|
|
537
564
|
|
|
538
565
|
- **locales**:
|
|
539
566
|
- _Type_: `string[]`
|
|
540
|
-
- _Default_: `[
|
|
567
|
+
- _Default_: `[Locales.ENGLISH]`
|
|
541
568
|
- _Description_: The list of supported locales in the application.
|
|
542
569
|
- _Example_: `['en', 'fr', 'es']`
|
|
543
570
|
|
|
@@ -558,7 +585,7 @@ Defines settings related to internationalization, including available locales an
|
|
|
558
585
|
|
|
559
586
|
- **defaultLocale**:
|
|
560
587
|
- _Type_: `string`
|
|
561
|
-
- _Default_: `
|
|
588
|
+
- _Default_: `Locales.ENGLISH`
|
|
562
589
|
- _Description_: The default locale used as a fallback if the requested locale is not found.
|
|
563
590
|
- _Example_: `'en'`
|
|
564
591
|
- _Note_: This is used to determine the locale when none is specified in the URL, cookie, or header.
|
|
@@ -573,7 +600,7 @@ Defines settings related to the integrated editor, including server port and act
|
|
|
573
600
|
|
|
574
601
|
- **applicationURL**:
|
|
575
602
|
- _Type_: `string`
|
|
576
|
-
- _Default_: `
|
|
603
|
+
- _Default_: `''`
|
|
577
604
|
- _Description_: The URL of the application. Used to restrict the origin of the editor for security reasons.
|
|
578
605
|
- _Example_:
|
|
579
606
|
- `'http://localhost:3000'`
|
|
@@ -637,7 +664,7 @@ Defines settings related to the integrated editor, including server port and act
|
|
|
637
664
|
|
|
638
665
|
- **liveSync**:
|
|
639
666
|
- _Type_: `boolean`
|
|
640
|
-
- _Default_: `
|
|
667
|
+
- _Default_: `true`
|
|
641
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.
|
|
642
669
|
- _Example_: `true`
|
|
643
670
|
- _Note_: For example, when a new dictionary is added or updated, the application will update the content to display in the page.
|
|
@@ -676,7 +703,7 @@ Settings that control routing behavior, including URL structure, locale storage,
|
|
|
676
703
|
|
|
677
704
|
- **storage**:
|
|
678
705
|
- _Type_: `false | 'cookie' | 'localStorage' | 'sessionStorage' | 'header' | CookiesAttributes | StorageAttributes | Array`
|
|
679
|
-
- _Default_: `'
|
|
706
|
+
- _Default_: `['cookie', 'header']`
|
|
680
707
|
- _Description_: Configuration for storing the locale in the client.
|
|
681
708
|
|
|
682
709
|
- **cookie**:
|
|
@@ -779,7 +806,6 @@ const config: IntlayerConfig = {
|
|
|
779
806
|
routing: {
|
|
780
807
|
mode: "prefix-no-default",
|
|
781
808
|
storage: "localStorage",
|
|
782
|
-
headerName: "x-intlayer-locale",
|
|
783
809
|
basePath: "",
|
|
784
810
|
},
|
|
785
811
|
};
|
|
@@ -812,7 +838,6 @@ const config: IntlayerConfig = {
|
|
|
812
838
|
httpOnly: false,
|
|
813
839
|
},
|
|
814
840
|
],
|
|
815
|
-
headerName: "x-intlayer-locale",
|
|
816
841
|
basePath: "",
|
|
817
842
|
},
|
|
818
843
|
};
|
|
@@ -833,7 +858,6 @@ const config: IntlayerConfig = {
|
|
|
833
858
|
routing: {
|
|
834
859
|
mode: "search-params",
|
|
835
860
|
storage: "localStorage",
|
|
836
|
-
headerName: "x-intlayer-locale",
|
|
837
861
|
basePath: "",
|
|
838
862
|
},
|
|
839
863
|
};
|
|
@@ -857,7 +881,6 @@ const config: IntlayerConfig = {
|
|
|
857
881
|
type: "sessionStorage",
|
|
858
882
|
name: "app-locale",
|
|
859
883
|
},
|
|
860
|
-
headerName: "x-custom-locale",
|
|
861
884
|
basePath: "/my-app",
|
|
862
885
|
},
|
|
863
886
|
};
|
|
@@ -872,7 +895,6 @@ export default config;
|
|
|
872
895
|
import { nextjsRewrite } from "intlayer/routing";
|
|
873
896
|
|
|
874
897
|
const config: IntlayerConfig = {
|
|
875
|
-
|
|
876
898
|
internationalization: {
|
|
877
899
|
locales: ["en", "fr"],
|
|
878
900
|
defaultLocale: "en",
|
|
@@ -893,12 +915,11 @@ const config: IntlayerConfig = {
|
|
|
893
915
|
en: "/blog/[category]/[id]",
|
|
894
916
|
fr: "/journal/[category]/[id]",
|
|
895
917
|
},
|
|
896
|
-
|
|
918
|
+
}),
|
|
919
|
+
},
|
|
897
920
|
};
|
|
898
921
|
|
|
899
|
-
export default config
|
|
900
|
-
},
|
|
901
|
-
});
|
|
922
|
+
export default config;
|
|
902
923
|
```
|
|
903
924
|
|
|
904
925
|
---
|
|
@@ -916,7 +937,7 @@ Settings related to content handling within the application, including directory
|
|
|
916
937
|
|
|
917
938
|
- **fileExtensions**:
|
|
918
939
|
- _Type_: `string[]`
|
|
919
|
-
- _Default_: `['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']`
|
|
940
|
+
- _Default_: `['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.json5', '.content.jsonc', '.content.tsx', '.content.jsx']`
|
|
920
941
|
- _Description_: File extensions to look for when building dictionaries.
|
|
921
942
|
- _Example_: `['.data.ts', '.data.js', '.data.json']`
|
|
922
943
|
- _Note_: Customizing file extensions can help avoid conflicts.
|
|
@@ -1213,8 +1234,8 @@ Build options apply to the `@intlayer/babel` and `@intlayer/swc` plugins.
|
|
|
1213
1234
|
- _Note_: This can slow down the build.
|
|
1214
1235
|
|
|
1215
1236
|
- **outputFormat**:
|
|
1216
|
-
- _Type_: `'esm' | 'cjs'`
|
|
1217
|
-
- _Default_: `'esm'`
|
|
1237
|
+
- _Type_: `('esm' | 'cjs')[]`
|
|
1238
|
+
- _Default_: `['cjs', 'esm']`
|
|
1218
1239
|
- _Description_: Controls the output format of the dictionaries.
|
|
1219
1240
|
- _Example_: `'cjs'`
|
|
1220
1241
|
- _Note_: The output format of the dictionaries.
|
|
@@ -1245,7 +1266,7 @@ Settings that control the Intlayer compiler, which extracts dictionaries straigh
|
|
|
1245
1266
|
|
|
1246
1267
|
- **dictionaryKeyPrefix**:
|
|
1247
1268
|
- _Type_: `string`
|
|
1248
|
-
- _Default_: `'
|
|
1269
|
+
- _Default_: `''`
|
|
1249
1270
|
- _Description_: Prefix for the extracted dictionary keys.
|
|
1250
1271
|
- _Example_: `'my-key-'`
|
|
1251
1272
|
- _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.
|
|
@@ -1269,23 +1290,25 @@ Settings that control the Intlayer compiler, which extracts dictionaries straigh
|
|
|
1269
1290
|
- _Description_: Patterns that define which files should be excluded during optimization.
|
|
1270
1291
|
- _Example_: `['**/node_modules/**', '!**/node_modules/react/**']`
|
|
1271
1292
|
|
|
1272
|
-
- **outputDir**:
|
|
1273
|
-
- _Type_: `string`
|
|
1274
|
-
- _Default_: `'compiler'`
|
|
1275
|
-
- _Description_: The directory where the extracted dictionaries will be stored, relative to your project base path.
|
|
1276
|
-
|
|
1277
1293
|
- **output**:
|
|
1278
1294
|
- _Type_: `FilePathPattern`
|
|
1279
|
-
- _Default_: `
|
|
1280
|
-
- _Description_: Defines the output files path. Replaces `outputDir`. Handles dynamic variables
|
|
1281
|
-
- _Note_:
|
|
1282
|
-
- _Note_:
|
|
1283
|
-
- _Example_:
|
|
1295
|
+
- _Default_: `undefined`
|
|
1296
|
+
- _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}}`.
|
|
1297
|
+
- _Note_: `./` paths are resolved relative to the component directory. `/` paths are resolved relative to the project root (`baseDir`).
|
|
1298
|
+
- _Note_: Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
|
|
1299
|
+
- _Example_:
|
|
1300
|
+
- **Multilingual files near component**:
|
|
1301
|
+
- String: `'./{{fileName}}{{extension}}'`
|
|
1302
|
+
- Function: `({ fileName, extension }) => \`./${fileName}${extension}``
|
|
1303
|
+
|
|
1304
|
+
- **Centralized per-locale JSON**:
|
|
1305
|
+
- String: `'/locales/{{locale}}/{{key}}.content.json'`
|
|
1306
|
+
- Function: `({ key, locale }) => \`/locales/${locale}/${key}.content.json``
|
|
1284
1307
|
|
|
1285
1308
|
- **noMetadata**:
|
|
1286
1309
|
- _Type_: `boolean`
|
|
1287
1310
|
- _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).
|
|
1311
|
+
- _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
1312
|
- _Note_: Useful if used with `loadJSON` plugin.
|
|
1290
1313
|
- _Example_:
|
|
1291
1314
|
If `true`:
|
|
@@ -1629,6 +1629,182 @@ bun add @intlayer/swc --dev
|
|
|
1629
1629
|
|
|
1630
1630
|
> Note: If you set the option as `importMode: 'dynamic'` or `importMode: 'fetch'` (in the `dictionary` configuration), it will rely on Suspense, so you will have to wrap your `useIntlayer` calls in a `Suspense` boundary. That means, you will not be able to use the `useIntlayer` directly at the top level of your Page / Layout component.
|
|
1631
1631
|
|
|
1632
|
+
### (Optional) Step 14: Extract the content of your components
|
|
1633
|
+
|
|
1634
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
1635
|
+
|
|
1636
|
+
To ease this process, Intlayer propose a [compiler](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/compiler.md) / [extractor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/cli/extract.md) to transform your components and extract the content.
|
|
1637
|
+
|
|
1638
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
1639
|
+
|
|
1640
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
1641
|
+
import { type IntlayerConfig } from "intlayer";
|
|
1642
|
+
|
|
1643
|
+
const config: IntlayerConfig = {
|
|
1644
|
+
// ... Rest of your config
|
|
1645
|
+
compiler: {
|
|
1646
|
+
/**
|
|
1647
|
+
* Indicates if the compiler should be enabled.
|
|
1648
|
+
*/
|
|
1649
|
+
enabled: true,
|
|
1650
|
+
|
|
1651
|
+
/**
|
|
1652
|
+
* Defines the output files path
|
|
1653
|
+
*/
|
|
1654
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* Indicates if the components should be saved after being transformed.
|
|
1658
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1659
|
+
*/
|
|
1660
|
+
saveComponents: false,
|
|
1661
|
+
|
|
1662
|
+
/**
|
|
1663
|
+
* Dictionary key prefix
|
|
1664
|
+
*/
|
|
1665
|
+
dictionaryKeyPrefix: "",
|
|
1666
|
+
},
|
|
1667
|
+
};
|
|
1668
|
+
|
|
1669
|
+
export default config;
|
|
1670
|
+
```
|
|
1671
|
+
|
|
1672
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
1673
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
1674
|
+
const config = {
|
|
1675
|
+
// ... Rest of your config
|
|
1676
|
+
compiler: {
|
|
1677
|
+
/**
|
|
1678
|
+
* Indicates if the compiler should be enabled.
|
|
1679
|
+
*/
|
|
1680
|
+
enabled: true,
|
|
1681
|
+
|
|
1682
|
+
/**
|
|
1683
|
+
* Defines the output files path
|
|
1684
|
+
*/
|
|
1685
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* Indicates if the components should be saved after being transformed.
|
|
1689
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1690
|
+
*/
|
|
1691
|
+
saveComponents: false,
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Dictionary key prefix
|
|
1695
|
+
*/
|
|
1696
|
+
dictionaryKeyPrefix: "",
|
|
1697
|
+
},
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1700
|
+
export default config;
|
|
1701
|
+
```
|
|
1702
|
+
|
|
1703
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
1704
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
1705
|
+
const config = {
|
|
1706
|
+
// ... Rest of your config
|
|
1707
|
+
compiler: {
|
|
1708
|
+
/**
|
|
1709
|
+
* Indicates if the compiler should be enabled.
|
|
1710
|
+
*/
|
|
1711
|
+
enabled: true,
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* Defines the output files path
|
|
1715
|
+
*/
|
|
1716
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1717
|
+
|
|
1718
|
+
/**
|
|
1719
|
+
* Indicates if the components should be saved after being transformed.
|
|
1720
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1721
|
+
*/
|
|
1722
|
+
saveComponents: false,
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Dictionary key prefix
|
|
1726
|
+
*/
|
|
1727
|
+
dictionaryKeyPrefix: "",
|
|
1728
|
+
},
|
|
1729
|
+
};
|
|
1730
|
+
|
|
1731
|
+
module.exports = config;
|
|
1732
|
+
```
|
|
1733
|
+
|
|
1734
|
+
<Tabs>
|
|
1735
|
+
<Tab value='Extract command'>
|
|
1736
|
+
|
|
1737
|
+
Run the extractor to transform your components and extract the content
|
|
1738
|
+
|
|
1739
|
+
```bash packageManager="npm"
|
|
1740
|
+
npx intlayer extract
|
|
1741
|
+
```
|
|
1742
|
+
|
|
1743
|
+
```bash packageManager="pnpm"
|
|
1744
|
+
pnpm intlayer extract
|
|
1745
|
+
```
|
|
1746
|
+
|
|
1747
|
+
```bash packageManager="yarn"
|
|
1748
|
+
yarn intlayer extract
|
|
1749
|
+
```
|
|
1750
|
+
|
|
1751
|
+
```bash packageManager="bun"
|
|
1752
|
+
bunx intlayer extract
|
|
1753
|
+
```
|
|
1754
|
+
|
|
1755
|
+
</Tab>
|
|
1756
|
+
<Tab value='Babel compiler'>
|
|
1757
|
+
|
|
1758
|
+
```bash packageManager="npm"
|
|
1759
|
+
npm install @intlayer/babel --save-dev
|
|
1760
|
+
```
|
|
1761
|
+
|
|
1762
|
+
```bash packageManager="pnpm"
|
|
1763
|
+
pnpm add @intlayer/babel --save-dev
|
|
1764
|
+
```
|
|
1765
|
+
|
|
1766
|
+
```bash packageManager="yarn"
|
|
1767
|
+
yarn add @intlayer/babel --save-dev
|
|
1768
|
+
```
|
|
1769
|
+
|
|
1770
|
+
```bash packageManager="bun"
|
|
1771
|
+
bun add @intlayer/babel --dev
|
|
1772
|
+
```
|
|
1773
|
+
|
|
1774
|
+
```js fileName="babel.config.js"
|
|
1775
|
+
const {
|
|
1776
|
+
intlayerExtractBabelPlugin,
|
|
1777
|
+
getExtractPluginOptions,
|
|
1778
|
+
} = require("@intlayer/babel");
|
|
1779
|
+
|
|
1780
|
+
module.exports = {
|
|
1781
|
+
presets: ["next/babel"],
|
|
1782
|
+
plugins: [
|
|
1783
|
+
// Extract content from components into dictionaries
|
|
1784
|
+
[intlayerExtractBabelPlugin, getExtractPluginOptions()],
|
|
1785
|
+
],
|
|
1786
|
+
};
|
|
1787
|
+
```
|
|
1788
|
+
|
|
1789
|
+
```bash packageManager="npm"
|
|
1790
|
+
npm run build # Or npm run dev
|
|
1791
|
+
```
|
|
1792
|
+
|
|
1793
|
+
```bash packageManager="pnpm"
|
|
1794
|
+
pnpm run build # Or pnpm run dev
|
|
1795
|
+
```
|
|
1796
|
+
|
|
1797
|
+
```bash packageManager="yarn"
|
|
1798
|
+
yarn build # Or yarn dev
|
|
1799
|
+
```
|
|
1800
|
+
|
|
1801
|
+
```bash packageManager="bun"
|
|
1802
|
+
bun run build # Or bun run dev
|
|
1803
|
+
```
|
|
1804
|
+
|
|
1805
|
+
</Tab>
|
|
1806
|
+
</Tabs>
|
|
1807
|
+
|
|
1632
1808
|
### Watch dictionaries changes on Turbopack
|
|
1633
1809
|
|
|
1634
1810
|
When using Turbopack as your development server with the `next dev` command, dictionary changes will not be automatically detected by default.
|
|
@@ -431,7 +431,9 @@ export const LocaleSwitcher: FC = () => {
|
|
|
431
431
|
|
|
432
432
|
When using `next-intlayer`, dictionaries are included in the bundle for every page by default. To optimize bundle size, Intlayer provides an optional SWC plugin that intelligently replace `useIntlayer` calls using macros. This ensures dictionaries are only included in bundles for pages that actually use them.
|
|
433
433
|
|
|
434
|
-
|
|
434
|
+
The `@intlayer/babel` plugin already integrate the bundling optimization (see `babel.config.js`). But the `@intlayer/swc` plugin is more performant. If you remove the `@intlayer/babel` plugin, you can use the `@intlayer/swc` plugin.
|
|
435
|
+
|
|
436
|
+
Install the `@intlayer/swc` package. Once installed, `next-intlayer` will automatically detect and use the plugin:
|
|
435
437
|
|
|
436
438
|
```bash packageManager="npm"
|
|
437
439
|
npm install @intlayer/swc --save-dev
|
|
@@ -455,6 +457,182 @@ bun add @intlayer/swc --dev
|
|
|
455
457
|
|
|
456
458
|
> Note: If you set the option as `importMode: 'dynamic'` or `importMode: 'fetch'` (in the `dictionary` configuration), it will rely on Suspense, so you will have to wrap your `useIntlayer` calls in a `Suspense` boundary. That means, you will not be able to use the `useIntlayer` directly at the top level of your Page / Layout component.
|
|
457
459
|
|
|
460
|
+
### (Optional) Step 11: Extract the content of your components
|
|
461
|
+
|
|
462
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
463
|
+
|
|
464
|
+
To ease this process, Intlayer propose a [compiler](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/compiler.md) / [extractor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/cli/extract.md) to transform your components and extract the content.
|
|
465
|
+
|
|
466
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
467
|
+
|
|
468
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
469
|
+
import { type IntlayerConfig } from "intlayer";
|
|
470
|
+
|
|
471
|
+
const config: IntlayerConfig = {
|
|
472
|
+
// ... Rest of your config
|
|
473
|
+
compiler: {
|
|
474
|
+
/**
|
|
475
|
+
* Indicates if the compiler should be enabled.
|
|
476
|
+
*/
|
|
477
|
+
enabled: true,
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Defines the output files path
|
|
481
|
+
*/
|
|
482
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Indicates if the components should be saved after being transformed.
|
|
486
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
487
|
+
*/
|
|
488
|
+
saveComponents: false,
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Dictionary key prefix
|
|
492
|
+
*/
|
|
493
|
+
dictionaryKeyPrefix: "",
|
|
494
|
+
},
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
export default config;
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
501
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
502
|
+
const config = {
|
|
503
|
+
// ... Rest of your config
|
|
504
|
+
compiler: {
|
|
505
|
+
/**
|
|
506
|
+
* Indicates if the compiler should be enabled.
|
|
507
|
+
*/
|
|
508
|
+
enabled: true,
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Defines the output files path
|
|
512
|
+
*/
|
|
513
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Indicates if the components should be saved after being transformed.
|
|
517
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
518
|
+
*/
|
|
519
|
+
saveComponents: false,
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Dictionary key prefix
|
|
523
|
+
*/
|
|
524
|
+
dictionaryKeyPrefix: "",
|
|
525
|
+
},
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
export default config;
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
532
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
533
|
+
const config = {
|
|
534
|
+
// ... Rest of your config
|
|
535
|
+
compiler: {
|
|
536
|
+
/**
|
|
537
|
+
* Indicates if the compiler should be enabled.
|
|
538
|
+
*/
|
|
539
|
+
enabled: true,
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Defines the output files path
|
|
543
|
+
*/
|
|
544
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Indicates if the components should be saved after being transformed.
|
|
548
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
549
|
+
*/
|
|
550
|
+
saveComponents: false,
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Dictionary key prefix
|
|
554
|
+
*/
|
|
555
|
+
dictionaryKeyPrefix: "",
|
|
556
|
+
},
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
module.exports = config;
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
<Tabs>
|
|
563
|
+
<Tab value='Extract command'>
|
|
564
|
+
|
|
565
|
+
Run the extractor to transform your components and extract the content
|
|
566
|
+
|
|
567
|
+
```bash packageManager="npm"
|
|
568
|
+
npx intlayer extract
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
```bash packageManager="pnpm"
|
|
572
|
+
pnpm intlayer extract
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
```bash packageManager="yarn"
|
|
576
|
+
yarn intlayer extract
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
```bash packageManager="bun"
|
|
580
|
+
bunx intlayer extract
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
</Tab>
|
|
584
|
+
<Tab value='Babel compiler'>
|
|
585
|
+
|
|
586
|
+
```bash packageManager="npm"
|
|
587
|
+
npm install @intlayer/babel --save-dev
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
```bash packageManager="pnpm"
|
|
591
|
+
pnpm add @intlayer/babel --save-dev
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
```bash packageManager="yarn"
|
|
595
|
+
yarn add @intlayer/babel --save-dev
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
```bash packageManager="bun"
|
|
599
|
+
bun add @intlayer/babel --dev
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
```js fileName="babel.config.js"
|
|
603
|
+
const {
|
|
604
|
+
intlayerExtractBabelPlugin,
|
|
605
|
+
getExtractPluginOptions,
|
|
606
|
+
} = require("@intlayer/babel");
|
|
607
|
+
|
|
608
|
+
module.exports = {
|
|
609
|
+
presets: ["next/babel"],
|
|
610
|
+
plugins: [
|
|
611
|
+
// Extract content from components into dictionaries
|
|
612
|
+
[intlayerExtractBabelPlugin, getExtractPluginOptions()],
|
|
613
|
+
],
|
|
614
|
+
};
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
```bash packageManager="npm"
|
|
618
|
+
npm run build # Or npm run dev
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
```bash packageManager="pnpm"
|
|
622
|
+
pnpm run build # Or pnpm run dev
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
```bash packageManager="yarn"
|
|
626
|
+
yarn build # Or yarn dev
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
```bash packageManager="bun"
|
|
630
|
+
bun run build # Or bun run dev
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
</Tab>
|
|
634
|
+
</Tabs>
|
|
635
|
+
|
|
458
636
|
### Configure TypeScript
|
|
459
637
|
|
|
460
638
|
Intlayer use module augmentation to get benefits of TypeScript and make your codebase stronger.
|