@intlayer/core 7.4.0 → 7.5.0-canary.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/dist/cjs/localization/getLocale.cjs +3 -4
- package/dist/cjs/localization/getLocale.cjs.map +1 -1
- package/dist/cjs/localization/getLocalizedUrl.cjs +2 -1
- package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
- package/dist/cjs/messageFormat/ICU.cjs +309 -0
- package/dist/cjs/messageFormat/ICU.cjs.map +1 -0
- package/dist/cjs/messageFormat/i18next.cjs +320 -0
- package/dist/cjs/messageFormat/i18next.cjs.map +1 -0
- package/dist/cjs/messageFormat/index.cjs +10 -0
- package/dist/cjs/messageFormat/verify-icu-format.cjs +65 -0
- package/dist/cjs/messageFormat/verify-icu-format.cjs.map +1 -0
- package/dist/cjs/messageFormat/vue-i18n.cjs +166 -0
- package/dist/cjs/messageFormat/vue-i18n.cjs.map +1 -0
- package/dist/esm/localization/getLocale.mjs +1 -2
- package/dist/esm/localization/getLocale.mjs.map +1 -1
- package/dist/esm/localization/getLocalizedUrl.mjs +2 -1
- package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -1
- package/dist/esm/messageFormat/ICU.mjs +307 -0
- package/dist/esm/messageFormat/ICU.mjs.map +1 -0
- package/dist/esm/messageFormat/i18next.mjs +318 -0
- package/dist/esm/messageFormat/i18next.mjs.map +1 -0
- package/dist/esm/messageFormat/index.mjs +5 -0
- package/dist/esm/messageFormat/verify-icu-format.mjs +65 -0
- package/dist/esm/messageFormat/verify-icu-format.mjs.map +1 -0
- package/dist/esm/messageFormat/vue-i18n.mjs +164 -0
- package/dist/esm/messageFormat/vue-i18n.mjs.map +1 -0
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +8 -7
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +8 -7
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +8 -7
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/orderDictionaries.d.ts +2 -2
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
- package/dist/types/messageFormat/ICU.d.ts +11 -0
- package/dist/types/messageFormat/ICU.d.ts.map +1 -0
- package/dist/types/messageFormat/i18next.d.ts +9 -0
- package/dist/types/messageFormat/i18next.d.ts.map +1 -0
- package/dist/types/messageFormat/index.d.ts +4 -0
- package/dist/types/messageFormat/verify-icu-format.d.ts +1 -0
- package/dist/types/messageFormat/vue-i18n.d.ts +9 -0
- package/dist/types/messageFormat/vue-i18n.d.ts.map +1 -0
- package/package.json +14 -9
- package/dist/cjs/dist/esm/getStorageAttributes.cjs +0 -134
- package/dist/cjs/dist/esm/getStorageAttributes.cjs.map +0 -1
- package/dist/cjs/dist/esm/localization/localeResolver.cjs +0 -28
- package/dist/cjs/dist/esm/localization/localeResolver.cjs.map +0 -1
- package/dist/cjs/dist/esm/utils/getCookie.cjs +0 -32
- package/dist/cjs/dist/esm/utils/getCookie.cjs.map +0 -1
- package/dist/cjs/dist/esm/utils/localeStorage.cjs +0 -61
- package/dist/cjs/dist/esm/utils/localeStorage.cjs.map +0 -1
- package/dist/cjs/localization/isValidLocale.cjs +0 -54
- package/dist/cjs/localization/isValidLocale.cjs.map +0 -1
- package/dist/esm/dist/esm/getStorageAttributes.mjs +0 -133
- package/dist/esm/dist/esm/getStorageAttributes.mjs.map +0 -1
- package/dist/esm/dist/esm/localization/localeResolver.mjs +0 -26
- package/dist/esm/dist/esm/localization/localeResolver.mjs.map +0 -1
- package/dist/esm/dist/esm/utils/getCookie.mjs +0 -31
- package/dist/esm/dist/esm/utils/getCookie.mjs.map +0 -1
- package/dist/esm/dist/esm/utils/localeStorage.mjs +0 -59
- package/dist/esm/dist/esm/utils/localeStorage.mjs.map +0 -1
- package/dist/esm/localization/isValidLocale.mjs +0 -52
- package/dist/esm/localization/isValidLocale.mjs.map +0 -1
- package/dist/types/localization/isValidLocale.d.ts +0 -35
- package/dist/types/localization/isValidLocale.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeProps, Plugins } from "../interpreter/getContent/plugins.js";
|
|
2
2
|
import "../interpreter/index.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _intlayer_types7 from "@intlayer/types";
|
|
4
4
|
import { ContentNode, DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts
|
|
@@ -24,11 +24,12 @@ declare const getFilterMissingTranslationsContent: <T extends ContentNode, L ext
|
|
|
24
24
|
declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, localeToCheck: LocalesValues) => {
|
|
25
25
|
content: any;
|
|
26
26
|
$schema?: string;
|
|
27
|
-
id?:
|
|
27
|
+
id?: _intlayer_types7.DictionaryId;
|
|
28
28
|
projectIds?: string[];
|
|
29
|
-
localId?:
|
|
30
|
-
localIds?:
|
|
31
|
-
|
|
29
|
+
localId?: _intlayer_types7.LocalDictionaryId;
|
|
30
|
+
localIds?: _intlayer_types7.LocalDictionaryId[];
|
|
31
|
+
format?: _intlayer_types7.DictionaryFormat;
|
|
32
|
+
key: _intlayer_types7.DictionaryKey;
|
|
32
33
|
title?: string;
|
|
33
34
|
description?: string;
|
|
34
35
|
versions?: string[];
|
|
@@ -36,11 +37,11 @@ declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, l
|
|
|
36
37
|
filePath?: string;
|
|
37
38
|
tags?: string[];
|
|
38
39
|
locale?: LocalesValues;
|
|
39
|
-
fill?:
|
|
40
|
+
fill?: _intlayer_types7.Fill;
|
|
40
41
|
filled?: true;
|
|
41
42
|
priority?: number;
|
|
42
43
|
live?: boolean;
|
|
43
|
-
location?:
|
|
44
|
+
location?: _intlayer_types7.DictionaryLocation;
|
|
44
45
|
};
|
|
45
46
|
//#endregion
|
|
46
47
|
export { filterMissingTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilterMissingTranslationsContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterMissingTranslationsContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAmMa,qDACI,kBACd;;AAFH;AA8LA;;;;;;;;AA0BA;;;;cA1Ba,gDACD,uBACA,gBAAgB,uBAEpB,kBACS,cACJ;cAoBA,qDACC,2BACG;;;OAAa,
|
|
1
|
+
{"version":3,"file":"getFilterMissingTranslationsContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterMissingTranslationsContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAmMa,qDACI,kBACd;;AAFH;AA8LA;;;;;;;;AA0BA;;;;cA1Ba,gDACD,uBACA,gBAAgB,uBAEpB,kBACS,cACJ;cAoBA,qDACC,2BACG;;;OAAa,gBAAA,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeepTransformContent, NodeProps, Plugins } from "../interpreter/getContent/plugins.js";
|
|
2
2
|
import "../interpreter/index.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _intlayer_types14 from "@intlayer/types";
|
|
4
4
|
import { ContentNode, DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts
|
|
@@ -16,11 +16,12 @@ declare const getFilterTranslationsOnlyContent: <T extends ContentNode, L extend
|
|
|
16
16
|
declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, locale?: LocalesValues, fallback?: LocalesValues) => {
|
|
17
17
|
content: any;
|
|
18
18
|
$schema?: string;
|
|
19
|
-
id?:
|
|
19
|
+
id?: _intlayer_types14.DictionaryId;
|
|
20
20
|
projectIds?: string[];
|
|
21
|
-
localId?:
|
|
22
|
-
localIds?:
|
|
23
|
-
|
|
21
|
+
localId?: _intlayer_types14.LocalDictionaryId;
|
|
22
|
+
localIds?: _intlayer_types14.LocalDictionaryId[];
|
|
23
|
+
format?: _intlayer_types14.DictionaryFormat;
|
|
24
|
+
key: _intlayer_types14.DictionaryKey;
|
|
24
25
|
title?: string;
|
|
25
26
|
description?: string;
|
|
26
27
|
versions?: string[];
|
|
@@ -28,11 +29,11 @@ declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, loca
|
|
|
28
29
|
filePath?: string;
|
|
29
30
|
tags?: string[];
|
|
30
31
|
locale?: LocalesValues;
|
|
31
|
-
fill?:
|
|
32
|
+
fill?: _intlayer_types14.Fill;
|
|
32
33
|
filled?: true;
|
|
33
34
|
priority?: number;
|
|
34
35
|
live?: boolean;
|
|
35
|
-
location?:
|
|
36
|
+
location?: _intlayer_types14.DictionaryLocation;
|
|
36
37
|
};
|
|
37
38
|
//#endregion
|
|
38
39
|
export { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilterTranslationsOnlyContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterTranslationsOnlyContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAoCa,uCACH,0BACG,kBACV;;AAHH;;;;;AAuFa,cAAA,gCAkBZ,EAAA,CAAA,UAjBW,WAiBX,EAAA,UAhBW,aAgBX,GAhB2B,eAgB3B,CAAA,CAAA,IAAA,EAdO,CAcP,EAAA,MAAA,EAbS,CAaT,EAAA,SAAA,EAZY,SAYZ,EAAA,QAAA,CAAA,EAXY,aAWZ,EAAA,GADO,oBACP,CAD4B,CAC5B,CAAA;AAjBW,cAmBC,mCAnBD,EAAA,CAAA,UAAA,EAoBE,UApBF,EAAA,MAAA,CAAA,EAqBF,aArBE,EAAA,QAAA,CAAA,EAuBC,aAvBD,EAAA,GAAA;EACA,OAAA,EAAA,GAAA;EAAgB,OAAA,CAAA,EAAA,MAAA;EAEpB,EAAA,CAAA,EAoBkB,
|
|
1
|
+
{"version":3,"file":"getFilterTranslationsOnlyContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterTranslationsOnlyContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAoCa,uCACH,0BACG,kBACV;;AAHH;;;;;AAuFa,cAAA,gCAkBZ,EAAA,CAAA,UAjBW,WAiBX,EAAA,UAhBW,aAgBX,GAhB2B,eAgB3B,CAAA,CAAA,IAAA,EAdO,CAcP,EAAA,MAAA,EAbS,CAaT,EAAA,SAAA,EAZY,SAYZ,EAAA,QAAA,CAAA,EAXY,aAWZ,EAAA,GADO,oBACP,CAD4B,CAC5B,CAAA;AAjBW,cAmBC,mCAnBD,EAAA,CAAA,UAAA,EAoBE,UApBF,EAAA,MAAA,CAAA,EAqBF,aArBE,EAAA,QAAA,CAAA,EAuBC,aAvBD,EAAA,GAAA;EACA,OAAA,EAAA,GAAA;EAAgB,OAAA,CAAA,EAAA,MAAA;EAEpB,EAAA,CAAA,EAoBkB,iBAAA,CAAA,YApBlB;EACE,UAAA,CAAA,EAAA,MAAA,EAAA;EACG,OAAA,CAAA,qCAAA;EACA,QAAA,CAAA,uCAAA;EAUgB,MAAA,CAAA,oCAAA;EAArB,GAAA,iCAAA;EAAoB,KAAA,CAAA,EAAA,MAAA;EAGf,WAAA,CAAA,EAAA,MAAA;EACC,QAAA,CAAA,EAAA,MAAA,EAAA;EACJ,OAAA,CAAA,EAAA,MAAA;EAEG,QAAA,CAAA,EAAA,MAAA;EAAa,IAAA,CAAA,EAAA,MAAA,EAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeProps } from "../interpreter/getContent/plugins.js";
|
|
2
2
|
import "../interpreter/index.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _intlayer_types0 from "@intlayer/types";
|
|
4
4
|
import { ContentNode, Dictionary, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/deepTransformPlugins/getFilteredLocalesContent.d.ts
|
|
@@ -8,11 +8,12 @@ declare const getFilteredLocalesContent: (node: ContentNode, locales: LocalesVal
|
|
|
8
8
|
declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: LocalesValues | LocalesValues[]) => {
|
|
9
9
|
content: any;
|
|
10
10
|
$schema?: string;
|
|
11
|
-
id?:
|
|
11
|
+
id?: _intlayer_types0.DictionaryId;
|
|
12
12
|
projectIds?: string[];
|
|
13
|
-
localId?:
|
|
14
|
-
localIds?:
|
|
15
|
-
|
|
13
|
+
localId?: _intlayer_types0.LocalDictionaryId;
|
|
14
|
+
localIds?: _intlayer_types0.LocalDictionaryId[];
|
|
15
|
+
format?: _intlayer_types0.DictionaryFormat;
|
|
16
|
+
key: _intlayer_types0.DictionaryKey;
|
|
16
17
|
title?: string;
|
|
17
18
|
description?: string;
|
|
18
19
|
versions?: string[];
|
|
@@ -20,11 +21,11 @@ declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: Loc
|
|
|
20
21
|
filePath?: string;
|
|
21
22
|
tags?: string[];
|
|
22
23
|
locale?: LocalesValues;
|
|
23
|
-
fill?:
|
|
24
|
+
fill?: _intlayer_types0.Fill;
|
|
24
25
|
filled?: true;
|
|
25
26
|
priority?: number;
|
|
26
27
|
live?: boolean;
|
|
27
|
-
location?:
|
|
28
|
+
location?: _intlayer_types0.DictionaryLocation;
|
|
28
29
|
};
|
|
29
30
|
//#endregion
|
|
30
31
|
export { getFilteredLocalesContent, getFilteredLocalesDictionary };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilteredLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilteredLocalesContent.ts"],"sourcesContent":[],"mappings":";;;;;;cAsCa,kCACL,sBACG,gBAAgB,4BACd;cAwBA,2CACC,oBACJ,gBAAgB;;;EA7Bb,EAAA,CAAA,EA6B0B,gBAAA,CAAA,YAbtC;EAfO,UAAA,CAAA,EAAA,MAAA,EAAA;EACG,OAAA,CAAA,oCAAA;EAAgB,QAAA,CAAA,sCAAA;EACd,GAAA,gCAAA;
|
|
1
|
+
{"version":3,"file":"getFilteredLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilteredLocalesContent.ts"],"sourcesContent":[],"mappings":";;;;;;cAsCa,kCACL,sBACG,gBAAgB,4BACd;cAwBA,2CACC,oBACJ,gBAAgB;;;EA7Bb,EAAA,CAAA,EA6B0B,gBAAA,CAAA,YAbtC;EAfO,UAAA,CAAA,EAAA,MAAA,EAAA;EACG,OAAA,CAAA,oCAAA;EAAgB,QAAA,CAAA,sCAAA;EACd,MAAA,CAAA,mCAAA;EAAS,GAAA,gCAAA;EAwBT,KAAA,CAAA,EAAA,MAAA;EACC,WAAA,CAAA,EAAA,MAAA;EACJ,QAAA,CAAA,EAAA,MAAA,EAAA;EAAgB,OAAA,CAAA,EAAA,MAAA;EAAa,QAAA,CAAA,EAAA,MAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types6 from "@intlayer/types";
|
|
2
2
|
import { Dictionary } from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/dictionaryManipulator/orderDictionaries.d.ts
|
|
@@ -10,7 +10,7 @@ import { Dictionary } from "@intlayer/types";
|
|
|
10
10
|
* @param priorityStrategy - The priority strategy ('local_first' or 'distant_first')
|
|
11
11
|
* @returns Ordered array of dictionaries
|
|
12
12
|
*/
|
|
13
|
-
declare const orderDictionaries: (dictionaries: Dictionary[], configuration?:
|
|
13
|
+
declare const orderDictionaries: (dictionaries: Dictionary[], configuration?: _intlayer_types6.IntlayerConfig) => Dictionary[];
|
|
14
14
|
//#endregion
|
|
15
15
|
export { orderDictionaries };
|
|
16
16
|
//# sourceMappingURL=orderDictionaries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAoCA;AAcA;;;;;;
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAoCA;AAcA;;;;;;AAIc,KAlBF,OAAA,GAkBE;EACR,EAAA,EAAA,MAAA;EAAgB,SAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,GAAA,OAAA;EACO,SAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,KAAA,EAflB,SAekB,EAAA,WAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,KAAA,EAdO,SAcP,EAAA,GAAA,GAAA,EAAA,GAAA,GAAA;CAAE;;;;AACM,KAPzB,eAOyB,CAAA,CAAA,EAAA,CAAA,EAAA,UAPO,aAOP,CAAA,GAPwB,CAOxB,SAAA;EAAI,QAAA,EAN7B,QAM6B,GAAA,MAAA;EAAjC,CALL,QAAA,CAAS,WAAA,CAKJ,EAAA,KAAA,EAAA;CAAoB,GAAA,CAAA,SAHd,MAGc,CAHP,WAGO,EAAA,OAAA,CAAA,GAFtB,CAEsB,SAAA,MAFN,CAEM,GADpB,oBACoB,CADC,CACD,CADG,CACH,CAAA,EADO,CACP,CAAA,GAApB,oBAAoB,CAAC,CAAD,CAAA,MAAS,CAAT,CAAA,EAAa,CAAb,CAAA,GAAA,KAAA,GAAA,KAAA;AAK5B;AACU,cADG,iBACH,EAAA,CAAA,MAAA,EAAA,aAAA,EAAA,QAAA,CAAA,EACG,aADH,EAAA,iBAAA,CAAA,EAAA,CAAA,MAAA,EAGE,aAHF,EAAA,QAAA,EAII,aAJJ,EAAA,OAAA,EAKG,OALH,EAAA,EAAA,GAAA,IAAA,EAAA,GAOP,OAPO;;;;AAKG,KAgCD,eAhCC,CA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
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dictionary } from "@intlayer/types";
|
|
2
|
+
|
|
3
|
+
//#region src/messageFormat/ICU.d.ts
|
|
4
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
5
|
+
[key: string]: JsonValue;
|
|
6
|
+
};
|
|
7
|
+
declare const intlayerToICUFormatter: (message: Dictionary["content"]) => JsonValue;
|
|
8
|
+
declare const icuToIntlayerFormatter: (message: Dictionary["content"]) => JsonValue;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { JsonValue, icuToIntlayerFormatter, intlayerToICUFormatter };
|
|
11
|
+
//# sourceMappingURL=ICU.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICU.d.ts","names":[],"sources":["../../../src/messageFormat/ICU.ts"],"sourcesContent":[],"mappings":";;;KA4CY,SAAA,sCAKR;iBACiB;AANrB,CAAA;AAkca,cAAA,sBACF,EAAA,CAAA,OACR,EADQ,UAOV,CAAA,SAAA,CAAA,EAAA,GANE,SAMF;AAEY,cAAA,sBACF,EAAA,CAAA,OACR,EADQ,UAOV,CAAA,SAAA,CAAA,EAAA,GANE,SAMF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JsonValue } from "./ICU.js";
|
|
2
|
+
import { Dictionary } from "@intlayer/types";
|
|
3
|
+
|
|
4
|
+
//#region src/messageFormat/i18next.d.ts
|
|
5
|
+
declare const intlayerToI18nextFormatter: (message: Dictionary["content"]) => JsonValue;
|
|
6
|
+
declare const i18nextToIntlayerFormatter: (message: JsonValue) => Dictionary["content"];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { i18nextToIntlayerFormatter, intlayerToI18nextFormatter };
|
|
9
|
+
//# sourceMappingURL=i18next.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18next.d.ts","names":[],"sources":["../../../src/messageFormat/i18next.ts"],"sourcesContent":[],"mappings":";;;;cAwca,sCACF,0BACR;cAQU,sCACF,cACR"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { JsonValue, icuToIntlayerFormatter, intlayerToICUFormatter } from "./ICU.js";
|
|
2
|
+
import { i18nextToIntlayerFormatter, intlayerToI18nextFormatter } from "./i18next.js";
|
|
3
|
+
import { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "./vue-i18n.js";
|
|
4
|
+
export { JsonValue, i18nextToIntlayerFormatter, icuToIntlayerFormatter, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JsonValue } from "./ICU.js";
|
|
2
|
+
import { Dictionary } from "@intlayer/types";
|
|
3
|
+
|
|
4
|
+
//#region src/messageFormat/vue-i18n.d.ts
|
|
5
|
+
declare const intlayerToVueI18nFormatter: (message: Dictionary["content"]) => JsonValue;
|
|
6
|
+
declare const vueI18nToIntlayerFormatter: (message: JsonValue) => Dictionary["content"];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter };
|
|
9
|
+
//# sourceMappingURL=vue-i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-i18n.d.ts","names":[],"sources":["../../../src/messageFormat/vue-i18n.ts"],"sourcesContent":[],"mappings":";;;;cAqQa,sCACF,0BACR;cAQU,sCACF,cACR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0-canary.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -42,6 +42,11 @@
|
|
|
42
42
|
"require": "./dist/cjs/index.cjs",
|
|
43
43
|
"import": "./dist/esm/index.mjs"
|
|
44
44
|
},
|
|
45
|
+
"./messageFormat": {
|
|
46
|
+
"types": "./dist/types/messageFormat/index.d.ts",
|
|
47
|
+
"require": "./dist/cjs/messageFormat/index.cjs",
|
|
48
|
+
"import": "./dist/esm/messageFormat/index.mjs"
|
|
49
|
+
},
|
|
45
50
|
"./file": {
|
|
46
51
|
"types": "./dist/types/transpiler/file/file.d.ts",
|
|
47
52
|
"node": {
|
|
@@ -102,22 +107,22 @@
|
|
|
102
107
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
103
108
|
},
|
|
104
109
|
"dependencies": {
|
|
105
|
-
"@intlayer/api": "7.
|
|
106
|
-
"@intlayer/config": "7.
|
|
107
|
-
"@intlayer/dictionaries-entry": "7.
|
|
108
|
-
"@intlayer/types": "7.
|
|
109
|
-
"@intlayer/unmerged-dictionaries-entry": "7.
|
|
110
|
+
"@intlayer/api": "7.5.0-canary.1",
|
|
111
|
+
"@intlayer/config": "7.5.0-canary.1",
|
|
112
|
+
"@intlayer/dictionaries-entry": "7.5.0-canary.1",
|
|
113
|
+
"@intlayer/types": "7.5.0-canary.1",
|
|
114
|
+
"@intlayer/unmerged-dictionaries-entry": "7.5.0-canary.1",
|
|
110
115
|
"defu": "6.1.4"
|
|
111
116
|
},
|
|
112
117
|
"devDependencies": {
|
|
113
|
-
"@types/node": "
|
|
118
|
+
"@types/node": "25.0.2",
|
|
114
119
|
"@utils/ts-config": "1.0.4",
|
|
115
120
|
"@utils/ts-config-types": "1.0.4",
|
|
116
121
|
"@utils/tsdown-config": "1.0.4",
|
|
117
122
|
"rimraf": "6.1.2",
|
|
118
|
-
"tsdown": "0.
|
|
123
|
+
"tsdown": "0.18.0",
|
|
119
124
|
"typescript": "5.9.3",
|
|
120
|
-
"vitest": "4.0.
|
|
125
|
+
"vitest": "4.0.16"
|
|
121
126
|
},
|
|
122
127
|
"engines": {
|
|
123
128
|
"node": ">=14.18"
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __intlayer_config_client = require("@intlayer/config/client");
|
|
3
|
-
|
|
4
|
-
//#region dist/esm/getStorageAttributes.mjs
|
|
5
|
-
/**
|
|
6
|
-
* Creates a cookie entry with default values for missing attributes
|
|
7
|
-
*/
|
|
8
|
-
const createCookieEntry = (options) => {
|
|
9
|
-
const { name, path, expires, domain, secure, sameSite, httpOnly } = options ?? {};
|
|
10
|
-
return {
|
|
11
|
-
name: name ?? __intlayer_config_client.DefaultValues.Routing.COOKIE_NAME,
|
|
12
|
-
attributes: {
|
|
13
|
-
path,
|
|
14
|
-
expires,
|
|
15
|
-
domain,
|
|
16
|
-
secure,
|
|
17
|
-
sameSite,
|
|
18
|
-
httpOnly
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Creates a web storage entry (localStorage or sessionStorage) with default name
|
|
24
|
-
*/
|
|
25
|
-
const createWebStorageEntry = (options) => {
|
|
26
|
-
const { name } = options ?? {};
|
|
27
|
-
return { name: name ?? __intlayer_config_client.DefaultValues.Routing.LOCALE_STORAGE_NAME };
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Creates a header entry with default name
|
|
31
|
-
*/
|
|
32
|
-
const createHeaderEntry = (options) => {
|
|
33
|
-
const { name } = options ?? {};
|
|
34
|
-
return { name: name ?? __intlayer_config_client.DefaultValues.Routing.HEADER_NAME };
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Determines if a storage entry is a cookie based on its properties
|
|
38
|
-
*/
|
|
39
|
-
const isCookieEntry = (entry) => {
|
|
40
|
-
return entry.type === "cookie" || "sameSite" in entry || "httpOnly" in entry || "secure" in entry;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Determines the storage type from a string literal
|
|
44
|
-
*/
|
|
45
|
-
const isStorageType = (value) => {
|
|
46
|
-
return value === "cookie" || value === "localStorage" || value === "sessionStorage" || value === "header";
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Processes a single storage entry and returns the appropriate storage attributes
|
|
50
|
-
*/
|
|
51
|
-
const processStorageEntry = (entry) => {
|
|
52
|
-
if (typeof entry === "string") {
|
|
53
|
-
if (!isStorageType(entry)) return {
|
|
54
|
-
cookies: [],
|
|
55
|
-
localStorage: [],
|
|
56
|
-
sessionStorage: [],
|
|
57
|
-
headers: []
|
|
58
|
-
};
|
|
59
|
-
if (entry === "cookie") return { cookies: [createCookieEntry()] };
|
|
60
|
-
if (entry === "localStorage") return { localStorage: [createWebStorageEntry()] };
|
|
61
|
-
if (entry === "sessionStorage") return { sessionStorage: [createWebStorageEntry()] };
|
|
62
|
-
if (entry === "header") return { headers: [createHeaderEntry()] };
|
|
63
|
-
}
|
|
64
|
-
if (typeof entry === "object" && entry !== null) {
|
|
65
|
-
const typedEntry = entry;
|
|
66
|
-
if (isCookieEntry(typedEntry)) return { cookies: [createCookieEntry(typedEntry)] };
|
|
67
|
-
if ("type" in typedEntry && typedEntry.type === "localStorage") {
|
|
68
|
-
const { name: name$1, ...rest$1 } = typedEntry;
|
|
69
|
-
return { localStorage: [createWebStorageEntry({
|
|
70
|
-
name: name$1,
|
|
71
|
-
...rest$1
|
|
72
|
-
})] };
|
|
73
|
-
}
|
|
74
|
-
if ("type" in typedEntry && typedEntry.type === "sessionStorage") {
|
|
75
|
-
const { name: name$1, ...rest$1 } = typedEntry;
|
|
76
|
-
return { sessionStorage: [createWebStorageEntry({
|
|
77
|
-
name: name$1,
|
|
78
|
-
...rest$1
|
|
79
|
-
})] };
|
|
80
|
-
}
|
|
81
|
-
if ("type" in typedEntry && typedEntry.type === "header") {
|
|
82
|
-
const { name: name$1, ...rest$1 } = typedEntry;
|
|
83
|
-
return { headers: [createHeaderEntry({
|
|
84
|
-
name: name$1,
|
|
85
|
-
...rest$1
|
|
86
|
-
})] };
|
|
87
|
-
}
|
|
88
|
-
const { name, ...rest } = typedEntry;
|
|
89
|
-
return { localStorage: [createWebStorageEntry({
|
|
90
|
-
name,
|
|
91
|
-
...rest
|
|
92
|
-
})] };
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
cookies: [],
|
|
96
|
-
localStorage: [],
|
|
97
|
-
sessionStorage: [],
|
|
98
|
-
headers: []
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* Merges multiple partial storage attributes into a single result
|
|
103
|
-
*/
|
|
104
|
-
const mergeStorageAttributes = (accumulated, partial) => {
|
|
105
|
-
return {
|
|
106
|
-
cookies: [...accumulated.cookies, ...partial.cookies ?? []],
|
|
107
|
-
localStorage: [...accumulated.localStorage, ...partial.localStorage ?? []],
|
|
108
|
-
sessionStorage: [...accumulated.sessionStorage, ...partial.sessionStorage ?? []],
|
|
109
|
-
headers: [...accumulated.headers, ...partial.headers ?? []]
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Extracts and normalizes storage configuration into separate arrays for each storage type
|
|
114
|
-
*
|
|
115
|
-
* @param options - The storage configuration from IntlayerConfig
|
|
116
|
-
* @returns An object containing arrays for cookies, localStorage, and sessionStorage
|
|
117
|
-
*/
|
|
118
|
-
const getStorageAttributes = (options) => {
|
|
119
|
-
const emptyResult = {
|
|
120
|
-
cookies: [],
|
|
121
|
-
localStorage: [],
|
|
122
|
-
sessionStorage: [],
|
|
123
|
-
headers: []
|
|
124
|
-
};
|
|
125
|
-
if (options === false || options === void 0) return emptyResult;
|
|
126
|
-
if (Array.isArray(options)) return options.reduce((acc, entry) => {
|
|
127
|
-
return mergeStorageAttributes(acc, processStorageEntry(entry));
|
|
128
|
-
}, emptyResult);
|
|
129
|
-
return mergeStorageAttributes(emptyResult, processStorageEntry(options));
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
//#endregion
|
|
133
|
-
exports.getStorageAttributes = getStorageAttributes;
|
|
134
|
-
//# sourceMappingURL=getStorageAttributes.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getStorageAttributes.cjs","names":["DefaultValues"],"sources":["../../../esm/getStorageAttributes.mjs"],"sourcesContent":["import { DefaultValues } from \"@intlayer/config/client\";\n\n//#region src/getStorageAttributes.ts\n/**\n* Creates a cookie entry with default values for missing attributes\n*/\nconst createCookieEntry = (options) => {\n\tconst { name, path, expires, domain, secure, sameSite, httpOnly } = options ?? {};\n\treturn {\n\t\tname: name ?? DefaultValues.Routing.COOKIE_NAME,\n\t\tattributes: {\n\t\t\tpath,\n\t\t\texpires,\n\t\t\tdomain,\n\t\t\tsecure,\n\t\t\tsameSite,\n\t\t\thttpOnly\n\t\t}\n\t};\n};\n/**\n* Creates a web storage entry (localStorage or sessionStorage) with default name\n*/\nconst createWebStorageEntry = (options) => {\n\tconst { name } = options ?? {};\n\treturn { name: name ?? DefaultValues.Routing.LOCALE_STORAGE_NAME };\n};\n/**\n* Creates a header entry with default name\n*/\nconst createHeaderEntry = (options) => {\n\tconst { name } = options ?? {};\n\treturn { name: name ?? DefaultValues.Routing.HEADER_NAME };\n};\n/**\n* Determines if a storage entry is a cookie based on its properties\n*/\nconst isCookieEntry = (entry) => {\n\treturn entry.type === \"cookie\" || \"sameSite\" in entry || \"httpOnly\" in entry || \"secure\" in entry;\n};\n/**\n* Determines the storage type from a string literal\n*/\nconst isStorageType = (value) => {\n\treturn value === \"cookie\" || value === \"localStorage\" || value === \"sessionStorage\" || value === \"header\";\n};\n/**\n* Processes a single storage entry and returns the appropriate storage attributes\n*/\nconst processStorageEntry = (entry) => {\n\tif (typeof entry === \"string\") {\n\t\tif (!isStorageType(entry)) return {\n\t\t\tcookies: [],\n\t\t\tlocalStorage: [],\n\t\t\tsessionStorage: [],\n\t\t\theaders: []\n\t\t};\n\t\tif (entry === \"cookie\") return { cookies: [createCookieEntry()] };\n\t\tif (entry === \"localStorage\") return { localStorage: [createWebStorageEntry()] };\n\t\tif (entry === \"sessionStorage\") return { sessionStorage: [createWebStorageEntry()] };\n\t\tif (entry === \"header\") return { headers: [createHeaderEntry()] };\n\t}\n\tif (typeof entry === \"object\" && entry !== null) {\n\t\tconst typedEntry = entry;\n\t\tif (isCookieEntry(typedEntry)) return { cookies: [createCookieEntry(typedEntry)] };\n\t\tif (\"type\" in typedEntry && typedEntry.type === \"localStorage\") {\n\t\t\tconst { name: name$1, ...rest$1 } = typedEntry;\n\t\t\treturn { localStorage: [createWebStorageEntry({\n\t\t\t\tname: name$1,\n\t\t\t\t...rest$1\n\t\t\t})] };\n\t\t}\n\t\tif (\"type\" in typedEntry && typedEntry.type === \"sessionStorage\") {\n\t\t\tconst { name: name$1, ...rest$1 } = typedEntry;\n\t\t\treturn { sessionStorage: [createWebStorageEntry({\n\t\t\t\tname: name$1,\n\t\t\t\t...rest$1\n\t\t\t})] };\n\t\t}\n\t\tif (\"type\" in typedEntry && typedEntry.type === \"header\") {\n\t\t\tconst { name: name$1, ...rest$1 } = typedEntry;\n\t\t\treturn { headers: [createHeaderEntry({\n\t\t\t\tname: name$1,\n\t\t\t\t...rest$1\n\t\t\t})] };\n\t\t}\n\t\tconst { name, ...rest } = typedEntry;\n\t\treturn { localStorage: [createWebStorageEntry({\n\t\t\tname,\n\t\t\t...rest\n\t\t})] };\n\t}\n\treturn {\n\t\tcookies: [],\n\t\tlocalStorage: [],\n\t\tsessionStorage: [],\n\t\theaders: []\n\t};\n};\n/**\n* Merges multiple partial storage attributes into a single result\n*/\nconst mergeStorageAttributes = (accumulated, partial) => {\n\treturn {\n\t\tcookies: [...accumulated.cookies, ...partial.cookies ?? []],\n\t\tlocalStorage: [...accumulated.localStorage, ...partial.localStorage ?? []],\n\t\tsessionStorage: [...accumulated.sessionStorage, ...partial.sessionStorage ?? []],\n\t\theaders: [...accumulated.headers, ...partial.headers ?? []]\n\t};\n};\n/**\n* Extracts and normalizes storage configuration into separate arrays for each storage type\n*\n* @param options - The storage configuration from IntlayerConfig\n* @returns An object containing arrays for cookies, localStorage, and sessionStorage\n*/\nconst getStorageAttributes = (options) => {\n\tconst emptyResult = {\n\t\tcookies: [],\n\t\tlocalStorage: [],\n\t\tsessionStorage: [],\n\t\theaders: []\n\t};\n\tif (options === false || options === void 0) return emptyResult;\n\tif (Array.isArray(options)) return options.reduce((acc, entry) => {\n\t\treturn mergeStorageAttributes(acc, processStorageEntry(entry));\n\t}, emptyResult);\n\treturn mergeStorageAttributes(emptyResult, processStorageEntry(options));\n};\n\n//#endregion\nexport { getStorageAttributes };\n//# sourceMappingURL=getStorageAttributes.mjs.map"],"mappings":";;;;;;;AAMA,MAAM,qBAAqB,YAAY;CACtC,MAAM,EAAE,MAAM,MAAM,SAAS,QAAQ,QAAQ,UAAU,aAAa,WAAW,EAAE;AACjF,QAAO;EACN,MAAM,QAAQA,uCAAc,QAAQ;EACpC,YAAY;GACX;GACA;GACA;GACA;GACA;GACA;GACA;EACD;;;;;AAKF,MAAM,yBAAyB,YAAY;CAC1C,MAAM,EAAE,SAAS,WAAW,EAAE;AAC9B,QAAO,EAAE,MAAM,QAAQA,uCAAc,QAAQ,qBAAqB;;;;;AAKnE,MAAM,qBAAqB,YAAY;CACtC,MAAM,EAAE,SAAS,WAAW,EAAE;AAC9B,QAAO,EAAE,MAAM,QAAQA,uCAAc,QAAQ,aAAa;;;;;AAK3D,MAAM,iBAAiB,UAAU;AAChC,QAAO,MAAM,SAAS,YAAY,cAAc,SAAS,cAAc,SAAS,YAAY;;;;;AAK7F,MAAM,iBAAiB,UAAU;AAChC,QAAO,UAAU,YAAY,UAAU,kBAAkB,UAAU,oBAAoB,UAAU;;;;;AAKlG,MAAM,uBAAuB,UAAU;AACtC,KAAI,OAAO,UAAU,UAAU;AAC9B,MAAI,CAAC,cAAc,MAAM,CAAE,QAAO;GACjC,SAAS,EAAE;GACX,cAAc,EAAE;GAChB,gBAAgB,EAAE;GAClB,SAAS,EAAE;GACX;AACD,MAAI,UAAU,SAAU,QAAO,EAAE,SAAS,C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cAAc,CAAC,GAAG,YAAY,cAAc,GAAG,QAAQ,gBAAgB,EAAE,CAAC;EAC1E,gBAAgB,CAAC,GAAG,YAAY,gBAAgB,GAAG,QAAQ,kBAAkB,EAAE,CAAC;EAChF,SAAS,CAAC,GAAG,YAAY,SAAS,GAAG,QAAQ,WAAW,EAAE,CAAC;EAC3D;;;;;;;;AAQF,MAAM,wBAAwB,YAAY;CACzC,MAAM,cAAc;EACnB,SAAS,EAAE;EACX,cAAc,EAAE;EAChB,gBAAgB,EAAE;EAClB,SAAS,EAAE;EACX;AACD,KAAI,YAAY,SAAS,YAAY,KAAK,EAAG,QAAO;AACpD,KAAI,MAAM,QAAQ,QAAQ,CAAE,QAAO,QAAQ,QAAQ,KAAK,UAAU;AACjE,SAAO,uBAAuB,KAAK,oBAAoB,MAAM,CAAC;IAC5D,YAAY;AACf,QAAO,uBAAuB,aAAa,oBAAoB,QAAQ,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __intlayer_config_built = require("@intlayer/config/built");
|
|
3
|
-
__intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
|
|
4
|
-
|
|
5
|
-
//#region dist/esm/localization/localeResolver.mjs
|
|
6
|
-
/**
|
|
7
|
-
* Resolves the most specific locale from a user-provided list,
|
|
8
|
-
* or falls back to the default locale if no match is found.
|
|
9
|
-
*/
|
|
10
|
-
const localeResolver = (selectedLocale, locales = __intlayer_config_built.default?.internationalization?.locales, defaultLocale = __intlayer_config_built.default?.internationalization?.defaultLocale) => {
|
|
11
|
-
const requestedLocales = [selectedLocale].flat();
|
|
12
|
-
const normalize = (locale) => locale.trim().toLowerCase();
|
|
13
|
-
try {
|
|
14
|
-
for (const requested of requestedLocales) {
|
|
15
|
-
const normalizedRequested = normalize(requested);
|
|
16
|
-
const exactMatch = locales.find((loc) => normalize(loc) === normalizedRequested);
|
|
17
|
-
if (exactMatch) return exactMatch;
|
|
18
|
-
const [requestedLang] = normalizedRequested.split("-");
|
|
19
|
-
const partialMatch = locales.find((loc) => normalize(loc).split("-")[0] === requestedLang);
|
|
20
|
-
if (partialMatch) return partialMatch;
|
|
21
|
-
}
|
|
22
|
-
} catch (_error) {}
|
|
23
|
-
return defaultLocale;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
exports.localeResolver = localeResolver;
|
|
28
|
-
//# sourceMappingURL=localeResolver.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localeResolver.cjs","names":["configuration"],"sources":["../../../../esm/localization/localeResolver.mjs"],"sourcesContent":["import configuration from \"@intlayer/config/built\";\n\n//#region src/localization/localeResolver.ts\n/**\n* Resolves the most specific locale from a user-provided list,\n* or falls back to the default locale if no match is found.\n*/\nconst localeResolver = (selectedLocale, locales = configuration?.internationalization?.locales, defaultLocale = configuration?.internationalization?.defaultLocale) => {\n\tconst requestedLocales = [selectedLocale].flat();\n\tconst normalize = (locale) => locale.trim().toLowerCase();\n\ttry {\n\t\tfor (const requested of requestedLocales) {\n\t\t\tconst normalizedRequested = normalize(requested);\n\t\t\tconst exactMatch = locales.find((loc) => normalize(loc) === normalizedRequested);\n\t\t\tif (exactMatch) return exactMatch;\n\t\t\tconst [requestedLang] = normalizedRequested.split(\"-\");\n\t\t\tconst partialMatch = locales.find((loc) => normalize(loc).split(\"-\")[0] === requestedLang);\n\t\t\tif (partialMatch) return partialMatch;\n\t\t}\n\t} catch (_error) {}\n\treturn defaultLocale;\n};\n\n//#endregion\nexport { localeResolver };\n//# sourceMappingURL=localeResolver.mjs.map"],"mappings":";;;;;;;;;AAOA,MAAM,kBAAkB,gBAAgB,UAAUA,iCAAe,sBAAsB,SAAS,gBAAgBA,iCAAe,sBAAsB,kBAAkB;CACtK,MAAM,mBAAmB,CAAC,eAAe,CAAC,MAAM;CAChD,MAAM,aAAa,WAAW,OAAO,MAAM,CAAC,aAAa;AACzD,KAAI;AACH,OAAK,MAAM,aAAa,kBAAkB;GACzC,MAAM,sBAAsB,UAAU,UAAU;GAChD,MAAM,aAAa,QAAQ,MAAM,QAAQ,UAAU,IAAI,KAAK,oBAAoB;AAChF,OAAI,WAAY,QAAO;GACvB,MAAM,CAAC,iBAAiB,oBAAoB,MAAM,IAAI;GACtD,MAAM,eAAe,QAAQ,MAAM,QAAQ,UAAU,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,cAAc;AAC1F,OAAI,aAAc,QAAO;;UAElB,QAAQ;AACjB,QAAO"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region dist/esm/utils/getCookie.mjs
|
|
3
|
-
/**
|
|
4
|
-
* Retrieves a cookie by name from a cookie string or document.cookie
|
|
5
|
-
* @param name - The name of the cookie to retrieve
|
|
6
|
-
* @param cookieString - Optional cookie string to parse (defaults to document.cookie in browser)
|
|
7
|
-
* @returns The cookie value or undefined if not found
|
|
8
|
-
*/
|
|
9
|
-
const getCookie = (name, cookieString) => {
|
|
10
|
-
try {
|
|
11
|
-
const str = cookieString ?? (typeof document !== "undefined" ? document.cookie : "");
|
|
12
|
-
if (!str) return void 0;
|
|
13
|
-
const pairs = str.split(";");
|
|
14
|
-
for (let i = 0; i < pairs.length; i++) {
|
|
15
|
-
const part = pairs[i].trim();
|
|
16
|
-
if (!part) continue;
|
|
17
|
-
const equalIndex = part.indexOf("=");
|
|
18
|
-
if ((equalIndex >= 0 ? part.substring(0, equalIndex) : part) === name) {
|
|
19
|
-
const rawValue = equalIndex >= 0 ? part.substring(equalIndex + 1) : "";
|
|
20
|
-
try {
|
|
21
|
-
return decodeURIComponent(rawValue);
|
|
22
|
-
} catch {
|
|
23
|
-
return rawValue;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
} catch {}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
exports.getCookie = getCookie;
|
|
32
|
-
//# sourceMappingURL=getCookie.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCookie.cjs","names":[],"sources":["../../../../esm/utils/getCookie.mjs"],"sourcesContent":["//#region src/utils/getCookie.ts\n/**\n* Retrieves a cookie by name from a cookie string or document.cookie\n* @param name - The name of the cookie to retrieve\n* @param cookieString - Optional cookie string to parse (defaults to document.cookie in browser)\n* @returns The cookie value or undefined if not found\n*/\nconst getCookie = (name, cookieString) => {\n\ttry {\n\t\tconst str = cookieString ?? (typeof document !== \"undefined\" ? document.cookie : \"\");\n\t\tif (!str) return void 0;\n\t\tconst pairs = str.split(\";\");\n\t\tfor (let i = 0; i < pairs.length; i++) {\n\t\t\tconst part = pairs[i].trim();\n\t\t\tif (!part) continue;\n\t\t\tconst equalIndex = part.indexOf(\"=\");\n\t\t\tif ((equalIndex >= 0 ? part.substring(0, equalIndex) : part) === name) {\n\t\t\t\tconst rawValue = equalIndex >= 0 ? part.substring(equalIndex + 1) : \"\";\n\t\t\t\ttry {\n\t\t\t\t\treturn decodeURIComponent(rawValue);\n\t\t\t\t} catch {\n\t\t\t\t\treturn rawValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch {}\n};\n\n//#endregion\nexport { getCookie };\n//# sourceMappingURL=getCookie.mjs.map"],"mappings":";;;;;;;;AAOA,MAAM,aAAa,MAAM,iBAAiB;AACzC,KAAI;EACH,MAAM,MAAM,iBAAiB,OAAO,aAAa,cAAc,SAAS,SAAS;AACjF,MAAI,CAAC,IAAK,QAAO,KAAK;EACtB,MAAM,QAAQ,IAAI,MAAM,IAAI;AAC5B,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;GACtC,MAAM,OAAO,MAAM,GAAG,MAAM;AAC5B,OAAI,CAAC,KAAM;GACX,MAAM,aAAa,KAAK,QAAQ,IAAI;AACpC,QAAK,cAAc,IAAI,KAAK,UAAU,GAAG,WAAW,GAAG,UAAU,MAAM;IACtE,MAAM,WAAW,cAAc,IAAI,KAAK,UAAU,aAAa,EAAE,GAAG;AACpE,QAAI;AACH,YAAO,mBAAmB,SAAS;YAC5B;AACP,YAAO;;;;SAIH"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_getStorageAttributes = require('../getStorageAttributes.cjs');
|
|
3
|
-
const require_getCookie = require('./getCookie.cjs');
|
|
4
|
-
let __intlayer_config_built = require("@intlayer/config/built");
|
|
5
|
-
__intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
|
|
6
|
-
|
|
7
|
-
//#region dist/esm/utils/localeStorage.mjs
|
|
8
|
-
/**
|
|
9
|
-
* Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).
|
|
10
|
-
* The function checks storage locations in order of priority as defined in the configuration.
|
|
11
|
-
*
|
|
12
|
-
* @returns The locale if found in any storage, or undefined if not found
|
|
13
|
-
*/
|
|
14
|
-
const getLocaleFromStorage = (options) => {
|
|
15
|
-
const { routing, internationalization } = __intlayer_config_built.default;
|
|
16
|
-
const { locales } = internationalization;
|
|
17
|
-
const { storage } = routing;
|
|
18
|
-
if (storage === false || options?.isCookieEnabled === false) return void 0;
|
|
19
|
-
const storageAttributes = require_getStorageAttributes.getStorageAttributes(storage);
|
|
20
|
-
const isValidLocale = (value) => {
|
|
21
|
-
if (!value) return false;
|
|
22
|
-
return locales.includes(value);
|
|
23
|
-
};
|
|
24
|
-
const readCookie = (name) => {
|
|
25
|
-
try {
|
|
26
|
-
const fromOption = options?.getCookie?.(name);
|
|
27
|
-
if (fromOption !== null && fromOption !== void 0) return fromOption;
|
|
28
|
-
} catch {}
|
|
29
|
-
return require_getCookie.getCookie(name);
|
|
30
|
-
};
|
|
31
|
-
for (let i = 0; i < storageAttributes.cookies.length; i++) {
|
|
32
|
-
const { name } = storageAttributes.cookies[i];
|
|
33
|
-
const value = readCookie(name);
|
|
34
|
-
if (isValidLocale(value)) return value;
|
|
35
|
-
}
|
|
36
|
-
for (let i = 0; i < storageAttributes.localStorage.length; i++) {
|
|
37
|
-
const { name } = storageAttributes.localStorage[i];
|
|
38
|
-
try {
|
|
39
|
-
const value = options?.getLocaleStorage?.(name);
|
|
40
|
-
if (isValidLocale(value)) return value;
|
|
41
|
-
} catch {}
|
|
42
|
-
}
|
|
43
|
-
for (let i = 0; i < storageAttributes.sessionStorage.length; i++) {
|
|
44
|
-
const { name } = storageAttributes.sessionStorage[i];
|
|
45
|
-
try {
|
|
46
|
-
const value = options?.getSessionStorage?.(name);
|
|
47
|
-
if (isValidLocale(value)) return value;
|
|
48
|
-
} catch {}
|
|
49
|
-
}
|
|
50
|
-
for (let i = 0; i < storageAttributes.headers.length; i++) {
|
|
51
|
-
const { name } = storageAttributes.headers[i];
|
|
52
|
-
try {
|
|
53
|
-
const value = options?.getHeader?.(name);
|
|
54
|
-
if (isValidLocale(value)) return value;
|
|
55
|
-
} catch {}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
//#endregion
|
|
60
|
-
exports.getLocaleFromStorage = getLocaleFromStorage;
|
|
61
|
-
//# sourceMappingURL=localeStorage.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localeStorage.cjs","names":["configuration","getStorageAttributes","getCookie"],"sources":["../../../../esm/utils/localeStorage.mjs"],"sourcesContent":["import { getStorageAttributes } from \"../getStorageAttributes.mjs\";\nimport { getCookie } from \"./getCookie.mjs\";\nimport configuration from \"@intlayer/config/built\";\n\n//#region src/utils/localeStorage.ts\nconst buildCookieString = (name, value, attributes) => {\n\tconst parts = [`${name}=${encodeURIComponent(value)}`];\n\tif (attributes.path) parts.push(`Path=${attributes.path}`);\n\tif (attributes.domain) parts.push(`Domain=${attributes.domain}`);\n\tif (attributes.expires instanceof Date) parts.push(`Expires=${attributes.expires.toUTCString()}`);\n\tif (attributes.secure) parts.push(\"Secure\");\n\tif (attributes.sameSite) parts.push(`SameSite=${attributes.sameSite}`);\n\treturn parts.join(\"; \");\n};\n/**\n* Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function checks storage locations in order of priority as defined in the configuration.\n*\n* @returns The locale if found in any storage, or undefined if not found\n*/\nconst getLocaleFromStorage = (options) => {\n\tconst { routing, internationalization } = configuration;\n\tconst { locales } = internationalization;\n\tconst { storage } = routing;\n\tif (storage === false || options?.isCookieEnabled === false) return void 0;\n\tconst storageAttributes = getStorageAttributes(storage);\n\tconst isValidLocale = (value) => {\n\t\tif (!value) return false;\n\t\treturn locales.includes(value);\n\t};\n\tconst readCookie = (name) => {\n\t\ttry {\n\t\t\tconst fromOption = options?.getCookie?.(name);\n\t\t\tif (fromOption !== null && fromOption !== void 0) return fromOption;\n\t\t} catch {}\n\t\treturn getCookie(name);\n\t};\n\tfor (let i = 0; i < storageAttributes.cookies.length; i++) {\n\t\tconst { name } = storageAttributes.cookies[i];\n\t\tconst value = readCookie(name);\n\t\tif (isValidLocale(value)) return value;\n\t}\n\tfor (let i = 0; i < storageAttributes.localStorage.length; i++) {\n\t\tconst { name } = storageAttributes.localStorage[i];\n\t\ttry {\n\t\t\tconst value = options?.getLocaleStorage?.(name);\n\t\t\tif (isValidLocale(value)) return value;\n\t\t} catch {}\n\t}\n\tfor (let i = 0; i < storageAttributes.sessionStorage.length; i++) {\n\t\tconst { name } = storageAttributes.sessionStorage[i];\n\t\ttry {\n\t\t\tconst value = options?.getSessionStorage?.(name);\n\t\t\tif (isValidLocale(value)) return value;\n\t\t} catch {}\n\t}\n\tfor (let i = 0; i < storageAttributes.headers.length; i++) {\n\t\tconst { name } = storageAttributes.headers[i];\n\t\ttry {\n\t\t\tconst value = options?.getHeader?.(name);\n\t\t\tif (isValidLocale(value)) return value;\n\t\t} catch {}\n\t}\n};\n/**\n* Stores the locale in various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function writes to all configured storage locations according to their attributes.\n* Respects overwrite flags for localStorage and sessionStorage.\n*\n* @param locale - The locale to store\n*/\nconst setLocaleInStorage = (locale, options) => {\n\tif (configuration.routing.storage === false || options?.isCookieEnabled === false) return;\n\tconst storageAttributes = getStorageAttributes(configuration.routing.storage);\n\tfor (let i = 0; i < storageAttributes.cookies.length; i++) {\n\t\tconst { name, attributes } = storageAttributes.cookies[i];\n\t\ttry {\n\t\t\tif (options?.setCookieStore) options?.setCookieStore?.(name, locale, {\n\t\t\t\t...attributes,\n\t\t\t\texpires: attributes.expires instanceof Date ? attributes.expires.getTime() : attributes.expires\n\t\t\t});\n\t\t} catch {\n\t\t\ttry {\n\t\t\t\tif (options?.setCookieString) {\n\t\t\t\t\tconst cookieString = buildCookieString(name, locale, attributes);\n\t\t\t\t\toptions?.setCookieString?.(name, cookieString);\n\t\t\t\t}\n\t\t\t} catch {}\n\t\t}\n\t}\n\tif (options?.setLocaleStorage) for (let i = 0; i < storageAttributes.localStorage.length; i++) {\n\t\tconst { name } = storageAttributes.localStorage[i];\n\t\ttry {\n\t\t\tif (!(options?.overwrite ?? true) && options?.getLocaleStorage) {\n\t\t\t\tif (options?.getLocaleStorage?.(name)) continue;\n\t\t\t}\n\t\t\toptions?.setLocaleStorage?.(name, locale);\n\t\t} catch {}\n\t}\n\tif (options?.setSessionStorage) for (let i = 0; i < storageAttributes.sessionStorage.length; i++) {\n\t\tconst { name } = storageAttributes.sessionStorage[i];\n\t\ttry {\n\t\t\tif (!(options?.overwrite ?? true) && options?.getSessionStorage) {\n\t\t\t\tif (options?.getSessionStorage?.(name)) continue;\n\t\t\t}\n\t\t\toptions?.setSessionStorage?.(name, locale);\n\t\t} catch {}\n\t}\n\tif (options?.setHeader) for (let i = 0; i < storageAttributes.headers.length; i++) {\n\t\tconst { name } = storageAttributes.headers[i];\n\t\ttry {\n\t\t\toptions?.setHeader?.(name, locale);\n\t\t} catch {}\n\t}\n};\n/**\n* Utility object to get and set the locale in the storage by considering the configuration\n*\n* @property getLocale - Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function checks storage locations in order of priority as defined in the configuration.\n*\n* @property setLocale - Stores the locale in various storage mechanisms (cookies, localStorage, sessionStorage, headers).\n* The function writes to all configured storage locations according to their attributes.\n* Respects overwrite flags for localStorage and sessionStorage.\n*\n* @returns The locale if found in any storage, or undefined if not found\n*/\nconst LocaleStorage = (options) => ({\n\tgetLocale: () => getLocaleFromStorage(options),\n\tsetLocale: (locale) => setLocaleInStorage(locale, options)\n});\n\n//#endregion\nexport { LocaleStorage, getLocaleFromStorage, setLocaleInStorage };\n//# sourceMappingURL=localeStorage.mjs.map"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,wBAAwB,YAAY;CACzC,MAAM,EAAE,SAAS,yBAAyBA;CAC1C,MAAM,EAAE,YAAY;CACpB,MAAM,EAAE,YAAY;AACpB,KAAI,YAAY,SAAS,SAAS,oBAAoB,MAAO,QAAO,KAAK;CACzE,MAAM,oBAAoBC,kDAAqB,QAAQ;CACvD,MAAM,iBAAiB,UAAU;AAChC,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,QAAQ,SAAS,MAAM;;CAE/B,MAAM,cAAc,SAAS;AAC5B,MAAI;GACH,MAAM,aAAa,SAAS,YAAY,KAAK;AAC7C,OAAI,eAAe,QAAQ,eAAe,KAAK,EAAG,QAAO;UAClD;AACR,SAAOC,4BAAU,KAAK;;AAEvB,MAAK,IAAI,IAAI,GAAG,IAAI,kBAAkB,QAAQ,QAAQ,KAAK;EAC1D,MAAM,EAAE,SAAS,kBAAkB,QAAQ;EAC3C,MAAM,QAAQ,WAAW,KAAK;AAC9B,MAAI,cAAc,MAAM,CAAE,QAAO;;AAElC,MAAK,IAAI,IAAI,GAAG,IAAI,kBAAkB,aAAa,QAAQ,KAAK;EAC/D,MAAM,EAAE,SAAS,kBAAkB,aAAa;AAChD,MAAI;GACH,MAAM,QAAQ,SAAS,mBAAmB,KAA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