intlayer 1.2.1 → 2.0.0
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 +7 -6
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +2 -3
- package/dist/esm/index.d.mts +2 -3
- package/dist/esm/index.mjs +1 -3
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +4 -9
- package/src/index.ts +5 -6
package/README.md
CHANGED
|
@@ -144,7 +144,8 @@ module.exports = pageContent;
|
|
|
144
144
|
|
|
145
145
|
#### Using JSON
|
|
146
146
|
|
|
147
|
-
```
|
|
147
|
+
```json5
|
|
148
|
+
// src/app/[locale]/page.content.json
|
|
148
149
|
{
|
|
149
150
|
"id": "page",
|
|
150
151
|
"getStarted": {
|
|
@@ -152,9 +153,9 @@ module.exports = pageContent;
|
|
|
152
153
|
"nodeType": "translation",
|
|
153
154
|
"en": "Get started by editing",
|
|
154
155
|
"fr": "Commencez par éditer",
|
|
155
|
-
"es": "Comience por editar"
|
|
156
|
+
"es": "Comience por editar",
|
|
156
157
|
},
|
|
157
|
-
"pageLink": "src/app/page.tsx"
|
|
158
|
+
"pageLink": "src/app/page.tsx",
|
|
158
159
|
},
|
|
159
160
|
"nestedContent": {
|
|
160
161
|
"id": "enumeration",
|
|
@@ -165,9 +166,9 @@ module.exports = pageContent;
|
|
|
165
166
|
"0": "No cars",
|
|
166
167
|
"1": "One car",
|
|
167
168
|
">5": "Some cars",
|
|
168
|
-
">19": "Many cars"
|
|
169
|
-
}
|
|
170
|
-
}
|
|
169
|
+
">19": "Many cars",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
171
172
|
}
|
|
172
173
|
```
|
|
173
174
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n type TranslationContent,\n t as tCore,\n getTranslationContent as getTranslationContentCore,\n type LanguageContent,\n} from '@intlayer/core';\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-empty-interface */\nexport interface IConfigLocales<Content> {\n // This interface should be augmented in the consuming app\n}\n\ntype ConfigLocales = keyof IConfigLocales<unknown>;\n\
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n type TranslationContent,\n t as tCore,\n getTranslationContent as getTranslationContentCore,\n type LanguageContent,\n} from '@intlayer/core';\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-empty-interface */\nexport interface IConfigLocales<Content> {\n // This interface should be augmented in the consuming app\n}\n\ntype ConfigLocales = keyof IConfigLocales<unknown>;\n\nexport type CustomizableLanguageContent<Content = string> =\n ConfigLocales extends never\n ? LanguageContent<Content>\n : IConfigLocales<Content>;\n\n// Re-exporting the following functions from the core package: to use module augmentation\nexport const t: <Content = string>(\n content?: CustomizableLanguageContent<Content>\n) => TranslationContent<Content> = tCore;\nexport const getTranslationContent: <Content = string>(\n languageContent: CustomizableLanguageContent<Content>,\n locale: Locales\n) => Content = getTranslationContentCore;\n\nexport type {\n LanguageContent,\n QuantityContent,\n ContentValue,\n ContentModule,\n} from '@intlayer/core';\nexport { getLocaleName, enu, getEnumerationContent } from '@intlayer/core';\nexport type {\n LocalesValues,\n CustomIntlayerConfig as IntlayerConfig,\n} from '@intlayer/config/client';\nexport { Locales } from '@intlayer/config/client';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAKO;AA8BP,IAAAA,eAA0D;AAK1D,oBAAwB;AAnBjB,MAAM,IAEsB,YAAAC;AAC5B,MAAM,wBAGE,YAAAC;","names":["import_core","tCore","getTranslationContentCore"]}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Locales } from '@intlayer/config/client';
|
|
2
|
-
export { CustomIntlayerConfig as IntlayerConfig, Locales } from '@intlayer/config/client';
|
|
2
|
+
export { CustomIntlayerConfig as IntlayerConfig, Locales, LocalesValues } from '@intlayer/config/client';
|
|
3
3
|
import { LanguageContent, TranslationContent } from '@intlayer/core';
|
|
4
4
|
export { ContentModule, ContentValue, LanguageContent, QuantityContent, enu, getEnumerationContent, getLocaleName } from '@intlayer/core';
|
|
5
5
|
|
|
6
6
|
interface IConfigLocales<Content> {
|
|
7
7
|
}
|
|
8
8
|
type ConfigLocales = keyof IConfigLocales<unknown>;
|
|
9
|
-
type
|
|
10
|
-
type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : ConfigLanguageContent<Content>;
|
|
9
|
+
type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : IConfigLocales<Content>;
|
|
11
10
|
declare const t: <Content = string>(content?: CustomizableLanguageContent<Content>) => TranslationContent<Content>;
|
|
12
11
|
declare const getTranslationContent: <Content = string>(languageContent: CustomizableLanguageContent<Content>, locale: Locales) => Content;
|
|
13
12
|
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Locales } from '@intlayer/config/client';
|
|
2
|
-
export { CustomIntlayerConfig as IntlayerConfig, Locales } from '@intlayer/config/client';
|
|
2
|
+
export { CustomIntlayerConfig as IntlayerConfig, Locales, LocalesValues } from '@intlayer/config/client';
|
|
3
3
|
import { LanguageContent, TranslationContent } from '@intlayer/core';
|
|
4
4
|
export { ContentModule, ContentValue, LanguageContent, QuantityContent, enu, getEnumerationContent, getLocaleName } from '@intlayer/core';
|
|
5
5
|
|
|
6
6
|
interface IConfigLocales<Content> {
|
|
7
7
|
}
|
|
8
8
|
type ConfigLocales = keyof IConfigLocales<unknown>;
|
|
9
|
-
type
|
|
10
|
-
type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : ConfigLanguageContent<Content>;
|
|
9
|
+
type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : IConfigLocales<Content>;
|
|
11
10
|
declare const t: <Content = string>(content?: CustomizableLanguageContent<Content>) => TranslationContent<Content>;
|
|
12
11
|
declare const getTranslationContent: <Content = string>(languageContent: CustomizableLanguageContent<Content>, locale: Locales) => Content;
|
|
13
12
|
|
package/dist/esm/index.mjs
CHANGED
|
@@ -5,9 +5,7 @@ import {
|
|
|
5
5
|
const t = tCore;
|
|
6
6
|
const getTranslationContent = getTranslationContentCore;
|
|
7
7
|
import { getLocaleName, enu, getEnumerationContent } from "@intlayer/core";
|
|
8
|
-
import {
|
|
9
|
-
Locales
|
|
10
|
-
} from "@intlayer/config/client";
|
|
8
|
+
import { Locales } from "@intlayer/config/client";
|
|
11
9
|
export {
|
|
12
10
|
Locales,
|
|
13
11
|
enu,
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n type TranslationContent,\n t as tCore,\n getTranslationContent as getTranslationContentCore,\n type LanguageContent,\n} from '@intlayer/core';\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-empty-interface */\nexport interface IConfigLocales<Content> {\n // This interface should be augmented in the consuming app\n}\n\ntype ConfigLocales = keyof IConfigLocales<unknown>;\n\
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\nimport {\n type TranslationContent,\n t as tCore,\n getTranslationContent as getTranslationContentCore,\n type LanguageContent,\n} from '@intlayer/core';\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/no-empty-interface */\nexport interface IConfigLocales<Content> {\n // This interface should be augmented in the consuming app\n}\n\ntype ConfigLocales = keyof IConfigLocales<unknown>;\n\nexport type CustomizableLanguageContent<Content = string> =\n ConfigLocales extends never\n ? LanguageContent<Content>\n : IConfigLocales<Content>;\n\n// Re-exporting the following functions from the core package: to use module augmentation\nexport const t: <Content = string>(\n content?: CustomizableLanguageContent<Content>\n) => TranslationContent<Content> = tCore;\nexport const getTranslationContent: <Content = string>(\n languageContent: CustomizableLanguageContent<Content>,\n locale: Locales\n) => Content = getTranslationContentCore;\n\nexport type {\n LanguageContent,\n QuantityContent,\n ContentValue,\n ContentModule,\n} from '@intlayer/core';\nexport { getLocaleName, enu, getEnumerationContent } from '@intlayer/core';\nexport type {\n LocalesValues,\n CustomIntlayerConfig as IntlayerConfig,\n} from '@intlayer/config/client';\nexport { Locales } from '@intlayer/config/client';\n"],"mappings":"AACA;AAAA,EAEE,KAAK;AAAA,EACL,yBAAyB;AAAA,OAEpB;AAgBA,MAAM,IAEsB;AAC5B,MAAM,wBAGE;AAQf,SAAS,eAAe,KAAK,6BAA6B;AAK1D,SAAS,eAAe;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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": [
|
|
@@ -28,11 +28,6 @@
|
|
|
28
28
|
"require": "./dist/cjs/index.cjs",
|
|
29
29
|
"import": "./dist/esm/index.mjs"
|
|
30
30
|
},
|
|
31
|
-
"./augmentation": {
|
|
32
|
-
"types": "./dist/esm/augmentation.d.mts",
|
|
33
|
-
"require": "./dist/cjs/augmentation.cjs",
|
|
34
|
-
"import": "./dist/esm/augmentation.mjs"
|
|
35
|
-
},
|
|
36
31
|
"./package.json": "./package.json"
|
|
37
32
|
},
|
|
38
33
|
"main": "src/index.ts",
|
|
@@ -51,9 +46,9 @@
|
|
|
51
46
|
],
|
|
52
47
|
"dependencies": {
|
|
53
48
|
"webpack": "^5.91.0",
|
|
54
|
-
"@intlayer/config": "^
|
|
55
|
-
"@intlayer/core": "^
|
|
56
|
-
"intlayer": "^
|
|
49
|
+
"@intlayer/config": "^2.0.0",
|
|
50
|
+
"@intlayer/core": "^2.0.0",
|
|
51
|
+
"intlayer": "^2.0.0"
|
|
57
52
|
},
|
|
58
53
|
"devDependencies": {
|
|
59
54
|
"@changesets/changelog-github": "0.5.0",
|
package/src/index.ts
CHANGED
|
@@ -14,12 +14,10 @@ export interface IConfigLocales<Content> {
|
|
|
14
14
|
|
|
15
15
|
type ConfigLocales = keyof IConfigLocales<unknown>;
|
|
16
16
|
|
|
17
|
-
type ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;
|
|
18
|
-
|
|
19
17
|
export type CustomizableLanguageContent<Content = string> =
|
|
20
18
|
ConfigLocales extends never
|
|
21
19
|
? LanguageContent<Content>
|
|
22
|
-
:
|
|
20
|
+
: IConfigLocales<Content>;
|
|
23
21
|
|
|
24
22
|
// Re-exporting the following functions from the core package: to use module augmentation
|
|
25
23
|
export const t: <Content = string>(
|
|
@@ -37,7 +35,8 @@ export type {
|
|
|
37
35
|
ContentModule,
|
|
38
36
|
} from '@intlayer/core';
|
|
39
37
|
export { getLocaleName, enu, getEnumerationContent } from '@intlayer/core';
|
|
40
|
-
export {
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
export type {
|
|
39
|
+
LocalesValues,
|
|
40
|
+
CustomIntlayerConfig as IntlayerConfig,
|
|
43
41
|
} from '@intlayer/config/client';
|
|
42
|
+
export { Locales } from '@intlayer/config/client';
|