@intlayer/chokidar 8.1.1 → 8.1.2
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/assets/installSkills/skills/angular.md +131 -24
- package/dist/assets/installSkills/skills/astro.md +17 -2
- package/dist/assets/installSkills/skills/cli.md +42 -4
- package/dist/assets/installSkills/skills/config.md +53 -3
- package/dist/assets/installSkills/skills/content.md +247 -5
- package/dist/assets/installSkills/skills/next_js.md +93 -13
- package/dist/assets/installSkills/skills/preact.md +54 -20
- package/dist/assets/installSkills/skills/react.md +71 -4
- package/dist/assets/installSkills/skills/remote_content.md +23 -2
- package/dist/assets/installSkills/skills/solid.md +58 -18
- package/dist/assets/installSkills/skills/svelte.md +61 -7
- package/dist/assets/installSkills/skills/usage.md +18 -83
- package/dist/assets/installSkills/skills/vue.md +19 -6
- package/dist/cjs/_virtual/_utils_asset.cjs +1 -1
- package/dist/cjs/build.cjs +51 -0
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +1 -1
- package/dist/cjs/cleanOutputDir.cjs +1 -1
- package/dist/cjs/cleanRemovedContentDeclaration.cjs +4 -4
- package/dist/cjs/cli.cjs +21 -0
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +2 -2
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +2 -2
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +2 -2
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +2 -2
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +2 -2
- package/dist/cjs/createType/createModuleAugmentation.cjs +1 -1
- package/dist/cjs/filterInvalidDictionaries.cjs +1 -1
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +1 -1
- package/dist/cjs/handleContentDeclarationFileChange.cjs +3 -3
- package/dist/cjs/handleContentDeclarationFileMoved.cjs +1 -1
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +2 -2
- package/dist/cjs/index.cjs +20 -20
- package/dist/cjs/initConfig/index.cjs +1 -1
- package/dist/cjs/installSkills/index.cjs +86 -158
- package/dist/cjs/installSkills/index.cjs.map +1 -1
- package/dist/cjs/listGitFiles.cjs +2 -2
- package/dist/cjs/listProjects.cjs +1 -1
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +1 -1
- package/dist/cjs/loadDictionaries/index.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
- package/dist/cjs/prepareIntlayer.cjs +4 -4
- package/dist/cjs/transformFiles/transformFiles.cjs +2 -2
- package/dist/cjs/utils/formatter.cjs +1 -1
- package/dist/cjs/utils/index.cjs +46 -0
- package/dist/cjs/watcher.cjs +3 -3
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +2 -2
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +2 -2
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +3 -3
- package/dist/esm/_virtual/_utils_asset.mjs +1 -1
- package/dist/esm/build.mjs +24 -0
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +1 -1
- package/dist/esm/cleanOutputDir.mjs +1 -1
- package/dist/esm/cleanRemovedContentDeclaration.mjs +4 -4
- package/dist/esm/cli.mjs +8 -0
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +2 -2
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +2 -2
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +2 -2
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +2 -2
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +2 -2
- package/dist/esm/createType/createModuleAugmentation.mjs +1 -1
- package/dist/esm/filterInvalidDictionaries.mjs +1 -1
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs +1 -1
- package/dist/esm/handleContentDeclarationFileChange.mjs +3 -3
- package/dist/esm/handleContentDeclarationFileMoved.mjs +1 -1
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +2 -2
- package/dist/esm/index.mjs +20 -20
- package/dist/esm/initConfig/index.mjs +1 -1
- package/dist/esm/installSkills/index.mjs +86 -157
- package/dist/esm/installSkills/index.mjs.map +1 -1
- package/dist/esm/listGitFiles.mjs +2 -2
- package/dist/esm/listProjects.mjs +1 -1
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +1 -1
- package/dist/esm/loadDictionaries/index.mjs +1 -1
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
- package/dist/esm/prepareIntlayer.mjs +4 -4
- package/dist/esm/transformFiles/transformFiles.mjs +2 -2
- package/dist/esm/utils/formatter.mjs +1 -1
- package/dist/esm/utils/index.mjs +20 -0
- package/dist/esm/watcher.mjs +3 -3
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +2 -2
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +2 -2
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs +3 -3
- package/dist/types/build.d.ts +29 -0
- package/dist/types/cli.d.ts +8 -0
- package/dist/types/index.d.ts +16 -16
- package/dist/types/installSkills/index.d.ts +42 -2
- package/dist/types/installSkills/index.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +19 -0
- package/package.json +44 -12
|
@@ -1,49 +1,156 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Angular
|
|
2
|
+
name: intlayer-angular
|
|
3
|
+
description: Integrates Intlayer internationalization with Angular applications. Use when the user asks to "setup Angular i18n", create a new translated component, use the "useIntlayer" composable, or configure providers.
|
|
4
|
+
metadata:
|
|
5
|
+
author: Intlayer
|
|
6
|
+
url: https://intlayer.org
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
mcp-server: "@intlayer/mcp"
|
|
9
|
+
category: productivity
|
|
10
|
+
tags: [i18n, angular]
|
|
11
|
+
documentation: https://intlayer.org/doc
|
|
12
|
+
support: contact@intlayer.org
|
|
4
13
|
---
|
|
5
14
|
|
|
6
15
|
# Intlayer Angular Usage
|
|
7
16
|
|
|
17
|
+
## Core Philosophy
|
|
18
|
+
|
|
19
|
+
Intlayer promotes **Component-Level Content Declaration**. Instead of a massive global translation file, content is declared in `*.content.ts` files adjacent to the Angular components that use them.
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
To create a translated component, you need two files:
|
|
24
|
+
|
|
25
|
+
1. **Declaration:** A content file (e.g., `my-component.content.ts`) defining the dictionary.
|
|
26
|
+
2. **Implementation:** An Angular component (e.g., `my-component.component.ts`) using the `useIntlayer` signal.
|
|
27
|
+
|
|
28
|
+
### 1. Declare Content
|
|
29
|
+
|
|
30
|
+
Create a content file using `t()` for translations.
|
|
31
|
+
**File:** `src/app/my-component/my-component.content.ts`
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { t, type Dictionary } from "intlayer";
|
|
35
|
+
|
|
36
|
+
const content = {
|
|
37
|
+
// The 'key' must be unique and matches what you pass to useIntlayer()
|
|
38
|
+
key: "my-component",
|
|
39
|
+
content: {
|
|
40
|
+
text: t({
|
|
41
|
+
en: "Welcome",
|
|
42
|
+
fr: "Bienvenue",
|
|
43
|
+
es: "Hola",
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
} satisfies Dictionary;
|
|
47
|
+
|
|
48
|
+
export default content;
|
|
49
|
+
```
|
|
50
|
+
|
|
8
51
|
## Setup
|
|
9
52
|
|
|
10
53
|
- [Angular](https://intlayer.org/doc/environment/angular.md)
|
|
11
54
|
|
|
12
|
-
|
|
55
|
+
### Intlayer Provider
|
|
56
|
+
|
|
57
|
+
To use Intlayer in your Angular application, you need to add the `provideIntlayer` provider to your application configuration.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { ApplicationConfig } from "@angular/core";
|
|
61
|
+
import { provideIntlayer } from "angular-intlayer";
|
|
62
|
+
|
|
63
|
+
export const appConfig: ApplicationConfig = {
|
|
64
|
+
providers: [provideIntlayer()],
|
|
65
|
+
};
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## useIntlayer Hook
|
|
69
|
+
|
|
70
|
+
In Angular, `useIntlayer` returns a **Signal**. You must call it as a function to access the value.
|
|
13
71
|
|
|
14
72
|
```typescript
|
|
15
73
|
import { Component } from "@angular/core";
|
|
16
|
-
import { useIntlayer
|
|
74
|
+
import { useIntlayer } from "angular-intlayer";
|
|
17
75
|
|
|
18
76
|
@Component({
|
|
19
|
-
selector: "app-
|
|
77
|
+
selector: "app-my-component",
|
|
20
78
|
standalone: true,
|
|
21
|
-
imports: [ContentSelectorWrapperComponent],
|
|
22
79
|
template: `
|
|
23
80
|
<div>
|
|
24
81
|
<h1>
|
|
25
|
-
|
|
26
|
-
<app-content-selector-wrapper
|
|
27
|
-
[dictionaryKey]="content().title.dictionaryKey"
|
|
28
|
-
[keyPath]="content().title.keyPath"
|
|
29
|
-
>
|
|
30
|
-
{{ content().title }}
|
|
31
|
-
</app-content-selector-wrapper>
|
|
82
|
+
{{ content().text }}
|
|
32
83
|
</h1>
|
|
33
|
-
<
|
|
34
|
-
<!-- Render as string -->
|
|
35
|
-
{{ content().title }}
|
|
36
|
-
</h1>
|
|
37
|
-
<img
|
|
38
|
-
[src]="content().image.src.value"
|
|
39
|
-
[alt]="content().image.alt.value"
|
|
40
|
-
/>
|
|
84
|
+
<img [src]="content().text.value" [alt]="content().text.value" />
|
|
41
85
|
</div>
|
|
42
86
|
`,
|
|
43
87
|
})
|
|
44
|
-
export class
|
|
45
|
-
content = useIntlayer("my-
|
|
88
|
+
export class MyComponent {
|
|
89
|
+
content = useIntlayer("my-component");
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Change language
|
|
94
|
+
|
|
95
|
+
To change the language, use the `setLocale` function from the `useLocale` hook.
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { Component } from "@angular/core";
|
|
99
|
+
import { useLocale } from "angular-intlayer";
|
|
100
|
+
import { Locales } from "intlayer";
|
|
101
|
+
|
|
102
|
+
@Component({
|
|
103
|
+
selector: "app-locale-switcher",
|
|
104
|
+
standalone: true,
|
|
105
|
+
template: `
|
|
106
|
+
<button (click)="setLocale(Locales.FRENCH)">
|
|
107
|
+
Change Language to French
|
|
108
|
+
</button>
|
|
109
|
+
`,
|
|
110
|
+
})
|
|
111
|
+
export class LocaleSwitcherComponent {
|
|
112
|
+
Locales = Locales;
|
|
113
|
+
private localeCtx = useLocale();
|
|
114
|
+
setLocale = this.localeCtx.setLocale;
|
|
46
115
|
}
|
|
47
116
|
```
|
|
48
117
|
|
|
49
|
-
|
|
118
|
+
## Localized Link component
|
|
119
|
+
|
|
120
|
+
Ensure your application's navigation respects the current locale by using a localized link. You can create a component or use a helper.
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { Component, Input } from "@angular/core";
|
|
124
|
+
import { RouterModule } from "@angular/router";
|
|
125
|
+
import { useLocale } from "angular-intlayer";
|
|
126
|
+
import { getLocalizedUrl } from "intlayer";
|
|
127
|
+
|
|
128
|
+
@Component({
|
|
129
|
+
selector: "app-link",
|
|
130
|
+
standalone: true,
|
|
131
|
+
imports: [RouterModule],
|
|
132
|
+
template: `
|
|
133
|
+
<a [routerLink]="localizedHref()" [replaceUrl]="false">
|
|
134
|
+
<ng-content></ng-content>
|
|
135
|
+
</a>
|
|
136
|
+
`,
|
|
137
|
+
})
|
|
138
|
+
export class LinkComponent {
|
|
139
|
+
@Input() href: string = "";
|
|
140
|
+
|
|
141
|
+
private localeCtx = useLocale();
|
|
142
|
+
locale = this.localeCtx.locale;
|
|
143
|
+
|
|
144
|
+
localizedHref() {
|
|
145
|
+
return this.href.startsWith("http")
|
|
146
|
+
? this.href
|
|
147
|
+
: getLocalizedUrl(this.href, this.locale());
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## References
|
|
153
|
+
|
|
154
|
+
- [Angular](https://intlayer.org/doc/environment/angular.md)
|
|
155
|
+
- [Angular Intlayer Exports](https://intlayer.org/doc/packages/angular-intlayer/exports.md)
|
|
156
|
+
- [Intlayer Exports](https://intlayer.org/doc/packages/intlayer/exports.md)
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Astro-
|
|
2
|
+
name: intlayer-astro
|
|
3
|
+
description: Integrates Intlayer internationalization with Astro applications. Use when the user asks to "setup Astro i18n", use "getIntlayer" in Astro components, or manage server-side content in Astro.
|
|
4
|
+
metadata:
|
|
5
|
+
author: Intlayer
|
|
6
|
+
url: https://intlayer.org
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
mcp-server: "@intlayer/mcp"
|
|
9
|
+
category: productivity
|
|
10
|
+
tags: [i18n]
|
|
11
|
+
documentation: https://intlayer.org/doc
|
|
12
|
+
support: contact@intlayer.org
|
|
4
13
|
---
|
|
5
14
|
|
|
6
15
|
# Intlayer Astro Usage
|
|
@@ -20,3 +29,9 @@ const content = await getIntlayer("my-dictionary-key");
|
|
|
20
29
|
```
|
|
21
30
|
|
|
22
31
|
[Astro Documentation](https://intlayer.org/doc/packages/astro-intlayer.md)
|
|
32
|
+
|
|
33
|
+
## References
|
|
34
|
+
|
|
35
|
+
- [Astro](https://intlayer.org/doc/environment/astro.md)
|
|
36
|
+
- [Intlayer Exports](https://intlayer.org/doc/packages/intlayer/exports.md)
|
|
37
|
+
- [Astro Intlayer Exports](https://intlayer.org/doc/packages/astro-intlayer/exports.md)
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Intlayer
|
|
2
|
+
name: intlayer-cli
|
|
3
|
+
description: Manages Intlayer dictionaries and configuration via the Command Line Interface. Use when the user asks to "audit translations", "build dictionaries", "sync content", or run "intlayer" commands.
|
|
4
|
+
metadata:
|
|
5
|
+
author: Intlayer
|
|
6
|
+
url: https://intlayer.org
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
mcp-server: "@intlayer/mcp"
|
|
9
|
+
category: productivity
|
|
10
|
+
tags: [i18n]
|
|
11
|
+
documentation: https://intlayer.org/doc
|
|
12
|
+
support: contact@intlayer.org
|
|
4
13
|
---
|
|
5
14
|
|
|
6
15
|
# Intlayer CLI
|
|
@@ -13,7 +22,7 @@ The `intlayer-cli` package provides a set of commands to manage Intlayer diction
|
|
|
13
22
|
npm install intlayer-cli
|
|
14
23
|
```
|
|
15
24
|
|
|
16
|
-
## CLI Commands
|
|
25
|
+
## Main CLI Commands
|
|
17
26
|
|
|
18
27
|
| Command | Description |
|
|
19
28
|
| ------------------------ | ------------------------------------------------------------- |
|
|
@@ -25,4 +34,33 @@ npm install intlayer-cli
|
|
|
25
34
|
| `npx intlayer test` | Runs tests on dictionaries. |
|
|
26
35
|
| `npx intlayer transform` | Transforms dictionaries between formats. |
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
## References
|
|
38
|
+
|
|
39
|
+
### Concepts
|
|
40
|
+
|
|
41
|
+
- [Build](https://intlayer.org/doc/concept/cli/build.md)
|
|
42
|
+
- [CI](https://intlayer.org/doc/concept/cli/ci.md)
|
|
43
|
+
- [Configuration](https://intlayer.org/doc/concept/cli/configuration.md)
|
|
44
|
+
- [Debug](https://intlayer.org/doc/concept/cli/debug.md)
|
|
45
|
+
- [Doc Review](https://intlayer.org/doc/concept/cli/doc-review.md)
|
|
46
|
+
- [Doc Translate](https://intlayer.org/doc/concept/cli/doc-translate.md)
|
|
47
|
+
- [Editor](https://intlayer.org/doc/concept/cli/editor.md)
|
|
48
|
+
- [Fill](https://intlayer.org/doc/concept/cli/fill.md)
|
|
49
|
+
- [Overview](https://intlayer.org/doc/concept/cli/overview.md)
|
|
50
|
+
- [Init](https://intlayer.org/doc/concept/cli/init.md)
|
|
51
|
+
- [List](https://intlayer.org/doc/concept/cli/list.md)
|
|
52
|
+
- [List Projects](https://intlayer.org/doc/concept/cli/list-projects.md)
|
|
53
|
+
- [Live](https://intlayer.org/doc/concept/cli/live.md)
|
|
54
|
+
- [Login](https://intlayer.org/doc/concept/cli/login.md)
|
|
55
|
+
- [Pull](https://intlayer.org/doc/concept/cli/pull.md)
|
|
56
|
+
- [Push](https://intlayer.org/doc/concept/cli/push.md)
|
|
57
|
+
- [SDK](https://intlayer.org/doc/concept/cli/sdk.md)
|
|
58
|
+
- [Test](https://intlayer.org/doc/concept/cli/test.md)
|
|
59
|
+
- [Transform](https://intlayer.org/doc/concept/cli/transform.md)
|
|
60
|
+
- [Version](https://intlayer.org/doc/concept/cli/version.md)
|
|
61
|
+
- [Watch](https://intlayer.org/doc/concept/cli/watch.md)
|
|
62
|
+
|
|
63
|
+
### Packages
|
|
64
|
+
|
|
65
|
+
- [Intlayer CLI](https://intlayer.org/doc/packages/intlayer-cli.md)
|
|
66
|
+
- [Intlayer CLI Exports](https://intlayer.org/doc/packages/intlayer-cli/exports.md)
|
|
@@ -1,10 +1,60 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Intlayer
|
|
2
|
+
name: intlayer-config
|
|
3
|
+
description: Configures Intlayer project settings and environment variables. Use when the user asks to "setup intlayer.config", "configure locales", or "customize Intlayer settings".
|
|
4
|
+
metadata:
|
|
5
|
+
author: Intlayer
|
|
6
|
+
url: https://intlayer.org
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
mcp-server: "@intlayer/mcp"
|
|
9
|
+
category: productivity
|
|
10
|
+
tags: [i18n]
|
|
11
|
+
documentation: https://intlayer.org/doc
|
|
12
|
+
support: contact@intlayer.org
|
|
4
13
|
---
|
|
5
14
|
|
|
6
15
|
# Intlayer Configuration
|
|
7
16
|
|
|
8
|
-
|
|
17
|
+
Configure Intlayer project settings and environment variables. Check these files to identify which locales are declared for the application, which helps in defining the appropriate content.
|
|
18
|
+
|
|
19
|
+
Supported configuration files:
|
|
20
|
+
|
|
21
|
+
- `intlayer.config.{ts|js|json|json5|jsonc|cjs|mjs}`
|
|
22
|
+
- `.intlayerrc`
|
|
23
|
+
|
|
24
|
+
It acts as the central brain for your application's internationalization strategy. It is divided into several specialized sections that control everything from language support to AI-powered translations.
|
|
25
|
+
|
|
26
|
+
### Internationalization
|
|
27
|
+
|
|
28
|
+
This section defines your language footprint.
|
|
29
|
+
|
|
30
|
+
- **Locales**: Define which languages you support (e.g., English, French, Spanish).
|
|
31
|
+
- **Default Locale**: Set the fallback language if a user's preference isn't found.
|
|
32
|
+
|
|
33
|
+
### Routing & middleware
|
|
34
|
+
|
|
35
|
+
Controls how users navigate between different languages.
|
|
36
|
+
|
|
37
|
+
### AI & Automation
|
|
38
|
+
|
|
39
|
+
Intlayer integrates with major AI providers (OpenAI, Anthropic, Gemini, etc.) to automate your workflow.
|
|
40
|
+
|
|
41
|
+
### Content & Dictionaries
|
|
42
|
+
|
|
43
|
+
Manages how and where your translation files are handled.
|
|
44
|
+
|
|
45
|
+
- **Import Mode**: Choose between **Static** (faster performance), **Dynamic** (lazy loading), or **Fetch** (live updates from a CMS).
|
|
46
|
+
- **Auto-Transformation**: Automatically convert Markdown or HTML strings into processed components.
|
|
47
|
+
|
|
48
|
+
### Editor & System
|
|
49
|
+
|
|
50
|
+
Settings for the visual workflow and internal plumbing.
|
|
51
|
+
|
|
52
|
+
## References
|
|
53
|
+
|
|
54
|
+
### Concepts
|
|
9
55
|
|
|
10
56
|
- [Configuration](https://intlayer.org/doc/concept/configuration.md)
|
|
57
|
+
|
|
58
|
+
### Packages
|
|
59
|
+
|
|
60
|
+
- [Intlayer getConfiguration](https://intlayer.org/doc/packages/intlayer/getConfiguration.md)
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description:
|
|
2
|
+
name: intlayer-content
|
|
3
|
+
description: Define rich content structures using Intlayer content nodes. Use when the user asks to "create translations", "handle pluralization", "use markdown in content", or implement "conditional content".
|
|
4
|
+
metadata:
|
|
5
|
+
author: Intlayer
|
|
6
|
+
url: https://intlayer.org
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
mcp-server: "@intlayer/mcp"
|
|
9
|
+
category: productivity
|
|
10
|
+
tags: [i18n]
|
|
11
|
+
documentation: https://intlayer.org/doc
|
|
12
|
+
support: contact@intlayer.org
|
|
4
13
|
---
|
|
5
14
|
|
|
6
15
|
# Intlayer Content Nodes
|
|
7
16
|
|
|
8
|
-
|
|
17
|
+
Define rich and dynamic content using Intlayer functions. Use the reference below for each node type.
|
|
9
18
|
|
|
10
19
|
## Translation (`t`)
|
|
11
20
|
|
|
@@ -23,6 +32,11 @@ const content = t({
|
|
|
23
32
|
});
|
|
24
33
|
```
|
|
25
34
|
|
|
35
|
+
Find locales to declare in config file. Supported configuration files:
|
|
36
|
+
|
|
37
|
+
- `intlayer.config.{ts|js|json|json5|jsonc|cjs|mjs}`
|
|
38
|
+
- `.intlayerrc`
|
|
39
|
+
|
|
26
40
|
## Enumeration (`enu`)
|
|
27
41
|
|
|
28
42
|
Map content to specific keys, numbers, or ranges (useful for pluralization).
|
|
@@ -111,6 +125,30 @@ const fetched = async () => {
|
|
|
111
125
|
};
|
|
112
126
|
```
|
|
113
127
|
|
|
128
|
+
## Insertion (`insert`)
|
|
129
|
+
|
|
130
|
+
Define dynamic content with variables.
|
|
131
|
+
|
|
132
|
+
[Doc](https://intlayer.org/doc/concept/content/insertion.md)
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { insert } from "intlayer";
|
|
136
|
+
|
|
137
|
+
const welcome = insert("Hello {{name}}!");
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## File (`file`)
|
|
141
|
+
|
|
142
|
+
Reference external files as content.
|
|
143
|
+
|
|
144
|
+
[Doc](https://intlayer.org/doc/concept/content/file.md)
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { file } from "intlayer";
|
|
148
|
+
|
|
149
|
+
const myFile = file("./path/to/file.txt");
|
|
150
|
+
```
|
|
151
|
+
|
|
114
152
|
## Gender (`gender`)
|
|
115
153
|
|
|
116
154
|
Define content based on gender ('male', 'female', etc.).
|
|
@@ -127,6 +165,210 @@ const greeting = gender({
|
|
|
127
165
|
});
|
|
128
166
|
```
|
|
129
167
|
|
|
130
|
-
|
|
168
|
+
### Example Directory Structure (react)
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
src/
|
|
172
|
+
├── components/
|
|
173
|
+
│ ├── MyComponent/
|
|
174
|
+
│ │ ├── index.content.ts # Content declaration
|
|
175
|
+
│ │ └── index.tsx # Component
|
|
176
|
+
│ ├── myOtherComponent.content.ts # Content declaration
|
|
177
|
+
│ └── MyOtherComponent.tsx # Component
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Content Templates
|
|
181
|
+
|
|
182
|
+
_TypeScript (.content.ts)_
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { t, type Dictionary } from "intlayer";
|
|
186
|
+
|
|
187
|
+
const content = {
|
|
188
|
+
key: "my-component-key",
|
|
189
|
+
content: {
|
|
190
|
+
title: "...",
|
|
191
|
+
},
|
|
192
|
+
} satisfies Dictionary;
|
|
193
|
+
|
|
194
|
+
export default content;
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
_TypeScript with React (.content.tsx)_
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
import { t, type Dictionary } from "intlayer";
|
|
201
|
+
import { ReactNode } from "react";
|
|
202
|
+
|
|
203
|
+
const content = {
|
|
204
|
+
key: "my-component-key",
|
|
205
|
+
content: {
|
|
206
|
+
title: <>My React Node</>,
|
|
207
|
+
},
|
|
208
|
+
} satisfies Dictionary;
|
|
209
|
+
|
|
210
|
+
export default content;
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"key": "my-component-key",
|
|
216
|
+
"content": {
|
|
217
|
+
"title": "..."
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
```javascript
|
|
223
|
+
import { t } from "intlayer";
|
|
224
|
+
|
|
225
|
+
/** @type {import('intlayer').Dictionary} **/
|
|
226
|
+
const content = {
|
|
227
|
+
key: "my-component-key",
|
|
228
|
+
content: {
|
|
229
|
+
title: "...",
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export default content;
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Content declaration combination
|
|
237
|
+
|
|
238
|
+
Nodes can be imbricated for complex logic.
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
import {
|
|
242
|
+
cond,
|
|
243
|
+
enu,
|
|
244
|
+
file,
|
|
245
|
+
gender,
|
|
246
|
+
insert,
|
|
247
|
+
html,
|
|
248
|
+
md,
|
|
249
|
+
nest,
|
|
250
|
+
t,
|
|
251
|
+
type Dictionary,
|
|
252
|
+
} from "intlayer";
|
|
253
|
+
|
|
254
|
+
const content = {
|
|
255
|
+
key: "test",
|
|
256
|
+
title: "Test component content",
|
|
257
|
+
description:
|
|
258
|
+
"Content declarations for the Test component, including examples of plurals, conditions, gender-specific messages, dynamic insertions, markdown, file-based content and nested dictionaries used for demonstration and testing purposes.",
|
|
259
|
+
content: {
|
|
260
|
+
baseContent: "Intlayer", // Content that no need to be i18n
|
|
261
|
+
welcomeMessage: t({
|
|
262
|
+
en: "Welcome to our application",
|
|
263
|
+
"en-GB": "Welcome to our application",
|
|
264
|
+
fr: "Bienvenue dans notre application",
|
|
265
|
+
es: "Bienvenido a nuestra aplicación",
|
|
266
|
+
// ... All other locales set in intlayer config file
|
|
267
|
+
}),
|
|
268
|
+
numberOfCar: enu({
|
|
269
|
+
// Check all conditions in other
|
|
270
|
+
"<-1": "Less than minus one car",
|
|
271
|
+
"-1": "Minus one car",
|
|
272
|
+
"0": "No cars",
|
|
273
|
+
"1": "One car",
|
|
274
|
+
">19": "Many cars",
|
|
275
|
+
">5": "Some cars", // Will never will triggered, because >5 is included between 1 and >19
|
|
276
|
+
fallback: "Fallback value", // Optional but avoid undefined type
|
|
277
|
+
}),
|
|
278
|
+
myCondition: cond({
|
|
279
|
+
true: "my content when it's true",
|
|
280
|
+
false: "my content when it's false",
|
|
281
|
+
fallback: "my content when the condition fails", // Optional but avoid undefined type
|
|
282
|
+
}),
|
|
283
|
+
myGender: gender({
|
|
284
|
+
male: "my content for male users",
|
|
285
|
+
female: "my content for female users",
|
|
286
|
+
fallback: "my content when gender is not specified", // Optional but avoid undefined type
|
|
287
|
+
}),
|
|
288
|
+
myInsertion: insert(
|
|
289
|
+
"Hello, my name is {{name}} and I am {{age}} years old!"
|
|
290
|
+
),
|
|
291
|
+
myMultilingualInsertion: insert(
|
|
292
|
+
t({
|
|
293
|
+
ar: "مرحبا, اسمي {{name}} وأنا {{age}} سنة!",
|
|
294
|
+
de: "Hallo, mein Name ist {{name}} und ich bin {{age}} Jahre alt!",
|
|
295
|
+
en: "Hello, my name is {{name}} and I am {{age}} years old!",
|
|
296
|
+
"en-GB": "Hello, my name is {{name}} and I am {{age}} years old!",
|
|
297
|
+
})
|
|
298
|
+
),
|
|
299
|
+
myTextFile: file("./test.txt"), // File helps to know where is located the file
|
|
300
|
+
subContent: {
|
|
301
|
+
contentNumber: 0,
|
|
302
|
+
contentString: "string",
|
|
303
|
+
},
|
|
304
|
+
fullNested: nest("code"),
|
|
305
|
+
// References a specific nested value:
|
|
306
|
+
partialNested: nest("code", "title"),
|
|
307
|
+
myMarkdown: md("## My title \n\nLorem Ipsum"),
|
|
308
|
+
myMarkdownFile: md(file("./test.md")),
|
|
309
|
+
multilingualMarkdown: t({
|
|
310
|
+
en: md("## test en"),
|
|
311
|
+
fr: md("## test fr"),
|
|
312
|
+
es: md("## test es"),
|
|
313
|
+
"en-GB": md("## test en-GB"),
|
|
314
|
+
}),
|
|
315
|
+
myHTML: html("<h2>My title</h2><p>Lorem Ipsum</p>"),
|
|
316
|
+
myHTMLFile: html(file("./test.html")),
|
|
317
|
+
|
|
318
|
+
arrayContent: ["string", "string2", "string3"],
|
|
319
|
+
arrayOfObject: [
|
|
320
|
+
{
|
|
321
|
+
name: "item1",
|
|
322
|
+
description: "description1",
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: "item2",
|
|
326
|
+
description: "description2",
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
objectOfArray: {
|
|
330
|
+
array: ["item1", "item2", "item3"],
|
|
331
|
+
object: {
|
|
332
|
+
name: "object name",
|
|
333
|
+
description: "object description",
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
tags: ["test", "test page"],
|
|
338
|
+
} satisfies Dictionary;
|
|
339
|
+
|
|
340
|
+
export default content;
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## Type validation of dictionary
|
|
344
|
+
|
|
345
|
+
```ts
|
|
346
|
+
Dictionary<{ title: string; description?: string }>; // Generic describing content type for formatted data (metadata, etc)
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Key Dictionary Fields for AI Management
|
|
350
|
+
|
|
351
|
+
Core Metadata
|
|
352
|
+
|
|
353
|
+
- key: The identifier for the dictionary (e.g., `about-page-meta`). AI can ensure consistent naming conventions.
|
|
354
|
+
- title: A human-readable name for identification in the CMS or editor.
|
|
355
|
+
- description: Provides context for the dictionary. AI uses this to understand the purpose and generate better translations or content.
|
|
356
|
+
- tags: Categorization strings (e.g., `metadata`, `SEO`) to help organize and filter dictionaries.
|
|
357
|
+
|
|
358
|
+
Content & Localization
|
|
359
|
+
|
|
360
|
+
- locale: Specifies the language of the content for (per-locale file)[https://intlayer.org/doc/concept/per-locale-file.md]
|
|
361
|
+
- contentAutoTransformation: A toggle to automatically convert raw strings into specialized formats like Markdown, HTML, or Insertions (variables).
|
|
362
|
+
- fill: An instruction indicating whether the dictionary should be automatically populated by AI/automation tools.
|
|
363
|
+
|
|
364
|
+
Behaviorals Settings
|
|
365
|
+
|
|
366
|
+
- priority: A numeric value used to resolve conflicts during merge of dictionaries under a same key.
|
|
367
|
+
- importMode: Defines how content is loaded (`static`, `dynamic`, or `live`). AI can recommend the best mode based on performance needs.
|
|
368
|
+
- location: Controls CMS synchronization (`hybrid`, `remote`, `local`). AI can manage where the source of truth resides.
|
|
369
|
+
- schema: string that use zod schema declared in config file to validate data
|
|
370
|
+
|
|
371
|
+
## References
|
|
131
372
|
|
|
132
|
-
[Content Overview](https://intlayer.org/doc/concept/content.md)
|
|
373
|
+
- [Content Overview](https://intlayer.org/doc/concept/content.md)
|
|
374
|
+
- [Exports intlayer package](https://intlayer.org/doc/packages/intlayer/exports.md)
|