astro-intlayer 9.5.4 → 9.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +28 -0
- package/dist/cjs/client/format/index.cjs +57 -0
- package/dist/cjs/client/index.cjs +81 -0
- package/dist/cjs/client/localeRedirect.cjs +64 -0
- package/dist/cjs/client/localeRedirect.cjs.map +1 -0
- package/dist/cjs/format/index.cjs +20 -0
- package/dist/cjs/format/useCompact.cjs +18 -0
- package/dist/cjs/format/useCompact.cjs.map +1 -0
- package/dist/cjs/format/useCurrency.cjs +18 -0
- package/dist/cjs/format/useCurrency.cjs.map +1 -0
- package/dist/cjs/format/useDate.cjs +27 -0
- package/dist/cjs/format/useDate.cjs.map +1 -0
- package/dist/cjs/format/useIntl.cjs +24 -0
- package/dist/cjs/format/useIntl.cjs.map +1 -0
- package/dist/cjs/format/useList.cjs +18 -0
- package/dist/cjs/format/useList.cjs.map +1 -0
- package/dist/cjs/format/useNumber.cjs +21 -0
- package/dist/cjs/format/useNumber.cjs.map +1 -0
- package/dist/cjs/format/usePercentage.cjs +18 -0
- package/dist/cjs/format/usePercentage.cjs.map +1 -0
- package/dist/cjs/format/useRelativeTime.cjs +18 -0
- package/dist/cjs/format/useRelativeTime.cjs.map +1 -0
- package/dist/cjs/format/useUnit.cjs +18 -0
- package/dist/cjs/format/useUnit.cjs.map +1 -0
- package/dist/cjs/html/index.cjs +33 -0
- package/dist/cjs/index.cjs +33 -35
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/integration.cjs +77 -0
- package/dist/cjs/integration.cjs.map +1 -0
- package/dist/cjs/markdown/index.cjs +45 -0
- package/dist/cjs/middleware.cjs +103 -0
- package/dist/cjs/middleware.cjs.map +1 -0
- package/dist/cjs/requestStorage.cjs +24 -0
- package/dist/cjs/requestStorage.cjs.map +1 -0
- package/dist/cjs/useDictionary.cjs +38 -0
- package/dist/cjs/useDictionary.cjs.map +1 -0
- package/dist/cjs/useIntlayer.cjs +38 -0
- package/dist/cjs/useIntlayer.cjs.map +1 -0
- package/dist/cjs/useLocale.cjs +41 -0
- package/dist/cjs/useLocale.cjs.map +1 -0
- package/dist/cjs/withInertOnChange.cjs +17 -0
- package/dist/cjs/withInertOnChange.cjs.map +1 -0
- package/dist/esm/client/format/index.mjs +3 -0
- package/dist/esm/client/index.mjs +3 -0
- package/dist/esm/client/localeRedirect.mjs +62 -0
- package/dist/esm/client/localeRedirect.mjs.map +1 -0
- package/dist/esm/format/index.mjs +11 -0
- package/dist/esm/format/useCompact.mjs +17 -0
- package/dist/esm/format/useCompact.mjs.map +1 -0
- package/dist/esm/format/useCurrency.mjs +17 -0
- package/dist/esm/format/useCurrency.mjs.map +1 -0
- package/dist/esm/format/useDate.mjs +26 -0
- package/dist/esm/format/useDate.mjs.map +1 -0
- package/dist/esm/format/useIntl.mjs +23 -0
- package/dist/esm/format/useIntl.mjs.map +1 -0
- package/dist/esm/format/useList.mjs +17 -0
- package/dist/esm/format/useList.mjs.map +1 -0
- package/dist/esm/format/useNumber.mjs +20 -0
- package/dist/esm/format/useNumber.mjs.map +1 -0
- package/dist/esm/format/usePercentage.mjs +17 -0
- package/dist/esm/format/usePercentage.mjs.map +1 -0
- package/dist/esm/format/useRelativeTime.mjs +17 -0
- package/dist/esm/format/useRelativeTime.mjs.map +1 -0
- package/dist/esm/format/useUnit.mjs +17 -0
- package/dist/esm/format/useUnit.mjs.map +1 -0
- package/dist/esm/html/index.mjs +3 -0
- package/dist/esm/index.mjs +30 -36
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/integration.mjs +75 -0
- package/dist/esm/integration.mjs.map +1 -0
- package/dist/esm/markdown/index.mjs +3 -0
- package/dist/esm/middleware.mjs +100 -0
- package/dist/esm/middleware.mjs.map +1 -0
- package/dist/esm/requestStorage.mjs +21 -0
- package/dist/esm/requestStorage.mjs.map +1 -0
- package/dist/esm/useDictionary.mjs +37 -0
- package/dist/esm/useDictionary.mjs.map +1 -0
- package/dist/esm/useIntlayer.mjs +37 -0
- package/dist/esm/useIntlayer.mjs.map +1 -0
- package/dist/esm/useLocale.mjs +40 -0
- package/dist/esm/useLocale.mjs.map +1 -0
- package/dist/esm/withInertOnChange.mjs +16 -0
- package/dist/esm/withInertOnChange.mjs.map +1 -0
- package/dist/types/client/format/index.d.ts +2 -0
- package/dist/types/client/index.d.ts +2 -0
- package/dist/types/client/localeRedirect.d.ts +26 -0
- package/dist/types/client/localeRedirect.d.ts.map +1 -0
- package/dist/types/format/index.d.ts +10 -0
- package/dist/types/format/useCompact.d.ts +5 -0
- package/dist/types/format/useCompact.d.ts.map +1 -0
- package/dist/types/format/useCurrency.d.ts +5 -0
- package/dist/types/format/useCurrency.d.ts.map +1 -0
- package/dist/types/format/useDate.d.ts +8 -0
- package/dist/types/format/useDate.d.ts.map +1 -0
- package/dist/types/format/useIntl.d.ts +15 -0
- package/dist/types/format/useIntl.d.ts.map +1 -0
- package/dist/types/format/useList.d.ts +5 -0
- package/dist/types/format/useList.d.ts.map +1 -0
- package/dist/types/format/useNumber.d.ts +8 -0
- package/dist/types/format/useNumber.d.ts.map +1 -0
- package/dist/types/format/usePercentage.d.ts +5 -0
- package/dist/types/format/usePercentage.d.ts.map +1 -0
- package/dist/types/format/useRelativeTime.d.ts +5 -0
- package/dist/types/format/useRelativeTime.d.ts.map +1 -0
- package/dist/types/format/useUnit.d.ts +5 -0
- package/dist/types/format/useUnit.d.ts.map +1 -0
- package/dist/types/html/index.d.ts +2 -0
- package/dist/types/index.d.ts +13 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/integration.d.ts +41 -0
- package/dist/types/integration.d.ts.map +1 -0
- package/dist/types/markdown/index.d.ts +2 -0
- package/dist/types/middleware.d.ts +54 -0
- package/dist/types/middleware.d.ts.map +1 -0
- package/dist/types/requestStorage.d.ts +22 -0
- package/dist/types/requestStorage.d.ts.map +1 -0
- package/dist/types/useDictionary.d.ts +29 -0
- package/dist/types/useDictionary.d.ts.map +1 -0
- package/dist/types/useIntlayer.d.ts +28 -0
- package/dist/types/useIntlayer.d.ts.map +1 -0
- package/dist/types/useLocale.d.ts +29 -0
- package/dist/types/useLocale.d.ts.map +1 -0
- package/dist/types/withInertOnChange.d.ts +12 -0
- package/dist/types/withInertOnChange.d.ts.map +1 -0
- package/package.json +96 -6
package/README.md
CHANGED
|
@@ -188,7 +188,8 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
188
188
|
<li><a href="https://intlayer.org/doc/environment/create-react-app" rel=''>React CRA</a></li>
|
|
189
189
|
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React</a></li>
|
|
190
190
|
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React using Compiler</a></li>
|
|
191
|
-
<li><a href="https://intlayer.org/doc/environment/vite-and-react/
|
|
191
|
+
<li><a href="https://intlayer.org/doc/environment/vite-and-react/react-router-v7" rel=''>React-router-v7</a></li>
|
|
192
|
+
<li><a href="https://intlayer.org/doc/environment/remix-3" rel=''>Remix 3</a></li>
|
|
192
193
|
<li><a href="https://intlayer.org/doc/environment/tanstack-start" rel=''>Tanstack start</a>
|
|
193
194
|
<ul>
|
|
194
195
|
<li><a href="https://intlayer.org/doc/environment/tanstack-start/solid" rel=''>Solid</a></li>
|
|
@@ -200,7 +201,6 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
200
201
|
<li><a href="https://intlayer.org/doc/environment/astro/vue" rel=''>Vue</a></li>
|
|
201
202
|
<li><a href="https://intlayer.org/doc/environment/astro/svelte" rel=''>Svelte</a></li>
|
|
202
203
|
<li><a href="https://intlayer.org/doc/environment/astro/solid" rel=''>Solid</a></li>
|
|
203
|
-
<li><a href="https://intlayer.org/doc/environment/astro/vanilla" rel=''>Vanilla JS</a></li>
|
|
204
204
|
<li><a href="https://intlayer.org/doc/environment/astro/lit" rel=''>Lit</a></li>
|
|
205
205
|
</ul>
|
|
206
206
|
</li>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let vanilla_intlayer_format = require("vanilla-intlayer/format");
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, 'useCompact', {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function () {
|
|
7
|
+
return vanilla_intlayer_format.useCompact;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(exports, 'useCurrency', {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return vanilla_intlayer_format.useCurrency;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, 'useDate', {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return vanilla_intlayer_format.useDate;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, 'useIntl', {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return vanilla_intlayer_format.useIntl;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, 'useList', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return vanilla_intlayer_format.useList;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, 'useNumber', {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return vanilla_intlayer_format.useNumber;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, 'usePercentage', {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return vanilla_intlayer_format.usePercentage;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, 'useRelativeTime', {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return vanilla_intlayer_format.useRelativeTime;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, 'useUnit', {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () {
|
|
55
|
+
return vanilla_intlayer_format.useUnit;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let vanilla_intlayer = require("vanilla-intlayer");
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, 'getDictionary', {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function () {
|
|
7
|
+
return vanilla_intlayer.getDictionary;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(exports, 'getIntlayer', {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return vanilla_intlayer.getIntlayer;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, 'installIntlayer', {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return vanilla_intlayer.installIntlayer;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, 'localeCookie', {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return vanilla_intlayer.localeCookie;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, 'localeInStorage', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return vanilla_intlayer.localeInStorage;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, 'setLocaleCookie', {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return vanilla_intlayer.setLocaleCookie;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, 'setLocaleInStorage', {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return vanilla_intlayer.setLocaleInStorage;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, 'useDictionary', {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return vanilla_intlayer.useDictionary;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, 'useDictionaryDynamic', {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () {
|
|
55
|
+
return vanilla_intlayer.useDictionaryDynamic;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, 'useIntlayer', {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () {
|
|
61
|
+
return vanilla_intlayer.useIntlayer;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, 'useLocale', {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return vanilla_intlayer.useLocale;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(exports, 'useLocaleCookie', {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () {
|
|
73
|
+
return vanilla_intlayer.useLocaleCookie;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, 'useLocaleStorage', {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return vanilla_intlayer.useLocaleStorage;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _intlayer_core_localization = require("@intlayer/core/localization");
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
let _intlayer_core_utils = require("@intlayer/core/utils");
|
|
5
|
+
|
|
6
|
+
//#region src/client/localeRedirect.ts
|
|
7
|
+
/**
|
|
8
|
+
* Locale explicitly carried by a URL — path prefix, or `?locale=` in
|
|
9
|
+
* `search-params` mode. `undefined` when the URL is unlocalized, which in
|
|
10
|
+
* `prefix-no-default` mode means it belongs to the default locale.
|
|
11
|
+
*/
|
|
12
|
+
const getExplicitUrlLocale = (url) => {
|
|
13
|
+
const candidate = _intlayer_config_built.routing.mode === "search-params" ? url.searchParams.get("locale") : url.pathname.split("/")[1];
|
|
14
|
+
return candidate && _intlayer_config_built.internationalization.locales.includes(candidate) ? candidate : void 0;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Computes where a prerendered page should send the visitor so it matches the
|
|
18
|
+
* locale they stored (cookie, localStorage or sessionStorage, per
|
|
19
|
+
* `routing.storage`).
|
|
20
|
+
*
|
|
21
|
+
* Mirrors the redirect the Intlayer proxy performs on server-rendered requests,
|
|
22
|
+
* for pages served as static files where no server can read the cookie:
|
|
23
|
+
* - the URL wins over storage, so a localized URL is never redirected;
|
|
24
|
+
* - `routing.enableProxy: false` and `no-prefix` routing disable it;
|
|
25
|
+
* - in auto mode a dev server keeps routing URL-driven, like the proxy.
|
|
26
|
+
*
|
|
27
|
+
* @param url - The URL of the current page.
|
|
28
|
+
* @param isDevServer - Whether `astro dev` is serving the page.
|
|
29
|
+
* @returns The localized URL to navigate to, or `undefined` to stay put.
|
|
30
|
+
*/
|
|
31
|
+
const getStoredLocaleRedirect = (url, isDevServer) => {
|
|
32
|
+
const proxyMode = (0, _intlayer_core_localization.resolveProxyMode)(_intlayer_config_built.routing.enableProxy);
|
|
33
|
+
if (proxyMode === "disabled") return;
|
|
34
|
+
if (!(0, _intlayer_core_localization.isProxyStorageLocaleEnabled)(proxyMode, isDevServer)) return;
|
|
35
|
+
if (_intlayer_config_built.routing.mode === "no-prefix") return;
|
|
36
|
+
if (getExplicitUrlLocale(url)) return;
|
|
37
|
+
const storedLocale = (0, _intlayer_core_utils.getLocaleFromStorageClient)();
|
|
38
|
+
if (!storedLocale || storedLocale === _intlayer_config_built.internationalization.defaultLocale) return;
|
|
39
|
+
const currentPath = `${url.pathname}${url.search}${url.hash}`;
|
|
40
|
+
const localizedPath = (0, _intlayer_core_localization.getLocalizedUrl)(currentPath, storedLocale);
|
|
41
|
+
return localizedPath === currentPath ? void 0 : localizedPath;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Whether `astro dev` is serving the page. Vite inlines `import.meta.env.DEV`
|
|
45
|
+
* into the client bundle; the optional chain keeps the module loadable where
|
|
46
|
+
* no bundler defines it.
|
|
47
|
+
*/
|
|
48
|
+
const isDevServer = {}.env?.DEV === true;
|
|
49
|
+
/**
|
|
50
|
+
* Sends the visitor of a prerendered page to the URL of their stored locale.
|
|
51
|
+
*
|
|
52
|
+
* Injected on every page by the `intlayer()` integration; a no-op once the URL
|
|
53
|
+
* already names a locale, so a redirected page does not redirect again.
|
|
54
|
+
*/
|
|
55
|
+
const redirectToStoredLocale = () => {
|
|
56
|
+
if (typeof window === "undefined") return;
|
|
57
|
+
const target = getStoredLocaleRedirect(new URL(window.location.href), isDevServer);
|
|
58
|
+
if (target) window.location.replace(target);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.getStoredLocaleRedirect = getStoredLocaleRedirect;
|
|
63
|
+
exports.redirectToStoredLocale = redirectToStoredLocale;
|
|
64
|
+
//# sourceMappingURL=localeRedirect.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localeRedirect.cjs","names":["routing","internationalization","resolveProxyMode","isProxyStorageLocaleEnabled","getLocaleFromStorageClient","getLocalizedUrl"],"sources":["../../../src/client/localeRedirect.ts"],"sourcesContent":["import { internationalization, routing } from '@intlayer/config/built';\nimport {\n getLocalizedUrl,\n isProxyStorageLocaleEnabled,\n resolveProxyMode,\n} from '@intlayer/core/localization';\nimport { getLocaleFromStorageClient } from '@intlayer/core/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\n\n/**\n * Locale explicitly carried by a URL — path prefix, or `?locale=` in\n * `search-params` mode. `undefined` when the URL is unlocalized, which in\n * `prefix-no-default` mode means it belongs to the default locale.\n */\nconst getExplicitUrlLocale = (url: URL): Locale | undefined => {\n const candidate =\n routing.mode === 'search-params'\n ? url.searchParams.get('locale')\n : url.pathname.split('/')[1];\n\n return candidate && internationalization.locales.includes(candidate as Locale)\n ? (candidate as Locale)\n : undefined;\n};\n\n/**\n * Computes where a prerendered page should send the visitor so it matches the\n * locale they stored (cookie, localStorage or sessionStorage, per\n * `routing.storage`).\n *\n * Mirrors the redirect the Intlayer proxy performs on server-rendered requests,\n * for pages served as static files where no server can read the cookie:\n * - the URL wins over storage, so a localized URL is never redirected;\n * - `routing.enableProxy: false` and `no-prefix` routing disable it;\n * - in auto mode a dev server keeps routing URL-driven, like the proxy.\n *\n * @param url - The URL of the current page.\n * @param isDevServer - Whether `astro dev` is serving the page.\n * @returns The localized URL to navigate to, or `undefined` to stay put.\n */\nexport const getStoredLocaleRedirect = (\n url: URL,\n isDevServer: boolean\n): string | undefined => {\n const proxyMode = resolveProxyMode(routing.enableProxy);\n\n if (proxyMode === 'disabled') return;\n if (!isProxyStorageLocaleEnabled(proxyMode, isDevServer)) return;\n if (routing.mode === 'no-prefix') return;\n if (getExplicitUrlLocale(url)) return;\n\n const storedLocale = getLocaleFromStorageClient();\n\n if (!storedLocale || storedLocale === internationalization.defaultLocale) {\n return;\n }\n\n const currentPath = `${url.pathname}${url.search}${url.hash}`;\n const localizedPath = getLocalizedUrl(currentPath, storedLocale);\n\n return localizedPath === currentPath ? undefined : localizedPath;\n};\n\n/**\n * Whether `astro dev` is serving the page. Vite inlines `import.meta.env.DEV`\n * into the client bundle; the optional chain keeps the module loadable where\n * no bundler defines it.\n */\nconst isDevServer =\n (import.meta as { env?: { DEV?: boolean } }).env?.DEV === true;\n\n/**\n * Sends the visitor of a prerendered page to the URL of their stored locale.\n *\n * Injected on every page by the `intlayer()` integration; a no-op once the URL\n * already names a locale, so a redirected page does not redirect again.\n */\nexport const redirectToStoredLocale = (): void => {\n if (typeof window === 'undefined') return;\n\n const target = getStoredLocaleRedirect(\n new URL(window.location.href),\n isDevServer\n );\n\n if (target) window.location.replace(target);\n};\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,wBAAwB,QAAiC;CAC7D,MAAM,YACJA,+BAAQ,SAAS,kBACb,IAAI,aAAa,IAAI,QAAQ,IAC7B,IAAI,SAAS,MAAM,GAAG,CAAC,CAAC;CAE9B,OAAO,aAAaC,4CAAqB,QAAQ,SAAS,SAAmB,IACxE,YACD;AACN;;;;;;;;;;;;;;;;AAiBA,MAAa,2BACX,KACA,gBACuB;CACvB,MAAM,gBAAYC,8CAAiBF,+BAAQ,WAAW;CAEtD,IAAI,cAAc,YAAY;CAC9B,IAAI,KAACG,yDAA4B,WAAW,WAAW,GAAG;CAC1D,IAAIH,+BAAQ,SAAS,aAAa;CAClC,IAAI,qBAAqB,GAAG,GAAG;CAE/B,MAAM,mBAAeI,iDAA2B;CAEhD,IAAI,CAAC,gBAAgB,iBAAiBH,4CAAqB,eACzD;CAGF,MAAM,cAAc,GAAG,IAAI,WAAW,IAAI,SAAS,IAAI;CACvD,MAAM,oBAAgBI,6CAAgB,aAAa,YAAY;CAE/D,OAAO,kBAAkB,cAAc,SAAY;AACrD;;;;;;AAOA,MAAM,iBACyC,KAAK,QAAQ;;;;;;;AAQ5D,MAAa,+BAAqC;CAChD,IAAI,OAAO,WAAW,aAAa;CAEnC,MAAM,SAAS,wBACb,IAAI,IAAI,OAAO,SAAS,IAAI,GAC5B,WACF;CAEA,IAAI,QAAQ,OAAO,SAAS,QAAQ,MAAM;AAC5C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_format_useCompact = require('./useCompact.cjs');
|
|
3
|
+
const require_format_useCurrency = require('./useCurrency.cjs');
|
|
4
|
+
const require_format_useDate = require('./useDate.cjs');
|
|
5
|
+
const require_format_useIntl = require('./useIntl.cjs');
|
|
6
|
+
const require_format_useList = require('./useList.cjs');
|
|
7
|
+
const require_format_useNumber = require('./useNumber.cjs');
|
|
8
|
+
const require_format_usePercentage = require('./usePercentage.cjs');
|
|
9
|
+
const require_format_useRelativeTime = require('./useRelativeTime.cjs');
|
|
10
|
+
const require_format_useUnit = require('./useUnit.cjs');
|
|
11
|
+
|
|
12
|
+
exports.useCompact = require_format_useCompact.useCompact;
|
|
13
|
+
exports.useCurrency = require_format_useCurrency.useCurrency;
|
|
14
|
+
exports.useDate = require_format_useDate.useDate;
|
|
15
|
+
exports.useIntl = require_format_useIntl.useIntl;
|
|
16
|
+
exports.useList = require_format_useList.useList;
|
|
17
|
+
exports.useNumber = require_format_useNumber.useNumber;
|
|
18
|
+
exports.usePercentage = require_format_usePercentage.usePercentage;
|
|
19
|
+
exports.useRelativeTime = require_format_useRelativeTime.useRelativeTime;
|
|
20
|
+
exports.useUnit = require_format_useUnit.useUnit;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
|
+
|
|
6
|
+
//#region src/format/useCompact.ts
|
|
7
|
+
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
|
+
const useCompact = () => {
|
|
9
|
+
const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
|
|
10
|
+
return (...args) => (0, _intlayer_core_formatters.compact)(args[0], {
|
|
11
|
+
...args[1],
|
|
12
|
+
locale: args[1]?.locale ?? locale
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.useCompact = useCompact;
|
|
18
|
+
//# sourceMappingURL=useCompact.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCompact.cjs","names":["internationalization","getRequestLocale","compact"],"sources":["../../../src/format/useCompact.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { compact } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const useCompact = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,mBAAmB;CAC9B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,mCAAQ,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
|
+
|
|
6
|
+
//#region src/format/useCurrency.ts
|
|
7
|
+
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
|
+
const useCurrency = () => {
|
|
9
|
+
const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
|
|
10
|
+
return (...args) => (0, _intlayer_core_formatters.currency)(args[0], {
|
|
11
|
+
...args[1],
|
|
12
|
+
locale: args[1]?.locale ?? locale
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.useCurrency = useCurrency;
|
|
18
|
+
//# sourceMappingURL=useCurrency.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrency.cjs","names":["internationalization","getRequestLocale","currency"],"sources":["../../../src/format/useCurrency.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { currency } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const useCurrency = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,oBAAoB;CAC/B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,oCAAS,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
|
+
|
|
6
|
+
//#region src/format/useDate.ts
|
|
7
|
+
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
|
+
/**
|
|
9
|
+
* Astro hook that provides a localized date/time formatter bound to the request locale.
|
|
10
|
+
*/
|
|
11
|
+
const useDate = () => {
|
|
12
|
+
const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
|
|
13
|
+
return (...args) => {
|
|
14
|
+
const options = typeof args[1] === "string" ? {
|
|
15
|
+
..._intlayer_core_formatters.presets[args[1]],
|
|
16
|
+
locale
|
|
17
|
+
} : {
|
|
18
|
+
...args[1],
|
|
19
|
+
locale: args[1]?.locale ?? locale
|
|
20
|
+
};
|
|
21
|
+
return (0, _intlayer_core_formatters.date)(args[0], options);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.useDate = useDate;
|
|
27
|
+
//# sourceMappingURL=useDate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDate.cjs","names":["internationalization","getRequestLocale","presets","date"],"sources":["../../../src/format/useDate.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { date, presets } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\n/**\n * Astro hook that provides a localized date/time formatter bound to the request locale.\n */\nexport const useDate = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof date>) => {\n const options =\n typeof args[1] === 'string'\n ? { ...presets[args[1]], locale }\n : { ...args[1], locale: args[1]?.locale ?? locale };\n\n return date(args[0], options as Parameters<typeof date>[1]);\n };\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;;;;AAK1B,MAAa,gBAAgB;CAC3B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,SAAkC;EAC3C,MAAM,UACJ,OAAO,KAAK,OAAO,WACf;GAAE,GAAGC,kCAAQ,KAAK;GAAK;EAAO,IAC9B;GAAE,GAAG,KAAK;GAAI,QAAQ,KAAK,EAAE,EAAE,UAAU;EAAO;EAEtD,WAAOC,gCAAK,KAAK,IAAI,OAAqC;CAC5D;AACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
let _intlayer_core_utils = require("@intlayer/core/utils");
|
|
5
|
+
|
|
6
|
+
//#region src/format/useIntl.ts
|
|
7
|
+
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
|
+
/**
|
|
9
|
+
* Astro hook that provides a locale-bound `Intl` object.
|
|
10
|
+
*
|
|
11
|
+
* It uses the request locale on the server, falling back to the configured
|
|
12
|
+
* default locale.
|
|
13
|
+
*/
|
|
14
|
+
const useIntl = (locale) => {
|
|
15
|
+
const currentLocale = locale ?? require_requestStorage.getRequestLocale() ?? defaultLocale;
|
|
16
|
+
return {
|
|
17
|
+
intl: (0, _intlayer_core_utils.bindIntl)(currentLocale),
|
|
18
|
+
subscribe: () => () => {}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.useIntl = useIntl;
|
|
24
|
+
//# sourceMappingURL=useIntl.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIntl.cjs","names":["internationalization","getRequestLocale","bindIntl"],"sources":["../../../src/format/useIntl.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { bindIntl, type WrappedIntl } from '@intlayer/core/utils';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\n/**\n * Astro hook that provides a locale-bound `Intl` object.\n *\n * It uses the request locale on the server, falling back to the configured\n * default locale.\n */\nexport const useIntl = (\n locale?: LocalesValues\n): {\n intl: WrappedIntl;\n subscribe: (callback: (intl: WrappedIntl) => void) => () => void;\n} => {\n const currentLocale =\n locale ?? getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n const intl = bindIntl(currentLocale);\n\n return {\n intl,\n subscribe: () => () => {},\n };\n};\n"],"mappings":";;;;;;AAQA,MAAM,EAAE,kBAAkBA;;;;;;;AAQ1B,MAAa,WACX,WAIG;CACH,MAAM,gBACJ,UAAUC,wCAAiB,KAAM;CAGnC,OAAO;EACL,UAHWC,+BAAS,aAGjB;EACH,uBAAuB,CAAC;CAC1B;AACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
|
+
|
|
6
|
+
//#region src/format/useList.ts
|
|
7
|
+
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
|
+
const useList = () => {
|
|
9
|
+
const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
|
|
10
|
+
return (...args) => (0, _intlayer_core_formatters.list)(args[0], {
|
|
11
|
+
...args[1],
|
|
12
|
+
locale: args[1]?.locale ?? locale
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.useList = useList;
|
|
18
|
+
//# sourceMappingURL=useList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useList.cjs","names":["internationalization","getRequestLocale","list"],"sources":["../../../src/format/useList.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { list } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const useList = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,gBAAgB;CAC3B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,gCAAK,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
|
+
|
|
6
|
+
//#region src/format/useNumber.ts
|
|
7
|
+
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
|
+
/**
|
|
9
|
+
* Astro hook that provides a localized number formatter bound to the request locale.
|
|
10
|
+
*/
|
|
11
|
+
const useNumber = () => {
|
|
12
|
+
const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
|
|
13
|
+
return (...args) => (0, _intlayer_core_formatters.number)(args[0], {
|
|
14
|
+
...args[1],
|
|
15
|
+
locale: args[1]?.locale ?? locale
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.useNumber = useNumber;
|
|
21
|
+
//# sourceMappingURL=useNumber.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNumber.cjs","names":["internationalization","getRequestLocale","number"],"sources":["../../../src/format/useNumber.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { number } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\n/**\n * Astro hook that provides a localized number formatter bound to the request locale.\n */\nexport const useNumber = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;;;;AAK1B,MAAa,kBAAkB;CAC7B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,kCAAO,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
|
+
|
|
6
|
+
//#region src/format/usePercentage.ts
|
|
7
|
+
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
|
+
const usePercentage = () => {
|
|
9
|
+
const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
|
|
10
|
+
return (...args) => (0, _intlayer_core_formatters.percentage)(args[0], {
|
|
11
|
+
...args[1],
|
|
12
|
+
locale: args[1]?.locale ?? locale
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.usePercentage = usePercentage;
|
|
18
|
+
//# sourceMappingURL=usePercentage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePercentage.cjs","names":["internationalization","getRequestLocale","percentage"],"sources":["../../../src/format/usePercentage.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { percentage } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const usePercentage = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,sBAAsB;CACjC,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,sCAAW,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
|
+
|
|
6
|
+
//#region src/format/useRelativeTime.ts
|
|
7
|
+
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
|
+
const useRelativeTime = () => {
|
|
9
|
+
const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
|
|
10
|
+
return (...args) => (0, _intlayer_core_formatters.relativeTime)(args[0], args[1], {
|
|
11
|
+
...args[2],
|
|
12
|
+
locale: args[2]?.locale ?? locale
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.useRelativeTime = useRelativeTime;
|
|
18
|
+
//# sourceMappingURL=useRelativeTime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRelativeTime.cjs","names":["internationalization","getRequestLocale","relativeTime"],"sources":["../../../src/format/useRelativeTime.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { relativeTime } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const useRelativeTime = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof relativeTime>) =>\n relativeTime(args[0], args[1], {\n ...args[2],\n locale: args[2]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,wBAAwB;CACnC,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,wCAAa,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
|
+
|
|
6
|
+
//#region src/format/useUnit.ts
|
|
7
|
+
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
|
+
const useUnit = () => {
|
|
9
|
+
const locale = require_requestStorage.getRequestLocale() ?? defaultLocale;
|
|
10
|
+
return (...args) => (0, _intlayer_core_formatters.units)(args[0], {
|
|
11
|
+
...args[1],
|
|
12
|
+
locale: args[1]?.locale ?? locale
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.useUnit = useUnit;
|
|
18
|
+
//# sourceMappingURL=useUnit.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnit.cjs","names":["internationalization","getRequestLocale","units"],"sources":["../../../src/format/useUnit.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport { units } from '@intlayer/core/formatters';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\n\nconst { defaultLocale } = internationalization;\n\nexport const useUnit = () => {\n const locale = getRequestLocale() ?? (defaultLocale as DeclaredLocales);\n\n return (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,kBAAkBA;AAE1B,MAAa,gBAAgB;CAC3B,MAAM,SAASC,wCAAiB,KAAM;CAEtC,QAAQ,GAAG,aACTC,iCAAM,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let vanilla_intlayer_html = require("vanilla-intlayer/html");
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, 'installIntlayerHTML', {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function () {
|
|
7
|
+
return vanilla_intlayer_html.installIntlayerHTML;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(exports, 'installIntlayerHTMLDynamic', {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return vanilla_intlayer_html.installIntlayerHTMLDynamic;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, 'renderHTML', {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return vanilla_intlayer_html.renderHTML;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, 'useHTML', {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return vanilla_intlayer_html.useHTML;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, 'useHTMLRenderer', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return vanilla_intlayer_html.useHTMLRenderer;
|
|
32
|
+
}
|
|
33
|
+
});
|