@intlayer/docs 8.2.4 → 8.3.0-canary.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/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/cjs/blog.cjs.map +1 -1
- package/dist/cjs/common.cjs +1 -1
- package/dist/cjs/common.cjs.map +1 -1
- package/dist/cjs/doc.cjs.map +1 -1
- package/dist/cjs/frequentQuestions.cjs.map +1 -1
- package/dist/cjs/generated/blog.entry.cjs +1 -1
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +1 -1
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +1 -1
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/cjs/legal.cjs.map +1 -1
- package/dist/esm/blog.mjs.map +1 -1
- package/dist/esm/common.mjs +1 -1
- package/dist/esm/common.mjs.map +1 -1
- package/dist/esm/doc.mjs.map +1 -1
- package/dist/esm/frequentQuestions.mjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
- package/dist/esm/generated/legal.entry.mjs.map +1 -1
- package/dist/esm/legal.mjs.map +1 -1
- package/dist/types/blog.d.ts +1 -1
- package/dist/types/common.d.ts +1 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/doc.d.ts +1 -1
- package/dist/types/frequentQuestions.d.ts +1 -1
- package/dist/types/generated/blog.entry.d.ts +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -1
- package/dist/types/generated/frequentQuestions.entry.d.ts +1 -1
- package/dist/types/generated/legal.entry.d.ts +1 -1
- package/dist/types/legal.d.ts +1 -1
- package/docs/ar/compiler.md +73 -8
- package/docs/ar/configuration.md +74 -27
- package/docs/ar/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/ar/intlayer_with_tanstack.md +22 -1
- package/docs/ar/intlayer_with_vite+react_compiler.md +13 -5
- package/docs/de/compiler.md +74 -9
- package/docs/de/configuration.md +61 -22
- package/docs/de/intlayer_with_nextjs_compiler.md +12 -4
- package/docs/de/intlayer_with_tanstack.md +22 -1
- package/docs/de/intlayer_with_vite+react_compiler.md +12 -4
- package/docs/en/compiler.md +79 -1
- package/docs/en/configuration.md +50 -9
- package/docs/en/intlayer_with_nextjs_compiler.md +9 -1
- package/docs/en/intlayer_with_tanstack.md +23 -2
- package/docs/en/intlayer_with_vite+react_compiler.md +9 -1
- package/docs/en-GB/compiler.md +72 -6
- package/docs/en-GB/configuration.md +50 -10
- package/docs/en-GB/intlayer_with_nextjs_compiler.md +22 -3
- package/docs/en-GB/intlayer_with_tanstack.md +22 -1
- package/docs/en-GB/intlayer_with_vite+react_compiler.md +22 -3
- package/docs/es/compiler.md +71 -6
- package/docs/es/configuration.md +65 -26
- package/docs/es/intlayer_with_nextjs_compiler.md +9 -1
- package/docs/es/intlayer_with_tanstack.md +22 -1
- package/docs/es/intlayer_with_vite+react_compiler.md +9 -1
- package/docs/fr/compiler.md +69 -4
- package/docs/fr/configuration.md +62 -23
- package/docs/fr/intlayer_with_nextjs_compiler.md +9 -1
- package/docs/fr/intlayer_with_tanstack.md +22 -1
- package/docs/fr/intlayer_with_vite+react_compiler.md +9 -1
- package/docs/hi/compiler.md +74 -9
- package/docs/hi/configuration.md +70 -23
- package/docs/hi/intlayer_with_nextjs_compiler.md +15 -7
- package/docs/hi/intlayer_with_tanstack.md +22 -1
- package/docs/hi/intlayer_with_vite+react_compiler.md +15 -7
- package/docs/id/compiler.md +73 -8
- package/docs/id/configuration.md +67 -20
- package/docs/id/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/id/intlayer_with_tanstack.md +22 -1
- package/docs/id/intlayer_with_vite+react_compiler.md +13 -5
- package/docs/it/compiler.md +73 -8
- package/docs/it/configuration.md +66 -27
- package/docs/it/intlayer_with_nextjs_compiler.md +12 -4
- package/docs/it/intlayer_with_tanstack.md +22 -1
- package/docs/it/intlayer_with_vite+react_compiler.md +12 -4
- package/docs/ja/compiler.md +75 -10
- package/docs/ja/configuration.md +70 -23
- package/docs/ja/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/ja/intlayer_with_tanstack.md +22 -1
- package/docs/ja/intlayer_with_vite+react_compiler.md +13 -5
- package/docs/ko/compiler.md +75 -10
- package/docs/ko/configuration.md +70 -23
- package/docs/ko/intlayer_with_nextjs_compiler.md +22 -3
- package/docs/ko/intlayer_with_tanstack.md +22 -1
- package/docs/ko/intlayer_with_vite+react_compiler.md +22 -3
- package/docs/pl/compiler.md +73 -8
- package/docs/pl/configuration.md +71 -29
- package/docs/pl/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/pl/intlayer_with_tanstack.md +22 -1
- package/docs/pl/intlayer_with_vite+react_compiler.md +13 -5
- package/docs/pt/compiler.md +74 -9
- package/docs/pt/configuration.md +62 -23
- package/docs/pt/intlayer_with_nextjs_compiler.md +12 -4
- package/docs/pt/intlayer_with_tanstack.md +22 -1
- package/docs/pt/intlayer_with_vite+react_compiler.md +12 -4
- package/docs/ru/compiler.md +74 -9
- package/docs/ru/configuration.md +61 -22
- package/docs/ru/intlayer_with_nextjs_compiler.md +11 -3
- package/docs/ru/intlayer_with_tanstack.md +22 -1
- package/docs/ru/intlayer_with_vite+react_compiler.md +11 -3
- package/docs/tr/compiler.md +73 -8
- package/docs/tr/configuration.md +77 -42
- package/docs/tr/intlayer_with_nextjs_compiler.md +11 -3
- package/docs/tr/intlayer_with_tanstack.md +22 -1
- package/docs/tr/intlayer_with_vite+react_compiler.md +11 -3
- package/docs/uk/compiler.md +74 -9
- package/docs/uk/configuration.md +207 -165
- package/docs/uk/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/uk/intlayer_with_tanstack.md +22 -1
- package/docs/uk/intlayer_with_vite+react_compiler.md +13 -5
- package/docs/vi/compiler.md +75 -10
- package/docs/vi/configuration.md +97 -21
- package/docs/vi/intlayer_with_nextjs_compiler.md +14 -6
- package/docs/vi/intlayer_with_tanstack.md +22 -1
- package/docs/vi/intlayer_with_vite+react_compiler.md +14 -6
- package/docs/zh/compiler.md +75 -10
- package/docs/zh/configuration.md +77 -42
- package/docs/zh/intlayer_with_nextjs_compiler.md +13 -5
- package/docs/zh/intlayer_with_tanstack.md +22 -1
- package/docs/zh/intlayer_with_vite+react_compiler.md +13 -5
- package/package.json +17 -17
- package/src/blog.ts +1 -1
- package/src/common.ts +2 -1
- package/src/doc.ts +1 -1
- package/src/frequentQuestions.ts +1 -1
- package/src/generated/blog.entry.ts +1 -1
- package/src/generated/docs.entry.ts +1 -1
- package/src/generated/frequentQuestions.entry.ts +1 -1
- package/src/generated/legal.entry.ts +1 -1
- package/src/legal.ts +1 -1
package/docs/en/configuration.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2024-08-13
|
|
3
|
-
updatedAt: 2026-
|
|
3
|
+
updatedAt: 2026-03-11
|
|
4
4
|
title: Configuration
|
|
5
5
|
description: Learn how to configure Intlayer for your application. Understand the various settings and options available to customize Intlayer to your needs.
|
|
6
6
|
keywords:
|
|
@@ -14,6 +14,12 @@ slugs:
|
|
|
14
14
|
- concept
|
|
15
15
|
- configuration
|
|
16
16
|
history:
|
|
17
|
+
- version: 8.3.0
|
|
18
|
+
data: 2026-03-11
|
|
19
|
+
changes: Move 'baseDir' from 'content' to 'system' config
|
|
20
|
+
- version: 8.2.0
|
|
21
|
+
date: 2026-03-09
|
|
22
|
+
changes: Update compiler options, add 'output' and 'noMetadata' support
|
|
17
23
|
- version: 8.1.7
|
|
18
24
|
date: 2026-02-25
|
|
19
25
|
changes: Update compiler options
|
|
@@ -478,7 +484,12 @@ const config: IntlayerConfig = {
|
|
|
478
484
|
/**
|
|
479
485
|
* Output directory for the optimized dictionaries.
|
|
480
486
|
*/
|
|
481
|
-
|
|
487
|
+
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Inset only content in generated file, without key.
|
|
491
|
+
*/
|
|
492
|
+
noMetadata: false,
|
|
482
493
|
|
|
483
494
|
/**
|
|
484
495
|
* Dictionary key prefix
|
|
@@ -910,13 +921,6 @@ Settings related to content handling within the application, including directory
|
|
|
910
921
|
- _Example_: `['.data.ts', '.data.js', '.data.json']`
|
|
911
922
|
- _Note_: Customizing file extensions can help avoid conflicts.
|
|
912
923
|
|
|
913
|
-
- **baseDir**:
|
|
914
|
-
- _Type_: `string`
|
|
915
|
-
- _Default_: `process.cwd()`
|
|
916
|
-
- _Description_: The base directory for the project.
|
|
917
|
-
- _Example_: `'/path/to/project'`
|
|
918
|
-
- _Note_: This is used to resolve all Intlayer-related directories.
|
|
919
|
-
|
|
920
924
|
- **contentDir**:
|
|
921
925
|
- _Type_: `string[]`
|
|
922
926
|
- _Default_: `['.']`
|
|
@@ -955,6 +959,13 @@ Settings related to internal paths and output results of Intlayer. These setting
|
|
|
955
959
|
|
|
956
960
|
#### Properties
|
|
957
961
|
|
|
962
|
+
- **baseDir**:
|
|
963
|
+
- _Type_: `string`
|
|
964
|
+
- _Default_: `process.cwd()`
|
|
965
|
+
- _Description_: The base directory for the project.
|
|
966
|
+
- _Example_: `'/path/to/project'`
|
|
967
|
+
- _Note_: This is used to resolve all Intlayer-related directories.
|
|
968
|
+
|
|
958
969
|
- **dictionariesDir**:
|
|
959
970
|
- _Type_: `string`
|
|
960
971
|
- _Default_: `'.intlayer/dictionary'`
|
|
@@ -1262,3 +1273,33 @@ Settings that control the Intlayer compiler, which extracts dictionaries straigh
|
|
|
1262
1273
|
- _Type_: `string`
|
|
1263
1274
|
- _Default_: `'compiler'`
|
|
1264
1275
|
- _Description_: The directory where the extracted dictionaries will be stored, relative to your project base path.
|
|
1276
|
+
|
|
1277
|
+
- **output**:
|
|
1278
|
+
- _Type_: `FilePathPattern`
|
|
1279
|
+
- _Default_: `({ key }) => 'compiler/${key}.content.json'`
|
|
1280
|
+
- _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.
|
|
1281
|
+
- _Note_: `./**/*` Path are resolved relatively to the component. `/**/*` path are resolved relatively to the Intlayer `baseDir`.
|
|
1282
|
+
- _Note_: If locale is set in the path, it will generate per-locale dictionaries.
|
|
1283
|
+
- _Example_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
|
|
1284
|
+
|
|
1285
|
+
- **noMetadata**:
|
|
1286
|
+
- _Type_: `boolean`
|
|
1287
|
+
- _Default_: `false`
|
|
1288
|
+
- _Description_: Indicates if the metadata should be saved in the file. If true, the compiler will not save the metadata of the dictionaries (key, content wrapper).
|
|
1289
|
+
- _Note_: Useful if used with `loadJSON` plugin.
|
|
1290
|
+
- _Example_:
|
|
1291
|
+
If `true`:
|
|
1292
|
+
```json
|
|
1293
|
+
{
|
|
1294
|
+
"key": "value"
|
|
1295
|
+
}
|
|
1296
|
+
```
|
|
1297
|
+
If `false`:
|
|
1298
|
+
```json
|
|
1299
|
+
{
|
|
1300
|
+
"key": "value",
|
|
1301
|
+
"content": {
|
|
1302
|
+
"key": "value"
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
```
|
|
@@ -20,6 +20,9 @@ slugs:
|
|
|
20
20
|
applicationTemplate: https://github.com/aymericzip/intlayer-next-no-lolale-path-template
|
|
21
21
|
youtubeVideo: https://www.youtube.com/watch?v=e_PPG7PTqGU
|
|
22
22
|
history:
|
|
23
|
+
- version: 8.2.0
|
|
24
|
+
date: 2026-03-09
|
|
25
|
+
changes: Update compiler options, add FilePathPattern support
|
|
23
26
|
- version: 8.1.6
|
|
24
27
|
date: 2026-02-23
|
|
25
28
|
changes: Initial release
|
|
@@ -135,7 +138,12 @@ const config: IntlayerConfig = {
|
|
|
135
138
|
/**
|
|
136
139
|
* Output directory for the optimized dictionaries.
|
|
137
140
|
*/
|
|
138
|
-
|
|
141
|
+
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Inset only content in generated file, without key.
|
|
145
|
+
*/
|
|
146
|
+
noMetadata: false,
|
|
139
147
|
|
|
140
148
|
/**
|
|
141
149
|
* Dictionary key prefix
|
|
@@ -426,7 +426,7 @@ Access your content dictionaries throughout your application:
|
|
|
426
426
|
|
|
427
427
|
```tsx fileName="src/routes/{-$locale}/index.tsx"
|
|
428
428
|
import { createFileRoute } from "@tanstack/react-router";
|
|
429
|
-
import { getIntlayer } from "intlayer";
|
|
429
|
+
import { getIntlayer, defaultLocale } from "intlayer";
|
|
430
430
|
import { useIntlayer } from "react-intlayer";
|
|
431
431
|
|
|
432
432
|
import LocaleSwitcher from "@/components/locale-switcher";
|
|
@@ -437,12 +437,33 @@ export const Route = createFileRoute("/{-$locale}/")({
|
|
|
437
437
|
component: RouteComponent,
|
|
438
438
|
head: ({ params }) => {
|
|
439
439
|
const { locale } = params;
|
|
440
|
+
const path = "/"; // The path for this route
|
|
441
|
+
|
|
440
442
|
const metaContent = getIntlayer("app", locale);
|
|
441
443
|
|
|
442
444
|
return {
|
|
445
|
+
links: [
|
|
446
|
+
// Canonical link: Points to the current localized page
|
|
447
|
+
{ rel: "canonical", href: getLocalizedUrl(path, locale) },
|
|
448
|
+
|
|
449
|
+
// Hreflang: Tell Google about all localized versions
|
|
450
|
+
...localeMap(({ locale: mapLocale }) => ({
|
|
451
|
+
rel: "alternate",
|
|
452
|
+
hrefLang: mapLocale,
|
|
453
|
+
href: getLocalizedUrl(path, mapLocale),
|
|
454
|
+
})),
|
|
455
|
+
|
|
456
|
+
// x-default: For users in unmatched languages
|
|
457
|
+
// Define the default fallback locale (usually your primary language)
|
|
458
|
+
{
|
|
459
|
+
rel: "alternate",
|
|
460
|
+
hrefLang: "x-default",
|
|
461
|
+
href: getLocalizedUrl(path, defaultLocale),
|
|
462
|
+
},
|
|
463
|
+
],
|
|
443
464
|
meta: [
|
|
444
465
|
{ title: metaContent.title },
|
|
445
|
-
{ content: metaContent.meta.description
|
|
466
|
+
{ name: "description", content: metaContent.meta.description },
|
|
446
467
|
],
|
|
447
468
|
};
|
|
448
469
|
},
|
|
@@ -19,6 +19,9 @@ slugs:
|
|
|
19
19
|
applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
|
|
20
20
|
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
21
21
|
history:
|
|
22
|
+
- version: 8.2.0
|
|
23
|
+
date: 2026-03-09
|
|
24
|
+
changes: Update compiler options, add FilePathPattern support
|
|
22
25
|
- version: 8.1.6
|
|
23
26
|
date: 2026-02-23
|
|
24
27
|
changes: Initial release
|
|
@@ -132,7 +135,12 @@ const config: IntlayerConfig = {
|
|
|
132
135
|
/**
|
|
133
136
|
* Output directory for the optimized dictionaries.
|
|
134
137
|
*/
|
|
135
|
-
|
|
138
|
+
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Inset only content in generated file, without key.
|
|
142
|
+
*/
|
|
143
|
+
noMetadata: false,
|
|
136
144
|
|
|
137
145
|
/**
|
|
138
146
|
* Dictionary key prefix
|
package/docs/en-GB/compiler.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-09
|
|
3
|
-
updatedAt: 2026-
|
|
3
|
+
updatedAt: 2026-03-10
|
|
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:
|
|
@@ -20,6 +20,9 @@ slugs:
|
|
|
20
20
|
- doc
|
|
21
21
|
- compiler
|
|
22
22
|
history:
|
|
23
|
+
- version: 8.2.0
|
|
24
|
+
date: 2026-03-09
|
|
25
|
+
changes: Update compiler options, add FilePathPattern support
|
|
23
26
|
- version: 8.1.7
|
|
24
27
|
date: 2026-02-25
|
|
25
28
|
changes: Update compiler options
|
|
@@ -157,13 +160,12 @@ import { type IntlayerConfig, Locales } from "intlayer";
|
|
|
157
160
|
const config: IntlayerConfig = {
|
|
158
161
|
compiler: {
|
|
159
162
|
/**
|
|
160
|
-
* Indicates if the compiler should be enabled.
|
|
161
163
|
* Set to 'build-only' to skip the compiler during development and speed up start times.
|
|
162
164
|
*/
|
|
163
165
|
enabled: true,
|
|
164
166
|
|
|
165
167
|
/**
|
|
166
|
-
* Pattern to traverse the code to
|
|
168
|
+
* Pattern to traverse the code to optimize.
|
|
167
169
|
*/
|
|
168
170
|
transformPattern: [
|
|
169
171
|
"**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}",
|
|
@@ -171,14 +173,19 @@ const config: IntlayerConfig = {
|
|
|
171
173
|
],
|
|
172
174
|
|
|
173
175
|
/**
|
|
174
|
-
* Pattern to exclude from the
|
|
176
|
+
* Pattern to exclude from the optimization.
|
|
175
177
|
*/
|
|
176
178
|
excludePattern: ["**/node_modules/**"],
|
|
177
179
|
|
|
178
180
|
/**
|
|
179
|
-
* Output directory for the
|
|
181
|
+
* Output directory for the optimized dictionaries.
|
|
180
182
|
*/
|
|
181
|
-
|
|
183
|
+
output: ({ key }) => `compiler/${key}.content.json`,
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Inset only content in generated file, without key.
|
|
187
|
+
*/
|
|
188
|
+
noMetadata: false,
|
|
182
189
|
|
|
183
190
|
/**
|
|
184
191
|
* Dictionary key prefix
|
|
@@ -196,6 +203,65 @@ const config: IntlayerConfig = {
|
|
|
196
203
|
export default config;
|
|
197
204
|
```
|
|
198
205
|
|
|
206
|
+
### Compiler Configuration Reference
|
|
207
|
+
|
|
208
|
+
The following properties can be configured in the `compiler` block of your `intlayer.config.ts` file:
|
|
209
|
+
|
|
210
|
+
- **enabled**:
|
|
211
|
+
- _Type_: `boolean | 'build-only'`
|
|
212
|
+
- _Default_: `true`
|
|
213
|
+
- _Description_: Indicates if the compiler should be enabled.
|
|
214
|
+
- **dictionaryKeyPrefix**:
|
|
215
|
+
- _Type_: `string`
|
|
216
|
+
- _Default_: `'comp-'`
|
|
217
|
+
- _Description_: Prefix for the extracted dictionary keys.
|
|
218
|
+
- **transformPattern**:
|
|
219
|
+
- _Type_: `string | string[]`
|
|
220
|
+
- _Default_: `['**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}', '!**/node_modules/**']`
|
|
221
|
+
- _Description_: Patterns to traverse the code to optimize.
|
|
222
|
+
- **excludePattern**:
|
|
223
|
+
- _Type_: `string | string[]`
|
|
224
|
+
- _Default_: `['**/node_modules/**']`
|
|
225
|
+
- _Description_: Patterns to exclude from the optimization.
|
|
226
|
+
- **outputDir** (Deprecated):
|
|
227
|
+
- _Type_: `string`
|
|
228
|
+
- _Default_: `'compiler'`
|
|
229
|
+
- _Description_: The directory where the extracted dictionaries will be stored.
|
|
230
|
+
|
|
231
|
+
- **output**:
|
|
232
|
+
- _Type_: `FilePathPattern`
|
|
233
|
+
- _Default_: `({ key }) => 'compiler/${key}.content.json'`
|
|
234
|
+
- _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
|
+
- _Note_: `./**/*` Path are resolved relatively to the component. `/**/*` path are resolved relatively to the Intlayer `baseDir`.
|
|
236
|
+
- _Example_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
|
|
237
|
+
|
|
238
|
+
- **noMetadata**:
|
|
239
|
+
- _Type_: `boolean`
|
|
240
|
+
- _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).
|
|
242
|
+
- _Note_: Useful if used with `loadJSON` plugin.
|
|
243
|
+
- _Example_:
|
|
244
|
+
If `true`:
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"key": "value"
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
If `false`:
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"key": "value",
|
|
254
|
+
"content": {
|
|
255
|
+
"key": "value"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
- **saveComponents**:
|
|
261
|
+
- _Type_: `boolean`
|
|
262
|
+
- _Default_: `false`
|
|
263
|
+
- _Description_: Indicates if the components should be saved after being transformed.
|
|
264
|
+
|
|
199
265
|
### Fill missing translation
|
|
200
266
|
|
|
201
267
|
Intlayer provide a CLI tool to help you fill missing translations. You can use the `intlayer` command to test and fill missing translations from your code.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2024-08-13
|
|
3
|
-
updatedAt: 2026-
|
|
3
|
+
updatedAt: 2026-03-11
|
|
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:
|
|
@@ -14,6 +14,12 @@ slugs:
|
|
|
14
14
|
- concept
|
|
15
15
|
- configuration
|
|
16
16
|
history:
|
|
17
|
+
- version: 8.3.0
|
|
18
|
+
data: 2026-03-11
|
|
19
|
+
changes: Move 'baseDir' from 'content' to 'system' config
|
|
20
|
+
- version: 8.2.0
|
|
21
|
+
date: 2026-03-09
|
|
22
|
+
changes: Update compiler options, add 'output' and 'noMetadata' support
|
|
17
23
|
- version: 8.1.7
|
|
18
24
|
date: 2026-02-25
|
|
19
25
|
changes: Update compiler options
|
|
@@ -439,7 +445,12 @@ const config: IntlayerConfig = {
|
|
|
439
445
|
/**
|
|
440
446
|
* Output directory for the optimized dictionaries.
|
|
441
447
|
*/
|
|
442
|
-
|
|
448
|
+
output: ({ key }) => `compiler/${key}.content.json`,
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Inset only content in generated file, without key.
|
|
452
|
+
*/
|
|
453
|
+
noMetadata: false,
|
|
443
454
|
|
|
444
455
|
/**
|
|
445
456
|
* Dictionary key prefix
|
|
@@ -704,7 +715,7 @@ Settings related to content handling within the application, including directory
|
|
|
704
715
|
#### Properties
|
|
705
716
|
|
|
706
717
|
- **autoFill**:
|
|
707
|
-
- _Type_: `boolean | string | { [key in Locales]?: string }`
|
|
718
|
+
- _Type_: `boolean | string | FilePathPattern | { [key in Locales]?: string }`
|
|
708
719
|
- _Default_: `undefined`
|
|
709
720
|
- _Description_: Indicates how the content should be automatically filled using AI. Can be declared globally in the `intlayer.config.ts` file.
|
|
710
721
|
- _Example_: true
|
|
@@ -727,13 +738,6 @@ Settings related to content handling within the application, including directory
|
|
|
727
738
|
- _Example_: `['.data.ts', '.data.js', '.data.json']`
|
|
728
739
|
- _Note_: Customising file extensions can help avoid conflicts.
|
|
729
740
|
|
|
730
|
-
- **baseDir**:
|
|
731
|
-
- _Type_: `string`
|
|
732
|
-
- _Default_: `process.cwd()`
|
|
733
|
-
- _Description_: The base directory for the project.
|
|
734
|
-
- _Example_: `'/path/to/project'`
|
|
735
|
-
- _Note_: This is used to resolve all Intlayer-related directories.
|
|
736
|
-
|
|
737
741
|
- **contentDir**:
|
|
738
742
|
- _Type_: `string[]`
|
|
739
743
|
- _Default_: `['.']`
|
|
@@ -772,6 +776,13 @@ Settings related to internal paths and output results of Intlayer. These setting
|
|
|
772
776
|
|
|
773
777
|
#### Properties
|
|
774
778
|
|
|
779
|
+
- **baseDir**:
|
|
780
|
+
- _Type_: `string`
|
|
781
|
+
- _Default_: `process.cwd()`
|
|
782
|
+
- _Description_: The base directory for the project.
|
|
783
|
+
- _Example_: `'/path/to/project'`
|
|
784
|
+
- _Note_: This is used to resolve all Intlayer-related directories.
|
|
785
|
+
|
|
775
786
|
- **dictionariesDir**:
|
|
776
787
|
- _Type_: `string`
|
|
777
788
|
- _Default_: `'.intlayer/dictionary'`
|
|
@@ -1063,3 +1074,32 @@ Settings that control the Intlayer compiler, which extracts dictionaries straigh
|
|
|
1063
1074
|
- _Type_: `string`
|
|
1064
1075
|
- _Default_: `'compiler'`
|
|
1065
1076
|
- _Description_: The directory where the extracted dictionaries will be stored, relative to your project base path.
|
|
1077
|
+
|
|
1078
|
+
- **output**:
|
|
1079
|
+
- _Type_: `FilePathPattern`
|
|
1080
|
+
- _Default_: `({ key }) => 'compiler/${key}.content.json'`
|
|
1081
|
+
- _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.
|
|
1082
|
+
- _Note_: `./**/*` Path are resolved relatively to the component. `/**/*` path are resolved relatively to the Intlayer `baseDir`.
|
|
1083
|
+
- _Example_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
|
|
1084
|
+
|
|
1085
|
+
- **noMetadata**:
|
|
1086
|
+
- _Type_: `boolean`
|
|
1087
|
+
- _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).
|
|
1089
|
+
- _Note_: Useful if used with `loadJSON` plugin.
|
|
1090
|
+
- _Example_:
|
|
1091
|
+
If `true`:
|
|
1092
|
+
```json
|
|
1093
|
+
{
|
|
1094
|
+
"key": "value"
|
|
1095
|
+
}
|
|
1096
|
+
```
|
|
1097
|
+
If `false`:
|
|
1098
|
+
```json
|
|
1099
|
+
{
|
|
1100
|
+
"key": "value",
|
|
1101
|
+
"content": {
|
|
1102
|
+
"key": "value"
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
```
|
|
@@ -20,6 +20,9 @@ slugs:
|
|
|
20
20
|
applicationTemplate: https://github.com/aymericzip/intlayer-next-no-lolale-path-template
|
|
21
21
|
youtubeVideo: https://www.youtube.com/watch?v=e_PPG7PTqGU
|
|
22
22
|
history:
|
|
23
|
+
- version: 8.2.0
|
|
24
|
+
date: 2026-03-09
|
|
25
|
+
changes: Update compiler options, add FilePathPattern support
|
|
23
26
|
- version: 8.1.6
|
|
24
27
|
date: 2026-02-23
|
|
25
28
|
changes: Initial release
|
|
@@ -127,9 +130,25 @@ const config: IntlayerConfig = {
|
|
|
127
130
|
mode: "search-params",
|
|
128
131
|
},
|
|
129
132
|
compiler: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Set to 'build-only' to skip the compiler during development and speed up start times.
|
|
135
|
+
*/
|
|
136
|
+
enabled: true,
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Output directory for the optimized dictionaries.
|
|
140
|
+
*/
|
|
141
|
+
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Inset only content in generated file, without key.
|
|
145
|
+
*/
|
|
146
|
+
noMetadata: false,
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Dictionary key prefix
|
|
150
|
+
*/
|
|
151
|
+
dictionaryKeyPrefix: "", // Remove base prefix
|
|
133
152
|
},
|
|
134
153
|
ai: {
|
|
135
154
|
provider: "openai",
|
|
@@ -437,12 +437,33 @@ export const Route = createFileRoute("/{-$locale}/")({
|
|
|
437
437
|
component: RouteComponent,
|
|
438
438
|
head: ({ params }) => {
|
|
439
439
|
const { locale } = params;
|
|
440
|
+
const path = "/"; // The path for this route
|
|
441
|
+
|
|
440
442
|
const metaContent = getIntlayer("app", locale);
|
|
441
443
|
|
|
442
444
|
return {
|
|
445
|
+
links: [
|
|
446
|
+
// Canonical link: Points to the current localized page
|
|
447
|
+
{ rel: "canonical", href: getLocalizedUrl(path, locale) },
|
|
448
|
+
|
|
449
|
+
// Hreflang: Tell Google about all localized versions
|
|
450
|
+
...localeMap(({ locale: mapLocale }) => ({
|
|
451
|
+
rel: "alternate",
|
|
452
|
+
hrefLang: mapLocale,
|
|
453
|
+
href: getLocalizedUrl(path, mapLocale),
|
|
454
|
+
})),
|
|
455
|
+
|
|
456
|
+
// x-default: For users in unmatched languages
|
|
457
|
+
// Define the default fallback locale (usually your primary language)
|
|
458
|
+
{
|
|
459
|
+
rel: "alternate",
|
|
460
|
+
hrefLang: "x-default",
|
|
461
|
+
href: getLocalizedUrl(path, defaultLocale),
|
|
462
|
+
},
|
|
463
|
+
],
|
|
443
464
|
meta: [
|
|
444
465
|
{ title: metaContent.title },
|
|
445
|
-
{ content: metaContent.meta.description
|
|
466
|
+
{ name: "description", content: metaContent.meta.description },
|
|
446
467
|
],
|
|
447
468
|
};
|
|
448
469
|
},
|
|
@@ -19,6 +19,9 @@ slugs:
|
|
|
19
19
|
applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
|
|
20
20
|
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
21
21
|
history:
|
|
22
|
+
- version: 8.2.0
|
|
23
|
+
date: 2026-03-09
|
|
24
|
+
changes: Update compiler options, add FilePathPattern support
|
|
22
25
|
- version: 8.1.6
|
|
23
26
|
date: 2026-02-23
|
|
24
27
|
changes: Initial release
|
|
@@ -124,9 +127,25 @@ const config: IntlayerConfig = {
|
|
|
124
127
|
defaultLocale: Locales.ENGLISH,
|
|
125
128
|
},
|
|
126
129
|
compiler: {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Set to 'build-only' to skip the compiler during development and speed up start times.
|
|
132
|
+
*/
|
|
133
|
+
enabled: true,
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Output directory for the optimized dictionaries.
|
|
137
|
+
*/
|
|
138
|
+
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Inset only content in generated file, without key.
|
|
142
|
+
*/
|
|
143
|
+
noMetadata: false,
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Dictionary key prefix
|
|
147
|
+
*/
|
|
148
|
+
dictionaryKeyPrefix: "", // Remove base prefix
|
|
130
149
|
},
|
|
131
150
|
ai: {
|
|
132
151
|
provider: "openai",
|
package/docs/es/compiler.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-09
|
|
3
|
-
updatedAt: 2026-
|
|
3
|
+
updatedAt: 2026-03-10
|
|
4
4
|
title: Intlayer Compiler | Extracción Automática de Contenido para i18n
|
|
5
5
|
description: Automatiza tu proceso de internacionalización con el Intlayer Compiler. Extrae contenido directamente de tus componentes para una i18n más rápida y eficiente en Vite, Next.js y más.
|
|
6
6
|
keywords:
|
|
@@ -20,6 +20,9 @@ slugs:
|
|
|
20
20
|
- doc
|
|
21
21
|
- compiler
|
|
22
22
|
history:
|
|
23
|
+
- version: 8.2.0
|
|
24
|
+
date: 2026-03-10
|
|
25
|
+
changes: Update compiler options, add FilePathPattern support
|
|
23
26
|
- version: 8.1.7
|
|
24
27
|
date: 2026-02-25
|
|
25
28
|
changes: Actualizar opciones del compilador
|
|
@@ -157,7 +160,6 @@ import { type IntlayerConfig, Locales } from "intlayer";
|
|
|
157
160
|
const config: IntlayerConfig = {
|
|
158
161
|
compiler: {
|
|
159
162
|
/**
|
|
160
|
-
* Indica si el compilador debe estar habilitado.
|
|
161
163
|
* Establécelo en 'build-only' para omitir el compilador durante el desarrollo y acelerar los tiempos de inicio.
|
|
162
164
|
*/
|
|
163
165
|
enabled: true,
|
|
@@ -171,23 +173,28 @@ const config: IntlayerConfig = {
|
|
|
171
173
|
],
|
|
172
174
|
|
|
173
175
|
/**
|
|
174
|
-
* Patrón
|
|
176
|
+
* Patrón a excluir de la optimización.
|
|
175
177
|
*/
|
|
176
178
|
excludePattern: ["**/node_modules/**"],
|
|
177
179
|
|
|
178
180
|
/**
|
|
179
181
|
* Directorio de salida para los diccionarios optimizados.
|
|
180
182
|
*/
|
|
181
|
-
|
|
183
|
+
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Inserta solo el contenido en el archivo generado, sin clave.
|
|
187
|
+
*/
|
|
188
|
+
noMetadata: false,
|
|
182
189
|
|
|
183
190
|
/**
|
|
184
191
|
* Prefijo de clave de diccionario
|
|
185
192
|
*/
|
|
186
|
-
dictionaryKeyPrefix: "", // Eliminar prefijo base
|
|
193
|
+
dictionaryKeyPrefix: "", // Eliminar el prefijo base
|
|
187
194
|
|
|
188
195
|
/**
|
|
189
196
|
* Indica si los componentes deben guardarse después de ser transformados.
|
|
190
|
-
* De esta manera, el compilador puede ejecutarse
|
|
197
|
+
* De esta manera, el compilador puede ejecutarse una sola vez para transformar la aplicación y luego puede eliminarse.
|
|
191
198
|
*/
|
|
192
199
|
saveComponents: false,
|
|
193
200
|
},
|
|
@@ -209,3 +216,61 @@ npx intlayer fill # Rellenar traducciones faltantes
|
|
|
209
216
|
```
|
|
210
217
|
|
|
211
218
|
> Para más detalles, consulta la [documentación de la CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/cli/ci.md)
|
|
219
|
+
|
|
220
|
+
### Referencia de configuración del compilador
|
|
221
|
+
|
|
222
|
+
Las siguientes propiedades pueden configurarse en el bloque `compiler` de tu archivo `intlayer.config.ts`:
|
|
223
|
+
|
|
224
|
+
- **enabled**:
|
|
225
|
+
- _Tipo_: `boolean | 'build-only'`
|
|
226
|
+
- _Por defecto_: `true`
|
|
227
|
+
- _Descripción_: Indica si el compilador debe estar habilitado.
|
|
228
|
+
- **dictionaryKeyPrefix**:
|
|
229
|
+
- _Tipo_: `string`
|
|
230
|
+
- _Por defecto_: `'comp-'`
|
|
231
|
+
- _Descripción_: Prefijo para las claves de diccionario extraídas.
|
|
232
|
+
- **transformPattern**:
|
|
233
|
+
- _Tipo_: `string | string[]`
|
|
234
|
+
- _Por defecto_: `['**/*.{js,ts,mjs,cjs,jsx,tsx,vue,svelte}', '!**/node_modules/**']`
|
|
235
|
+
- _Descripción_: Patrones para recorrer el código a optimizar.
|
|
236
|
+
- **excludePattern**:
|
|
237
|
+
- _Tipo_: `string | string[]`
|
|
238
|
+
- _Por defecto_: `['**/node_modules/**']`
|
|
239
|
+
- _Descripción_: Patrones para excluir de la optimización.
|
|
240
|
+
- **outputDir** (Deprecated):
|
|
241
|
+
- _Tipo_: `string`
|
|
242
|
+
- _Por defecto_: `'compiler'`
|
|
243
|
+
- _Descripción_: El directorio donde se almacenarán los diccionarios extraídos.
|
|
244
|
+
|
|
245
|
+
- **output**:
|
|
246
|
+
- _Type_: `FilePathPattern`
|
|
247
|
+
- _Por defecto_: `({ key }) => 'compiler/${key}.content.json'`
|
|
248
|
+
- _Descripción_: Define la ruta de los archivos de salida. Reemplaza `outputDir`. Maneja variables dinámicas como `{{locale}}`, `{{key}}`, `{{fileName}}`, `{{extension}}`, `{{format}}`, `{{dirPath}}`, `{{componentFileName}}`, `{{componentExtension}}`, `{{componentFormat}}`. Se puede configurar como una cadena usando el formato `'my/{{var}}/path'` o como una función.
|
|
249
|
+
- _Nota_: `./**/*` Los caminos se resuelven de forma relativa al componente. `/**/*` los caminos se resuelven de forma relativa al `baseDir` de Intlayer.
|
|
250
|
+
- _Ejemplo_: `output: ({ locale, key }) => 'compiler/${locale}/${key}.json'`
|
|
251
|
+
|
|
252
|
+
- **noMetadata**:
|
|
253
|
+
- _Tipo_: `boolean`
|
|
254
|
+
- _Por defecto_: `false`
|
|
255
|
+
- _Descripción_: Indica si los metadatos deben guardarse en el archivo. Si es verdadero, el compilador no guardará los metadatos de los diccionarios (clave, contenedor de contenido).
|
|
256
|
+
- _Nota_: Útil si se usa con el plugin `loadJSON`.
|
|
257
|
+
- _Ejemplo_: Si es `true`:
|
|
258
|
+
```json
|
|
259
|
+
{
|
|
260
|
+
"key": "value"
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
Si es `false`:
|
|
264
|
+
```json
|
|
265
|
+
{
|
|
266
|
+
"key": "value",
|
|
267
|
+
"content": {
|
|
268
|
+
"key": "value"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
- **saveComponents**:
|
|
274
|
+
- _Tipo_: `boolean`
|
|
275
|
+
- _Por defecto_: `false`
|
|
276
|
+
- _Descripción_: Indica si los componentes deben guardarse después de ser transformados.
|