@intlayer/chokidar 8.1.0 → 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 +82 -0
- package/dist/assets/installSkills/skills/react.md +77 -9
- package/dist/assets/installSkills/skills/remote_content.md +23 -2
- package/dist/assets/installSkills/skills/solid.md +87 -0
- package/dist/assets/installSkills/skills/svelte.md +61 -10
- 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 +88 -71
- 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 +88 -70
- 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 +43 -1
- 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,10 +1,53 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Next.js
|
|
2
|
+
name: intlayer-next-js
|
|
3
|
+
description: Integrates Intlayer internationalization with Next.js App Router and Pages Router. Use when the user asks to "setup Next.js i18n", use "useIntlayer" in Server Components, or handle client-side translations in Next.js.
|
|
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, nextjs]
|
|
11
|
+
documentation: https://intlayer.org/doc
|
|
12
|
+
support: contact@intlayer.org
|
|
4
13
|
---
|
|
5
14
|
|
|
6
15
|
# Intlayer Next.js 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 Next.js 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., `myComponent.content.ts`) defining the dictionary.
|
|
26
|
+
2. **Implementation:** A Next.js component (Server or Client) using the `useIntlayer` hook.
|
|
27
|
+
|
|
28
|
+
### 1. Declare Content
|
|
29
|
+
|
|
30
|
+
Create a content file using `t()` for translations.
|
|
31
|
+
**File:** `src/components/MyComponent/myComponent.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
|
- [Next.js](https://intlayer.org/doc/environment/nextjs.md)
|
|
@@ -15,34 +58,71 @@ description: Next.js-specific usage (Server & Client components)
|
|
|
15
58
|
|
|
16
59
|
## Server Components
|
|
17
60
|
|
|
61
|
+
To use Intlayer in Server Components, use `IntlayerServerProvider` to provide the locale and `useIntlayer` from `next-intlayer/server`.
|
|
62
|
+
|
|
18
63
|
```tsx
|
|
19
|
-
import { useIntlayer } from "next-intlayer/server";
|
|
20
|
-
|
|
21
|
-
|
|
64
|
+
import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
|
|
65
|
+
|
|
66
|
+
const MyServerComponent = () => {
|
|
67
|
+
const content = useIntlayer("my-component");
|
|
22
68
|
return (
|
|
23
69
|
<div>
|
|
24
|
-
<h1>{content.
|
|
25
|
-
<img src={content.image.src.value} alt={content.image.alt.value} />
|
|
70
|
+
<h1>{content.text}</h1>
|
|
26
71
|
</div>
|
|
27
72
|
);
|
|
28
73
|
};
|
|
74
|
+
|
|
75
|
+
const Page = async ({ params }) => {
|
|
76
|
+
const { locale } = await params;
|
|
77
|
+
return (
|
|
78
|
+
<IntlayerServerProvider locale={locale}>
|
|
79
|
+
<MyServerComponent />
|
|
80
|
+
</IntlayerServerProvider>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default Page;
|
|
29
85
|
```
|
|
30
86
|
|
|
31
87
|
## Client Components
|
|
32
88
|
|
|
89
|
+
For Client Components, add the `"use client"` directive and use `useIntlayer` from `next-intlayer`. Ensure the component is wrapped in an `IntlayerClientProvider`.
|
|
90
|
+
|
|
33
91
|
```tsx
|
|
34
92
|
"use client";
|
|
93
|
+
|
|
35
94
|
import { useIntlayer } from "next-intlayer";
|
|
36
|
-
|
|
37
|
-
|
|
95
|
+
|
|
96
|
+
export const MyClientComponent = () => {
|
|
97
|
+
const content = useIntlayer("my-component");
|
|
98
|
+
|
|
38
99
|
return (
|
|
39
100
|
<div>
|
|
40
|
-
<h1>{content.
|
|
41
|
-
<img src={content.image.src.value} alt={content.image.alt.value} />
|
|
101
|
+
<h1>{content.text}</h1>
|
|
42
102
|
</div>
|
|
43
103
|
);
|
|
44
104
|
};
|
|
45
105
|
```
|
|
46
106
|
|
|
47
|
-
|
|
48
|
-
[Next.js Documentation](https://intlayer.org/doc/packages/next-intlayer.md)
|
|
107
|
+
[Next.js package Documentation](https://intlayer.org/doc/packages/next-intlayer.md)
|
|
108
|
+
[Next.js package Documentation](https://intlayer.org/doc/packages/next-intlayer.md)
|
|
109
|
+
|
|
110
|
+
## References
|
|
111
|
+
|
|
112
|
+
### Environments
|
|
113
|
+
|
|
114
|
+
- [Next.js](https://intlayer.org/doc/environment/nextjs.md)
|
|
115
|
+
- [Next.js 14](https://intlayer.org/doc/environment/nextjs/14.md)
|
|
116
|
+
- [Next.js 15](https://intlayer.org/doc/environment/nextjs/15.md)
|
|
117
|
+
- [Next.js No Locale Path](https://intlayer.org/doc/environment/nextjs/no-locale-path.md)
|
|
118
|
+
- [Next.js with Page Router](https://intlayer.org/doc/environment/nextjs/next-with-page-router.md)
|
|
119
|
+
|
|
120
|
+
### Packages
|
|
121
|
+
|
|
122
|
+
- [Intlayer Exports](https://intlayer.org/doc/packages/intlayer/exports.md)
|
|
123
|
+
- [Next Intlayer Exports](https://intlayer.org/doc/packages/next-intlayer/exports.md)
|
|
124
|
+
- [Next Intlayer Middleware](https://intlayer.org/doc/packages/next-intlayer/intlayerMiddleware.md)
|
|
125
|
+
- [Next Intlayer T](https://intlayer.org/doc/packages/next-intlayer/t.md)
|
|
126
|
+
- [Next Intlayer useDictionary](https://intlayer.org/doc/packages/next-intlayer/useDictionary.md)
|
|
127
|
+
- [Next Intlayer useIntlayer](https://intlayer.org/doc/packages/next-intlayer/useIntlayer.md)
|
|
128
|
+
- [Next Intlayer useLocale](https://intlayer.org/doc/packages/next-intlayer/useLocale.md)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: intlayer-preact
|
|
3
|
+
description: Integrates Intlayer internationalization with Preact applications. Use when the user asks to "setup Preact i18n", create a new translated component, use the "useIntlayer" hook in Preact, 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, preact, vite]
|
|
11
|
+
documentation: https://intlayer.org/doc
|
|
12
|
+
support: contact@intlayer.org
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Intlayer Preact Usage
|
|
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 Preact 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., `myComponent.content.ts`) defining the dictionary.
|
|
26
|
+
2. **Implementation:** A Preact component (e.g., `MyComponent.tsx`) using the `useIntlayer` hook.
|
|
27
|
+
|
|
28
|
+
### Declare Content
|
|
29
|
+
|
|
30
|
+
Create a content file using `t()` for translations.
|
|
31
|
+
**File:** `src/components/MyComponent/myComponent.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
|
+
|
|
51
|
+
## Setup
|
|
52
|
+
|
|
53
|
+
- [Vite and Preact](https://intlayer.org/doc/environment/vite-and-preact.md)
|
|
54
|
+
|
|
55
|
+
## useIntlayer Hook
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { useIntlayer } from "preact-intlayer";
|
|
59
|
+
|
|
60
|
+
const MyComponent = () => {
|
|
61
|
+
const content = useIntlayer("my-component");
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div>
|
|
65
|
+
<h1>
|
|
66
|
+
{/* Return content */}
|
|
67
|
+
{content.text}
|
|
68
|
+
</h1>
|
|
69
|
+
{/* Return string (.value) */}
|
|
70
|
+
<img src={content.text.value} alt={content.text.value} />
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
[Preact package Documentation](https://intlayer.org/doc/packages/preact-intlayer.md)
|
|
77
|
+
|
|
78
|
+
## References
|
|
79
|
+
|
|
80
|
+
- [Vite and Preact](https://intlayer.org/doc/environment/vite-and-preact.md)
|
|
81
|
+
- [Intlayer Exports](https://intlayer.org/doc/packages/intlayer/exports.md)
|
|
82
|
+
- [Preact Intlayer Exports](https://intlayer.org/doc/packages/preact-intlayer/exports.md)
|
|
@@ -1,20 +1,65 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: React
|
|
2
|
+
name: intlayer-react
|
|
3
|
+
description: Integrates Intlayer internationalization with React component. Use when the user asks to "setup React i18n", create a new translated component, use the "useIntlayer" hook, 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, react, vite]
|
|
11
|
+
documentation: https://intlayer.org/doc
|
|
12
|
+
support: contact@intlayer.org
|
|
4
13
|
---
|
|
5
14
|
|
|
6
15
|
# Intlayer React 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 React 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., `myComponent.content.ts`) defining the dictionary.
|
|
26
|
+
2. **Implementation:** A React component (e.g., `MyComponent.tsx`) using the `useIntlayer` hook.
|
|
27
|
+
|
|
28
|
+
### 1. Declare Content
|
|
29
|
+
|
|
30
|
+
Create a content file using `t()` for translations.
|
|
31
|
+
**File:** `src/components/MyComponent/myComponent.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
|
+
// ... All other locales set in intlayer config file
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
} satisfies Dictionary;
|
|
48
|
+
|
|
49
|
+
export default content;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
# Intlayer React Usage
|
|
53
|
+
|
|
8
54
|
## Setup
|
|
9
55
|
|
|
10
56
|
- [Vite and React](https://intlayer.org/doc/environment/vite-and-react.md)
|
|
11
57
|
- [Create React App](https://intlayer.org/doc/environment/create-react-app.md)
|
|
58
|
+
- [React Router v7](https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md)
|
|
59
|
+
- [React Router v7 (fs routes)](https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md)
|
|
60
|
+
- [Tanstack Start](https://intlayer.org/doc/environment/tanstack-start.md)
|
|
12
61
|
- [React Native and Expo](https://intlayer.org/doc/environment/react-native-and-expo.md)
|
|
13
|
-
- [Vite and React (React Router v7)](https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md)
|
|
14
62
|
- [Lynx and React](https://intlayer.org/doc/environment/lynx-and-react.md)
|
|
15
|
-
- [Page Metadata](https://intlayer.org/doc/environment/react-intlayer/page-metadata.md)
|
|
16
|
-
- [Sitemap](https://intlayer.org/doc/environment/react-intlayer/sitemap.md)
|
|
17
|
-
- [Server Actions](https://intlayer.org/doc/environment/react-intlayer/server-actions.md)
|
|
18
63
|
|
|
19
64
|
## useIntlayer Hook
|
|
20
65
|
|
|
@@ -24,11 +69,34 @@ const MyComponent = () => {
|
|
|
24
69
|
const content = useIntlayer("my-dictionary-key");
|
|
25
70
|
return (
|
|
26
71
|
<div>
|
|
27
|
-
<h1>
|
|
28
|
-
|
|
72
|
+
<h1>
|
|
73
|
+
{/* Return react node */}
|
|
74
|
+
{content.text}
|
|
75
|
+
</h1>
|
|
76
|
+
{/* Return string (.value) */}
|
|
77
|
+
<img src={content.text.value} alt={content.text.value} />
|
|
29
78
|
</div>
|
|
30
79
|
);
|
|
31
80
|
};
|
|
32
81
|
```
|
|
33
82
|
|
|
34
|
-
|
|
83
|
+
## References
|
|
84
|
+
|
|
85
|
+
### Environments
|
|
86
|
+
|
|
87
|
+
- [Vite and React](https://intlayer.org/doc/environment/vite-and-react.md)
|
|
88
|
+
- [Create React App](https://intlayer.org/doc/environment/create-react-app.md)
|
|
89
|
+
- [Vite and React (React Router v7)](https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md)
|
|
90
|
+
- [Vite and React (React Router v7 FS Routes)](https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md)
|
|
91
|
+
|
|
92
|
+
### Packages
|
|
93
|
+
|
|
94
|
+
- [Intlayer Exports](https://intlayer.org/doc/packages/intlayer/exports.md)
|
|
95
|
+
- [React Intlayer Provider](https://intlayer.org/doc/packages/react-intlayer/IntlayerProvider.md)
|
|
96
|
+
- [React Intlayer MarkdownRenderer](https://intlayer.org/doc/packages/react-intlayer/MarkdownRenderer.md)
|
|
97
|
+
- [React Intlayer Exports](https://intlayer.org/doc/packages/react-intlayer/exports.md)
|
|
98
|
+
- [React Intlayer T](https://intlayer.org/doc/packages/react-intlayer/t.md)
|
|
99
|
+
- [React Intlayer useDictionary](https://intlayer.org/doc/packages/react-intlayer/useDictionary.md)
|
|
100
|
+
- [React Intlayer useI18n](https://intlayer.org/doc/packages/react-intlayer/useI18n.md)
|
|
101
|
+
- [React Intlayer useIntlayer](https://intlayer.org/doc/packages/react-intlayer/useIntlayer.md)
|
|
102
|
+
- [React Intlayer useLocale](https://intlayer.org/doc/packages/react-intlayer/useLocale.md)
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description:
|
|
2
|
+
name: intlayer-cms
|
|
3
|
+
description: Manages remote content and server-side dictionaries using the Intlayer CMS. Use when the user asks to "fetch remote translations", "use Intlayer CMS", or "handle server-side 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 Server Content & CMS
|
|
@@ -8,3 +17,15 @@ description: How to use Intlayer with Remote/CMS/Server-side content
|
|
|
8
17
|
For managing server-side content and using the Intlayer CMS:
|
|
9
18
|
|
|
10
19
|
- [Intlayer CMS Documentation](https://intlayer.org/cms.md)
|
|
20
|
+
|
|
21
|
+
## References
|
|
22
|
+
|
|
23
|
+
### Concepts
|
|
24
|
+
|
|
25
|
+
- [CMS Concept](https://intlayer.org/doc/concept/cms.md)
|
|
26
|
+
- [Editor Concept](https://intlayer.org/doc/concept/editor.md)
|
|
27
|
+
|
|
28
|
+
### Links
|
|
29
|
+
|
|
30
|
+
- [CMS](https://intlayer.org/cms)
|
|
31
|
+
- [TMS](https://intlayer.org/tms)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: intlayer-solid-js
|
|
3
|
+
description: Integrates Intlayer internationalization with SolidJS components. Use when the user asks to "setup SolidJS i18n", create a new translated component, use the "useIntlayer" hook in Solid, 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, solid, vite]
|
|
11
|
+
documentation: https://intlayer.org/doc
|
|
12
|
+
support: contact@intlayer.org
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Intlayer Solid Usage
|
|
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 Solid 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., `myComponent.content.ts`) defining the dictionary.
|
|
26
|
+
2. **Implementation:** A Solid component (e.g., `MyComponent.tsx`) using the `useIntlayer` hook.
|
|
27
|
+
|
|
28
|
+
### Declare Content
|
|
29
|
+
|
|
30
|
+
Create a content file using `t()` for translations.
|
|
31
|
+
**File:** `src/components/MyComponent/myComponent.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
|
+
|
|
51
|
+
## Setup
|
|
52
|
+
|
|
53
|
+
- [Vite and Solid](https://intlayer.org/doc/environment/vite-and-solid.md)
|
|
54
|
+
|
|
55
|
+
## useIntlayer Hook
|
|
56
|
+
|
|
57
|
+
> [!IMPORTANT]
|
|
58
|
+
> In Solid, `useIntlayer` returns an **accessor** function (e.g., `content()`). You must call this function to access the reactive content.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { useIntlayer } from "solid-intlayer";
|
|
62
|
+
|
|
63
|
+
const MyComponent = () => {
|
|
64
|
+
const content = useIntlayer("my-component");
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div>
|
|
68
|
+
<h1>
|
|
69
|
+
{/* Return content */}
|
|
70
|
+
{content().text}
|
|
71
|
+
</h1>
|
|
72
|
+
{/* Return string (.value) */}
|
|
73
|
+
<img src={content().text.value} alt={content().text.value} />
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## References
|
|
80
|
+
|
|
81
|
+
### Environments
|
|
82
|
+
|
|
83
|
+
- [Vite and Solid](https://intlayer.org/doc/environment/vite-and-solid.md)
|
|
84
|
+
|
|
85
|
+
### Packages
|
|
86
|
+
|
|
87
|
+
- [Solid Intlayer Exports](https://intlayer.org/doc/packages/solid-intlayer/exports.md)
|
|
@@ -1,30 +1,81 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Svelte
|
|
2
|
+
name: intlayer-svelte
|
|
3
|
+
description: Integrates Intlayer internationalization with Svelte and SvelteKit applications. Use when the user asks to "setup Svelte i18n", create a new translated component, use the "useIntlayer" store, 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, svelte, vite]
|
|
11
|
+
documentation: https://intlayer.org/doc
|
|
12
|
+
support: contact@intlayer.org
|
|
4
13
|
---
|
|
5
14
|
|
|
6
15
|
# Intlayer Svelte 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 Svelte 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., `myComponent.content.ts`) defining the dictionary.
|
|
26
|
+
2. **Implementation:** A Svelte component (e.g., `MyComponent.svelte`) using the `useIntlayer` store.
|
|
27
|
+
|
|
28
|
+
### 1. Declare Content
|
|
29
|
+
|
|
30
|
+
Create a content file using `t()` for translations.
|
|
31
|
+
**File:** `src/components/MyComponent/myComponent.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
|
- [SvelteKit](https://intlayer.org/doc/environment/sveltekit.md)
|
|
11
54
|
- [Vite and Svelte](https://intlayer.org/doc/environment/vite-and-svelte.md)
|
|
12
|
-
- [Page Metadata](https://intlayer.org/doc/environment/svelte-intlayer/page-metadata.md)
|
|
13
|
-
- [Sitemap](https://intlayer.org/doc/environment/svelte-intlayer/sitemap.md)
|
|
14
|
-
- [Server Actions](https://intlayer.org/doc/environment/svelte-intlayer/server-actions.md)
|
|
15
55
|
|
|
16
56
|
## useIntlayer Hook
|
|
17
57
|
|
|
58
|
+
In Svelte, `useIntlayer` returns a **store**. You must use the `$` prefix to access its value.
|
|
59
|
+
|
|
18
60
|
```svelte
|
|
19
61
|
<script>
|
|
20
62
|
import { useIntlayer } from "svelte-intlayer";
|
|
21
|
-
const content = useIntlayer("my-
|
|
63
|
+
const content = useIntlayer("my-component");
|
|
22
64
|
</script>
|
|
65
|
+
|
|
23
66
|
<div>
|
|
24
|
-
<h1>
|
|
25
|
-
|
|
26
|
-
|
|
67
|
+
<h1>
|
|
68
|
+
{/* Return content */}
|
|
69
|
+
{$content.text}
|
|
70
|
+
</h1>
|
|
71
|
+
{/* Return string (.value) */}
|
|
72
|
+
<div aria-label={$content.text.value}></div>
|
|
27
73
|
</div>
|
|
28
74
|
```
|
|
29
75
|
|
|
30
|
-
|
|
76
|
+
## References
|
|
77
|
+
|
|
78
|
+
- [Intlayer Exports](https://intlayer.org/doc/packages/intlayer/exports.md)
|
|
79
|
+
- [Vite and Svelte](https://intlayer.org/doc/environment/vite-and-svelte.md)
|
|
80
|
+
- [SvelteKit](https://intlayer.org/doc/environment/sveltekit.md)
|
|
81
|
+
- [Svelte Intlayer Exports](https://intlayer.org/doc/packages/svelte-intlayer/exports.md)
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description:
|
|
2
|
+
name: intlayer-usage
|
|
3
|
+
description: Provides general guidelines for using Intlayer in any project. Use when the user asks to "get started with Intlayer", "declare content files", or understand the "project structure" for internationalization.
|
|
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 Usage
|
|
@@ -12,87 +21,6 @@ To use Intlayer effectively:
|
|
|
12
21
|
2. **Declare Content**:
|
|
13
22
|
We recommend creating one content declaration file per component, located alongside the component file. This keeps translations close to the code.
|
|
14
23
|
|
|
15
|
-
**Example Directory Structure:**
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
src/
|
|
19
|
-
├── components/
|
|
20
|
-
│ ├── MyComponent/
|
|
21
|
-
│ │ ├── index.content.ts # Content declaration
|
|
22
|
-
│ │ └── index.tsx # Component
|
|
23
|
-
│ ├── MyOtherComponent.content.ts # Content declaration
|
|
24
|
-
│ └── MyOtherComponent.tsx # Component
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Content Templates:**
|
|
28
|
-
|
|
29
|
-
_TypeScript (.content.ts)_
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
import { t, type Dictionary } from "intlayer";
|
|
33
|
-
|
|
34
|
-
const content = {
|
|
35
|
-
key: "my-component-key",
|
|
36
|
-
content: {
|
|
37
|
-
title: t({
|
|
38
|
-
en: "Hello World",
|
|
39
|
-
es: "Hola Mundo",
|
|
40
|
-
}),
|
|
41
|
-
description: "My description text",
|
|
42
|
-
},
|
|
43
|
-
} satisfies Dictionary;
|
|
44
|
-
|
|
45
|
-
export default content;
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
_TypeScript with React (.content.tsx)_
|
|
49
|
-
|
|
50
|
-
```tsx
|
|
51
|
-
import { t, type Dictionary } from "intlayer";
|
|
52
|
-
import { ReactNode } from "react";
|
|
53
|
-
|
|
54
|
-
const content = {
|
|
55
|
-
key: "my-component-key",
|
|
56
|
-
content: {
|
|
57
|
-
description: t<ReactNode>({
|
|
58
|
-
en: <>My description text</>,
|
|
59
|
-
es: <>Mi descripción de texto</>,
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
|
-
} satisfies Dictionary;
|
|
63
|
-
|
|
64
|
-
export default content;
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
```json
|
|
68
|
-
{
|
|
69
|
-
"key": "my-component-key",
|
|
70
|
-
"content": {
|
|
71
|
-
"title": {
|
|
72
|
-
"en": "Hello World",
|
|
73
|
-
"fr": "Bonjour le monde"
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
```javascript
|
|
80
|
-
import { t } from "intlayer";
|
|
81
|
-
|
|
82
|
-
export default {
|
|
83
|
-
key: "my-component-key",
|
|
84
|
-
content: {
|
|
85
|
-
title: t({
|
|
86
|
-
en: "Hello World",
|
|
87
|
-
fr: "Bonjour le monde",
|
|
88
|
-
}),
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
- [Content Declaration Documentation](https://intlayer.org/doc/concept/content.md)
|
|
94
|
-
- [Content File Format](https://intlayer.org/doc/concept/content/file.md)
|
|
95
|
-
|
|
96
24
|
3. **Consume Content**: Use the provided hooks and functions to access your content.
|
|
97
25
|
- [Intlayer Exports](https://intlayer.org/doc/packages/intlayer/exports.md)
|
|
98
26
|
- [React Intlayer Exports](https://intlayer.org/doc/packages/react-intlayer/exports.md)
|
|
@@ -105,3 +33,10 @@ To use Intlayer effectively:
|
|
|
105
33
|
4. **CLI Commands**:
|
|
106
34
|
Useful commands for managing your content:
|
|
107
35
|
- `npx intlayer build`: Build the dictionaries from your content declarations.
|
|
36
|
+
|
|
37
|
+
## References
|
|
38
|
+
|
|
39
|
+
- [Get Started](https://intlayer.org/doc/get-started.md)
|
|
40
|
+
- [How Intlayer Works](https://intlayer.org/doc/concept/how-works-intlayer.md)
|
|
41
|
+
- [Why Intlayer](https://intlayer.org/doc/why.md)
|
|
42
|
+
- [Per-locale File](https://intlayer.org/doc/concept/per-locale-file.md)
|