astro-intlayer 9.6.0 → 9.7.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/format/useCompact.cjs +1 -3
- package/dist/cjs/format/useCompact.cjs.map +1 -1
- package/dist/cjs/format/useCurrency.cjs +1 -3
- package/dist/cjs/format/useCurrency.cjs.map +1 -1
- package/dist/cjs/format/useDate.cjs +1 -3
- package/dist/cjs/format/useDate.cjs.map +1 -1
- package/dist/cjs/format/useIntl.cjs +3 -5
- package/dist/cjs/format/useIntl.cjs.map +1 -1
- package/dist/cjs/format/useList.cjs +1 -3
- package/dist/cjs/format/useList.cjs.map +1 -1
- package/dist/cjs/format/useNumber.cjs +1 -3
- package/dist/cjs/format/useNumber.cjs.map +1 -1
- package/dist/cjs/format/usePercentage.cjs +1 -3
- package/dist/cjs/format/usePercentage.cjs.map +1 -1
- package/dist/cjs/format/useRelativeTime.cjs +1 -3
- package/dist/cjs/format/useRelativeTime.cjs.map +1 -1
- package/dist/cjs/format/useUnit.cjs +1 -3
- package/dist/cjs/format/useUnit.cjs.map +1 -1
- package/dist/esm/format/useCompact.mjs +1 -3
- package/dist/esm/format/useCompact.mjs.map +1 -1
- package/dist/esm/format/useCurrency.mjs +1 -3
- package/dist/esm/format/useCurrency.mjs.map +1 -1
- package/dist/esm/format/useDate.mjs +1 -3
- package/dist/esm/format/useDate.mjs.map +1 -1
- package/dist/esm/format/useIntl.mjs +3 -5
- package/dist/esm/format/useIntl.mjs.map +1 -1
- package/dist/esm/format/useList.mjs +1 -3
- package/dist/esm/format/useList.mjs.map +1 -1
- package/dist/esm/format/useNumber.mjs +1 -3
- package/dist/esm/format/useNumber.mjs.map +1 -1
- package/dist/esm/format/usePercentage.mjs +1 -3
- package/dist/esm/format/usePercentage.mjs.map +1 -1
- package/dist/esm/format/useRelativeTime.mjs +1 -3
- package/dist/esm/format/useRelativeTime.mjs.map +1 -1
- package/dist/esm/format/useUnit.mjs +1 -3
- package/dist/esm/format/useUnit.mjs.map +1 -1
- package/dist/types/format/useCompact.d.ts.map +1 -1
- package/dist/types/format/useCurrency.d.ts.map +1 -1
- package/dist/types/format/useDate.d.ts.map +1 -1
- package/dist/types/format/useIntl.d.ts +2 -2
- package/dist/types/format/useIntl.d.ts.map +1 -1
- package/dist/types/format/useList.d.ts.map +1 -1
- package/dist/types/format/useNumber.d.ts.map +1 -1
- package/dist/types/format/usePercentage.d.ts.map +1 -1
- package/dist/types/format/useRelativeTime.d.ts.map +1 -1
- package/dist/types/format/useUnit.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
3
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
4
|
|
|
6
5
|
//#region src/format/useCompact.ts
|
|
7
|
-
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
6
|
const useCompact = () => {
|
|
9
|
-
const locale = require_requestStorage.getRequestLocale()
|
|
7
|
+
const locale = require_requestStorage.getRequestLocale();
|
|
10
8
|
return (...args) => (0, _intlayer_core_formatters.compact)(args[0], {
|
|
11
9
|
...args[1],
|
|
12
10
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompact.cjs","names":["
|
|
1
|
+
{"version":3,"file":"useCompact.cjs","names":["getRequestLocale","compact"],"sources":["../../../src/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const useCompact = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;AAGA,MAAa,mBAAmB;CAC9B,MAAM,SAASA,wCAAiB;CAEhC,QAAQ,GAAG,aACTC,mCAAQ,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
3
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
4
|
|
|
6
5
|
//#region src/format/useCurrency.ts
|
|
7
|
-
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
6
|
const useCurrency = () => {
|
|
9
|
-
const locale = require_requestStorage.getRequestLocale()
|
|
7
|
+
const locale = require_requestStorage.getRequestLocale();
|
|
10
8
|
return (...args) => (0, _intlayer_core_formatters.currency)(args[0], {
|
|
11
9
|
...args[1],
|
|
12
10
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrency.cjs","names":["
|
|
1
|
+
{"version":3,"file":"useCurrency.cjs","names":["getRequestLocale","currency"],"sources":["../../../src/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const useCurrency = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;AAGA,MAAa,oBAAoB;CAC/B,MAAM,SAASA,wCAAiB;CAEhC,QAAQ,GAAG,aACTC,oCAAS,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
3
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
4
|
|
|
6
5
|
//#region src/format/useDate.ts
|
|
7
|
-
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
6
|
/**
|
|
9
7
|
* Astro hook that provides a localized date/time formatter bound to the request locale.
|
|
10
8
|
*/
|
|
11
9
|
const useDate = () => {
|
|
12
|
-
const locale = require_requestStorage.getRequestLocale()
|
|
10
|
+
const locale = require_requestStorage.getRequestLocale();
|
|
13
11
|
return (...args) => {
|
|
14
12
|
const options = typeof args[1] === "string" ? {
|
|
15
13
|
..._intlayer_core_formatters.presets[args[1]],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDate.cjs","names":["
|
|
1
|
+
{"version":3,"file":"useDate.cjs","names":["getRequestLocale","presets","date"],"sources":["../../../src/format/useDate.ts"],"sourcesContent":["import { date, presets } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\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();\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":";;;;;;;;AAMA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,wCAAiB;CAEhC,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"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
3
|
let _intlayer_core_utils = require("@intlayer/core/utils");
|
|
5
4
|
|
|
6
5
|
//#region src/format/useIntl.ts
|
|
7
|
-
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
6
|
/**
|
|
9
7
|
* Astro hook that provides a locale-bound `Intl` object.
|
|
10
8
|
*
|
|
11
|
-
* It uses the request locale on the server, falling back to the
|
|
12
|
-
* default locale.
|
|
9
|
+
* It uses the request locale on the server, falling back to the stored
|
|
10
|
+
* locale in the browser, then to the default locale.
|
|
13
11
|
*/
|
|
14
12
|
const useIntl = (locale) => {
|
|
15
|
-
const currentLocale = locale ?? require_requestStorage.getRequestLocale()
|
|
13
|
+
const currentLocale = locale ?? require_requestStorage.getRequestLocale();
|
|
16
14
|
return {
|
|
17
15
|
intl: (0, _intlayer_core_utils.bindIntl)(currentLocale),
|
|
18
16
|
subscribe: () => () => {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntl.cjs","names":["
|
|
1
|
+
{"version":3,"file":"useIntl.cjs","names":["getRequestLocale","bindIntl"],"sources":["../../../src/format/useIntl.ts"],"sourcesContent":["import { bindIntl, type WrappedIntl } from '@intlayer/core/utils';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\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 stored\n * locale in the browser, then to the default locale.\n */\nexport const useIntl = (\n locale?: LocalesValues\n): {\n intl: WrappedIntl;\n subscribe: (callback: (intl: WrappedIntl) => void) => () => void;\n} => {\n const currentLocale = locale ?? getRequestLocale();\n const intl = bindIntl(currentLocale);\n\n return {\n intl,\n subscribe: () => () => {},\n };\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,WACX,WAIG;CACH,MAAM,gBAAgB,UAAUA,wCAAiB;CAGjD,OAAO;EACL,UAHWC,+BAAS,aAGjB;EACH,uBAAuB,CAAC;CAC1B;AACF"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
3
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
4
|
|
|
6
5
|
//#region src/format/useList.ts
|
|
7
|
-
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
6
|
const useList = () => {
|
|
9
|
-
const locale = require_requestStorage.getRequestLocale()
|
|
7
|
+
const locale = require_requestStorage.getRequestLocale();
|
|
10
8
|
return (...args) => (0, _intlayer_core_formatters.list)(args[0], {
|
|
11
9
|
...args[1],
|
|
12
10
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useList.cjs","names":["
|
|
1
|
+
{"version":3,"file":"useList.cjs","names":["getRequestLocale","list"],"sources":["../../../src/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const useList = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;AAGA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,wCAAiB;CAEhC,QAAQ,GAAG,aACTC,gCAAK,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
3
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
4
|
|
|
6
5
|
//#region src/format/useNumber.ts
|
|
7
|
-
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
6
|
/**
|
|
9
7
|
* Astro hook that provides a localized number formatter bound to the request locale.
|
|
10
8
|
*/
|
|
11
9
|
const useNumber = () => {
|
|
12
|
-
const locale = require_requestStorage.getRequestLocale()
|
|
10
|
+
const locale = require_requestStorage.getRequestLocale();
|
|
13
11
|
return (...args) => (0, _intlayer_core_formatters.number)(args[0], {
|
|
14
12
|
...args[1],
|
|
15
13
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.cjs","names":["
|
|
1
|
+
{"version":3,"file":"useNumber.cjs","names":["getRequestLocale","number"],"sources":["../../../src/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\n/**\n * Astro hook that provides a localized number formatter bound to the request locale.\n */\nexport const useNumber = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;AAMA,MAAa,kBAAkB;CAC7B,MAAM,SAASA,wCAAiB;CAEhC,QAAQ,GAAG,aACTC,kCAAO,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
3
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
4
|
|
|
6
5
|
//#region src/format/usePercentage.ts
|
|
7
|
-
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
6
|
const usePercentage = () => {
|
|
9
|
-
const locale = require_requestStorage.getRequestLocale()
|
|
7
|
+
const locale = require_requestStorage.getRequestLocale();
|
|
10
8
|
return (...args) => (0, _intlayer_core_formatters.percentage)(args[0], {
|
|
11
9
|
...args[1],
|
|
12
10
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.cjs","names":["
|
|
1
|
+
{"version":3,"file":"usePercentage.cjs","names":["getRequestLocale","percentage"],"sources":["../../../src/format/usePercentage.ts"],"sourcesContent":["import { percentage } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const usePercentage = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;AAGA,MAAa,sBAAsB;CACjC,MAAM,SAASA,wCAAiB;CAEhC,QAAQ,GAAG,aACTC,sCAAW,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
3
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
4
|
|
|
6
5
|
//#region src/format/useRelativeTime.ts
|
|
7
|
-
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
6
|
const useRelativeTime = () => {
|
|
9
|
-
const locale = require_requestStorage.getRequestLocale()
|
|
7
|
+
const locale = require_requestStorage.getRequestLocale();
|
|
10
8
|
return (...args) => (0, _intlayer_core_formatters.relativeTime)(args[0], args[1], {
|
|
11
9
|
...args[2],
|
|
12
10
|
locale: args[2]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.cjs","names":["
|
|
1
|
+
{"version":3,"file":"useRelativeTime.cjs","names":["getRequestLocale","relativeTime"],"sources":["../../../src/format/useRelativeTime.ts"],"sourcesContent":["import { relativeTime } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const useRelativeTime = () => {\n const locale = getRequestLocale();\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":";;;;;AAGA,MAAa,wBAAwB;CACnC,MAAM,SAASA,wCAAiB;CAEhC,QAAQ,GAAG,aACTC,wCAAa,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_requestStorage = require('../requestStorage.cjs');
|
|
3
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
4
3
|
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
5
4
|
|
|
6
5
|
//#region src/format/useUnit.ts
|
|
7
|
-
const { defaultLocale } = _intlayer_config_built.internationalization;
|
|
8
6
|
const useUnit = () => {
|
|
9
|
-
const locale = require_requestStorage.getRequestLocale()
|
|
7
|
+
const locale = require_requestStorage.getRequestLocale();
|
|
10
8
|
return (...args) => (0, _intlayer_core_formatters.units)(args[0], {
|
|
11
9
|
...args[1],
|
|
12
10
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.cjs","names":["
|
|
1
|
+
{"version":3,"file":"useUnit.cjs","names":["getRequestLocale","units"],"sources":["../../../src/format/useUnit.ts"],"sourcesContent":["import { units } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const useUnit = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;AAGA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,wCAAiB;CAEhC,QAAQ,GAAG,aACTC,iCAAM,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { getRequestLocale } from "../requestStorage.mjs";
|
|
2
|
-
import { internationalization } from "@intlayer/config/built";
|
|
3
2
|
import { compact } from "@intlayer/core/formatters";
|
|
4
3
|
|
|
5
4
|
//#region src/format/useCompact.ts
|
|
6
|
-
const { defaultLocale } = internationalization;
|
|
7
5
|
const useCompact = () => {
|
|
8
|
-
const locale = getRequestLocale()
|
|
6
|
+
const locale = getRequestLocale();
|
|
9
7
|
return (...args) => compact(args[0], {
|
|
10
8
|
...args[1],
|
|
11
9
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompact.mjs","names":[],"sources":["../../../src/format/useCompact.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useCompact.mjs","names":[],"sources":["../../../src/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const useCompact = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;AAGA,MAAa,mBAAmB;CAC9B,MAAM,SAAS,iBAAiB;CAEhC,QAAQ,GAAG,SACT,QAAQ,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { getRequestLocale } from "../requestStorage.mjs";
|
|
2
|
-
import { internationalization } from "@intlayer/config/built";
|
|
3
2
|
import { currency } from "@intlayer/core/formatters";
|
|
4
3
|
|
|
5
4
|
//#region src/format/useCurrency.ts
|
|
6
|
-
const { defaultLocale } = internationalization;
|
|
7
5
|
const useCurrency = () => {
|
|
8
|
-
const locale = getRequestLocale()
|
|
6
|
+
const locale = getRequestLocale();
|
|
9
7
|
return (...args) => currency(args[0], {
|
|
10
8
|
...args[1],
|
|
11
9
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrency.mjs","names":[],"sources":["../../../src/format/useCurrency.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useCurrency.mjs","names":[],"sources":["../../../src/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const useCurrency = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;AAGA,MAAa,oBAAoB;CAC/B,MAAM,SAAS,iBAAiB;CAEhC,QAAQ,GAAG,SACT,SAAS,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { getRequestLocale } from "../requestStorage.mjs";
|
|
2
|
-
import { internationalization } from "@intlayer/config/built";
|
|
3
2
|
import { date, presets } from "@intlayer/core/formatters";
|
|
4
3
|
|
|
5
4
|
//#region src/format/useDate.ts
|
|
6
|
-
const { defaultLocale } = internationalization;
|
|
7
5
|
/**
|
|
8
6
|
* Astro hook that provides a localized date/time formatter bound to the request locale.
|
|
9
7
|
*/
|
|
10
8
|
const useDate = () => {
|
|
11
|
-
const locale = getRequestLocale()
|
|
9
|
+
const locale = getRequestLocale();
|
|
12
10
|
return (...args) => {
|
|
13
11
|
const options = typeof args[1] === "string" ? {
|
|
14
12
|
...presets[args[1]],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDate.mjs","names":[],"sources":["../../../src/format/useDate.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useDate.mjs","names":[],"sources":["../../../src/format/useDate.ts"],"sourcesContent":["import { date, presets } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\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();\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":";;;;;;;AAMA,MAAa,gBAAgB;CAC3B,MAAM,SAAS,iBAAiB;CAEhC,QAAQ,GAAG,SAAkC;EAC3C,MAAM,UACJ,OAAO,KAAK,OAAO,WACf;GAAE,GAAG,QAAQ,KAAK;GAAK;EAAO,IAC9B;GAAE,GAAG,KAAK;GAAI,QAAQ,KAAK,EAAE,EAAE,UAAU;EAAO;EAEtD,OAAO,KAAK,KAAK,IAAI,OAAqC;CAC5D;AACF"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { getRequestLocale } from "../requestStorage.mjs";
|
|
2
|
-
import { internationalization } from "@intlayer/config/built";
|
|
3
2
|
import { bindIntl } from "@intlayer/core/utils";
|
|
4
3
|
|
|
5
4
|
//#region src/format/useIntl.ts
|
|
6
|
-
const { defaultLocale } = internationalization;
|
|
7
5
|
/**
|
|
8
6
|
* Astro hook that provides a locale-bound `Intl` object.
|
|
9
7
|
*
|
|
10
|
-
* It uses the request locale on the server, falling back to the
|
|
11
|
-
* default locale.
|
|
8
|
+
* It uses the request locale on the server, falling back to the stored
|
|
9
|
+
* locale in the browser, then to the default locale.
|
|
12
10
|
*/
|
|
13
11
|
const useIntl = (locale) => {
|
|
14
|
-
const currentLocale = locale ?? getRequestLocale()
|
|
12
|
+
const currentLocale = locale ?? getRequestLocale();
|
|
15
13
|
return {
|
|
16
14
|
intl: bindIntl(currentLocale),
|
|
17
15
|
subscribe: () => () => {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntl.mjs","names":[],"sources":["../../../src/format/useIntl.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useIntl.mjs","names":[],"sources":["../../../src/format/useIntl.ts"],"sourcesContent":["import { bindIntl, type WrappedIntl } from '@intlayer/core/utils';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { getRequestLocale } from '../requestStorage';\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 stored\n * locale in the browser, then to the default locale.\n */\nexport const useIntl = (\n locale?: LocalesValues\n): {\n intl: WrappedIntl;\n subscribe: (callback: (intl: WrappedIntl) => void) => () => void;\n} => {\n const currentLocale = locale ?? getRequestLocale();\n const intl = bindIntl(currentLocale);\n\n return {\n intl,\n subscribe: () => () => {},\n };\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,WACX,WAIG;CACH,MAAM,gBAAgB,UAAU,iBAAiB;CAGjD,OAAO;EACL,MAHW,SAAS,aAGjB;EACH,uBAAuB,CAAC;CAC1B;AACF"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { getRequestLocale } from "../requestStorage.mjs";
|
|
2
|
-
import { internationalization } from "@intlayer/config/built";
|
|
3
2
|
import { list } from "@intlayer/core/formatters";
|
|
4
3
|
|
|
5
4
|
//#region src/format/useList.ts
|
|
6
|
-
const { defaultLocale } = internationalization;
|
|
7
5
|
const useList = () => {
|
|
8
|
-
const locale = getRequestLocale()
|
|
6
|
+
const locale = getRequestLocale();
|
|
9
7
|
return (...args) => list(args[0], {
|
|
10
8
|
...args[1],
|
|
11
9
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useList.mjs","names":[],"sources":["../../../src/format/useList.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useList.mjs","names":[],"sources":["../../../src/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const useList = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;AAGA,MAAa,gBAAgB;CAC3B,MAAM,SAAS,iBAAiB;CAEhC,QAAQ,GAAG,SACT,KAAK,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { getRequestLocale } from "../requestStorage.mjs";
|
|
2
|
-
import { internationalization } from "@intlayer/config/built";
|
|
3
2
|
import { number } from "@intlayer/core/formatters";
|
|
4
3
|
|
|
5
4
|
//#region src/format/useNumber.ts
|
|
6
|
-
const { defaultLocale } = internationalization;
|
|
7
5
|
/**
|
|
8
6
|
* Astro hook that provides a localized number formatter bound to the request locale.
|
|
9
7
|
*/
|
|
10
8
|
const useNumber = () => {
|
|
11
|
-
const locale = getRequestLocale()
|
|
9
|
+
const locale = getRequestLocale();
|
|
12
10
|
return (...args) => number(args[0], {
|
|
13
11
|
...args[1],
|
|
14
12
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.mjs","names":[],"sources":["../../../src/format/useNumber.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useNumber.mjs","names":[],"sources":["../../../src/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\n/**\n * Astro hook that provides a localized number formatter bound to the request locale.\n */\nexport const useNumber = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;AAMA,MAAa,kBAAkB;CAC7B,MAAM,SAAS,iBAAiB;CAEhC,QAAQ,GAAG,SACT,OAAO,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { getRequestLocale } from "../requestStorage.mjs";
|
|
2
|
-
import { internationalization } from "@intlayer/config/built";
|
|
3
2
|
import { percentage } from "@intlayer/core/formatters";
|
|
4
3
|
|
|
5
4
|
//#region src/format/usePercentage.ts
|
|
6
|
-
const { defaultLocale } = internationalization;
|
|
7
5
|
const usePercentage = () => {
|
|
8
|
-
const locale = getRequestLocale()
|
|
6
|
+
const locale = getRequestLocale();
|
|
9
7
|
return (...args) => percentage(args[0], {
|
|
10
8
|
...args[1],
|
|
11
9
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.mjs","names":[],"sources":["../../../src/format/usePercentage.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"usePercentage.mjs","names":[],"sources":["../../../src/format/usePercentage.ts"],"sourcesContent":["import { percentage } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const usePercentage = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;AAGA,MAAa,sBAAsB;CACjC,MAAM,SAAS,iBAAiB;CAEhC,QAAQ,GAAG,SACT,WAAW,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { getRequestLocale } from "../requestStorage.mjs";
|
|
2
|
-
import { internationalization } from "@intlayer/config/built";
|
|
3
2
|
import { relativeTime } from "@intlayer/core/formatters";
|
|
4
3
|
|
|
5
4
|
//#region src/format/useRelativeTime.ts
|
|
6
|
-
const { defaultLocale } = internationalization;
|
|
7
5
|
const useRelativeTime = () => {
|
|
8
|
-
const locale = getRequestLocale()
|
|
6
|
+
const locale = getRequestLocale();
|
|
9
7
|
return (...args) => relativeTime(args[0], args[1], {
|
|
10
8
|
...args[2],
|
|
11
9
|
locale: args[2]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.mjs","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useRelativeTime.mjs","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"sourcesContent":["import { relativeTime } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const useRelativeTime = () => {\n const locale = getRequestLocale();\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":";;;;AAGA,MAAa,wBAAwB;CACnC,MAAM,SAAS,iBAAiB;CAEhC,QAAQ,GAAG,SACT,aAAa,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { getRequestLocale } from "../requestStorage.mjs";
|
|
2
|
-
import { internationalization } from "@intlayer/config/built";
|
|
3
2
|
import { units } from "@intlayer/core/formatters";
|
|
4
3
|
|
|
5
4
|
//#region src/format/useUnit.ts
|
|
6
|
-
const { defaultLocale } = internationalization;
|
|
7
5
|
const useUnit = () => {
|
|
8
|
-
const locale = getRequestLocale()
|
|
6
|
+
const locale = getRequestLocale();
|
|
9
7
|
return (...args) => units(args[0], {
|
|
10
8
|
...args[1],
|
|
11
9
|
locale: args[1]?.locale ?? locale
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.mjs","names":[],"sources":["../../../src/format/useUnit.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useUnit.mjs","names":[],"sources":["../../../src/format/useUnit.ts"],"sourcesContent":["import { units } from '@intlayer/core/formatters';\nimport { getRequestLocale } from '../requestStorage';\n\nexport const useUnit = () => {\n const locale = getRequestLocale();\n\n return (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;AAGA,MAAa,gBAAgB;CAC3B,MAAM,SAAS,iBAAiB;CAEhC,QAAQ,GAAG,SACT,MAAM,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;qBAGa,sBAAU,MAGJ,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;qBAGa,uBAAW,MAGL,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../src/format/useDate.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../src/format/useDate.ts"],"mappings":";;;;;qBAMa,mBAAO,MAGD,kBAAkB"}
|
|
@@ -4,8 +4,8 @@ import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
|
4
4
|
/**
|
|
5
5
|
* Astro hook that provides a locale-bound `Intl` object.
|
|
6
6
|
*
|
|
7
|
-
* It uses the request locale on the server, falling back to the
|
|
8
|
-
* default locale.
|
|
7
|
+
* It uses the request locale on the server, falling back to the stored
|
|
8
|
+
* locale in the browser, then to the default locale.
|
|
9
9
|
*/
|
|
10
10
|
export declare const useIntl: (locale?: LocalesValues) => {
|
|
11
11
|
intl: WrappedIntl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../src/format/useIntl.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../src/format/useIntl.ts"],"mappings":";;;;;;;;;qBAUa,UAAO,SACT;EAET,MAAM;EACN,YAAY,WAAW,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;qBAGa,mBAAO,MAGD,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;qBAMa,qBAAS,MAGH,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;qBAGa,yBAAa,MAGP,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;qBAGa,2BAAe,MAGT,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;qBAGa,mBAAO,MAGD,kBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-intlayer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Astro applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -167,16 +167,16 @@
|
|
|
167
167
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
168
168
|
},
|
|
169
169
|
"dependencies": {
|
|
170
|
-
"@intlayer/config": "9.
|
|
171
|
-
"@intlayer/core": "9.
|
|
172
|
-
"@intlayer/engine": "9.
|
|
173
|
-
"@intlayer/types": "9.
|
|
174
|
-
"vanilla-intlayer": "9.
|
|
175
|
-
"vite-intlayer": "9.
|
|
170
|
+
"@intlayer/config": "9.7.0",
|
|
171
|
+
"@intlayer/core": "9.7.0",
|
|
172
|
+
"@intlayer/engine": "9.7.0",
|
|
173
|
+
"@intlayer/types": "9.7.0",
|
|
174
|
+
"vanilla-intlayer": "9.7.0",
|
|
175
|
+
"vite-intlayer": "9.7.0"
|
|
176
176
|
},
|
|
177
177
|
"devDependencies": {
|
|
178
|
-
"@intlayer/dictionaries-entry": "9.
|
|
179
|
-
"@types/node": "^
|
|
178
|
+
"@intlayer/dictionaries-entry": "9.7.0",
|
|
179
|
+
"@types/node": "^26",
|
|
180
180
|
"@utils/ts-config": "1.0.4",
|
|
181
181
|
"@utils/ts-config-types": "1.0.4",
|
|
182
182
|
"@utils/tsdown-config": "1.0.4",
|