@intlayer/core 7.3.15 → 7.4.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/dist/cjs/dist/esm/getStorageAttributes.cjs +134 -0
- package/dist/cjs/dist/esm/getStorageAttributes.cjs.map +1 -0
- package/dist/cjs/dist/esm/localization/localeResolver.cjs +28 -0
- package/dist/cjs/dist/esm/localization/localeResolver.cjs.map +1 -0
- package/dist/cjs/dist/esm/utils/getCookie.cjs +32 -0
- package/dist/cjs/dist/esm/utils/getCookie.cjs.map +1 -0
- package/dist/cjs/dist/esm/utils/localeStorage.cjs +61 -0
- package/dist/cjs/dist/esm/utils/localeStorage.cjs.map +1 -0
- package/dist/cjs/index.cjs +3 -1
- package/dist/cjs/localization/getLocale.cjs +4 -3
- package/dist/cjs/localization/getLocale.cjs.map +1 -1
- package/dist/cjs/localization/getLocalizedUrl.cjs +6 -1
- package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
- package/dist/cjs/localization/getMultilingualUrls.cjs +7 -1
- package/dist/cjs/localization/getMultilingualUrls.cjs.map +1 -1
- package/dist/cjs/localization/getPrefix.cjs +8 -2
- package/dist/cjs/localization/getPrefix.cjs.map +1 -1
- package/dist/cjs/localization/index.cjs +3 -1
- package/dist/cjs/localization/isValidLocale.cjs +54 -0
- package/dist/cjs/localization/isValidLocale.cjs.map +1 -0
- package/dist/cjs/localization/validatePrefix.cjs +54 -0
- package/dist/cjs/localization/validatePrefix.cjs.map +1 -0
- package/dist/esm/dist/esm/getStorageAttributes.mjs +133 -0
- package/dist/esm/dist/esm/getStorageAttributes.mjs.map +1 -0
- package/dist/esm/dist/esm/localization/localeResolver.mjs +26 -0
- package/dist/esm/dist/esm/localization/localeResolver.mjs.map +1 -0
- package/dist/esm/dist/esm/utils/getCookie.mjs +31 -0
- package/dist/esm/dist/esm/utils/getCookie.mjs.map +1 -0
- package/dist/esm/dist/esm/utils/localeStorage.mjs +59 -0
- package/dist/esm/dist/esm/utils/localeStorage.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/localization/getLocale.mjs +2 -1
- package/dist/esm/localization/getLocale.mjs.map +1 -1
- package/dist/esm/localization/getLocalizedUrl.mjs +6 -1
- package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -1
- package/dist/esm/localization/getMultilingualUrls.mjs +7 -1
- package/dist/esm/localization/getMultilingualUrls.mjs.map +1 -1
- package/dist/esm/localization/getPrefix.mjs +8 -2
- package/dist/esm/localization/getPrefix.mjs.map +1 -1
- package/dist/esm/localization/index.mjs +2 -1
- package/dist/esm/localization/isValidLocale.mjs +52 -0
- package/dist/esm/localization/isValidLocale.mjs.map +1 -0
- package/dist/esm/localization/validatePrefix.mjs +52 -0
- package/dist/esm/localization/validatePrefix.mjs.map +1 -0
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +7 -7
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +7 -7
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +7 -7
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/orderDictionaries.d.ts +2 -2
- package/dist/types/dictionaryManipulator/orderDictionaries.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
- package/dist/types/localization/getMultilingualUrls.d.ts.map +1 -1
- package/dist/types/localization/getPrefix.d.ts +2 -1
- package/dist/types/localization/getPrefix.d.ts.map +1 -1
- package/dist/types/localization/index.d.ts +2 -1
- package/dist/types/localization/isValidLocale.d.ts +35 -0
- package/dist/types/localization/isValidLocale.d.ts.map +1 -0
- package/dist/types/localization/validatePrefix.d.ts +38 -0
- package/dist/types/localization/validatePrefix.d.ts.map +1 -0
- package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -1
- package/dist/types/transpiler/translation/translation.d.ts +1 -1
- package/dist/types/transpiler/translation/translation.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getPrefix } from "./getPrefix.mjs";
|
|
2
|
+
import { DefaultValues } from "@intlayer/config/client";
|
|
3
|
+
import configuration from "@intlayer/config/built";
|
|
4
|
+
|
|
5
|
+
//#region src/localization/validatePrefix.ts
|
|
6
|
+
/**
|
|
7
|
+
* Checks whether a given locale is valid based on the configured locales.
|
|
8
|
+
*
|
|
9
|
+
* @param locale - The locale value to validate. Can be `undefined` or `null`.
|
|
10
|
+
* @param options - Optional configuration to override default settings.
|
|
11
|
+
* @param options.locales - Array of valid locales. Defaults to the configured internationalization locales.
|
|
12
|
+
* @param options.defaultLocale - The default locale to use as fallback. Defaults to the configured default locale.
|
|
13
|
+
* @param options.mode - The routing mode (`'prefix'`, `'prefix-all'`, or `'no-prefix'`). Defaults to the configured routing mode.
|
|
14
|
+
* @returns An object containing the validation result and the locale prefix.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Check if 'en' is a valid locale
|
|
18
|
+
* const { isValid, localePrefix } = validatePrefix('en');
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Check with custom options
|
|
22
|
+
* const { isValid, localePrefix } = validatePrefix('fr', {
|
|
23
|
+
* locales: ['en', 'fr', 'es'],
|
|
24
|
+
* defaultLocale: 'en',
|
|
25
|
+
* mode: 'prefix-all',
|
|
26
|
+
* });
|
|
27
|
+
*/
|
|
28
|
+
const validatePrefix = (locale, options) => {
|
|
29
|
+
const { defaultLocale, mode, locales } = {
|
|
30
|
+
defaultLocale: configuration?.internationalization?.defaultLocale ?? DefaultValues.Internationalization.DEFAULT_LOCALE,
|
|
31
|
+
mode: configuration?.routing?.mode ?? DefaultValues.Routing.ROUTING_MODE,
|
|
32
|
+
locales: configuration?.internationalization?.locales ?? DefaultValues.Internationalization.LOCALES,
|
|
33
|
+
...options
|
|
34
|
+
};
|
|
35
|
+
const { localePrefix } = getPrefix(locale || defaultLocale, {
|
|
36
|
+
mode,
|
|
37
|
+
locales,
|
|
38
|
+
defaultLocale
|
|
39
|
+
});
|
|
40
|
+
if (localePrefix === locale && locale === void 0) return {
|
|
41
|
+
isValid: true,
|
|
42
|
+
localePrefix: void 0
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
isValid: locales.some((localeEl) => localeEl === locale),
|
|
46
|
+
localePrefix
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { validatePrefix };
|
|
52
|
+
//# sourceMappingURL=validatePrefix.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatePrefix.mjs","names":[],"sources":["../../../src/localization/validatePrefix.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { DefaultValues } from '@intlayer/config/client';\nimport type { LocalesValues } from '@intlayer/types';\nimport { getPrefix } from './getPrefix';\n\nexport type ValidatePrefixResult = {\n isValid: boolean;\n localePrefix: string | undefined;\n};\n\n/**\n * Checks whether a given locale is valid based on the configured locales.\n *\n * @param locale - The locale value to validate. Can be `undefined` or `null`.\n * @param options - Optional configuration to override default settings.\n * @param options.locales - Array of valid locales. Defaults to the configured internationalization locales.\n * @param options.defaultLocale - The default locale to use as fallback. Defaults to the configured default locale.\n * @param options.mode - The routing mode (`'prefix'`, `'prefix-all'`, or `'no-prefix'`). Defaults to the configured routing mode.\n * @returns An object containing the validation result and the locale prefix.\n *\n * @example\n * // Check if 'en' is a valid locale\n * const { isValid, localePrefix } = validatePrefix('en');\n *\n * @example\n * // Check with custom options\n * const { isValid, localePrefix } = validatePrefix('fr', {\n * locales: ['en', 'fr', 'es'],\n * defaultLocale: 'en',\n * mode: 'prefix-all',\n * });\n */\nexport const validatePrefix = (\n locale: LocalesValues | undefined | null,\n options?: {\n locales?: LocalesValues[];\n defaultLocale?: LocalesValues;\n mode?: typeof configuration.routing.mode;\n }\n): ValidatePrefixResult => {\n const { defaultLocale, mode, locales } = {\n defaultLocale:\n configuration?.internationalization?.defaultLocale ??\n DefaultValues.Internationalization.DEFAULT_LOCALE,\n mode: configuration?.routing?.mode ?? DefaultValues.Routing.ROUTING_MODE,\n locales:\n configuration?.internationalization?.locales ??\n DefaultValues.Internationalization.LOCALES,\n ...options,\n };\n\n // If no locale provided (optional param), will use default\n // In `routing.mode = 'prefix-all'`, the locale is required to be a valid locale\n const { localePrefix } = getPrefix(locale || defaultLocale, {\n mode,\n locales,\n defaultLocale,\n });\n\n if (localePrefix === locale && locale === undefined) {\n return { isValid: true, localePrefix: undefined };\n }\n\n // Check if the provided locale is valid\n const isValid: boolean = locales.some((localeEl) => localeEl === locale);\n\n return { isValid: isValid, localePrefix };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,kBACX,QACA,YAKyB;CACzB,MAAM,EAAE,eAAe,MAAM,YAAY;EACvC,eACE,eAAe,sBAAsB,iBACrC,cAAc,qBAAqB;EACrC,MAAM,eAAe,SAAS,QAAQ,cAAc,QAAQ;EAC5D,SACE,eAAe,sBAAsB,WACrC,cAAc,qBAAqB;EACrC,GAAG;EACJ;CAID,MAAM,EAAE,iBAAiB,UAAU,UAAU,eAAe;EAC1D;EACA;EACA;EACD,CAAC;AAEF,KAAI,iBAAiB,UAAU,WAAW,OACxC,QAAO;EAAE,SAAS;EAAM,cAAc;EAAW;AAMnD,QAAO;EAAE,SAFgB,QAAQ,MAAM,aAAa,aAAa,OAAO;EAE7C;EAAc"}
|
|
@@ -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_types12 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,11 @@ 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_types12.DictionaryId;
|
|
28
28
|
projectIds?: string[];
|
|
29
|
-
localId?:
|
|
30
|
-
localIds?:
|
|
31
|
-
key:
|
|
29
|
+
localId?: _intlayer_types12.LocalDictionaryId;
|
|
30
|
+
localIds?: _intlayer_types12.LocalDictionaryId[];
|
|
31
|
+
key: _intlayer_types12.DictionaryKey;
|
|
32
32
|
title?: string;
|
|
33
33
|
description?: string;
|
|
34
34
|
versions?: string[];
|
|
@@ -36,11 +36,11 @@ declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, l
|
|
|
36
36
|
filePath?: string;
|
|
37
37
|
tags?: string[];
|
|
38
38
|
locale?: LocalesValues;
|
|
39
|
-
fill?:
|
|
39
|
+
fill?: _intlayer_types12.Fill;
|
|
40
40
|
filled?: true;
|
|
41
41
|
priority?: number;
|
|
42
42
|
live?: boolean;
|
|
43
|
-
location?:
|
|
43
|
+
location?: _intlayer_types12.DictionaryLocation;
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
46
46
|
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,iBAAA,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_types0 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,11 @@ 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_types0.DictionaryId;
|
|
20
20
|
projectIds?: string[];
|
|
21
|
-
localId?:
|
|
22
|
-
localIds?:
|
|
23
|
-
key:
|
|
21
|
+
localId?: _intlayer_types0.LocalDictionaryId;
|
|
22
|
+
localIds?: _intlayer_types0.LocalDictionaryId[];
|
|
23
|
+
key: _intlayer_types0.DictionaryKey;
|
|
24
24
|
title?: string;
|
|
25
25
|
description?: string;
|
|
26
26
|
versions?: string[];
|
|
@@ -28,11 +28,11 @@ declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, loca
|
|
|
28
28
|
filePath?: string;
|
|
29
29
|
tags?: string[];
|
|
30
30
|
locale?: LocalesValues;
|
|
31
|
-
fill?:
|
|
31
|
+
fill?: _intlayer_types0.Fill;
|
|
32
32
|
filled?: true;
|
|
33
33
|
priority?: number;
|
|
34
34
|
live?: boolean;
|
|
35
|
-
location?:
|
|
35
|
+
location?: _intlayer_types0.DictionaryLocation;
|
|
36
36
|
};
|
|
37
37
|
//#endregion
|
|
38
38
|
export { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary };
|
|
@@ -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_types6 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,11 @@ 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_types6.DictionaryId;
|
|
12
12
|
projectIds?: string[];
|
|
13
|
-
localId?:
|
|
14
|
-
localIds?:
|
|
15
|
-
key:
|
|
13
|
+
localId?: _intlayer_types6.LocalDictionaryId;
|
|
14
|
+
localIds?: _intlayer_types6.LocalDictionaryId[];
|
|
15
|
+
key: _intlayer_types6.DictionaryKey;
|
|
16
16
|
title?: string;
|
|
17
17
|
description?: string;
|
|
18
18
|
versions?: string[];
|
|
@@ -20,11 +20,11 @@ declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: Loc
|
|
|
20
20
|
filePath?: string;
|
|
21
21
|
tags?: string[];
|
|
22
22
|
locale?: LocalesValues;
|
|
23
|
-
fill?:
|
|
23
|
+
fill?: _intlayer_types6.Fill;
|
|
24
24
|
filled?: true;
|
|
25
25
|
priority?: number;
|
|
26
26
|
live?: boolean;
|
|
27
|
-
location?:
|
|
27
|
+
location?: _intlayer_types6.DictionaryLocation;
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
30
30
|
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,
|
|
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;EAAS,KAAA,CAAA,EAAA,MAAA;EAwBT,WAAA,CAAA,EAAA,MAAA;EACC,QAAA,CAAA,EAAA,MAAA,EAAA;EACJ,OAAA,CAAA,EAAA,MAAA;EAAgB,QAAA,CAAA,EAAA,MAAA;EAAa,IAAA,CAAA,EAAA,MAAA,EAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types0 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_types0.IntlayerConfig) => Dictionary[];
|
|
14
14
|
//#endregion
|
|
15
15
|
export { orderDictionaries };
|
|
16
16
|
//# sourceMappingURL=orderDictionaries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orderDictionaries.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/orderDictionaries.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAUA;;;;AAGa,cAHA,iBAGA,EAAA,CAAA,YAAA,EAFG,UAEH,EAAA,EAAA,aAAA,CAAA,EAFa,
|
|
1
|
+
{"version":3,"file":"orderDictionaries.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/orderDictionaries.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAUA;;;;AAGa,cAHA,iBAGA,EAAA,CAAA,YAAA,EAFG,UAEH,EAAA,EAAA,aAAA,CAAA,EAFa,gBAAA,CACxB,cACW,EAAA,GAAV,UAAU,EAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ import { GetPrefixOptions, GetPrefixResult, getPrefix } from "./localization/get
|
|
|
67
67
|
import { localeDetector } from "./localization/localeDetector.js";
|
|
68
68
|
import { localeFlatMap, localeMap, localeRecord } from "./localization/localeMapper.js";
|
|
69
69
|
import { localeResolver } from "./localization/localeResolver.js";
|
|
70
|
+
import { validatePrefix } from "./localization/validatePrefix.js";
|
|
70
71
|
import "./localization/index.js";
|
|
71
72
|
import { checkIsURLAbsolute } from "./utils/checkIsURLAbsolute.js";
|
|
72
73
|
import { getCookie } from "./utils/getCookie.js";
|
|
@@ -74,4 +75,4 @@ import { CachedIntl, createCachedIntl } from "./utils/intl.js";
|
|
|
74
75
|
import { isSameKeyPath } from "./utils/isSameKeyPath.js";
|
|
75
76
|
import { isValidElement } from "./utils/isValidReactElement.js";
|
|
76
77
|
import { parseYaml } from "./utils/parseYaml.js";
|
|
77
|
-
export { CachedIntl, CachedIntl as Intl, ConditionCond, ConditionContent, ConditionContentStates, DeepTransformContent, DotPath, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, FileCond, FileContent, FileContentConstructor, Gender, GenderCond, GenderContent, GenderContentStates, GetNestingResult, GetPrefixOptions, GetPrefixResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, InsertionContent, InsertionContentConstructor, IsAny, LocaleStorage, LocaleStorageOptions, MarkdownContent, MarkdownContentConstructor, NestedCond, NestedContent, NestedContentState, NodeProps, Plugins, ProcessedStorageAttributes, RequestContext, TranslationCond, TranslationContent, ValidDotPathsFor, buildMaskPlugin, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, condition as cond, conditionPlugin, createCachedIntl, currency, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, file, fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, getBrowserLocale, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTMLTextDir, getInsertionValues, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPrefix, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, getStorageAttributes, getTranslation, insertion as insert, insertContentInDictionary, insertionPlugin, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeDictionaries, normalizeDictionary, number, orderDictionaries, parseYaml, percentage, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, setLocaleInStorage, translation as t, translationPlugin, units, updateNodeChildren };
|
|
78
|
+
export { CachedIntl, CachedIntl as Intl, ConditionCond, ConditionContent, ConditionContentStates, DeepTransformContent, DotPath, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, FileCond, FileContent, FileContentConstructor, Gender, GenderCond, GenderContent, GenderContentStates, GetNestingResult, GetPrefixOptions, GetPrefixResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, InsertionContent, InsertionContentConstructor, IsAny, LocaleStorage, LocaleStorageOptions, MarkdownContent, MarkdownContentConstructor, NestedCond, NestedContent, NestedContentState, NodeProps, Plugins, ProcessedStorageAttributes, RequestContext, TranslationCond, TranslationContent, ValidDotPathsFor, buildMaskPlugin, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, condition as cond, conditionPlugin, createCachedIntl, currency, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, file, fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, getBrowserLocale, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTMLTextDir, getInsertionValues, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPrefix, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, getStorageAttributes, getTranslation, insertion as insert, insertContentInDictionary, insertionPlugin, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeDictionaries, normalizeDictionary, number, orderDictionaries, parseYaml, percentage, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, setLocaleInStorage, translation as t, translationPlugin, units, updateNodeChildren, validatePrefix };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAoCA;AAcA;;;;;;AAIqB,KAlBT,OAAA,GAkBS;EAAP,EAAA,EAAA,MAAA;EACR,SAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,GAAA,OAAA;EAAgB,SAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,KAAA,EAdX,SAcW,EAAA,WAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,KAAA,EAbc,SAad,EAAA,GAAA,GAAA,EAAA,GAAA,GAAA;CACO;;;;AACA,KAPjB,eAOiB,CAAA,CAAA,EAAA,CAAA,EAAA,UAPe,aAOf,CAAA,GAPgC,CAOhC,SAAA;EAAQ,QAAA,EANzB,QAMyB,GAAA,MAAA;EAAI,CALtC,QAAA,CAAS,WAAA,CAK6B,EAAA,KAAA,EAAA;CAAjC,GAHJ,CAGI,SAHM,MAGN,CAHa,WAGb,EAAA,OAAA,CAAA,GAFF,CAEE,SAAA,MAFc,CAEd,GADA,oBACA,CADqB,CACrB,CADuB,CACvB,CAAA,EAD2B,CAC3B,CAAA,GAAA,oBAAA,CAAqB,CAArB,CAAA,MAA6B,CAA7B,CAAA,EAAiC,CAAjC,CAAA,GAAA,KAAA,GAAA,KAAA;;AAKK,cAAA,iBAgCX,EAAA,CAAA,MAAA,EA/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dd,QA7Dc,CA6DL,CA7DK,EA6DF,CA7DE,EA6DC,CA7DD,CAAA,GA+Dd,kBA/Dc,CA+DK,CA/DL,EA+DQ,CA/DR,EA+DW,CA/DX,CAAA,CAAA,MA+DoB,kBA/DpB,CA+DuC,CA/DvC,EA+D0C,CA/D1C,EA+D6C,CA/D7C,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMultilingualUrls.d.ts","names":[],"sources":["../../../src/localization/getMultilingualUrls.ts"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"getMultilingualUrls.d.ts","names":[],"sources":["../../../src/localization/getMultilingualUrls.ts"],"sourcesContent":[],"mappings":";;;;;;AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa;YAGC;kBACM;;MAGjB"}
|
|
@@ -56,8 +56,9 @@ type GetPrefixResult = {
|
|
|
56
56
|
* @param options.mode - URL routing mode for locale handling. Defaults to configured mode.
|
|
57
57
|
* @returns An object containing pathPrefix, prefix, and localePrefix for the given locale.
|
|
58
58
|
*/
|
|
59
|
-
declare const getPrefix: (locale: LocalesValues, options?: {
|
|
59
|
+
declare const getPrefix: (locale: LocalesValues | undefined, options?: {
|
|
60
60
|
defaultLocale?: LocalesValues;
|
|
61
|
+
locales?: LocalesValues[];
|
|
61
62
|
mode?: "prefix-no-default" | "prefix-all" | "no-prefix" | "search-params";
|
|
62
63
|
}) => GetPrefixResult;
|
|
63
64
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPrefix.d.ts","names":[],"sources":["../../../src/localization/getPrefix.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getPrefix.d.ts","names":[],"sources":["../../../src/localization/getPrefix.ts"],"sourcesContent":[],"mappings":";;;KAIY,gBAAA;kBACM;EADN,IAAA,CAAA,EAAA,mBAAgB,GAAA,YACV,GAAA,WAAa,GAAA,eAAA;AAI/B,CAAA;AAoDa,KApDD,eAAA,GA8FX;EAzCS;;;;;;;;;;;;;;;gBArCM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoCH,oBACH;kBAEU;YACN;;MAGX"}
|
|
@@ -10,4 +10,5 @@ import { GetPrefixOptions, GetPrefixResult, getPrefix } from "./getPrefix.js";
|
|
|
10
10
|
import { localeDetector } from "./localeDetector.js";
|
|
11
11
|
import { localeFlatMap, localeMap, localeRecord } from "./localeMapper.js";
|
|
12
12
|
import { localeResolver } from "./localeResolver.js";
|
|
13
|
-
|
|
13
|
+
import { validatePrefix } from "./validatePrefix.js";
|
|
14
|
+
export { type GetPrefixOptions, type GetPrefixResult, getBrowserLocale, getHTMLTextDir, getLocaleFromPath, getLocaleLang, getLocaleName, getLocalizedUrl, getMultilingualUrls, getPathWithoutLocale, getPrefix, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, validatePrefix };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types";
|
|
2
|
+
import configuration from "@intlayer/config/built";
|
|
3
|
+
|
|
4
|
+
//#region src/localization/isValidLocale.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Checks whether a given locale is valid based on the configured locales.
|
|
8
|
+
*
|
|
9
|
+
* @param locale - The locale value to validate. Can be `undefined` or `null`.
|
|
10
|
+
* @param options - Optional configuration to override default settings.
|
|
11
|
+
* @param options.locales - Array of valid locales. Defaults to the configured internationalization locales.
|
|
12
|
+
* @param options.defaultLocale - The default locale to use as fallback. Defaults to the configured default locale.
|
|
13
|
+
* @param options.mode - The routing mode (`'prefix'`, `'prefix-all'`, or `'no-prefix'`). Defaults to the configured routing mode.
|
|
14
|
+
* @returns `true` if the locale is valid or if no locale is provided and the routing mode allows it; `false` otherwise.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Check if 'en' is a valid locale
|
|
18
|
+
* const isValid = validatePrefix('en');
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Check with custom options
|
|
22
|
+
* const isValid = validatePrefix('fr', {
|
|
23
|
+
* locales: ['en', 'fr', 'es'],
|
|
24
|
+
* defaultLocale: 'en',
|
|
25
|
+
* mode: 'prefix-all',
|
|
26
|
+
* });
|
|
27
|
+
*/
|
|
28
|
+
declare const validatePrefix: (locale: LocalesValues | undefined | null, options?: {
|
|
29
|
+
locales?: LocalesValues[];
|
|
30
|
+
defaultLocale?: LocalesValues;
|
|
31
|
+
mode?: typeof configuration.routing.mode;
|
|
32
|
+
}) => boolean;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { validatePrefix };
|
|
35
|
+
//# sourceMappingURL=isValidLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidLocale.d.ts","names":[],"sources":["../../../src/localization/isValidLocale.ts"],"sourcesContent":[],"mappings":";;;;;;;AA2BA;;;;;;;;;;;;;;;;;;;;cAAa,yBACH;YAEI;kBACM;gBACF,aAAA,CAAc,OAAA,CAAQ"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types";
|
|
2
|
+
import configuration from "@intlayer/config/built";
|
|
3
|
+
|
|
4
|
+
//#region src/localization/validatePrefix.d.ts
|
|
5
|
+
type ValidatePrefixResult = {
|
|
6
|
+
isValid: boolean;
|
|
7
|
+
localePrefix: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Checks whether a given locale is valid based on the configured locales.
|
|
11
|
+
*
|
|
12
|
+
* @param locale - The locale value to validate. Can be `undefined` or `null`.
|
|
13
|
+
* @param options - Optional configuration to override default settings.
|
|
14
|
+
* @param options.locales - Array of valid locales. Defaults to the configured internationalization locales.
|
|
15
|
+
* @param options.defaultLocale - The default locale to use as fallback. Defaults to the configured default locale.
|
|
16
|
+
* @param options.mode - The routing mode (`'prefix'`, `'prefix-all'`, or `'no-prefix'`). Defaults to the configured routing mode.
|
|
17
|
+
* @returns An object containing the validation result and the locale prefix.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Check if 'en' is a valid locale
|
|
21
|
+
* const { isValid, localePrefix } = validatePrefix('en');
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Check with custom options
|
|
25
|
+
* const { isValid, localePrefix } = validatePrefix('fr', {
|
|
26
|
+
* locales: ['en', 'fr', 'es'],
|
|
27
|
+
* defaultLocale: 'en',
|
|
28
|
+
* mode: 'prefix-all',
|
|
29
|
+
* });
|
|
30
|
+
*/
|
|
31
|
+
declare const validatePrefix: (locale: LocalesValues | undefined | null, options?: {
|
|
32
|
+
locales?: LocalesValues[];
|
|
33
|
+
defaultLocale?: LocalesValues;
|
|
34
|
+
mode?: typeof configuration.routing.mode;
|
|
35
|
+
}) => ValidatePrefixResult;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { ValidatePrefixResult, validatePrefix };
|
|
38
|
+
//# sourceMappingURL=validatePrefix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatePrefix.d.ts","names":[],"sources":["../../../src/localization/validatePrefix.ts"],"sourcesContent":[],"mappings":";;;;KAKY,oBAAA;;EAAA,YAAA,EAAA,MAAA,GAAoB,SAAA;AA2BhC,CAAA;;;;;;;;;;;;;;;;;;;;;;;cAAa,yBACH;YAEI;kBACM;gBACF,aAAA,CAAc,OAAA,CAAQ;MAErC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enumeration.d.ts","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":[],"mappings":";;;KAEK,QAAA;KACA,QAAA;AAH2E,KAI3E,OAAA,GAAU,QAFF,GAEa,QAFb;AAAA,KAIR,KAAA,GAAQ,OAHA;AAAA,KAIR,WAAA,GAHO,IAGW,OAHR,EAAA;AAAmB,KAI7B,QAAA,GAFK,IAEU,OAFP,EAAA;AAAO,KAGf,eAAA,GAFW,KAEY,OAFL,EAAA;AAAO,KAGzB,QAAA,GAFQ,IAEO,
|
|
1
|
+
{"version":3,"file":"enumeration.d.ts","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":[],"mappings":";;;KAEK,QAAA;KACA,QAAA;AAH2E,KAI3E,OAAA,GAAU,QAFF,GAEa,QAFb;AAAA,KAIR,KAAA,GAAQ,OAHA;AAAA,KAIR,WAAA,GAHO,IAGW,OAHR,EAAA;AAAmB,KAI7B,QAAA,GAFK,IAEU,OAFP,EAAA;AAAO,KAGf,eAAA,GAFW,KAEY,OAFL,EAAA;AAAO,KAGzB,QAAA,GAFQ,IAEO,OAFP,EAAO;AAAO,KAGtB,eAAA,GAFe,KAEQ,OAFA,EAAA;AACvB,KAGO,WAAA,GACR,KAJgB,GAKhB,WALuB,GAMvB,QANuB,GAOvB,eAPuB,GAQvB,QARuB,GASvB,eATuB;AACtB,KAUO,uBAVgB,CAAA,OAAO,CAAA,GAUY,OAVZ,CAWjC,MAXiC,CAW1B,WAX0B,EAWb,OAXa,CAAA,CAAA,GAAA;EAEvB,QAAA,CAAA,EAWC,OAXU;CACnB;AACA,KAYQ,kBAZR,CAAA,UAAA,OAAA,CAAA,GAYgD,cAZhD,CAaF,QAAA,CAAS,WAbP,EAcF,uBAdE,CAcsB,OAdtB,CAAA,CAAA;;;;;;AAMJ;;;;;;;AAMA;;;;;;AAGE;cAqBI,WAA0D,EAAA,CAAA,OAAA,CAAA,CAAA,OAAA,CAAA,EAAxB,uBAAwB,CAAA,OAAA,CAAA,EAAA,GAAQ,cAAR,CAAQ,QAAA,CAAA,WAAR,EAAQ,uBAAR,CAAQ,OAAR,CAAA,EAAA,CAAA,CAAA,CAAA"}
|
|
@@ -23,7 +23,7 @@ type TranslationContent<Content = unknown, RecordContent extends StrictModeLocal
|
|
|
23
23
|
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
24
24
|
*/
|
|
25
25
|
declare const translation: <Content = unknown, ContentRecord extends StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>>(content: ContentRecord) => TypedNodeModel<NodeType.Translation, ContentRecord, {
|
|
26
|
-
nodeType: "translation"
|
|
26
|
+
nodeType: NodeType.Translation | "translation";
|
|
27
27
|
} & {
|
|
28
28
|
translation: ContentRecord;
|
|
29
29
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.d.ts","names":[],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":[],"mappings":";;;KAOY,4DAGR,oBAAoB,WAAW,oBAAoB,YACnD,eAAe,QAAA,CAAS,aAAa;;AAJzC;;;;;;;;;AAIwD;;;;;;;;;;cAsBlD,WAKkB,EAAA,CAAA,UAAA,OAAA,EAAA,sBAFpB,mBAEoB,CAFA,OAEA,CAAA,GAFW,mBAEX,CAF+B,OAE/B,CAAA,CAAA,CAAA,OAAA,EAAb,aAAa,EAAA,GAAA,cAAA,CAAA,QAAA,CAAA,WAAA,EAAA,aAAA,EAAA;EAAA,QAAA,
|
|
1
|
+
{"version":3,"file":"translation.d.ts","names":[],"sources":["../../../../src/transpiler/translation/translation.ts"],"sourcesContent":[],"mappings":";;;KAOY,4DAGR,oBAAoB,WAAW,oBAAoB,YACnD,eAAe,QAAA,CAAS,aAAa;;AAJzC;;;;;;;;;AAIwD;;;;;;;;;;cAsBlD,WAKkB,EAAA,CAAA,UAAA,OAAA,EAAA,sBAFpB,mBAEoB,CAFA,OAEA,CAAA,GAFW,mBAEX,CAF+B,OAE/B,CAAA,CAAA,CAAA,OAAA,EAAb,aAAa,EAAA,GAAA,cAAA,CAAA,QAAA,CAAA,WAAA,EAAA,aAAA,EAAA;EAAA,QAAA,sBAAA,GAAA,aAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -102,11 +102,11 @@
|
|
|
102
102
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
|
-
"@intlayer/api": "7.
|
|
106
|
-
"@intlayer/config": "7.
|
|
107
|
-
"@intlayer/dictionaries-entry": "7.
|
|
108
|
-
"@intlayer/types": "7.
|
|
109
|
-
"@intlayer/unmerged-dictionaries-entry": "7.
|
|
105
|
+
"@intlayer/api": "7.4.0",
|
|
106
|
+
"@intlayer/config": "7.4.0",
|
|
107
|
+
"@intlayer/dictionaries-entry": "7.4.0",
|
|
108
|
+
"@intlayer/types": "7.4.0",
|
|
109
|
+
"@intlayer/unmerged-dictionaries-entry": "7.4.0",
|
|
110
110
|
"defu": "6.1.4"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|