@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
|
@@ -530,6 +530,165 @@ export default defineConfig({
|
|
|
530
530
|
});
|
|
531
531
|
```
|
|
532
532
|
|
|
533
|
+
### (Optional) Step 12: Extract the content of your components
|
|
534
|
+
|
|
535
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
536
|
+
|
|
537
|
+
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.
|
|
538
|
+
|
|
539
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
540
|
+
|
|
541
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
542
|
+
import { type IntlayerConfig } from "intlayer";
|
|
543
|
+
|
|
544
|
+
const config: IntlayerConfig = {
|
|
545
|
+
// ... Rest of your config
|
|
546
|
+
compiler: {
|
|
547
|
+
/**
|
|
548
|
+
* Indicates if the compiler should be enabled.
|
|
549
|
+
*/
|
|
550
|
+
enabled: true,
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Defines the output files path
|
|
554
|
+
*/
|
|
555
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Indicates if the components should be saved after being transformed.
|
|
559
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
560
|
+
*/
|
|
561
|
+
saveComponents: false,
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Dictionary key prefix
|
|
565
|
+
*/
|
|
566
|
+
dictionaryKeyPrefix: "",
|
|
567
|
+
},
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
export default config;
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
574
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
575
|
+
const config = {
|
|
576
|
+
// ... Rest of your config
|
|
577
|
+
compiler: {
|
|
578
|
+
/**
|
|
579
|
+
* Indicates if the compiler should be enabled.
|
|
580
|
+
*/
|
|
581
|
+
enabled: true,
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Defines the output files path
|
|
585
|
+
*/
|
|
586
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Indicates if the components should be saved after being transformed.
|
|
590
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
591
|
+
*/
|
|
592
|
+
saveComponents: false,
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Dictionary key prefix
|
|
596
|
+
*/
|
|
597
|
+
dictionaryKeyPrefix: "",
|
|
598
|
+
},
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
export default config;
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
605
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
606
|
+
const config = {
|
|
607
|
+
// ... Rest of your config
|
|
608
|
+
compiler: {
|
|
609
|
+
/**
|
|
610
|
+
* Indicates if the compiler should be enabled.
|
|
611
|
+
*/
|
|
612
|
+
enabled: true,
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Defines the output files path
|
|
616
|
+
*/
|
|
617
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Indicates if the components should be saved after being transformed.
|
|
621
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
622
|
+
*/
|
|
623
|
+
saveComponents: false,
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Dictionary key prefix
|
|
627
|
+
*/
|
|
628
|
+
dictionaryKeyPrefix: "",
|
|
629
|
+
},
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
module.exports = config;
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
<Tabs>
|
|
636
|
+
<Tab value='Extract command'>
|
|
637
|
+
|
|
638
|
+
Run the extractor to transform your components and extract the content
|
|
639
|
+
|
|
640
|
+
```bash packageManager="npm"
|
|
641
|
+
npx intlayer extract
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
```bash packageManager="pnpm"
|
|
645
|
+
pnpm intlayer extract
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
```bash packageManager="yarn"
|
|
649
|
+
yarn intlayer extract
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
```bash packageManager="bun"
|
|
653
|
+
bunx intlayer extract
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
</Tab>
|
|
657
|
+
<Tab value='Babel compiler'>
|
|
658
|
+
|
|
659
|
+
Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
|
|
660
|
+
|
|
661
|
+
```ts fileName="vite.config.ts"
|
|
662
|
+
import { defineConfig } from "vite";
|
|
663
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
664
|
+
|
|
665
|
+
export default defineConfig({
|
|
666
|
+
plugins: [
|
|
667
|
+
intlayer(),
|
|
668
|
+
intlayerCompiler(), // Adds the compiler plugin
|
|
669
|
+
],
|
|
670
|
+
});
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
```bash packageManager="npm"
|
|
674
|
+
npm run build # Or npm run dev
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
```bash packageManager="pnpm"
|
|
678
|
+
pnpm run build # Or pnpm run dev
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
```bash packageManager="yarn"
|
|
682
|
+
yarn build # Or yarn dev
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
```bash packageManager="bun"
|
|
686
|
+
bun run build # Or bun run dev
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
</Tab>
|
|
690
|
+
</Tabs>
|
|
691
|
+
|
|
533
692
|
---
|
|
534
693
|
|
|
535
694
|
## Configure TypeScript
|
|
@@ -593,6 +593,165 @@ export default defineConfig({
|
|
|
593
593
|
});
|
|
594
594
|
```
|
|
595
595
|
|
|
596
|
+
### (Optional) Step 11: Extract the content of your components
|
|
597
|
+
|
|
598
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
599
|
+
|
|
600
|
+
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.
|
|
601
|
+
|
|
602
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
603
|
+
|
|
604
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
605
|
+
import { type IntlayerConfig } from "intlayer";
|
|
606
|
+
|
|
607
|
+
const config: IntlayerConfig = {
|
|
608
|
+
// ... Rest of your config
|
|
609
|
+
compiler: {
|
|
610
|
+
/**
|
|
611
|
+
* Indicates if the compiler should be enabled.
|
|
612
|
+
*/
|
|
613
|
+
enabled: true,
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Defines the output files path
|
|
617
|
+
*/
|
|
618
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Indicates if the components should be saved after being transformed.
|
|
622
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
623
|
+
*/
|
|
624
|
+
saveComponents: false,
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Dictionary key prefix
|
|
628
|
+
*/
|
|
629
|
+
dictionaryKeyPrefix: "",
|
|
630
|
+
},
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
export default config;
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
637
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
638
|
+
const config = {
|
|
639
|
+
// ... Rest of your config
|
|
640
|
+
compiler: {
|
|
641
|
+
/**
|
|
642
|
+
* Indicates if the compiler should be enabled.
|
|
643
|
+
*/
|
|
644
|
+
enabled: true,
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Defines the output files path
|
|
648
|
+
*/
|
|
649
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Indicates if the components should be saved after being transformed.
|
|
653
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
654
|
+
*/
|
|
655
|
+
saveComponents: false,
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Dictionary key prefix
|
|
659
|
+
*/
|
|
660
|
+
dictionaryKeyPrefix: "",
|
|
661
|
+
},
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
export default config;
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
668
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
669
|
+
const config = {
|
|
670
|
+
// ... Rest of your config
|
|
671
|
+
compiler: {
|
|
672
|
+
/**
|
|
673
|
+
* Indicates if the compiler should be enabled.
|
|
674
|
+
*/
|
|
675
|
+
enabled: true,
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Defines the output files path
|
|
679
|
+
*/
|
|
680
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Indicates if the components should be saved after being transformed.
|
|
684
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
685
|
+
*/
|
|
686
|
+
saveComponents: false,
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Dictionary key prefix
|
|
690
|
+
*/
|
|
691
|
+
dictionaryKeyPrefix: "",
|
|
692
|
+
},
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
module.exports = config;
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
<Tabs>
|
|
699
|
+
<Tab value='Extract command'>
|
|
700
|
+
|
|
701
|
+
Run the extractor to transform your components and extract the content
|
|
702
|
+
|
|
703
|
+
```bash packageManager="npm"
|
|
704
|
+
npx intlayer extract
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
```bash packageManager="pnpm"
|
|
708
|
+
pnpm intlayer extract
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
```bash packageManager="yarn"
|
|
712
|
+
yarn intlayer extract
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
```bash packageManager="bun"
|
|
716
|
+
bunx intlayer extract
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
</Tab>
|
|
720
|
+
<Tab value='Babel compiler'>
|
|
721
|
+
|
|
722
|
+
Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
|
|
723
|
+
|
|
724
|
+
```ts fileName="vite.config.ts"
|
|
725
|
+
import { defineConfig } from "vite";
|
|
726
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
727
|
+
|
|
728
|
+
export default defineConfig({
|
|
729
|
+
plugins: [
|
|
730
|
+
intlayer(),
|
|
731
|
+
intlayerCompiler(), // Adds the compiler plugin
|
|
732
|
+
],
|
|
733
|
+
});
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
```bash packageManager="npm"
|
|
737
|
+
npm run build # Or npm run dev
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
```bash packageManager="pnpm"
|
|
741
|
+
pnpm run build # Or pnpm run dev
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
```bash packageManager="yarn"
|
|
745
|
+
yarn build # Or yarn dev
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
```bash packageManager="bun"
|
|
749
|
+
bun run build # Or bun run dev
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
</Tab>
|
|
753
|
+
</Tabs>
|
|
754
|
+
|
|
596
755
|
---
|
|
597
756
|
|
|
598
757
|
## Configure TypeScript
|
|
@@ -561,6 +561,165 @@ To be able to visualize the intlayer editor selector, you will have to use the c
|
|
|
561
561
|
</div>
|
|
562
562
|
```
|
|
563
563
|
|
|
564
|
+
### (Optional) Step 12: Extract the content of your components
|
|
565
|
+
|
|
566
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
567
|
+
|
|
568
|
+
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.
|
|
569
|
+
|
|
570
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
571
|
+
|
|
572
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
573
|
+
import { type IntlayerConfig } from "intlayer";
|
|
574
|
+
|
|
575
|
+
const config: IntlayerConfig = {
|
|
576
|
+
// ... Rest of your config
|
|
577
|
+
compiler: {
|
|
578
|
+
/**
|
|
579
|
+
* Indicates if the compiler should be enabled.
|
|
580
|
+
*/
|
|
581
|
+
enabled: true,
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Defines the output files path
|
|
585
|
+
*/
|
|
586
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Indicates if the components should be saved after being transformed.
|
|
590
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
591
|
+
*/
|
|
592
|
+
saveComponents: false,
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Dictionary key prefix
|
|
596
|
+
*/
|
|
597
|
+
dictionaryKeyPrefix: "",
|
|
598
|
+
},
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
export default config;
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
605
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
606
|
+
const config = {
|
|
607
|
+
// ... Rest of your config
|
|
608
|
+
compiler: {
|
|
609
|
+
/**
|
|
610
|
+
* Indicates if the compiler should be enabled.
|
|
611
|
+
*/
|
|
612
|
+
enabled: true,
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Defines the output files path
|
|
616
|
+
*/
|
|
617
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Indicates if the components should be saved after being transformed.
|
|
621
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
622
|
+
*/
|
|
623
|
+
saveComponents: false,
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Dictionary key prefix
|
|
627
|
+
*/
|
|
628
|
+
dictionaryKeyPrefix: "",
|
|
629
|
+
},
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
export default config;
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
636
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
637
|
+
const config = {
|
|
638
|
+
// ... Rest of your config
|
|
639
|
+
compiler: {
|
|
640
|
+
/**
|
|
641
|
+
* Indicates if the compiler should be enabled.
|
|
642
|
+
*/
|
|
643
|
+
enabled: true,
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Defines the output files path
|
|
647
|
+
*/
|
|
648
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Indicates if the components should be saved after being transformed.
|
|
652
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
653
|
+
*/
|
|
654
|
+
saveComponents: false,
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Dictionary key prefix
|
|
658
|
+
*/
|
|
659
|
+
dictionaryKeyPrefix: "",
|
|
660
|
+
},
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
module.exports = config;
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
<Tabs>
|
|
667
|
+
<Tab value='Extract command'>
|
|
668
|
+
|
|
669
|
+
Run the extractor to transform your components and extract the content
|
|
670
|
+
|
|
671
|
+
```bash packageManager="npm"
|
|
672
|
+
npx intlayer extract
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
```bash packageManager="pnpm"
|
|
676
|
+
pnpm intlayer extract
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
```bash packageManager="yarn"
|
|
680
|
+
yarn intlayer extract
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
```bash packageManager="bun"
|
|
684
|
+
bunx intlayer extract
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
</Tab>
|
|
688
|
+
<Tab value='Babel compiler'>
|
|
689
|
+
|
|
690
|
+
Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
|
|
691
|
+
|
|
692
|
+
```ts fileName="vite.config.ts"
|
|
693
|
+
import { defineConfig } from "vite";
|
|
694
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
695
|
+
|
|
696
|
+
export default defineConfig({
|
|
697
|
+
plugins: [
|
|
698
|
+
intlayer(),
|
|
699
|
+
intlayerCompiler(), // Adds the compiler plugin
|
|
700
|
+
],
|
|
701
|
+
});
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
```bash packageManager="npm"
|
|
705
|
+
npm run build # Or npm run dev
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
```bash packageManager="pnpm"
|
|
709
|
+
pnpm run build # Or pnpm run dev
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
```bash packageManager="yarn"
|
|
713
|
+
yarn build # Or yarn dev
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
```bash packageManager="bun"
|
|
717
|
+
bun run build # Or bun run dev
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
</Tab>
|
|
721
|
+
</Tabs>
|
|
722
|
+
|
|
564
723
|
### Git Configuration
|
|
565
724
|
|
|
566
725
|
It is recommended to ignore the files generated by Intlayer.
|
|
@@ -753,9 +753,168 @@ export const Route = createFileRoute("/{-$locale}/$")({
|
|
|
753
753
|
});
|
|
754
754
|
```
|
|
755
755
|
|
|
756
|
+
### (Optional) Step 15: Extract the content of your components
|
|
757
|
+
|
|
758
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
759
|
+
|
|
760
|
+
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.
|
|
761
|
+
|
|
762
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
763
|
+
|
|
764
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
765
|
+
import { type IntlayerConfig } from "intlayer";
|
|
766
|
+
|
|
767
|
+
const config: IntlayerConfig = {
|
|
768
|
+
// ... Rest of your config
|
|
769
|
+
compiler: {
|
|
770
|
+
/**
|
|
771
|
+
* Indicates if the compiler should be enabled.
|
|
772
|
+
*/
|
|
773
|
+
enabled: true,
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Defines the output files path
|
|
777
|
+
*/
|
|
778
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Indicates if the components should be saved after being transformed.
|
|
782
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
783
|
+
*/
|
|
784
|
+
saveComponents: false,
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Dictionary key prefix
|
|
788
|
+
*/
|
|
789
|
+
dictionaryKeyPrefix: "",
|
|
790
|
+
},
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
export default config;
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
797
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
798
|
+
const config = {
|
|
799
|
+
// ... Rest of your config
|
|
800
|
+
compiler: {
|
|
801
|
+
/**
|
|
802
|
+
* Indicates if the compiler should be enabled.
|
|
803
|
+
*/
|
|
804
|
+
enabled: true,
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Defines the output files path
|
|
808
|
+
*/
|
|
809
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Indicates if the components should be saved after being transformed.
|
|
813
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
814
|
+
*/
|
|
815
|
+
saveComponents: false,
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Dictionary key prefix
|
|
819
|
+
*/
|
|
820
|
+
dictionaryKeyPrefix: "",
|
|
821
|
+
},
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
export default config;
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
828
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
829
|
+
const config = {
|
|
830
|
+
// ... Rest of your config
|
|
831
|
+
compiler: {
|
|
832
|
+
/**
|
|
833
|
+
* Indicates if the compiler should be enabled.
|
|
834
|
+
*/
|
|
835
|
+
enabled: true,
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Defines the output files path
|
|
839
|
+
*/
|
|
840
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Indicates if the components should be saved after being transformed.
|
|
844
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
845
|
+
*/
|
|
846
|
+
saveComponents: false,
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Dictionary key prefix
|
|
850
|
+
*/
|
|
851
|
+
dictionaryKeyPrefix: "",
|
|
852
|
+
},
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
module.exports = config;
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
<Tabs>
|
|
859
|
+
<Tab value='Extract command'>
|
|
860
|
+
|
|
861
|
+
Run the extractor to transform your components and extract the content
|
|
862
|
+
|
|
863
|
+
```bash packageManager="npm"
|
|
864
|
+
npx intlayer extract
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
```bash packageManager="pnpm"
|
|
868
|
+
pnpm intlayer extract
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
```bash packageManager="yarn"
|
|
872
|
+
yarn intlayer extract
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
```bash packageManager="bun"
|
|
876
|
+
bunx intlayer extract
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
</Tab>
|
|
880
|
+
<Tab value='Babel compiler'>
|
|
881
|
+
|
|
882
|
+
Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
|
|
883
|
+
|
|
884
|
+
```ts fileName="vite.config.ts"
|
|
885
|
+
import { defineConfig } from "vite";
|
|
886
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
887
|
+
|
|
888
|
+
export default defineConfig({
|
|
889
|
+
plugins: [
|
|
890
|
+
intlayer(),
|
|
891
|
+
intlayerCompiler(), // Adds the compiler plugin
|
|
892
|
+
],
|
|
893
|
+
});
|
|
894
|
+
```
|
|
895
|
+
|
|
896
|
+
```bash packageManager="npm"
|
|
897
|
+
npm run build # Or npm run dev
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
```bash packageManager="pnpm"
|
|
901
|
+
pnpm run build # Or pnpm run dev
|
|
902
|
+
```
|
|
903
|
+
|
|
904
|
+
```bash packageManager="yarn"
|
|
905
|
+
yarn build # Or yarn dev
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
```bash packageManager="bun"
|
|
909
|
+
bun run build # Or bun run dev
|
|
910
|
+
```
|
|
911
|
+
|
|
912
|
+
</Tab>
|
|
913
|
+
</Tabs>
|
|
914
|
+
|
|
756
915
|
---
|
|
757
916
|
|
|
758
|
-
### Step
|
|
917
|
+
### Step 16: Configure TypeScript (Optional)
|
|
759
918
|
|
|
760
919
|
Intlayer uses module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
761
920
|
|