@intlayer/core 3.4.9 → 3.5.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/getPathWithoutLocale.cjs +41 -0
- package/dist/cjs/getPathWithoutLocale.cjs.map +1 -0
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/localeDetector.cjs.map +1 -1
- package/dist/esm/getPathWithoutLocale.mjs +17 -0
- package/dist/esm/getPathWithoutLocale.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/localeDetector.mjs.map +1 -1
- package/dist/types/getPathWithoutLocale.d.ts +3 -0
- package/dist/types/getPathWithoutLocale.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/localeDetector.d.ts +1 -1
- package/dist/types/localeDetector.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var getPathWithoutLocale_exports = {};
|
|
20
|
+
__export(getPathWithoutLocale_exports, {
|
|
21
|
+
getPathWithoutLocale: () => getPathWithoutLocale
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getPathWithoutLocale_exports);
|
|
24
|
+
const getPathWithoutLocale = (pathname, prefixDefault, currentLocale, defaultLocale) => {
|
|
25
|
+
if (
|
|
26
|
+
// If the locale is the default one and the prefixDefault is false, we don't need to add the locale to the path
|
|
27
|
+
!prefixDefault && currentLocale.toString() === defaultLocale.toString() && !pathname.startsWith(`/${defaultLocale}`)
|
|
28
|
+
) {
|
|
29
|
+
return pathname;
|
|
30
|
+
}
|
|
31
|
+
const slicedPath = pathname.slice(`/${currentLocale}`.length);
|
|
32
|
+
if (slicedPath) {
|
|
33
|
+
return slicedPath;
|
|
34
|
+
}
|
|
35
|
+
return "/";
|
|
36
|
+
};
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
getPathWithoutLocale
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=getPathWithoutLocale.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/getPathWithoutLocale.ts"],"sourcesContent":["import { Locales } from '@intlayer/config';\n\nexport const getPathWithoutLocale = (\n pathname: string,\n prefixDefault: boolean,\n currentLocale: Locales,\n defaultLocale: Locales\n) => {\n if (\n // If the locale is the default one and the prefixDefault is false, we don't need to add the locale to the path\n !prefixDefault &&\n currentLocale.toString() === defaultLocale.toString() &&\n !pathname.startsWith(`/${defaultLocale}`)\n ) {\n return pathname;\n }\n\n const slicedPath = pathname.slice(`/${currentLocale}`.length);\n\n // If the path without locale is not empty, we return it\n if (slicedPath) {\n return slicedPath;\n }\n\n // If the path without locale is empty, we return the root path\n return '/';\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,uBAAuB,CAClC,UACA,eACA,eACA,kBACG;AACH;AAAA;AAAA,IAEE,CAAC,iBACD,cAAc,SAAS,MAAM,cAAc,SAAS,KACpD,CAAC,SAAS,WAAW,IAAI,aAAa,EAAE;AAAA,IACxC;AACA,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,SAAS,MAAM,IAAI,aAAa,GAAG,MAAM;AAG5D,MAAI,YAAY;AACd,WAAO;AAAA,EACT;AAGA,SAAO;AACT;","names":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ __export(src_exports, {
|
|
|
25
25
|
getHTMLLang: () => import_getHTMLLang.getHTMLLang,
|
|
26
26
|
getHTMLTextDir: () => import_getHTMLTextDir.getHTMLTextDir,
|
|
27
27
|
getLocaleName: () => import_getLocaleName.getLocaleName,
|
|
28
|
+
getPathWithoutLocale: () => import_getPathWithoutLocale.getPathWithoutLocale,
|
|
28
29
|
getTranslationContent: () => import_content_transformers.getTranslationContent,
|
|
29
30
|
isSameKeyPath: () => import_isSameKeyPath.isSameKeyPath,
|
|
30
31
|
localeDetector: () => import_localeDetector.localeDetector,
|
|
@@ -40,6 +41,7 @@ var import_getHTMLLang = require('./getHTMLLang.cjs');
|
|
|
40
41
|
var import_localeList = require('./localeList.cjs');
|
|
41
42
|
var import_isSameKeyPath = require('./utils/isSameKeyPath.cjs');
|
|
42
43
|
var import_localeDetector = require('./localeDetector.cjs');
|
|
44
|
+
var import_getPathWithoutLocale = require('./getPathWithoutLocale.cjs');
|
|
43
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
46
|
0 && (module.exports = {
|
|
45
47
|
NodeType,
|
|
@@ -49,6 +51,7 @@ var import_localeDetector = require('./localeDetector.cjs');
|
|
|
49
51
|
getHTMLLang,
|
|
50
52
|
getHTMLTextDir,
|
|
51
53
|
getLocaleName,
|
|
54
|
+
getPathWithoutLocale,
|
|
52
55
|
getTranslationContent,
|
|
53
56
|
isSameKeyPath,
|
|
54
57
|
localeDetector,
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n KeyPath,\n ObjectNode,\n ArrayNode,\n RecursiveDictionaryValue,\n TranslationNode,\n EnumerationNode,\n DictionaryValue,\n Dictionary,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { getHTMLTextDir } from './getHTMLTextDir';\nexport { getHTMLLang } from './getHTMLLang';\nexport { localeList } from './localeList';\nexport { isSameKeyPath } from './utils/isSameKeyPath';\nexport { localeDetector } from './localeDetector';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,kCAMO;AAiBP,mBAAyB;AACzB,2BAA8B;AAC9B,4BAA+B;AAC/B,yBAA4B;AAC5B,wBAA2B;AAC3B,2BAA8B;AAC9B,4BAA+B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n KeyPath,\n ObjectNode,\n ArrayNode,\n RecursiveDictionaryValue,\n TranslationNode,\n EnumerationNode,\n DictionaryValue,\n Dictionary,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { getHTMLTextDir } from './getHTMLTextDir';\nexport { getHTMLLang } from './getHTMLLang';\nexport { localeList } from './localeList';\nexport { isSameKeyPath } from './utils/isSameKeyPath';\nexport { localeDetector } from './localeDetector';\nexport { getPathWithoutLocale } from './getPathWithoutLocale';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,kCAMO;AAiBP,mBAAyB;AACzB,2BAA8B;AAC9B,4BAA+B;AAC/B,yBAA4B;AAC5B,wBAA2B;AAC3B,2BAA8B;AAC9B,4BAA+B;AAC/B,kCAAqC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/localeDetector.ts"],"sourcesContent":["import { match } from '@formatjs/intl-localematcher';\nimport type { Locales } from '@intlayer/config';\nimport { getConfiguration } from '@intlayer/config/client';\nimport Negotiator from 'negotiator';\n\nconst { locales: envLocales, defaultLocale: defaultLocaleEnv } =\n getConfiguration().internationalization;\n\n/**\n * Detects the locale from the request headers\n *\n * Headers are provided by the browser and can be used to determine the user's preferred language\n */\nexport const localeDetector = (\n headers: Record<string, string>,\n locales: Locales[] = envLocales,\n defaultLocale: Locales = defaultLocaleEnv\n): Locales => {\n const languages = new Negotiator({ headers }).languages();\n\n // match can only use specifically formatted locales\n // https://stackoverflow.com/questions/76447732/nextjs-13-i18n-incorrect-locale-information-provided\n try {\n return match(languages, locales, defaultLocale) as Locales;\n } catch (_error) {\n return defaultLocale;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAsB;AAEtB,oBAAiC;AACjC,wBAAuB;AAEvB,MAAM,EAAE,SAAS,YAAY,eAAe,iBAAiB,QAC3D,gCAAiB,EAAE;AAOd,MAAM,iBAAiB,CAC5B,SACA,UAAqB,YACrB,gBAAyB,qBACb;AACZ,QAAM,YAAY,IAAI,kBAAAA,QAAW,EAAE,QAAQ,CAAC,EAAE,UAAU;AAIxD,MAAI;AACF,eAAO,iCAAM,WAAW,SAAS,aAAa;AAAA,EAChD,SAAS,QAAQ;AACf,WAAO;AAAA,EACT;AACF;","names":["Negotiator"]}
|
|
1
|
+
{"version":3,"sources":["../../src/localeDetector.ts"],"sourcesContent":["import { match } from '@formatjs/intl-localematcher';\nimport type { Locales } from '@intlayer/config';\nimport { getConfiguration } from '@intlayer/config/client';\nimport Negotiator from 'negotiator';\n\nconst { locales: envLocales, defaultLocale: defaultLocaleEnv } =\n getConfiguration().internationalization;\n\n/**\n * Detects the locale from the request headers\n *\n * Headers are provided by the browser and can be used to determine the user's preferred language\n */\nexport const localeDetector = (\n headers: Record<string, string | undefined>,\n locales: Locales[] = envLocales,\n defaultLocale: Locales = defaultLocaleEnv\n): Locales => {\n const languages = new Negotiator({ headers }).languages();\n\n // match can only use specifically formatted locales\n // https://stackoverflow.com/questions/76447732/nextjs-13-i18n-incorrect-locale-information-provided\n try {\n return match(languages, locales, defaultLocale) as Locales;\n } catch (_error) {\n return defaultLocale;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAsB;AAEtB,oBAAiC;AACjC,wBAAuB;AAEvB,MAAM,EAAE,SAAS,YAAY,eAAe,iBAAiB,QAC3D,gCAAiB,EAAE;AAOd,MAAM,iBAAiB,CAC5B,SACA,UAAqB,YACrB,gBAAyB,qBACb;AACZ,QAAM,YAAY,IAAI,kBAAAA,QAAW,EAAE,QAAQ,CAAC,EAAE,UAAU;AAIxD,MAAI;AACF,eAAO,iCAAM,WAAW,SAAS,aAAa;AAAA,EAChD,SAAS,QAAQ;AACf,WAAO;AAAA,EACT;AACF;","names":["Negotiator"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const getPathWithoutLocale = (pathname, prefixDefault, currentLocale, defaultLocale) => {
|
|
2
|
+
if (
|
|
3
|
+
// If the locale is the default one and the prefixDefault is false, we don't need to add the locale to the path
|
|
4
|
+
!prefixDefault && currentLocale.toString() === defaultLocale.toString() && !pathname.startsWith(`/${defaultLocale}`)
|
|
5
|
+
) {
|
|
6
|
+
return pathname;
|
|
7
|
+
}
|
|
8
|
+
const slicedPath = pathname.slice(`/${currentLocale}`.length);
|
|
9
|
+
if (slicedPath) {
|
|
10
|
+
return slicedPath;
|
|
11
|
+
}
|
|
12
|
+
return "/";
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
getPathWithoutLocale
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=getPathWithoutLocale.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/getPathWithoutLocale.ts"],"sourcesContent":["import { Locales } from '@intlayer/config';\n\nexport const getPathWithoutLocale = (\n pathname: string,\n prefixDefault: boolean,\n currentLocale: Locales,\n defaultLocale: Locales\n) => {\n if (\n // If the locale is the default one and the prefixDefault is false, we don't need to add the locale to the path\n !prefixDefault &&\n currentLocale.toString() === defaultLocale.toString() &&\n !pathname.startsWith(`/${defaultLocale}`)\n ) {\n return pathname;\n }\n\n const slicedPath = pathname.slice(`/${currentLocale}`.length);\n\n // If the path without locale is not empty, we return it\n if (slicedPath) {\n return slicedPath;\n }\n\n // If the path without locale is empty, we return the root path\n return '/';\n};\n"],"mappings":"AAEO,MAAM,uBAAuB,CAClC,UACA,eACA,eACA,kBACG;AACH;AAAA;AAAA,IAEE,CAAC,iBACD,cAAc,SAAS,MAAM,cAAc,SAAS,KACpD,CAAC,SAAS,WAAW,IAAI,aAAa,EAAE;AAAA,IACxC;AACA,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,SAAS,MAAM,IAAI,aAAa,GAAG,MAAM;AAG5D,MAAI,YAAY;AACd,WAAO;AAAA,EACT;AAGA,SAAO;AACT;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import { getHTMLLang } from './getHTMLLang.mjs';
|
|
|
12
12
|
import { localeList } from './localeList.mjs';
|
|
13
13
|
import { isSameKeyPath } from './utils/isSameKeyPath.mjs';
|
|
14
14
|
import { localeDetector } from './localeDetector.mjs';
|
|
15
|
+
import { getPathWithoutLocale } from './getPathWithoutLocale.mjs';
|
|
15
16
|
export {
|
|
16
17
|
NodeType,
|
|
17
18
|
enu,
|
|
@@ -20,6 +21,7 @@ export {
|
|
|
20
21
|
getHTMLLang,
|
|
21
22
|
getHTMLTextDir,
|
|
22
23
|
getLocaleName,
|
|
24
|
+
getPathWithoutLocale,
|
|
23
25
|
getTranslationContent,
|
|
24
26
|
isSameKeyPath,
|
|
25
27
|
localeDetector,
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n KeyPath,\n ObjectNode,\n ArrayNode,\n RecursiveDictionaryValue,\n TranslationNode,\n EnumerationNode,\n DictionaryValue,\n Dictionary,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { getHTMLTextDir } from './getHTMLTextDir';\nexport { getHTMLLang } from './getHTMLLang';\nexport { localeList } from './localeList';\nexport { isSameKeyPath } from './utils/isSameKeyPath';\nexport { localeDetector } from './localeDetector';\n"],"mappings":"AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiBP,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n KeyPath,\n ObjectNode,\n ArrayNode,\n RecursiveDictionaryValue,\n TranslationNode,\n EnumerationNode,\n DictionaryValue,\n Dictionary,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { getHTMLTextDir } from './getHTMLTextDir';\nexport { getHTMLLang } from './getHTMLLang';\nexport { localeList } from './localeList';\nexport { isSameKeyPath } from './utils/isSameKeyPath';\nexport { localeDetector } from './localeDetector';\nexport { getPathWithoutLocale } from './getPathWithoutLocale';\n"],"mappings":"AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiBP,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/localeDetector.ts"],"sourcesContent":["import { match } from '@formatjs/intl-localematcher';\nimport type { Locales } from '@intlayer/config';\nimport { getConfiguration } from '@intlayer/config/client';\nimport Negotiator from 'negotiator';\n\nconst { locales: envLocales, defaultLocale: defaultLocaleEnv } =\n getConfiguration().internationalization;\n\n/**\n * Detects the locale from the request headers\n *\n * Headers are provided by the browser and can be used to determine the user's preferred language\n */\nexport const localeDetector = (\n headers: Record<string, string>,\n locales: Locales[] = envLocales,\n defaultLocale: Locales = defaultLocaleEnv\n): Locales => {\n const languages = new Negotiator({ headers }).languages();\n\n // match can only use specifically formatted locales\n // https://stackoverflow.com/questions/76447732/nextjs-13-i18n-incorrect-locale-information-provided\n try {\n return match(languages, locales, defaultLocale) as Locales;\n } catch (_error) {\n return defaultLocale;\n }\n};\n"],"mappings":"AAAA,SAAS,aAAa;AAEtB,SAAS,wBAAwB;AACjC,OAAO,gBAAgB;AAEvB,MAAM,EAAE,SAAS,YAAY,eAAe,iBAAiB,IAC3D,iBAAiB,EAAE;AAOd,MAAM,iBAAiB,CAC5B,SACA,UAAqB,YACrB,gBAAyB,qBACb;AACZ,QAAM,YAAY,IAAI,WAAW,EAAE,QAAQ,CAAC,EAAE,UAAU;AAIxD,MAAI;AACF,WAAO,MAAM,WAAW,SAAS,aAAa;AAAA,EAChD,SAAS,QAAQ;AACf,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/localeDetector.ts"],"sourcesContent":["import { match } from '@formatjs/intl-localematcher';\nimport type { Locales } from '@intlayer/config';\nimport { getConfiguration } from '@intlayer/config/client';\nimport Negotiator from 'negotiator';\n\nconst { locales: envLocales, defaultLocale: defaultLocaleEnv } =\n getConfiguration().internationalization;\n\n/**\n * Detects the locale from the request headers\n *\n * Headers are provided by the browser and can be used to determine the user's preferred language\n */\nexport const localeDetector = (\n headers: Record<string, string | undefined>,\n locales: Locales[] = envLocales,\n defaultLocale: Locales = defaultLocaleEnv\n): Locales => {\n const languages = new Negotiator({ headers }).languages();\n\n // match can only use specifically formatted locales\n // https://stackoverflow.com/questions/76447732/nextjs-13-i18n-incorrect-locale-information-provided\n try {\n return match(languages, locales, defaultLocale) as Locales;\n } catch (_error) {\n return defaultLocale;\n }\n};\n"],"mappings":"AAAA,SAAS,aAAa;AAEtB,SAAS,wBAAwB;AACjC,OAAO,gBAAgB;AAEvB,MAAM,EAAE,SAAS,YAAY,eAAe,iBAAiB,IAC3D,iBAAiB,EAAE;AAOd,MAAM,iBAAiB,CAC5B,SACA,UAAqB,YACrB,gBAAyB,qBACb;AACZ,QAAM,YAAY,IAAI,WAAW,EAAE,QAAQ,CAAC,EAAE,UAAU;AAIxD,MAAI;AACF,WAAO,MAAM,WAAW,SAAS,aAAa;AAAA,EAChD,SAAS,QAAQ;AACf,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPathWithoutLocale.d.ts","sourceRoot":"","sources":["../../src/getPathWithoutLocale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,eAAO,MAAM,oBAAoB,aACrB,MAAM,iBACD,OAAO,iBACP,OAAO,iBACP,OAAO,WAoBvB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export { getHTMLLang } from './getHTMLLang';
|
|
|
8
8
|
export { localeList } from './localeList';
|
|
9
9
|
export { isSameKeyPath } from './utils/isSameKeyPath';
|
|
10
10
|
export { localeDetector } from './localeDetector';
|
|
11
|
+
export { getPathWithoutLocale } from './getPathWithoutLocale';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,2BAA2B,EAC3B,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,aAAa,IAAI,OAAO,GACzB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,CAAC,EACD,GAAG,EACH,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,yCAAyC,CAAC;AACjD,YAAY,EACV,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,UAAU,EACV,SAAS,EACT,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,eAAe,EACf,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,2BAA2B,EAC3B,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,aAAa,IAAI,OAAO,GACzB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,CAAC,EACD,GAAG,EACH,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,yCAAyC,CAAC;AACjD,YAAY,EACV,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,UAAU,EACV,SAAS,EACT,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,eAAe,EACf,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -4,5 +4,5 @@ import type { Locales } from '@intlayer/config';
|
|
|
4
4
|
*
|
|
5
5
|
* Headers are provided by the browser and can be used to determine the user's preferred language
|
|
6
6
|
*/
|
|
7
|
-
export declare const localeDetector: (headers: Record<string, string>, locales?: Locales[], defaultLocale?: Locales) => Locales;
|
|
7
|
+
export declare const localeDetector: (headers: Record<string, string | undefined>, locales?: Locales[], defaultLocale?: Locales) => Locales;
|
|
8
8
|
//# sourceMappingURL=localeDetector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localeDetector.d.ts","sourceRoot":"","sources":["../../src/localeDetector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAOhD;;;;GAIG;AACH,eAAO,MAAM,cAAc,YAChB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"localeDetector.d.ts","sourceRoot":"","sources":["../../src/localeDetector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAOhD;;;;GAIG;AACH,eAAO,MAAM,cAAc,YAChB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,YAClC,OAAO,EAAE,kBACH,OAAO,KACrB,OAUF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "IntLayer - Layer of abstraction between the business logic and the data access layer. Manage internationalization in a simple way, through TypeScript, JavaScript or JSON declaration file.",
|
|
6
6
|
"keywords": [
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@formatjs/intl-localematcher": "^0.5.4",
|
|
62
62
|
"chokidar": "^3.6.0",
|
|
63
63
|
"negotiator": "^0.6.3",
|
|
64
|
-
"@intlayer/config": "^3.
|
|
64
|
+
"@intlayer/config": "^3.5.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/negotiator": "^0.6.3",
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
"tsup": "^8.3.5",
|
|
76
76
|
"typescript": "^5.7.2",
|
|
77
77
|
"@utils/ts-config": "^1.0.4",
|
|
78
|
-
"@utils/eslint-config": "^1.0.4",
|
|
79
78
|
"@utils/ts-config-types": "^1.0.4",
|
|
79
|
+
"@utils/eslint-config": "^1.0.4",
|
|
80
80
|
"@utils/tsup-config": "^1.0.4"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"react": ">=16.0.0 <19.0.0",
|
|
84
|
-
"@intlayer/config": "^3.
|
|
84
|
+
"@intlayer/config": "^3.5.0"
|
|
85
85
|
},
|
|
86
86
|
"engines": {
|
|
87
87
|
"node": ">=14.18"
|