intlayer 1.0.1 → 1.2.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/README.md +174 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Intlayer: Next-Level Content Management in JavaScript
|
|
2
|
+
|
|
3
|
+
**Intlayer** is an innovative Content Management System (CMS) designed specifically for JavaScript developers. It enables seamless transpilation of JavaScript content into structured dictionaries, making integration into your codebase straightforward and efficient.
|
|
4
|
+
|
|
5
|
+
## Why Choose Intlayer?
|
|
6
|
+
|
|
7
|
+
- **JavaScript-Powered Content Management**: Harness the flexibility of JavaScript to define and manage your content efficiently.
|
|
8
|
+
- **Type-Safe Environment**: Leverage TypeScript to ensure all your content definitions are precise and error-free.
|
|
9
|
+
- **Integrated Content Files**: Keep your translations close to their respective components, enhancing maintainability and clarity.
|
|
10
|
+
|
|
11
|
+
## intlayer package
|
|
12
|
+
|
|
13
|
+
`intlayer` package intend to declare your content in a structured way, using JavaScript.
|
|
14
|
+
|
|
15
|
+
To build dictionaries from this declaration, you can use [intlayer-cli](https://github.com/aypineau/intlayer/blob/main/packages/intlayer-cli/readme.md).
|
|
16
|
+
And to interpret intlayer dictionaries you can interpreters, such as [react-intlayer](https://github.com/aypineau/intlayer/blob/main/packages/react-intlayer/readme.md), or [next-intlayer](https://github.com/aypineau/intlayer/blob/main/packages/next-intlayer/readme.md)
|
|
17
|
+
|
|
18
|
+
## Getting Started with Intlayer
|
|
19
|
+
|
|
20
|
+
[See how to use intlayer with NextJS](https://github.com/aypineau/intlayer/blob/main/readme.md)
|
|
21
|
+
|
|
22
|
+
### Install Package
|
|
23
|
+
|
|
24
|
+
Install the necessary packages using npm:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install intlayer
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
yarn install intlayer
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pnpm install intlayer
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Manage Your Content
|
|
39
|
+
|
|
40
|
+
Create and manage your content dictionaries:
|
|
41
|
+
|
|
42
|
+
#### Using typescript
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// src/app/[locale]/page.content.ts
|
|
46
|
+
import { t, enu, type ContentModule } from "intlayer";
|
|
47
|
+
|
|
48
|
+
const pageContent: ContentModule = {
|
|
49
|
+
id: "page",
|
|
50
|
+
getStarted: {
|
|
51
|
+
main: t({
|
|
52
|
+
en: "Get started by editing",
|
|
53
|
+
fr: "Commencez par éditer",
|
|
54
|
+
es: "Comience por editar",
|
|
55
|
+
}),
|
|
56
|
+
pageLink: "src/app/page.tsx",
|
|
57
|
+
},
|
|
58
|
+
nestedContent: {
|
|
59
|
+
id: "enumeration",
|
|
60
|
+
numberOfCar: enu({
|
|
61
|
+
"<-1": "Less than minus one car",
|
|
62
|
+
"-1": "Minus one car",
|
|
63
|
+
"0": "No cars",
|
|
64
|
+
"1": "One car",
|
|
65
|
+
">5": "Some cars",
|
|
66
|
+
">19": "Many cars",
|
|
67
|
+
}),
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Content should be exported as default
|
|
72
|
+
export default pageContent;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Using ECMAScript modules
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
// src/app/[locale]/page.content.mjs
|
|
79
|
+
|
|
80
|
+
import { t } from "intlayer";
|
|
81
|
+
|
|
82
|
+
/** @type {import('intlayer').ContentModule} */
|
|
83
|
+
const pageContent = {
|
|
84
|
+
id: "page",
|
|
85
|
+
getStarted: {
|
|
86
|
+
main: t({
|
|
87
|
+
en: "Get started by editing",
|
|
88
|
+
fr: "Commencez par éditer",
|
|
89
|
+
es: "Comience por editar",
|
|
90
|
+
}),
|
|
91
|
+
pageLink: "src/app/page.tsx",
|
|
92
|
+
},
|
|
93
|
+
nestedContent: {
|
|
94
|
+
id: "enumeration",
|
|
95
|
+
numberOfCar: enu({
|
|
96
|
+
"<-1": "Less than minus one car",
|
|
97
|
+
"-1": "Minus one car",
|
|
98
|
+
"0": "No cars",
|
|
99
|
+
"1": "One car",
|
|
100
|
+
">5": "Some cars",
|
|
101
|
+
">19": "Many cars",
|
|
102
|
+
}),
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Content should be exported as default
|
|
107
|
+
export default pageContent;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### Using CommonJS modules
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
// src/app/[locale]/page.content.cjs
|
|
114
|
+
|
|
115
|
+
const { t } = require("intlayer");
|
|
116
|
+
|
|
117
|
+
/** @type {import('intlayer').ContentModule} */
|
|
118
|
+
const pageContent = {
|
|
119
|
+
id: "page",
|
|
120
|
+
getStarted: {
|
|
121
|
+
main: t({
|
|
122
|
+
en: "Get started by editing",
|
|
123
|
+
fr: "Commencez par éditer",
|
|
124
|
+
es: "Comience por editar",
|
|
125
|
+
}),
|
|
126
|
+
pageLink: "src/app/page.tsx",
|
|
127
|
+
},
|
|
128
|
+
nestedContent: {
|
|
129
|
+
id: "enumeration",
|
|
130
|
+
numberOfCar: enu({
|
|
131
|
+
"<-1": "Less than minus one car",
|
|
132
|
+
"-1": "Minus one car",
|
|
133
|
+
"0": "No cars",
|
|
134
|
+
"1": "One car",
|
|
135
|
+
">5": "Some cars",
|
|
136
|
+
">19": "Many cars",
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// Content should be exported as default
|
|
142
|
+
module.exports = pageContent;
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### Using JSON
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"id": "page",
|
|
150
|
+
"getStarted": {
|
|
151
|
+
"main": {
|
|
152
|
+
"nodeType": "translation",
|
|
153
|
+
"en": "Get started by editing",
|
|
154
|
+
"fr": "Commencez par éditer",
|
|
155
|
+
"es": "Comience por editar"
|
|
156
|
+
},
|
|
157
|
+
"pageLink": "src/app/page.tsx"
|
|
158
|
+
},
|
|
159
|
+
"nestedContent": {
|
|
160
|
+
"id": "enumeration",
|
|
161
|
+
"nodeType": "enumeration",
|
|
162
|
+
"numberOfCar": {
|
|
163
|
+
"<-1": "Less than minus one car",
|
|
164
|
+
"-1": "Minus one car",
|
|
165
|
+
"0": "No cars",
|
|
166
|
+
"1": "One car",
|
|
167
|
+
">5": "Some cars",
|
|
168
|
+
">19": "Many cars"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
This version emphasizes ease of use, practical steps, and the professional application of Intlayer in a Next.js environment.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "IntLayer is a layer of abstraction between the business logic and the data access layer. Manage internationalization in a simple way, through TypeScript, JavaScript or JSON declaration file.",
|
|
6
6
|
"keywords": [
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"webpack": "^5.91.0",
|
|
54
|
-
"@intlayer/config": "^1.
|
|
55
|
-
"@intlayer/core": "^1.
|
|
56
|
-
"intlayer": "^1.
|
|
54
|
+
"@intlayer/config": "^1.2.1",
|
|
55
|
+
"@intlayer/core": "^1.2.1",
|
|
56
|
+
"intlayer": "^1.2.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@changesets/changelog-github": "0.5.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@types/node": "^20.12.7",
|
|
62
62
|
"rimraf": "5.0.5",
|
|
63
63
|
"tsup": "^8.0.2",
|
|
64
|
-
"typescript": "^5.
|
|
64
|
+
"typescript": "^5.4.5",
|
|
65
65
|
"@utils/eslint-config": "^1.0.1",
|
|
66
66
|
"@utils/ts-config": "^1.0.1"
|
|
67
67
|
},
|