@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
|
@@ -1316,6 +1316,165 @@ return (
|
|
|
1316
1316
|
);
|
|
1317
1317
|
```
|
|
1318
1318
|
|
|
1319
|
+
### (Optional) Step 12: Extract the content of your components
|
|
1320
|
+
|
|
1321
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
1322
|
+
|
|
1323
|
+
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.
|
|
1324
|
+
|
|
1325
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
1326
|
+
|
|
1327
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
1328
|
+
import { type IntlayerConfig } from "intlayer";
|
|
1329
|
+
|
|
1330
|
+
const config: IntlayerConfig = {
|
|
1331
|
+
// ... Rest of your config
|
|
1332
|
+
compiler: {
|
|
1333
|
+
/**
|
|
1334
|
+
* Indicates if the compiler should be enabled.
|
|
1335
|
+
*/
|
|
1336
|
+
enabled: true,
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* Defines the output files path
|
|
1340
|
+
*/
|
|
1341
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Indicates if the components should be saved after being transformed.
|
|
1345
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1346
|
+
*/
|
|
1347
|
+
saveComponents: false,
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Dictionary key prefix
|
|
1351
|
+
*/
|
|
1352
|
+
dictionaryKeyPrefix: "",
|
|
1353
|
+
},
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
export default config;
|
|
1357
|
+
```
|
|
1358
|
+
|
|
1359
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
1360
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
1361
|
+
const config = {
|
|
1362
|
+
// ... Rest of your config
|
|
1363
|
+
compiler: {
|
|
1364
|
+
/**
|
|
1365
|
+
* Indicates if the compiler should be enabled.
|
|
1366
|
+
*/
|
|
1367
|
+
enabled: true,
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* Defines the output files path
|
|
1371
|
+
*/
|
|
1372
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* Indicates if the components should be saved after being transformed.
|
|
1376
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1377
|
+
*/
|
|
1378
|
+
saveComponents: false,
|
|
1379
|
+
|
|
1380
|
+
/**
|
|
1381
|
+
* Dictionary key prefix
|
|
1382
|
+
*/
|
|
1383
|
+
dictionaryKeyPrefix: "",
|
|
1384
|
+
},
|
|
1385
|
+
};
|
|
1386
|
+
|
|
1387
|
+
export default config;
|
|
1388
|
+
```
|
|
1389
|
+
|
|
1390
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
1391
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
1392
|
+
const config = {
|
|
1393
|
+
// ... Rest of your config
|
|
1394
|
+
compiler: {
|
|
1395
|
+
/**
|
|
1396
|
+
* Indicates if the compiler should be enabled.
|
|
1397
|
+
*/
|
|
1398
|
+
enabled: true,
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* Defines the output files path
|
|
1402
|
+
*/
|
|
1403
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* Indicates if the components should be saved after being transformed.
|
|
1407
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1408
|
+
*/
|
|
1409
|
+
saveComponents: false,
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* Dictionary key prefix
|
|
1413
|
+
*/
|
|
1414
|
+
dictionaryKeyPrefix: "",
|
|
1415
|
+
},
|
|
1416
|
+
};
|
|
1417
|
+
|
|
1418
|
+
module.exports = config;
|
|
1419
|
+
```
|
|
1420
|
+
|
|
1421
|
+
<Tabs>
|
|
1422
|
+
<Tab value='Extract command'>
|
|
1423
|
+
|
|
1424
|
+
Run the extractor to transform your components and extract the content
|
|
1425
|
+
|
|
1426
|
+
```bash packageManager="npm"
|
|
1427
|
+
npx intlayer extract
|
|
1428
|
+
```
|
|
1429
|
+
|
|
1430
|
+
```bash packageManager="pnpm"
|
|
1431
|
+
pnpm intlayer extract
|
|
1432
|
+
```
|
|
1433
|
+
|
|
1434
|
+
```bash packageManager="yarn"
|
|
1435
|
+
yarn intlayer extract
|
|
1436
|
+
```
|
|
1437
|
+
|
|
1438
|
+
```bash packageManager="bun"
|
|
1439
|
+
bunx intlayer extract
|
|
1440
|
+
```
|
|
1441
|
+
|
|
1442
|
+
</Tab>
|
|
1443
|
+
<Tab value='Babel compiler'>
|
|
1444
|
+
|
|
1445
|
+
Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
|
|
1446
|
+
|
|
1447
|
+
```ts fileName="vite.config.ts"
|
|
1448
|
+
import { defineConfig } from "vite";
|
|
1449
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
1450
|
+
|
|
1451
|
+
export default defineConfig({
|
|
1452
|
+
plugins: [
|
|
1453
|
+
intlayer(),
|
|
1454
|
+
intlayerCompiler(), // Adds the compiler plugin
|
|
1455
|
+
],
|
|
1456
|
+
});
|
|
1457
|
+
```
|
|
1458
|
+
|
|
1459
|
+
```bash packageManager="npm"
|
|
1460
|
+
npm run build # Or npm run dev
|
|
1461
|
+
```
|
|
1462
|
+
|
|
1463
|
+
```bash packageManager="pnpm"
|
|
1464
|
+
pnpm run build # Or pnpm run dev
|
|
1465
|
+
```
|
|
1466
|
+
|
|
1467
|
+
```bash packageManager="yarn"
|
|
1468
|
+
yarn build # Or yarn dev
|
|
1469
|
+
```
|
|
1470
|
+
|
|
1471
|
+
```bash packageManager="bun"
|
|
1472
|
+
bun run build # Or bun run dev
|
|
1473
|
+
```
|
|
1474
|
+
|
|
1475
|
+
</Tab>
|
|
1476
|
+
</Tabs>
|
|
1477
|
+
|
|
1319
1478
|
### Configure TypeScript
|
|
1320
1479
|
|
|
1321
1480
|
Intlayer use module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
@@ -1357,6 +1357,165 @@ Link.displayName = "Link";
|
|
|
1357
1357
|
|
|
1358
1358
|
By integrating this `Link` component across your application, you maintain a coherent and language-aware user experience while also benefitting from improved SEO and usability.
|
|
1359
1359
|
|
|
1360
|
+
### (Optional) Step 11: Extract the content of your components
|
|
1361
|
+
|
|
1362
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
1363
|
+
|
|
1364
|
+
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.
|
|
1365
|
+
|
|
1366
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
1367
|
+
|
|
1368
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
1369
|
+
import { type IntlayerConfig } from "intlayer";
|
|
1370
|
+
|
|
1371
|
+
const config: IntlayerConfig = {
|
|
1372
|
+
// ... Rest of your config
|
|
1373
|
+
compiler: {
|
|
1374
|
+
/**
|
|
1375
|
+
* Indicates if the compiler should be enabled.
|
|
1376
|
+
*/
|
|
1377
|
+
enabled: true,
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* Defines the output files path
|
|
1381
|
+
*/
|
|
1382
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1383
|
+
|
|
1384
|
+
/**
|
|
1385
|
+
* Indicates if the components should be saved after being transformed.
|
|
1386
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1387
|
+
*/
|
|
1388
|
+
saveComponents: false,
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Dictionary key prefix
|
|
1392
|
+
*/
|
|
1393
|
+
dictionaryKeyPrefix: "",
|
|
1394
|
+
},
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
export default config;
|
|
1398
|
+
```
|
|
1399
|
+
|
|
1400
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
1401
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
1402
|
+
const config = {
|
|
1403
|
+
// ... Rest of your config
|
|
1404
|
+
compiler: {
|
|
1405
|
+
/**
|
|
1406
|
+
* Indicates if the compiler should be enabled.
|
|
1407
|
+
*/
|
|
1408
|
+
enabled: true,
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Defines the output files path
|
|
1412
|
+
*/
|
|
1413
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* Indicates if the components should be saved after being transformed.
|
|
1417
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1418
|
+
*/
|
|
1419
|
+
saveComponents: false,
|
|
1420
|
+
|
|
1421
|
+
/**
|
|
1422
|
+
* Dictionary key prefix
|
|
1423
|
+
*/
|
|
1424
|
+
dictionaryKeyPrefix: "",
|
|
1425
|
+
},
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1428
|
+
export default config;
|
|
1429
|
+
```
|
|
1430
|
+
|
|
1431
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
1432
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
1433
|
+
const config = {
|
|
1434
|
+
// ... Rest of your config
|
|
1435
|
+
compiler: {
|
|
1436
|
+
/**
|
|
1437
|
+
* Indicates if the compiler should be enabled.
|
|
1438
|
+
*/
|
|
1439
|
+
enabled: true,
|
|
1440
|
+
|
|
1441
|
+
/**
|
|
1442
|
+
* Defines the output files path
|
|
1443
|
+
*/
|
|
1444
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* Indicates if the components should be saved after being transformed.
|
|
1448
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
1449
|
+
*/
|
|
1450
|
+
saveComponents: false,
|
|
1451
|
+
|
|
1452
|
+
/**
|
|
1453
|
+
* Dictionary key prefix
|
|
1454
|
+
*/
|
|
1455
|
+
dictionaryKeyPrefix: "",
|
|
1456
|
+
},
|
|
1457
|
+
};
|
|
1458
|
+
|
|
1459
|
+
module.exports = config;
|
|
1460
|
+
```
|
|
1461
|
+
|
|
1462
|
+
<Tabs>
|
|
1463
|
+
<Tab value='Extract command'>
|
|
1464
|
+
|
|
1465
|
+
Run the extractor to transform your components and extract the content
|
|
1466
|
+
|
|
1467
|
+
```bash packageManager="npm"
|
|
1468
|
+
npx intlayer extract
|
|
1469
|
+
```
|
|
1470
|
+
|
|
1471
|
+
```bash packageManager="pnpm"
|
|
1472
|
+
pnpm intlayer extract
|
|
1473
|
+
```
|
|
1474
|
+
|
|
1475
|
+
```bash packageManager="yarn"
|
|
1476
|
+
yarn intlayer extract
|
|
1477
|
+
```
|
|
1478
|
+
|
|
1479
|
+
```bash packageManager="bun"
|
|
1480
|
+
bunx intlayer extract
|
|
1481
|
+
```
|
|
1482
|
+
|
|
1483
|
+
</Tab>
|
|
1484
|
+
<Tab value='Babel compiler'>
|
|
1485
|
+
|
|
1486
|
+
Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
|
|
1487
|
+
|
|
1488
|
+
```ts fileName="vite.config.ts"
|
|
1489
|
+
import { defineConfig } from "vite";
|
|
1490
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
1491
|
+
|
|
1492
|
+
export default defineConfig({
|
|
1493
|
+
plugins: [
|
|
1494
|
+
intlayer(),
|
|
1495
|
+
intlayerCompiler(), // Adds the compiler plugin
|
|
1496
|
+
],
|
|
1497
|
+
});
|
|
1498
|
+
```
|
|
1499
|
+
|
|
1500
|
+
```bash packageManager="npm"
|
|
1501
|
+
npm run build # Or npm run dev
|
|
1502
|
+
```
|
|
1503
|
+
|
|
1504
|
+
```bash packageManager="pnpm"
|
|
1505
|
+
pnpm run build # Or pnpm run dev
|
|
1506
|
+
```
|
|
1507
|
+
|
|
1508
|
+
```bash packageManager="yarn"
|
|
1509
|
+
yarn build # Or yarn dev
|
|
1510
|
+
```
|
|
1511
|
+
|
|
1512
|
+
```bash packageManager="bun"
|
|
1513
|
+
bun run build # Or bun run dev
|
|
1514
|
+
```
|
|
1515
|
+
|
|
1516
|
+
</Tab>
|
|
1517
|
+
</Tabs>
|
|
1518
|
+
|
|
1360
1519
|
### Configure TypeScript
|
|
1361
1520
|
|
|
1362
1521
|
Intlayer use module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
@@ -622,44 +622,165 @@ export const Link: ParentComponent<AnchorProps> = (props) => {
|
|
|
622
622
|
};
|
|
623
623
|
```
|
|
624
624
|
|
|
625
|
-
### (Optional) Step 11:
|
|
625
|
+
### (Optional) Step 11: Extract the content of your components
|
|
626
626
|
|
|
627
|
-
|
|
627
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
628
628
|
|
|
629
|
-
|
|
630
|
-
import { render } from "solid-js/web";
|
|
631
|
-
import { MarkdownProvider } from "solid-intlayer";
|
|
632
|
-
import App from "./App";
|
|
629
|
+
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.
|
|
633
630
|
|
|
634
|
-
|
|
631
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
635
632
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
633
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
634
|
+
import { type IntlayerConfig } from "intlayer";
|
|
635
|
+
|
|
636
|
+
const config: IntlayerConfig = {
|
|
637
|
+
// ... Rest of your config
|
|
638
|
+
compiler: {
|
|
639
|
+
/**
|
|
640
|
+
* Indicates if the compiler should be enabled.
|
|
641
|
+
*/
|
|
642
|
+
enabled: true,
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Defines the output files path
|
|
646
|
+
*/
|
|
647
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Indicates if the components should be saved after being transformed.
|
|
651
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
652
|
+
*/
|
|
653
|
+
saveComponents: false,
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Dictionary key prefix
|
|
657
|
+
*/
|
|
658
|
+
dictionaryKeyPrefix: "",
|
|
659
|
+
},
|
|
660
|
+
};
|
|
645
661
|
|
|
646
|
-
|
|
662
|
+
export default config;
|
|
663
|
+
```
|
|
647
664
|
|
|
648
|
-
```
|
|
649
|
-
|
|
665
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
666
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
667
|
+
const config = {
|
|
668
|
+
// ... Rest of your config
|
|
669
|
+
compiler: {
|
|
670
|
+
/**
|
|
671
|
+
* Indicates if the compiler should be enabled.
|
|
672
|
+
*/
|
|
673
|
+
enabled: true,
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Defines the output files path
|
|
677
|
+
*/
|
|
678
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Indicates if the components should be saved after being transformed.
|
|
682
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
683
|
+
*/
|
|
684
|
+
saveComponents: false,
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Dictionary key prefix
|
|
688
|
+
*/
|
|
689
|
+
dictionaryKeyPrefix: "",
|
|
690
|
+
},
|
|
691
|
+
};
|
|
650
692
|
|
|
651
|
-
|
|
652
|
-
|
|
693
|
+
export default config;
|
|
694
|
+
```
|
|
653
695
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
696
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
697
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
698
|
+
const config = {
|
|
699
|
+
// ... Rest of your config
|
|
700
|
+
compiler: {
|
|
701
|
+
/**
|
|
702
|
+
* Indicates if the compiler should be enabled.
|
|
703
|
+
*/
|
|
704
|
+
enabled: true,
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Defines the output files path
|
|
708
|
+
*/
|
|
709
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Indicates if the components should be saved after being transformed.
|
|
713
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
714
|
+
*/
|
|
715
|
+
saveComponents: false,
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Dictionary key prefix
|
|
719
|
+
*/
|
|
720
|
+
dictionaryKeyPrefix: "",
|
|
721
|
+
},
|
|
660
722
|
};
|
|
723
|
+
|
|
724
|
+
module.exports = config;
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
<Tabs>
|
|
728
|
+
<Tab value='Extract command'>
|
|
729
|
+
|
|
730
|
+
Run the extractor to transform your components and extract the content
|
|
731
|
+
|
|
732
|
+
```bash packageManager="npm"
|
|
733
|
+
npx intlayer extract
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
```bash packageManager="pnpm"
|
|
737
|
+
pnpm intlayer extract
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
```bash packageManager="yarn"
|
|
741
|
+
yarn intlayer extract
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
```bash packageManager="bun"
|
|
745
|
+
bunx intlayer extract
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
</Tab>
|
|
749
|
+
<Tab value='Babel compiler'>
|
|
750
|
+
|
|
751
|
+
Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
|
|
752
|
+
|
|
753
|
+
```ts fileName="vite.config.ts"
|
|
754
|
+
import { defineConfig } from "vite";
|
|
755
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
756
|
+
|
|
757
|
+
export default defineConfig({
|
|
758
|
+
plugins: [
|
|
759
|
+
intlayer(),
|
|
760
|
+
intlayerCompiler(), // Adds the compiler plugin
|
|
761
|
+
],
|
|
762
|
+
});
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
```bash packageManager="npm"
|
|
766
|
+
npm run build # Or npm run dev
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
```bash packageManager="pnpm"
|
|
770
|
+
pnpm run build # Or pnpm run dev
|
|
661
771
|
```
|
|
662
772
|
|
|
773
|
+
```bash packageManager="yarn"
|
|
774
|
+
yarn build # Or yarn dev
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
```bash packageManager="bun"
|
|
778
|
+
bun run build # Or bun run dev
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
</Tab>
|
|
782
|
+
</Tabs>
|
|
783
|
+
|
|
663
784
|
### Configure TypeScript
|
|
664
785
|
|
|
665
786
|
Ensure your TypeScript configuration includes the autogenerated types.
|
|
@@ -504,6 +504,165 @@ For SEO, it is recommended to prefix your routes with the locale (e.g., `/about`
|
|
|
504
504
|
</a>
|
|
505
505
|
```
|
|
506
506
|
|
|
507
|
+
### (Optional) Step 10: Extract the content of your components
|
|
508
|
+
|
|
509
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
510
|
+
|
|
511
|
+
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.
|
|
512
|
+
|
|
513
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
514
|
+
|
|
515
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
516
|
+
import { type IntlayerConfig } from "intlayer";
|
|
517
|
+
|
|
518
|
+
const config: IntlayerConfig = {
|
|
519
|
+
// ... Rest of your config
|
|
520
|
+
compiler: {
|
|
521
|
+
/**
|
|
522
|
+
* Indicates if the compiler should be enabled.
|
|
523
|
+
*/
|
|
524
|
+
enabled: true,
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Defines the output files path
|
|
528
|
+
*/
|
|
529
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Indicates if the components should be saved after being transformed.
|
|
533
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
534
|
+
*/
|
|
535
|
+
saveComponents: false,
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Dictionary key prefix
|
|
539
|
+
*/
|
|
540
|
+
dictionaryKeyPrefix: "",
|
|
541
|
+
},
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
export default config;
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
548
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
549
|
+
const config = {
|
|
550
|
+
// ... Rest of your config
|
|
551
|
+
compiler: {
|
|
552
|
+
/**
|
|
553
|
+
* Indicates if the compiler should be enabled.
|
|
554
|
+
*/
|
|
555
|
+
enabled: true,
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Defines the output files path
|
|
559
|
+
*/
|
|
560
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Indicates if the components should be saved after being transformed.
|
|
564
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
565
|
+
*/
|
|
566
|
+
saveComponents: false,
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Dictionary key prefix
|
|
570
|
+
*/
|
|
571
|
+
dictionaryKeyPrefix: "",
|
|
572
|
+
},
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
export default config;
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
579
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
580
|
+
const config = {
|
|
581
|
+
// ... Rest of your config
|
|
582
|
+
compiler: {
|
|
583
|
+
/**
|
|
584
|
+
* Indicates if the compiler should be enabled.
|
|
585
|
+
*/
|
|
586
|
+
enabled: true,
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Defines the output files path
|
|
590
|
+
*/
|
|
591
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Indicates if the components should be saved after being transformed.
|
|
595
|
+
* That way, the compiler can be run only once to transform the app, and then it can be removed.
|
|
596
|
+
*/
|
|
597
|
+
saveComponents: false,
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Dictionary key prefix
|
|
601
|
+
*/
|
|
602
|
+
dictionaryKeyPrefix: "",
|
|
603
|
+
},
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
module.exports = config;
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
<Tabs>
|
|
610
|
+
<Tab value='Extract command'>
|
|
611
|
+
|
|
612
|
+
Run the extractor to transform your components and extract the content
|
|
613
|
+
|
|
614
|
+
```bash packageManager="npm"
|
|
615
|
+
npx intlayer extract
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
```bash packageManager="pnpm"
|
|
619
|
+
pnpm intlayer extract
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
```bash packageManager="yarn"
|
|
623
|
+
yarn intlayer extract
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
```bash packageManager="bun"
|
|
627
|
+
bunx intlayer extract
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
</Tab>
|
|
631
|
+
<Tab value='Babel compiler'>
|
|
632
|
+
|
|
633
|
+
Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
|
|
634
|
+
|
|
635
|
+
```ts fileName="vite.config.ts"
|
|
636
|
+
import { defineConfig } from "vite";
|
|
637
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
638
|
+
|
|
639
|
+
export default defineConfig({
|
|
640
|
+
plugins: [
|
|
641
|
+
intlayer(),
|
|
642
|
+
intlayerCompiler(), // Adds the compiler plugin
|
|
643
|
+
],
|
|
644
|
+
});
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
```bash packageManager="npm"
|
|
648
|
+
npm run build # Or npm run dev
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
```bash packageManager="pnpm"
|
|
652
|
+
pnpm run build # Or pnpm run dev
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
```bash packageManager="yarn"
|
|
656
|
+
yarn build # Or yarn dev
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
```bash packageManager="bun"
|
|
660
|
+
bun run build # Or bun run dev
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
</Tab>
|
|
664
|
+
</Tabs>
|
|
665
|
+
|
|
507
666
|
### Git Configuration
|
|
508
667
|
|
|
509
668
|
It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
|