angular-intlayer 5.5.11 → 5.6.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 +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +14 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs.map +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs +4 -1
- package/dist/esm/client/useDictionaryDynamic.mjs.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<a href="https://www.facebook.com/intlayer" target="blank"><img align="center"
|
|
34
34
|
src="https://img.shields.io/badge/facebook-4267B2.svg?style=for-the-badge&logo=facebook&logoColor=white"
|
|
35
35
|
alt="Intlayer Facebook" height="30"/></a>
|
|
36
|
-
<a href="https://www.instagram.com/
|
|
36
|
+
<a href="https://www.instagram.com/intlayer/" target="blank"><img align="center"
|
|
37
37
|
src="https://img.shields.io/badge/instagram-%23E4405F.svg?style=for-the-badge&logo=Instagram&logoColor=white"
|
|
38
38
|
alt="Intlayer Instagram" height="30"/></a>
|
|
39
39
|
<a href="https://x.com/Intlayer183096" target="blank"><img align="center"
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
9
|
var __export = (target, all) => {
|
|
8
10
|
for (var name in all)
|
|
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
18
|
}
|
|
17
19
|
return to;
|
|
18
20
|
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
19
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
30
|
var useDictionaryDynamic_exports = {};
|
|
21
31
|
__export(useDictionaryDynamic_exports, {
|
|
@@ -23,12 +33,15 @@ __export(useDictionaryDynamic_exports, {
|
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(useDictionaryDynamic_exports);
|
|
25
35
|
var import_core = require("@angular/core");
|
|
36
|
+
var import_built = __toESM(require("@intlayer/config/built"));
|
|
26
37
|
var import_installIntlayer = require('./installIntlayer.cjs');
|
|
27
38
|
var import_useDictionary = require('./useDictionary.cjs');
|
|
28
39
|
var import_useLoadDynamic = require('./useLoadDynamic.cjs');
|
|
29
40
|
const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
|
|
30
41
|
const intlayer = (0, import_core.inject)(import_installIntlayer.INTLAYER_TOKEN);
|
|
31
|
-
const localeTarget = (0, import_core.computed)(
|
|
42
|
+
const localeTarget = (0, import_core.computed)(
|
|
43
|
+
() => locale ?? intlayer?.locale() ?? import_built.default?.internationalization.defaultLocale
|
|
44
|
+
);
|
|
32
45
|
const dictionary = (0, import_useLoadDynamic.useLoadDynamic)(
|
|
33
46
|
`${String(key)}.${localeTarget()}`,
|
|
34
47
|
dictionaryPromise[localeTarget()]()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type {\n Dictionary,\n DictionaryKeys,\n LanguageContent,\n} from '@intlayer/core';\nimport { INTLAYER_TOKEN, IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(()
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type {\n Dictionary,\n DictionaryKeys,\n LanguageContent,\n} from '@intlayer/core';\nimport { INTLAYER_TOKEN, IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(\n () =>\n locale ??\n intlayer?.locale() ??\n configuration?.internationalization.defaultLocale\n );\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget()}`,\n dictionaryPromise[localeTarget()]!()\n ) as T;\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAiC;AACjC,mBAA0B;AAO1B,6BAAiD;AACjD,2BAA8B;AAC9B,4BAA+B;AAOxB,MAAM,uBAAuB,CAIlC,mBACA,KACA,WACG;AACH,QAAM,eAAW,oBAAyB,qCAAc;AAExD,QAAM,mBAAe;AAAA,IACnB,MACE,UACA,UAAU,OAAO,KACjB,aAAAA,SAAe,qBAAqB;AAAA,EACxC;AAEA,QAAM,iBAAa;AAAA,IACjB,GAAG,OAAO,GAAG,CAAC,IAAI,aAAa,CAAC;AAAA,IAChC,kBAAkB,aAAa,CAAC,EAAG;AAAA,EACrC;AAEA,aAAO,oCAAc,YAAY,aAAa,CAAQ;AACxD;","names":["configuration"]}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { computed, inject } from "@angular/core";
|
|
3
|
+
import configuration from "@intlayer/config/built";
|
|
3
4
|
import { INTLAYER_TOKEN } from "./installIntlayer.mjs";
|
|
4
5
|
import { useDictionary } from "./useDictionary.mjs";
|
|
5
6
|
import { useLoadDynamic } from "./useLoadDynamic.mjs";
|
|
6
7
|
const useDictionaryDynamic = (dictionaryPromise, key, locale) => {
|
|
7
8
|
const intlayer = inject(INTLAYER_TOKEN);
|
|
8
|
-
const localeTarget = computed(
|
|
9
|
+
const localeTarget = computed(
|
|
10
|
+
() => locale ?? intlayer?.locale() ?? configuration?.internationalization.defaultLocale
|
|
11
|
+
);
|
|
9
12
|
const dictionary = useLoadDynamic(
|
|
10
13
|
`${String(key)}.${localeTarget()}`,
|
|
11
14
|
dictionaryPromise[localeTarget()]()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type {\n Dictionary,\n DictionaryKeys,\n LanguageContent,\n} from '@intlayer/core';\nimport { INTLAYER_TOKEN, IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(()
|
|
1
|
+
{"version":3,"sources":["../../../src/client/useDictionaryDynamic.ts"],"sourcesContent":["'use client';\n\nimport { computed, inject } from '@angular/core';\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type {\n Dictionary,\n DictionaryKeys,\n LanguageContent,\n} from '@intlayer/core';\nimport { INTLAYER_TOKEN, IntlayerProvider } from './installIntlayer';\nimport { useDictionary } from './useDictionary';\nimport { useLoadDynamic } from './useLoadDynamic';\n\n/**\n * On the server side, Hook that transform a dictionary and return the content\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const useDictionaryDynamic = <\n T extends Dictionary,\n K extends DictionaryKeys,\n>(\n dictionaryPromise: LanguageContent<() => Promise<T>>,\n key: K,\n locale?: LocalesValues\n) => {\n const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN);\n\n const localeTarget = computed(\n () =>\n locale ??\n intlayer?.locale() ??\n configuration?.internationalization.defaultLocale\n );\n\n const dictionary = useLoadDynamic<T>(\n `${String(key)}.${localeTarget()}`,\n dictionaryPromise[localeTarget()]!()\n ) as T;\n\n return useDictionary(dictionary, localeTarget() as any);\n};\n"],"mappings":";AAEA,SAAS,UAAU,cAAc;AACjC,OAAO,mBAAmB;AAO1B,SAAS,sBAAwC;AACjD,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAOxB,MAAM,uBAAuB,CAIlC,mBACA,KACA,WACG;AACH,QAAM,WAAW,OAAyB,cAAc;AAExD,QAAM,eAAe;AAAA,IACnB,MACE,UACA,UAAU,OAAO,KACjB,eAAe,qBAAqB;AAAA,EACxC;AAEA,QAAM,aAAa;AAAA,IACjB,GAAG,OAAO,GAAG,CAAC,IAAI,aAAa,CAAC;AAAA,IAChC,kBAAkB,aAAa,CAAC,EAAG;AAAA,EACrC;AAEA,SAAO,cAAc,YAAY,aAAa,CAAQ;AACxD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryDynamic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryDynamic.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAKxB;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,cAAc,EAExB,mBAAmB,eAAe,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EACpD,KAAK,CAAC,EACN,SAAS,aAAa,sGAiBvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-intlayer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Angular applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
"deepmerge": "^4.3.1",
|
|
65
65
|
"js-cookie": "^3.0.5",
|
|
66
66
|
"uuid": "^11.1.0",
|
|
67
|
-
"@intlayer/config": "5.
|
|
68
|
-
"@intlayer/
|
|
69
|
-
"@intlayer/webpack": "5.
|
|
70
|
-
"@intlayer/
|
|
71
|
-
"@intlayer/
|
|
72
|
-
"@intlayer/
|
|
67
|
+
"@intlayer/config": "5.6.0",
|
|
68
|
+
"@intlayer/editor": "5.6.0",
|
|
69
|
+
"@intlayer/webpack": "5.6.0",
|
|
70
|
+
"@intlayer/chokidar": "5.6.0",
|
|
71
|
+
"@intlayer/core": "5.6.0",
|
|
72
|
+
"@intlayer/dictionaries-entry": "5.6.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/node": "^22.15.30",
|
|
@@ -85,17 +85,17 @@
|
|
|
85
85
|
"vitest": "^3.2.2",
|
|
86
86
|
"@utils/eslint-config": "1.0.4",
|
|
87
87
|
"@utils/ts-config": "1.0.4",
|
|
88
|
-
"@utils/
|
|
89
|
-
"@utils/
|
|
88
|
+
"@utils/ts-config-types": "1.0.4",
|
|
89
|
+
"@utils/tsup-config": "1.0.4"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@angular/common": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
93
93
|
"@angular/core": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
|
|
94
94
|
"rxjs": "^6.0.0 || ^7.0.0",
|
|
95
|
-
"@intlayer/chokidar": "5.
|
|
96
|
-
"@intlayer/
|
|
97
|
-
"@intlayer/
|
|
98
|
-
"@intlayer/
|
|
95
|
+
"@intlayer/chokidar": "5.6.0",
|
|
96
|
+
"@intlayer/config": "5.6.0",
|
|
97
|
+
"@intlayer/dictionaries-entry": "5.6.0",
|
|
98
|
+
"@intlayer/core": "5.6.0"
|
|
99
99
|
},
|
|
100
100
|
"engines": {
|
|
101
101
|
"node": ">=14.18"
|