svelte-intlayer 5.7.8 → 5.8.1-canary.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/README.md +1 -1
- package/dist/cjs/client/getBrowserLocale.cjs +1 -1
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/esm/client/getBrowserLocale.mjs +3 -4
- package/dist/esm/client/useDictionary.mjs +8 -8
- package/dist/esm/client/useDictionaryAsync.mjs +14 -14
- package/dist/esm/client/useDictionaryDynamic.mjs +12 -12
- package/dist/esm/client/useIntlayer.mjs +7 -7
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=()=>{if(typeof navigator>"u")return"en";const e=navigator.language||navigator.languages?.[0];return e&&e.split("-")[0]||"en"};exports.getBrowserLocale=n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("svelte/store"),c=require("../getDictionary.cjs"),a=require("./intlayerContext.cjs"),l=require("./intlayerStore.cjs"),s=(t
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("svelte/store"),c=require("../getDictionary.cjs"),a=require("./intlayerContext.cjs"),l=require("./intlayerStore.cjs"),s=(e,t)=>{const r=a.getIntlayerContext();return i.derived([l.intlayerStore],([n])=>{const o=t??r?.locale??n.locale;return c.getDictionary(e,o)})};exports.useDictionary=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("svelte/store"),s=require("./intlayerContext.cjs"),y=require("./intlayerStore.cjs"),d=async(n,c)=>{const i=s.getIntlayerContext(),e=r.writable(null);return r.derived([y.intlayerStore],([a])=>{const o=c??i?.locale??a.locale;return(async()=>{try{const t=n[o];if(t){const l=await t();e.set(l)}else e.set(null)}catch(t){console.error(`Failed to load dictionary for key: ${String(o)}`,t),e.set(null)}})(),null})};exports.useDictionaryAsync=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("svelte/store"),y=require("./intlayerContext.cjs"),d=require("./intlayerStore.cjs"),u=(n,i
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("svelte/store"),y=require("./intlayerContext.cjs"),d=require("./intlayerStore.cjs"),u=(r,n,i)=>{const c=y.getIntlayerContext(),e=o.writable(null);return o.derived([d.intlayerStore],([a])=>{const l=i??c?.locale??a.locale;return(async()=>{try{const t=r[l];if(t){const s=await t();e.set(s)}else e.set(null)}catch(t){console.error(`Failed to load dictionary for key: ${String(n)}`,t),e.set(null)}})(),null})};exports.useDictionaryDynamic=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("svelte/store"),c=require("../getIntlayer.cjs"),a=require("./intlayerContext.cjs"),i=require("./intlayerStore.cjs"),s=(e,t)=>{const r=a.getIntlayerContext();return l.derived([i.intlayerStore],([n])=>{const o=t??r?.locale??n.locale;return c.getIntlayer(e,o)})};exports.useIntlayer=s;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
var n;
|
|
1
|
+
const a = () => {
|
|
3
2
|
if (typeof navigator > "u")
|
|
4
3
|
return "en";
|
|
5
|
-
const e = navigator.language ||
|
|
4
|
+
const e = navigator.language || navigator.languages?.[0];
|
|
6
5
|
return e && e.split("-")[0] || "en";
|
|
7
6
|
};
|
|
8
7
|
export {
|
|
9
|
-
|
|
8
|
+
a as getBrowserLocale
|
|
10
9
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { derived as
|
|
2
|
-
import { getDictionary as
|
|
3
|
-
import { getIntlayerContext as
|
|
4
|
-
import { intlayerStore as
|
|
1
|
+
import { derived as i } from "svelte/store";
|
|
2
|
+
import { getDictionary as c } from "../getDictionary.mjs";
|
|
3
|
+
import { getIntlayerContext as a } from "./intlayerContext.mjs";
|
|
4
|
+
import { intlayerStore as m } from "./intlayerStore.mjs";
|
|
5
5
|
const y = (t, o) => {
|
|
6
|
-
const r =
|
|
7
|
-
return
|
|
8
|
-
const
|
|
9
|
-
return
|
|
6
|
+
const r = a();
|
|
7
|
+
return i([m], ([e]) => {
|
|
8
|
+
const n = o ?? r?.locale ?? e.locale;
|
|
9
|
+
return c(t, n);
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { writable as
|
|
1
|
+
import { writable as l, derived as s } from "svelte/store";
|
|
2
2
|
import { getIntlayerContext as y } from "./intlayerContext.mjs";
|
|
3
3
|
import { intlayerStore as d } from "./intlayerStore.mjs";
|
|
4
|
-
const D = async (
|
|
5
|
-
const
|
|
6
|
-
return s([d], ([
|
|
7
|
-
const
|
|
4
|
+
const D = async (e, n) => {
|
|
5
|
+
const a = y(), o = l(null);
|
|
6
|
+
return s([d], ([c]) => {
|
|
7
|
+
const r = n ?? a?.locale ?? c.locale;
|
|
8
8
|
return (async () => {
|
|
9
9
|
try {
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const
|
|
13
|
-
|
|
10
|
+
const t = e[r];
|
|
11
|
+
if (t) {
|
|
12
|
+
const i = await t();
|
|
13
|
+
o.set(i);
|
|
14
14
|
} else
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
15
|
+
o.set(null);
|
|
16
|
+
} catch (t) {
|
|
17
17
|
console.error(
|
|
18
|
-
`Failed to load dictionary for key: ${String(
|
|
19
|
-
|
|
20
|
-
),
|
|
18
|
+
`Failed to load dictionary for key: ${String(r)}`,
|
|
19
|
+
t
|
|
20
|
+
), o.set(null);
|
|
21
21
|
}
|
|
22
22
|
})(), null;
|
|
23
23
|
});
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { writable as s, derived as y } from "svelte/store";
|
|
2
2
|
import { getIntlayerContext as d } from "./intlayerContext.mjs";
|
|
3
3
|
import { intlayerStore as m } from "./intlayerStore.mjs";
|
|
4
|
-
const g = (e, n
|
|
5
|
-
const
|
|
4
|
+
const g = (r, e, n) => {
|
|
5
|
+
const a = d(), o = s(null);
|
|
6
6
|
return y([m], ([i]) => {
|
|
7
|
-
const
|
|
7
|
+
const c = n ?? a?.locale ?? i.locale;
|
|
8
8
|
return (async () => {
|
|
9
9
|
try {
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const
|
|
13
|
-
|
|
10
|
+
const t = r[c];
|
|
11
|
+
if (t) {
|
|
12
|
+
const l = await t();
|
|
13
|
+
o.set(l);
|
|
14
14
|
} else
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
15
|
+
o.set(null);
|
|
16
|
+
} catch (t) {
|
|
17
17
|
console.error(
|
|
18
|
-
`Failed to load dictionary for key: ${String(
|
|
19
|
-
|
|
20
|
-
),
|
|
18
|
+
`Failed to load dictionary for key: ${String(e)}`,
|
|
19
|
+
t
|
|
20
|
+
), o.set(null);
|
|
21
21
|
}
|
|
22
22
|
})(), null;
|
|
23
23
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { derived as
|
|
1
|
+
import { derived as l } from "svelte/store";
|
|
2
2
|
import { getIntlayer as a } from "../getIntlayer.mjs";
|
|
3
3
|
import { getIntlayerContext as m } from "./intlayerContext.mjs";
|
|
4
|
-
import { intlayerStore as
|
|
5
|
-
const y = (t,
|
|
6
|
-
const
|
|
7
|
-
return
|
|
8
|
-
const
|
|
9
|
-
return a(t,
|
|
4
|
+
import { intlayerStore as c } from "./intlayerStore.mjs";
|
|
5
|
+
const y = (t, r) => {
|
|
6
|
+
const e = m();
|
|
7
|
+
return l([c], ([o]) => {
|
|
8
|
+
const n = r ?? e?.locale ?? o.locale;
|
|
9
|
+
return a(t, n);
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-intlayer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.1-canary.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Svelte applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -58,35 +58,35 @@
|
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"js-cookie": "^3.0.5",
|
|
61
|
-
"@intlayer/
|
|
62
|
-
"@intlayer/
|
|
63
|
-
"@intlayer/
|
|
64
|
-
"@intlayer/core": "5.
|
|
61
|
+
"@intlayer/api": "5.8.1-canary.0",
|
|
62
|
+
"@intlayer/config": "5.8.1-canary.0",
|
|
63
|
+
"@intlayer/editor": "5.8.1-canary.0",
|
|
64
|
+
"@intlayer/core": "5.8.1-canary.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
67
|
+
"@sveltejs/vite-plugin-svelte": "^6.1.2",
|
|
68
68
|
"@types/js-cookie": "^3.0.6",
|
|
69
|
-
"@types/node": "^
|
|
69
|
+
"@types/node": "^24.2.1",
|
|
70
70
|
"@typescript-eslint/parser": "^8.33.1",
|
|
71
71
|
"concurrently": "^9.1.2",
|
|
72
|
-
"eslint": "^9.
|
|
72
|
+
"eslint": "^9.33.0",
|
|
73
73
|
"prettier": "^3.5.3",
|
|
74
74
|
"rimraf": "^6.0.1",
|
|
75
|
-
"typescript": "^5.
|
|
76
|
-
"vite": "^
|
|
75
|
+
"typescript": "^5.9.2",
|
|
76
|
+
"vite": "^7.1.2",
|
|
77
77
|
"vite-plugin-dts": "^4.5.3",
|
|
78
78
|
"vitest": "^3.2.2",
|
|
79
|
-
"@utils/ts-config": "1.0.4",
|
|
80
79
|
"@utils/eslint-config": "1.0.4",
|
|
80
|
+
"@utils/ts-config": "1.0.4",
|
|
81
81
|
"@utils/ts-config-types": "1.0.4",
|
|
82
82
|
"@utils/tsup-config": "1.0.4"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"svelte": ">=5.0.0",
|
|
86
|
-
"@intlayer/
|
|
87
|
-
"@intlayer/
|
|
88
|
-
"@intlayer/
|
|
89
|
-
"@intlayer/
|
|
86
|
+
"@intlayer/api": "5.8.1-canary.0",
|
|
87
|
+
"@intlayer/config": "5.8.1-canary.0",
|
|
88
|
+
"@intlayer/core": "5.8.1-canary.0",
|
|
89
|
+
"@intlayer/editor": "5.8.1-canary.0"
|
|
90
90
|
},
|
|
91
91
|
"engines": {
|
|
92
92
|
"node": ">=14.18"
|