@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
|
@@ -957,64 +957,165 @@ import RouterLink from "@components/RouterLink.vue";
|
|
|
957
957
|
</template>
|
|
958
958
|
```
|
|
959
959
|
|
|
960
|
-
### (Optional) Step 11:
|
|
960
|
+
### (Optional) Step 11: Extract the content of your components
|
|
961
961
|
|
|
962
|
-
|
|
962
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
963
963
|
|
|
964
|
-
|
|
964
|
+
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.
|
|
965
965
|
|
|
966
|
-
|
|
966
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
967
967
|
|
|
968
|
-
|
|
968
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
969
|
+
import { type IntlayerConfig } from "intlayer";
|
|
969
970
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
971
|
+
const config: IntlayerConfig = {
|
|
972
|
+
// ... Rest of your config
|
|
973
|
+
compiler: {
|
|
974
|
+
/**
|
|
975
|
+
* Indicates if the compiler should be enabled.
|
|
976
|
+
*/
|
|
977
|
+
enabled: true,
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Defines the output files path
|
|
981
|
+
*/
|
|
982
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Indicates if the components should be saved after being transformed.
|
|
986
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
987
|
+
*/
|
|
988
|
+
saveComponents: false,
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Dictionary key prefix
|
|
992
|
+
*/
|
|
993
|
+
dictionaryKeyPrefix: "",
|
|
994
|
+
},
|
|
995
|
+
};
|
|
974
996
|
|
|
975
|
-
|
|
997
|
+
export default config;
|
|
998
|
+
```
|
|
976
999
|
|
|
977
|
-
|
|
1000
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
1001
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
1002
|
+
const config = {
|
|
1003
|
+
// ... Rest of your config
|
|
1004
|
+
compiler: {
|
|
1005
|
+
/**
|
|
1006
|
+
* Indicates if the compiler should be enabled.
|
|
1007
|
+
*/
|
|
1008
|
+
enabled: true,
|
|
1009
|
+
|
|
1010
|
+
/**
|
|
1011
|
+
* Defines the output files path
|
|
1012
|
+
*/
|
|
1013
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Indicates if the components should be saved after being transformed.
|
|
1017
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1018
|
+
*/
|
|
1019
|
+
saveComponents: false,
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Dictionary key prefix
|
|
1023
|
+
*/
|
|
1024
|
+
dictionaryKeyPrefix: "",
|
|
1025
|
+
},
|
|
1026
|
+
};
|
|
978
1027
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
linkify: true, // auto-link URLs
|
|
982
|
-
typographer: true, // enable smart quotes, dashes, etc.
|
|
983
|
-
});
|
|
1028
|
+
export default config;
|
|
1029
|
+
```
|
|
984
1030
|
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1031
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
1032
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
1033
|
+
const config = {
|
|
1034
|
+
// ... Rest of your config
|
|
1035
|
+
compiler: {
|
|
1036
|
+
/**
|
|
1037
|
+
* Indicates if the compiler should be enabled.
|
|
1038
|
+
*/
|
|
1039
|
+
enabled: true,
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Defines the output files path
|
|
1043
|
+
*/
|
|
1044
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Indicates if the components should be saved after being transformed.
|
|
1048
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1049
|
+
*/
|
|
1050
|
+
saveComponents: false,
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* Dictionary key prefix
|
|
1054
|
+
*/
|
|
1055
|
+
dictionaryKeyPrefix: "",
|
|
1056
|
+
},
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
module.exports = config;
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
<Tabs>
|
|
1063
|
+
<Tab value='Extract command'>
|
|
1064
|
+
|
|
1065
|
+
Run the extractor to transform your components and extract the content
|
|
1066
|
+
|
|
1067
|
+
```bash packageManager="npm"
|
|
1068
|
+
npx intlayer extract
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
```bash packageManager="pnpm"
|
|
1072
|
+
pnpm intlayer extract
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
```bash packageManager="yarn"
|
|
1076
|
+
yarn intlayer extract
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
```bash packageManager="bun"
|
|
1080
|
+
bunx intlayer extract
|
|
1081
|
+
```
|
|
1082
|
+
|
|
1083
|
+
</Tab>
|
|
1084
|
+
<Tab value='Babel compiler'>
|
|
1085
|
+
|
|
1086
|
+
Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
|
|
1087
|
+
|
|
1088
|
+
```ts fileName="vite.config.ts"
|
|
1089
|
+
import { defineConfig } from "vite";
|
|
1090
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
1091
|
+
|
|
1092
|
+
export default defineConfig({
|
|
1093
|
+
plugins: [
|
|
1094
|
+
intlayer(),
|
|
1095
|
+
intlayerCompiler(), // Adds the compiler plugin
|
|
1096
|
+
],
|
|
989
1097
|
});
|
|
990
1098
|
```
|
|
991
1099
|
|
|
992
|
-
|
|
1100
|
+
```bash packageManager="npm"
|
|
1101
|
+
npm run build # Or npm run dev
|
|
1102
|
+
```
|
|
993
1103
|
|
|
994
|
-
```
|
|
995
|
-
|
|
996
|
-
|
|
1104
|
+
```bash packageManager="pnpm"
|
|
1105
|
+
pnpm run build # Or pnpm run dev
|
|
1106
|
+
```
|
|
997
1107
|
|
|
998
|
-
|
|
999
|
-
|
|
1108
|
+
```bash packageManager="yarn"
|
|
1109
|
+
yarn build # Or yarn dev
|
|
1110
|
+
```
|
|
1000
1111
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
<!-- Basic syntax -->
|
|
1004
|
-
<myMarkdownContent />
|
|
1005
|
-
|
|
1006
|
-
<!-- Or with custom components -->
|
|
1007
|
-
<component
|
|
1008
|
-
:is="
|
|
1009
|
-
myMarkdownContent.use({
|
|
1010
|
-
h1: (props) => h('h1', { style: { color: 'red' } }, props.children),
|
|
1011
|
-
})
|
|
1012
|
-
"
|
|
1013
|
-
/>
|
|
1014
|
-
</div>
|
|
1015
|
-
</template>
|
|
1112
|
+
```bash packageManager="bun"
|
|
1113
|
+
bun run build # Or bun run dev
|
|
1016
1114
|
```
|
|
1017
1115
|
|
|
1116
|
+
</Tab>
|
|
1117
|
+
</Tabs>
|
|
1118
|
+
|
|
1018
1119
|
### Configure TypeScript
|
|
1019
1120
|
|
|
1020
1121
|
Intlayer uses module augmentation to get benefits of TypeScript and make your codebase stronger.
|
package/docs/en-GB/compiler.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-09
|
|
3
|
-
updatedAt: 2026-03-
|
|
3
|
+
updatedAt: 2026-03-12
|
|
4
4
|
title: Intlayer Compiler | Automated Content Extraction for i18n
|
|
5
5
|
description: Automate your internationalisation process with the Intlayer Compiler. Extract content directly from your components for faster, more efficient i18n in Vite, Next.js, and more.
|
|
6
6
|
keywords:
|
|
@@ -149,59 +149,83 @@ This configuration ensures that content declared in your components is automatic
|
|
|
149
149
|
See complete tutorial: [Intlayer Compiler with Next.js](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_with_nextjs_compiler.md)
|
|
150
150
|
|
|
151
151
|
</Tab>
|
|
152
|
+
</Tabs>
|
|
152
153
|
|
|
153
154
|
### Custom config
|
|
154
155
|
|
|
155
156
|
To customise the compiler behaviour, you can update the `intlayer.config.ts` file in the root of your project.
|
|
156
157
|
|
|
157
|
-
|
|
158
|
+
````ts fileName="intlayer.config.ts"
|
|
158
159
|
import { type IntlayerConfig, Locales } from "intlayer";
|
|
159
160
|
|
|
160
161
|
const config: IntlayerConfig = {
|
|
161
162
|
compiler: {
|
|
162
163
|
/**
|
|
164
|
+
* Indicates if the compiler should be enabled.
|
|
163
165
|
* Set to 'build-only' to skip the compiler during development and speed up start times.
|
|
164
166
|
*/
|
|
165
167
|
enabled: true,
|
|
166
168
|
|
|
167
169
|
/**
|
|
168
|
-
*
|
|
170
|
+
* Defines the output files path. Replaces `outputDir`.
|
|
171
|
+
*
|
|
172
|
+
* - Paths starting with `./` are resolved relatively to the component directory.
|
|
173
|
+
* - Paths starting with `/` are resolved relatively to the project root (`baseDir`).
|
|
174
|
+
*
|
|
175
|
+
* - Including the `{{locale}}` variable in the path will enable the generation of dictionaries separated by locale.
|
|
176
|
+
*
|
|
177
|
+
* Examples:
|
|
178
|
+
* ```ts
|
|
179
|
+
* {
|
|
180
|
+
* // Create multi-locale .content.ts files next to the component
|
|
181
|
+
* output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
182
|
+
*
|
|
183
|
+
* // output: './{{fileName}}{{extension}}', // Equivalent using string template
|
|
184
|
+
* }
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* ```ts
|
|
188
|
+
* {
|
|
189
|
+
* // Create centralized JSON files by locale in the project root
|
|
190
|
+
* output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
|
|
191
|
+
*
|
|
192
|
+
* // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using string template
|
|
193
|
+
* }
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* List of variables:
|
|
197
|
+
* - `fileName`: The file name.
|
|
198
|
+
* - `key`: The content key.
|
|
199
|
+
* - `locale`: The content locale.
|
|
200
|
+
* - `extension`: The file extension.
|
|
201
|
+
* - `componentFileName`: The component file name.
|
|
202
|
+
* - `componentExtension`: The component file extension.
|
|
203
|
+
* - `format`: The dictionary format.
|
|
204
|
+
* - `componentFormat`: The component dictionary format.
|
|
205
|
+
* - `componentDirPath`: The component directory path.
|
|
169
206
|
*/
|
|
170
|
-
|
|
171
|
-
"**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}",
|
|
172
|
-
"!**/node_modules/**",
|
|
173
|
-
],
|
|
207
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
174
208
|
|
|
175
209
|
/**
|
|
176
|
-
*
|
|
177
|
-
|
|
178
|
-
excludePattern: ["**/node_modules/**"],
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Output directory for the optimized dictionaries.
|
|
210
|
+
* Indicates if the components should be saved after being transformed.
|
|
211
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
182
212
|
*/
|
|
183
|
-
|
|
213
|
+
saveComponents: false,
|
|
184
214
|
|
|
185
215
|
/**
|
|
186
|
-
* Inset only content in generated file
|
|
216
|
+
* Inset only content in generated file. Useful for i18next or ICU MessageFormat JSON output per locale.
|
|
217
|
+
*
|
|
218
|
+
* - `output: ({ locale, key }) => `./locale/${locale}/${key}.json`,`
|
|
187
219
|
*/
|
|
188
220
|
noMetadata: false,
|
|
189
221
|
|
|
190
222
|
/**
|
|
191
223
|
* Dictionary key prefix
|
|
192
224
|
*/
|
|
193
|
-
dictionaryKeyPrefix: "", //
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Indicates if the components should be saved after being transformed.
|
|
197
|
-
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
198
|
-
*/
|
|
199
|
-
saveComponents: false,
|
|
225
|
+
dictionaryKeyPrefix: "", // Add an optional prefix for the extracted dictionary keys
|
|
200
226
|
},
|
|
201
227
|
};
|
|
202
|
-
|
|
203
|
-
export default config;
|
|
204
|
-
```
|
|
228
|
+
````
|
|
205
229
|
|
|
206
230
|
### Compiler Configuration Reference
|
|
207
231
|
|
|
@@ -211,34 +235,34 @@ The following properties can be configured in the `compiler` block of your `intl
|
|
|
211
235
|
- _Type_: `boolean | 'build-only'`
|
|
212
236
|
- _Default_: `true`
|
|
213
237
|
- _Description_: Indicates if the compiler should be enabled.
|
|
238
|
+
|
|
214
239
|
- **dictionaryKeyPrefix**:
|
|
215
240
|
- _Type_: `string`
|
|
216
|
-
- _Default_: `'
|
|
241
|
+
- _Default_: `''`
|
|
217
242
|
- _Description_: Prefix for the extracted dictionary keys.
|
|
243
|
+
|
|
218
244
|
- **transformPattern**:
|
|
219
245
|
- _Type_: `string | string[]`
|
|
220
246
|
- _Default_: `['**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}', '!**/node_modules/**']`
|
|
221
|
-
- _Description_: Patterns to traverse the code to
|
|
247
|
+
- _Description_: (Deprecated: use `build.traversePattern` instead) Patterns to traverse the code to optimise.
|
|
248
|
+
|
|
222
249
|
- **excludePattern**:
|
|
223
250
|
- _Type_: `string | string[]`
|
|
224
251
|
- _Default_: `['**/node_modules/**']`
|
|
225
|
-
- _Description_: Patterns to exclude from the
|
|
226
|
-
- **outputDir** (Deprecated):
|
|
227
|
-
- _Type_: `string`
|
|
228
|
-
- _Default_: `'compiler'`
|
|
229
|
-
- _Description_: The directory where the extracted dictionaries will be stored.
|
|
252
|
+
- _Description_: (Deprecated: use `build.traversePattern` instead) Patterns to exclude from the optimisation.
|
|
230
253
|
|
|
231
254
|
- **output**:
|
|
232
255
|
- _Type_: `FilePathPattern`
|
|
233
256
|
- _Default_: `({ key }) => 'compiler/${key}.content.json'`
|
|
234
257
|
- _Description_: Defines the output files path. Replaces `outputDir`. Handles dynamic variables like `{{locale}}`, `{{key}}`, `{{fileName}}`, `{{extension}}`, `{{format}}`, `{{dirPath}}`, `{{componentFileName}}`, `{{componentExtension}}`, `{{componentFormat}}`. Can be set as a string using `'my/{{var}}/path'` format, or as a function.
|
|
235
258
|
- _Note_: `./**/*` Path are resolved relatively to the component. `/**/*` path are resolved relatively to the Intlayer `baseDir`.
|
|
259
|
+
- _Note_: If the locale is defined in the path, the dictionaries will be generated by locale.
|
|
236
260
|
- _Example_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
|
|
237
261
|
|
|
238
262
|
- **noMetadata**:
|
|
239
263
|
- _Type_: `boolean`
|
|
240
264
|
- _Default_: `false`
|
|
241
|
-
- _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).
|
|
265
|
+
- _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.
|
|
242
266
|
- _Note_: Useful if used with `loadJSON` plugin.
|
|
243
267
|
- _Example_:
|
|
244
268
|
If `true`:
|
|
@@ -274,4 +298,12 @@ npx intlayer test # Test if there is missing translations
|
|
|
274
298
|
npx intlayer fill # Fill missing translations
|
|
275
299
|
```
|
|
276
300
|
|
|
277
|
-
|
|
301
|
+
### Extraction
|
|
302
|
+
|
|
303
|
+
Intlayer provides a CLI tool to extract content from your code. You can use the `intlayer extract` command to extract the content from your code.
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
npx intlayer extract
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
> For more details, refer to the [CLI documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/cli/index.md)
|
|
@@ -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 customise 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
|
|
@@ -92,7 +92,7 @@ Intlayer accepts JSON, JS, MJS, and TS configuration file formats:
|
|
|
92
92
|
|
|
93
93
|
## Example config file
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
````typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
96
96
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
97
97
|
import { nextjsRewrite } from "intlayer/routing";
|
|
98
98
|
import { z } from "zod";
|
|
@@ -190,7 +190,7 @@ const config: IntlayerConfig = {
|
|
|
190
190
|
* Options: 'cookie', 'localStorage', 'sessionStorage', 'header', or an array of these.
|
|
191
191
|
* Default: ['cookie', 'header']
|
|
192
192
|
*/
|
|
193
|
-
storage: "cookie",
|
|
193
|
+
storage: ["cookie", "header"],
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
196
|
* Base path for the application URLs.
|
|
@@ -327,6 +327,17 @@ const config: IntlayerConfig = {
|
|
|
327
327
|
* Base URL for the AI API.
|
|
328
328
|
*/
|
|
329
329
|
baseURL: "http://localhost:3000",
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Data serialisation
|
|
333
|
+
*
|
|
334
|
+
* Options:
|
|
335
|
+
* - "json": Standard, reliable; uses more tokens.
|
|
336
|
+
* - "toon": Fewer tokens, less consistent than JSON.
|
|
337
|
+
*
|
|
338
|
+
* Default: "json"
|
|
339
|
+
*/
|
|
340
|
+
dataSerialization: "json",
|
|
330
341
|
},
|
|
331
342
|
|
|
332
343
|
/**
|
|
@@ -426,42 +437,70 @@ const config: IntlayerConfig = {
|
|
|
426
437
|
compiler: {
|
|
427
438
|
/**
|
|
428
439
|
* Indicates if the compiler should be enabled.
|
|
440
|
+
*
|
|
441
|
+
* - false : Disables the compiler.
|
|
442
|
+
* - true : Enables the compiler.
|
|
443
|
+
* - "build-only" : Skips the compiler during development to speed up start times.
|
|
444
|
+
*
|
|
445
|
+
* Default: false
|
|
429
446
|
*/
|
|
430
447
|
enabled: true,
|
|
431
448
|
|
|
432
449
|
/**
|
|
433
|
-
*
|
|
450
|
+
* Defines the output files path. Replaces `outputDir`.
|
|
451
|
+
*
|
|
452
|
+
* - Paths starting with `./` are resolved relatively to the component directory.
|
|
453
|
+
* - Paths starting with `/` are resolved relatively to the project root (`baseDir`).
|
|
454
|
+
*
|
|
455
|
+
* - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
|
|
456
|
+
*
|
|
457
|
+
* Examples:
|
|
458
|
+
* ```ts
|
|
459
|
+
* {
|
|
460
|
+
* // Create multi-locale .content.ts files next to the component
|
|
461
|
+
* output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
462
|
+
*
|
|
463
|
+
* // output: './{{fileName}}{{extension}}', // Equivalent using a string template
|
|
464
|
+
* }
|
|
465
|
+
* ```
|
|
466
|
+
*
|
|
467
|
+
* ```ts
|
|
468
|
+
* {
|
|
469
|
+
* // Create centralised JSON files by locale in the project root
|
|
470
|
+
* output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
|
|
471
|
+
*
|
|
472
|
+
* // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using a string template
|
|
473
|
+
* }
|
|
474
|
+
* ```
|
|
475
|
+
*
|
|
476
|
+
* List of variables:
|
|
477
|
+
* - `fileName`: The file name.
|
|
478
|
+
* - `key`: The content key.
|
|
479
|
+
* - `locale`: The content locale.
|
|
480
|
+
* - `extension`: The file extension.
|
|
481
|
+
* - `componentFileName`: The component file name.
|
|
482
|
+
* - `componentExtension`: The component file extension.
|
|
483
|
+
* - `format`: The dictionary format.
|
|
484
|
+
* - `componentFormat`: The component dictionary format.
|
|
485
|
+
* - `componentDirPath`: The component directory path.
|
|
434
486
|
*/
|
|
435
|
-
|
|
436
|
-
"**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}",
|
|
437
|
-
"!**/node_modules/**",
|
|
438
|
-
],
|
|
487
|
+
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
439
488
|
|
|
440
489
|
/**
|
|
441
|
-
*
|
|
442
|
-
|
|
443
|
-
excludePattern: ["**/node_modules/**"],
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* Output directory for the optimized dictionaries.
|
|
490
|
+
* Indicates if the components should be saved after being transformed.
|
|
491
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
447
492
|
*/
|
|
448
|
-
|
|
493
|
+
saveComponents: false,
|
|
449
494
|
|
|
450
495
|
/**
|
|
451
|
-
*
|
|
496
|
+
* Insert only content into the generated file. Useful for per-locale i18next or ICU MessageFormat JSON outputs.
|
|
452
497
|
*/
|
|
453
498
|
noMetadata: false,
|
|
454
499
|
|
|
455
500
|
/**
|
|
456
501
|
* Dictionary key prefix
|
|
457
502
|
*/
|
|
458
|
-
dictionaryKeyPrefix: "", //
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Indicates if the components should be saved after being transformed.
|
|
462
|
-
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
463
|
-
*/
|
|
464
|
-
saveComponents: false,
|
|
503
|
+
dictionaryKeyPrefix: "", // Add optional prefix for the extracted dictionary keys
|
|
465
504
|
},
|
|
466
505
|
|
|
467
506
|
/**
|
|
@@ -480,7 +519,7 @@ const config: IntlayerConfig = {
|
|
|
480
519
|
};
|
|
481
520
|
|
|
482
521
|
export default config;
|
|
483
|
-
|
|
522
|
+
````
|
|
484
523
|
|
|
485
524
|
## Configuration Reference
|
|
486
525
|
|
|
@@ -1046,7 +1085,7 @@ Settings that control the Intlayer compiler, which extracts dictionaries straigh
|
|
|
1046
1085
|
|
|
1047
1086
|
- **dictionaryKeyPrefix**:
|
|
1048
1087
|
- _Type_: `string`
|
|
1049
|
-
- _Default_: `'
|
|
1088
|
+
- _Default_: `''`
|
|
1050
1089
|
- _Description_: Prefix for the extracted dictionary keys.
|
|
1051
1090
|
- _Example_: `'my-key-'`
|
|
1052
1091
|
- _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.
|
|
@@ -1070,22 +1109,25 @@ Settings that control the Intlayer compiler, which extracts dictionaries straigh
|
|
|
1070
1109
|
- _Description_: Patterns that define which files should be excluded during optimisation.
|
|
1071
1110
|
- _Example_: `['**/node_modules/**', '!**/node_modules/react/**']`
|
|
1072
1111
|
|
|
1073
|
-
- **outputDir**:
|
|
1074
|
-
- _Type_: `string`
|
|
1075
|
-
- _Default_: `'compiler'`
|
|
1076
|
-
- _Description_: The directory where the extracted dictionaries will be stored, relative to your project base path.
|
|
1077
|
-
|
|
1078
1112
|
- **output**:
|
|
1079
1113
|
- _Type_: `FilePathPattern`
|
|
1080
|
-
- _Default_: `
|
|
1081
|
-
- _Description_: Defines the output files path. Replaces `outputDir`.
|
|
1082
|
-
- _Note_:
|
|
1083
|
-
-
|
|
1114
|
+
- _Default_: `undefined`
|
|
1115
|
+
- _Description_: Defines the output files path. Replaces `outputDir`. Supports dynamic variables via a template string or a function. Supported variables: `{{fileName}}`, `{{key}}`, `{{locale}}`, `{{extension}}`, `{{componentFileName}}`, `{{componentExtension}}`, `{{format}}`, `{{componentFormat}}`, `{{componentDirPath}}`.
|
|
1116
|
+
- _Note_: Paths starting with `./` are resolved relatively to the component directory. Paths starting with `/` are resolved relatively to the project root (`baseDir`).
|
|
1117
|
+
- _Note_: Including the `{{locale}}` variable in the path will enable the generation of separate dictionaries per locale.
|
|
1118
|
+
- _Example_:
|
|
1119
|
+
- **Create multi-locale files next to the component**:
|
|
1120
|
+
- String: `'./{{fileName}}{{extension}}'`
|
|
1121
|
+
- Function: `({ fileName, extension }) => \`./${fileName}${extension}\``
|
|
1122
|
+
|
|
1123
|
+
- **Output centralised JSON files per locale**:
|
|
1124
|
+
- String: `'/locales/{{locale}}/{{key}}.content.json'`
|
|
1125
|
+
- Function: `({ key, locale }) => \`/locales/${locale}/${key}.content.json\``
|
|
1084
1126
|
|
|
1085
1127
|
- **noMetadata**:
|
|
1086
1128
|
- _Type_: `boolean`
|
|
1087
1129
|
- _Default_: `false`
|
|
1088
|
-
- _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).
|
|
1130
|
+
- _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.
|
|
1089
1131
|
- _Note_: Useful if used with `loadJSON` plugin.
|
|
1090
1132
|
- _Example_:
|
|
1091
1133
|
If `true`:
|