intlayer 1.2.0 → 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 CHANGED
@@ -142,11 +142,10 @@ const pageContent = {
142
142
  module.exports = pageContent;
143
143
  ```
144
144
 
145
- #### Using CommonJS modules
145
+ #### Using JSON
146
146
 
147
- ```json
147
+ ```json5
148
148
  // src/app/[locale]/page.content.json
149
-
150
149
  {
151
150
  "id": "page",
152
151
  "getStarted": {
@@ -170,7 +169,7 @@ module.exports = pageContent;
170
169
  ">19": "Many cars",
171
170
  },
172
171
  },
173
- };
172
+ }
174
173
  ```
175
174
 
176
175
  This version emphasizes ease of use, practical steps, and the professional application of Intlayer in a Next.js environment.
@@ -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\ntype ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;\n\nexport type CustomizableLanguageContent<Content = string> =\n ConfigLocales extends never\n ? LanguageContent<Content>\n : ConfigLanguageContent<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 {\n type CustomIntlayerConfig as IntlayerConfig,\n Locales,\n} from '@intlayer/config/client';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAKO;AAgCP,IAAAA,eAA0D;AAC1D,oBAGO;AAlBA,MAAM,IAEsB,YAAAC;AAC5B,MAAM,wBAGE,YAAAC;","names":["import_core","tCore","getTranslationContentCore"]}
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"]}
@@ -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 ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;
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
 
@@ -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 ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;
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
 
@@ -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,
@@ -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\ntype ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;\n\nexport type CustomizableLanguageContent<Content = string> =\n ConfigLocales extends never\n ? LanguageContent<Content>\n : ConfigLanguageContent<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 {\n type CustomIntlayerConfig as IntlayerConfig,\n Locales,\n} from '@intlayer/config/client';\n"],"mappings":"AACA;AAAA,EAEE,KAAK;AAAA,EACL,yBAAyB;AAAA,OAEpB;AAkBA,MAAM,IAEsB;AAC5B,MAAM,wBAGE;AAQf,SAAS,eAAe,KAAK,6BAA6B;AAC1D;AAAA,EAEE;AAAA,OACK;","names":[]}
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": "1.2.0",
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": "^1.2.0",
55
- "@intlayer/core": "^1.2.0",
56
- "intlayer": "^1.2.0"
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
- : ConfigLanguageContent<Content>;
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
- type CustomIntlayerConfig as IntlayerConfig,
42
- Locales,
38
+ export type {
39
+ LocalesValues,
40
+ CustomIntlayerConfig as IntlayerConfig,
43
41
  } from '@intlayer/config/client';
42
+ export { Locales } from '@intlayer/config/client';