@voltro/i18n 0.89.2 → 0.91.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/CHANGELOG.md +1943 -0
- package/dist/format.js +15 -15
- package/dist/index.js +15 -15
- package/dist/server.js +9 -9
- package/dist/typed.js +5 -5
- package/package.json +1 -1
package/dist/format.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useLocale as e } from "./hooks.js";
|
|
2
|
+
import { useRenderClock as t } from "./renderClock.js";
|
|
3
3
|
import { dateTimeFormat as n, numberFormat as r, pluralRules as i, relativeTimeFormat as a } from "./formatterCache.js";
|
|
4
4
|
import { useCallback as o, useMemo as s } from "react";
|
|
5
5
|
import { useIntl as c } from "react-intl";
|
|
@@ -12,8 +12,8 @@ var l = (e, t, n, r) => {
|
|
|
12
12
|
} catch {}
|
|
13
13
|
return (n[a] ?? n.other).replace(/\{count\}/g, String(t));
|
|
14
14
|
}, u = () => {
|
|
15
|
-
let
|
|
16
|
-
return o((
|
|
15
|
+
let t = e();
|
|
16
|
+
return o((e, n, r) => l(t, e, n, r), [t]);
|
|
17
17
|
}, d = (e) => e instanceof Date ? e : new Date(e), f = (e) => e != null, p = () => c().timeZone, m = (e, t, r, i) => {
|
|
18
18
|
let { fallback: a = "", ...o } = i ?? {};
|
|
19
19
|
if (!f(r)) return a;
|
|
@@ -28,8 +28,8 @@ var l = (e, t, n, r) => {
|
|
|
28
28
|
return String(r);
|
|
29
29
|
}
|
|
30
30
|
}, h = () => {
|
|
31
|
-
let
|
|
32
|
-
return o((
|
|
31
|
+
let t = e(), n = p();
|
|
32
|
+
return o((e, r) => m(t, n, e, r), [t, n]);
|
|
33
33
|
}, g = [
|
|
34
34
|
["year", 31536e6],
|
|
35
35
|
["month", 2592e6],
|
|
@@ -39,7 +39,7 @@ var l = (e, t, n, r) => {
|
|
|
39
39
|
["minute", 6e4],
|
|
40
40
|
["second", 1e3]
|
|
41
41
|
], _ = () => {
|
|
42
|
-
let n =
|
|
42
|
+
let n = e(), r = t();
|
|
43
43
|
return o((e, t) => {
|
|
44
44
|
let { now: i, fallback: o = "", ...s } = t ?? {};
|
|
45
45
|
if (!f(e)) return o;
|
|
@@ -58,14 +58,14 @@ var l = (e, t, n, r) => {
|
|
|
58
58
|
}
|
|
59
59
|
}, [n, r]);
|
|
60
60
|
}, v = () => {
|
|
61
|
-
let
|
|
62
|
-
return o((
|
|
61
|
+
let t = e();
|
|
62
|
+
return o((e, n) => {
|
|
63
63
|
try {
|
|
64
|
-
return r(
|
|
64
|
+
return r(t, n).format(e);
|
|
65
65
|
} catch {
|
|
66
|
-
return String(
|
|
66
|
+
return String(e);
|
|
67
67
|
}
|
|
68
|
-
}, [
|
|
68
|
+
}, [t]);
|
|
69
69
|
}, y = (e) => {
|
|
70
70
|
let t = v();
|
|
71
71
|
return o((n, r) => t(n, {
|
|
@@ -74,16 +74,16 @@ var l = (e, t, n, r) => {
|
|
|
74
74
|
...r
|
|
75
75
|
}), [t, e]);
|
|
76
76
|
}, b = () => {
|
|
77
|
-
let
|
|
77
|
+
let t = e(), n = p(), r = h(), i = _(), a = v(), o = u();
|
|
78
78
|
return s(() => ({
|
|
79
|
-
locale:
|
|
79
|
+
locale: t,
|
|
80
80
|
timeZone: n,
|
|
81
81
|
formatDate: r,
|
|
82
82
|
relativeTime: i,
|
|
83
83
|
formatNumber: a,
|
|
84
84
|
plural: o
|
|
85
85
|
}), [
|
|
86
|
-
|
|
86
|
+
t,
|
|
87
87
|
n,
|
|
88
88
|
r,
|
|
89
89
|
i,
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
export {
|
|
1
|
+
import { I18nProvider as e } from "./provider.js";
|
|
2
|
+
import { T as t } from "./components.js";
|
|
3
|
+
import { useLocale as n, useMessages as r, useT as i, useTFn as a } from "./hooks.js";
|
|
4
|
+
import { plural as o, useFormatCurrency as s, useFormatDate as c, useFormatNumber as l, useFormatters as u, usePlural as d, useRelativeTime as f, useTimeZone as p } from "./format.js";
|
|
5
|
+
import { DEFAULT_TIME_ZONE as m, VIEWER_TIME_ZONE as h, isSupportedTimeZone as g } from "./timeZone.js";
|
|
6
|
+
import { RenderClockContext as _, useRenderClock as v } from "./renderClock.js";
|
|
7
|
+
import { assertCatalogParity as y, defineCatalog as b, defineLocale as x, pickCatalog as S, placeholdersOf as C } from "./catalog.js";
|
|
8
|
+
import { createTypedMessages as w } from "./typed.js";
|
|
9
|
+
import { defineCatalogs as T } from "./lazyCatalog.js";
|
|
10
|
+
import { LazyI18nProvider as E } from "./lazyProvider.js";
|
|
11
|
+
import { makeSsgWrap as D } from "./ssgWrap.js";
|
|
12
|
+
import { LOCALE_COOKIE as O, THEME_COOKIE as k, TIMEZONE_COOKIE as A } from "./cookieNames.js";
|
|
13
|
+
import { LocaleSwitcher as j } from "./localeSwitcher.js";
|
|
14
|
+
import { i18nInstanceReport as M } from "./instanceRegistry.js";
|
|
15
|
+
export { m as DEFAULT_TIME_ZONE, e as I18nProvider, O as LOCALE_COOKIE, E as LazyI18nProvider, j as LocaleSwitcher, _ as RenderClockContext, t as T, k as THEME_COOKIE, A as TIMEZONE_COOKIE, h as VIEWER_TIME_ZONE, y as assertCatalogParity, w as createTypedMessages, b as defineCatalog, T as defineCatalogs, x as defineLocale, M as i18nInstanceReport, g as isSupportedTimeZone, D as makeSsgWrap, S as pickCatalog, C as placeholdersOf, o as plural, s as useFormatCurrency, c as useFormatDate, l as useFormatNumber, u as useFormatters, n as useLocale, r as useMessages, d as usePlural, f as useRelativeTime, v as useRenderClock, i as useT, a as useTFn, p as useTimeZone };
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { LOCALE_COOKIE as e, THEME_COOKIE as t, TIMEZONE_COOKIE as n } from "./cookieNames.js";
|
|
2
|
+
import { DEFAULT_TIME_ZONE as r, VIEWER_TIME_ZONE as i, isSupportedTimeZone as a } from "./timeZone.js";
|
|
3
3
|
// src/server.ts
|
|
4
|
-
var o =
|
|
4
|
+
var o = e, s = (e) => RegExp(`(?:^|;\\s*)${e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}=([^;]*)`), c = s(o), l = s(n), u = (e, t) => {
|
|
5
5
|
if (!e) return;
|
|
6
6
|
let n = e.match(t);
|
|
7
7
|
return n ? decodeURIComponent(n[1]) : void 0;
|
|
@@ -48,11 +48,11 @@ var o = r, s = (e) => RegExp(`(?:^|;\\s*)${e.replace(/[.*+?^${}()|[\]\\]/g, "\\$
|
|
|
48
48
|
}
|
|
49
49
|
return a;
|
|
50
50
|
}, m = (e) => {
|
|
51
|
-
let { cookieHeader: t, configured:
|
|
52
|
-
if (!
|
|
53
|
-
if (
|
|
54
|
-
let
|
|
55
|
-
return
|
|
51
|
+
let { cookieHeader: t, configured: n, defaultTimeZone: r } = e;
|
|
52
|
+
if (!n) return;
|
|
53
|
+
if (n !== "viewer") return a(n) ? n : a(r) ? r : "UTC";
|
|
54
|
+
let i = u(t, l);
|
|
55
|
+
return a(i) ? i : a(r) ? r : "UTC";
|
|
56
56
|
}, h = (e) => {
|
|
57
57
|
let { wraps: t, supported: n, defaultLocale: r } = e;
|
|
58
58
|
return Object.keys(t).length === 0 ? () => void 0 : (i, a, o, s) => {
|
|
@@ -83,4 +83,4 @@ var o = r, s = (e) => RegExp(`(?:^|;\\s*)${e.replace(/[.*+?^${}()|[\]\\]/g, "\\$
|
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
|
-
export {
|
|
86
|
+
export { r as DEFAULT_TIME_ZONE, e as LOCALE_COOKIE, t as THEME_COOKIE, n as TIMEZONE_COOKIE, i as VIEWER_TIME_ZONE, a as isSupportedTimeZone, h as makeSsrI18nResolver, p as resolveLocale, m as resolveTimeZone };
|
package/dist/typed.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useT as e, useTFn as t } from "./hooks.js";
|
|
2
|
+
import { T as n } from "./components.js";
|
|
3
3
|
// src/typed.ts
|
|
4
4
|
var r = (e) => {
|
|
5
5
|
let t = e;
|
|
6
6
|
return t.dynamic === void 0 && (t.dynamic = (t, n) => e(t, n)), t;
|
|
7
7
|
}, i = () => ({
|
|
8
|
-
useT: r((
|
|
9
|
-
useTFn: (() => r(
|
|
10
|
-
T:
|
|
8
|
+
useT: r((t, n) => e(t, n)),
|
|
9
|
+
useTFn: (() => r(t())),
|
|
10
|
+
T: n
|
|
11
11
|
});
|
|
12
12
|
export { i as createTypedMessages };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/i18n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.0",
|
|
4
4
|
"description": "Voltro's i18n layer — thin opinionated wrap over react-intl. Provides the framework's locale-resolution conventions (voltro:locale cookie + Accept-Language fallback), a typed message-catalog helper, and a slim provider component. Power users can import directly from react-intl for advanced APIs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|