@i18n-micro/astro 1.3.13 → 1.3.18
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/client/index.js +6 -17
- package/dist/client/preact.js +35 -64
- package/dist/client/react.js +35 -64
- package/dist/client/svelte.js +60 -62
- package/dist/client/vue.js +2 -1552
- package/dist/core-DwkpOV-H.cjs +1 -0
- package/dist/core-VSnkGRWR.js +28 -0
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +498 -564
- package/dist/vue-BVFyDsja.cjs +5 -0
- package/dist/vue-CyIbewNw.js +1723 -0
- package/package.json +11 -11
- package/dist/core-B-Ia_nzr.cjs +0 -1
- package/dist/core-Bk6qZuDf.js +0 -37
package/dist/client/index.js
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { I18nProvider as
|
|
3
|
-
import { I18nProvider as
|
|
4
|
-
import { createI18nStore as
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
u as I18nProvider,
|
|
8
|
-
a as I18nProviderPreact,
|
|
9
|
-
f as createI18nStore,
|
|
10
|
-
s as hasTranslation,
|
|
11
|
-
v as provideI18n,
|
|
12
|
-
o as translate,
|
|
13
|
-
n as useAstroI18nPreact,
|
|
14
|
-
A as useAstroI18nReact,
|
|
15
|
-
i as useAstroI18nSvelte,
|
|
16
|
-
x as useAstroI18nVue
|
|
17
|
-
};
|
|
1
|
+
import { n as e, t } from "../core-VSnkGRWR.js";
|
|
2
|
+
import { I18nProvider as n, useAstroI18n as r } from "./preact.js";
|
|
3
|
+
import { I18nProvider as i, useAstroI18n as a } from "./react.js";
|
|
4
|
+
import { createI18nStore as o, useAstroI18n as s } from "./svelte.js";
|
|
5
|
+
import { n as c, t as l } from "../vue-CyIbewNw.js";
|
|
6
|
+
export { i as I18nProvider, n as I18nProviderPreact, o as createI18nStore, t as hasTranslation, l as provideI18n, e as translate, r as useAstroI18nPreact, a as useAstroI18nReact, s as useAstroI18nSvelte, c as useAstroI18nVue };
|
package/dist/client/preact.js
CHANGED
|
@@ -1,66 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { n as e, t } from "../core-VSnkGRWR.js";
|
|
2
|
+
import { FormatService as n, defaultPlural as r } from "@i18n-micro/core";
|
|
3
|
+
import { createContext as i, createElement as a } from "preact";
|
|
4
|
+
import { useContext as o, useMemo as s, useState as c } from "preact/hooks";
|
|
5
|
+
//#region src/client/preact.tsx
|
|
6
|
+
var l = new n(), u = i(null), d = ({ children: e, value: t }) => {
|
|
7
|
+
let [n] = c(() => ({
|
|
8
|
+
locale: t.locale,
|
|
9
|
+
fallbackLocale: t.fallbackLocale,
|
|
10
|
+
translations: t.translations,
|
|
11
|
+
currentRoute: t.currentRoute
|
|
12
|
+
}));
|
|
13
|
+
return a(u.Provider, { value: n }, e);
|
|
13
14
|
};
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
() => (r, e) => s.formatNumber(r, t.locale, e),
|
|
35
|
-
[t.locale]
|
|
36
|
-
), b = a(
|
|
37
|
-
() => (r, e) => s.formatDate(r, t.locale, e),
|
|
38
|
-
[t.locale]
|
|
39
|
-
), p = a(
|
|
40
|
-
() => (r, e) => s.formatRelativeTime(r, t.locale, e),
|
|
41
|
-
[t.locale]
|
|
42
|
-
), R = a(
|
|
43
|
-
() => (r, e) => A(t, r, e),
|
|
44
|
-
[t]
|
|
45
|
-
);
|
|
46
|
-
return {
|
|
47
|
-
// Translation methods
|
|
48
|
-
t: o,
|
|
49
|
-
ts: l,
|
|
50
|
-
tc: m,
|
|
51
|
-
tn: f,
|
|
52
|
-
td: b,
|
|
53
|
-
tdr: p,
|
|
54
|
-
has: R,
|
|
55
|
-
// Locale state
|
|
56
|
-
locale: t.locale,
|
|
57
|
-
fallbackLocale: t.fallbackLocale,
|
|
58
|
-
currentRoute: t.currentRoute,
|
|
59
|
-
// Route management (read-only в клиентских островах)
|
|
60
|
-
getRoute: () => t.currentRoute
|
|
61
|
-
};
|
|
15
|
+
function f() {
|
|
16
|
+
let n = o(u);
|
|
17
|
+
if (!n) throw Error("useAstroI18n must be used within an I18nProvider");
|
|
18
|
+
let i = s(() => (t, r, i, a) => e(n, t, r, i, a), [n]);
|
|
19
|
+
return {
|
|
20
|
+
t: i,
|
|
21
|
+
ts: s(() => (e, t, n, r) => i(e, t, n, r)?.toString() ?? n ?? e, [i]),
|
|
22
|
+
tc: s(() => (e, t, a) => {
|
|
23
|
+
let { count: o, ...s } = typeof t == "number" ? { count: t } : t;
|
|
24
|
+
return o === void 0 ? a ?? e : r(e, Number.parseInt(o.toString(), 10), s, n.locale, (e, t, n) => i(e, t, n)) ?? a ?? e;
|
|
25
|
+
}, [i, n]),
|
|
26
|
+
tn: s(() => (e, t) => l.formatNumber(e, n.locale, t), [n.locale]),
|
|
27
|
+
td: s(() => (e, t) => l.formatDate(e, n.locale, t), [n.locale]),
|
|
28
|
+
tdr: s(() => (e, t) => l.formatRelativeTime(e, n.locale, t), [n.locale]),
|
|
29
|
+
has: s(() => (e, r) => t(n, e, r), [n]),
|
|
30
|
+
locale: n.locale,
|
|
31
|
+
fallbackLocale: n.fallbackLocale,
|
|
32
|
+
currentRoute: n.currentRoute,
|
|
33
|
+
getRoute: () => n.currentRoute
|
|
34
|
+
};
|
|
62
35
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
M as useAstroI18n
|
|
66
|
-
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { d as I18nProvider, f as useAstroI18n };
|
package/dist/client/react.js
CHANGED
|
@@ -1,66 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { n as e, t } from "../core-VSnkGRWR.js";
|
|
2
|
+
import { FormatService as n, defaultPlural as r } from "@i18n-micro/core";
|
|
3
|
+
import i, { createContext as a, useContext as o, useMemo as s, useState as c } from "react";
|
|
4
|
+
//#region src/client/react.tsx
|
|
5
|
+
var l = new n(), u = a(null);
|
|
6
|
+
function d({ children: e, value: t }) {
|
|
7
|
+
let [n] = c(() => ({
|
|
8
|
+
locale: t.locale,
|
|
9
|
+
fallbackLocale: t.fallbackLocale,
|
|
10
|
+
translations: t.translations,
|
|
11
|
+
currentRoute: t.currentRoute
|
|
12
|
+
}));
|
|
13
|
+
return i.createElement(u.Provider, { value: n }, e);
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
() => (e, r) => s.formatNumber(e, t.locale, r),
|
|
35
|
-
[t.locale]
|
|
36
|
-
), b = a(
|
|
37
|
-
() => (e, r) => s.formatDate(e, t.locale, r),
|
|
38
|
-
[t.locale]
|
|
39
|
-
), R = a(
|
|
40
|
-
() => (e, r) => s.formatRelativeTime(e, t.locale, r),
|
|
41
|
-
[t.locale]
|
|
42
|
-
), p = a(
|
|
43
|
-
() => (e, r) => A(t, e, r),
|
|
44
|
-
[t]
|
|
45
|
-
);
|
|
46
|
-
return {
|
|
47
|
-
// Translation methods
|
|
48
|
-
t: o,
|
|
49
|
-
ts: l,
|
|
50
|
-
tc: m,
|
|
51
|
-
tn: f,
|
|
52
|
-
td: b,
|
|
53
|
-
tdr: R,
|
|
54
|
-
has: p,
|
|
55
|
-
// Locale state
|
|
56
|
-
locale: t.locale,
|
|
57
|
-
fallbackLocale: t.fallbackLocale,
|
|
58
|
-
currentRoute: t.currentRoute,
|
|
59
|
-
// Route management (read-only в клиентских островах)
|
|
60
|
-
getRoute: () => t.currentRoute
|
|
61
|
-
};
|
|
15
|
+
function f() {
|
|
16
|
+
let n = o(u);
|
|
17
|
+
if (!n) throw Error("useAstroI18n must be used within an I18nProvider");
|
|
18
|
+
let i = s(() => (t, r, i, a) => e(n, t, r, i, a), [n]);
|
|
19
|
+
return {
|
|
20
|
+
t: i,
|
|
21
|
+
ts: s(() => (e, t, n, r) => i(e, t, n, r)?.toString() ?? n ?? e, [i]),
|
|
22
|
+
tc: s(() => (e, t, a) => {
|
|
23
|
+
let { count: o, ...s } = typeof t == "number" ? { count: t } : t;
|
|
24
|
+
return o === void 0 ? a ?? e : r(e, Number.parseInt(o.toString(), 10), s, n.locale, (e, t, n) => i(e, t, n)) ?? a ?? e;
|
|
25
|
+
}, [i, n]),
|
|
26
|
+
tn: s(() => (e, t) => l.formatNumber(e, n.locale, t), [n.locale]),
|
|
27
|
+
td: s(() => (e, t) => l.formatDate(e, n.locale, t), [n.locale]),
|
|
28
|
+
tdr: s(() => (e, t) => l.formatRelativeTime(e, n.locale, t), [n.locale]),
|
|
29
|
+
has: s(() => (e, r) => t(n, e, r), [n]),
|
|
30
|
+
locale: n.locale,
|
|
31
|
+
fallbackLocale: n.fallbackLocale,
|
|
32
|
+
currentRoute: n.currentRoute,
|
|
33
|
+
getRoute: () => n.currentRoute
|
|
34
|
+
};
|
|
62
35
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
F as useAstroI18n
|
|
66
|
-
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { d as I18nProvider, f as useAstroI18n };
|
package/dist/client/svelte.js
CHANGED
|
@@ -1,64 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { n as e, t } from "../core-VSnkGRWR.js";
|
|
2
|
+
import { FormatService as n, defaultPlural as r } from "@i18n-micro/core";
|
|
3
|
+
import { get as i, writable as a } from "svelte/store";
|
|
4
|
+
//#region src/client/svelte.ts
|
|
5
|
+
var o = new n();
|
|
6
|
+
function s(e) {
|
|
7
|
+
return a({
|
|
8
|
+
locale: e.locale,
|
|
9
|
+
fallbackLocale: e.fallbackLocale,
|
|
10
|
+
translations: e.translations,
|
|
11
|
+
currentRoute: e.currentRoute
|
|
12
|
+
});
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
14
|
+
function c(n) {
|
|
15
|
+
let a = () => i(n), s = (t, n, r, i) => e(a(), t, n, r, i);
|
|
16
|
+
return {
|
|
17
|
+
store: n,
|
|
18
|
+
t: s,
|
|
19
|
+
ts: (e, t, n, r) => s(e, t, n, r)?.toString() ?? n ?? e,
|
|
20
|
+
tc: (e, t, n) => {
|
|
21
|
+
let i = a(), { count: o, ...c } = typeof t == "number" ? { count: t } : t;
|
|
22
|
+
return o === void 0 ? n ?? e : r(e, Number.parseInt(o.toString(), 10), c, i.locale, (e, t, n) => s(e, t, n)) ?? n ?? e;
|
|
23
|
+
},
|
|
24
|
+
tn: (e, t) => {
|
|
25
|
+
let n = a();
|
|
26
|
+
return o.formatNumber(e, n.locale, t);
|
|
27
|
+
},
|
|
28
|
+
td: (e, t) => {
|
|
29
|
+
let n = a();
|
|
30
|
+
return o.formatDate(e, n.locale, t);
|
|
31
|
+
},
|
|
32
|
+
tdr: (e, t) => {
|
|
33
|
+
let n = a();
|
|
34
|
+
return o.formatRelativeTime(e, n.locale, t);
|
|
35
|
+
},
|
|
36
|
+
has: (e, n) => t(a(), e, n),
|
|
37
|
+
get locale() {
|
|
38
|
+
return a().locale;
|
|
39
|
+
},
|
|
40
|
+
get fallbackLocale() {
|
|
41
|
+
return a().fallbackLocale;
|
|
42
|
+
},
|
|
43
|
+
get currentRoute() {
|
|
44
|
+
return a().currentRoute;
|
|
45
|
+
},
|
|
46
|
+
setLocale: (e) => {
|
|
47
|
+
n.update((t) => ({
|
|
48
|
+
...t,
|
|
49
|
+
locale: e
|
|
50
|
+
}));
|
|
51
|
+
},
|
|
52
|
+
setRoute: (e) => {
|
|
53
|
+
n.update((t) => ({
|
|
54
|
+
...t,
|
|
55
|
+
currentRoute: e
|
|
56
|
+
}));
|
|
57
|
+
},
|
|
58
|
+
getRoute: () => a().currentRoute
|
|
59
|
+
};
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
P as useAstroI18n
|
|
64
|
-
};
|
|
61
|
+
//#endregion
|
|
62
|
+
export { s as createI18nStore, c as useAstroI18n };
|