@zachhandley/ez-i18n 0.3.18 → 0.3.19
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/runtime/index.d.ts +4 -2
- package/dist/runtime/index.js +1 -5
- package/package.json +1 -3
package/README.md
CHANGED
package/dist/runtime/index.d.ts
CHANGED
|
@@ -13,9 +13,11 @@ declare function getNestedValue(obj: Record<string, unknown>, path: string): unk
|
|
|
13
13
|
*/
|
|
14
14
|
declare function interpolate(str: string, params?: Record<string, string | number>): string;
|
|
15
15
|
/**
|
|
16
|
-
* Client-side locale preference
|
|
16
|
+
* Client-side locale preference
|
|
17
|
+
* Note: Persistence is handled via cookies (set by middleware) and the hydration script
|
|
18
|
+
* that syncs localStorage. We use a regular atom to avoid proxy issues in Cloudflare Workers.
|
|
17
19
|
*/
|
|
18
|
-
declare const localePreference: nanostores.
|
|
20
|
+
declare const localePreference: nanostores.PreinitializedWritableAtom<string> & object;
|
|
19
21
|
/**
|
|
20
22
|
* Effective locale - uses server locale if set, otherwise client preference
|
|
21
23
|
*/
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// src/runtime/store.ts
|
|
2
2
|
import { atom, computed } from "nanostores";
|
|
3
|
-
import { persistentAtom } from "@nanostores/persistent";
|
|
4
3
|
function getNestedValue(obj, path) {
|
|
5
4
|
const keys = path.split(".");
|
|
6
5
|
let value = obj;
|
|
@@ -19,10 +18,7 @@ function interpolate(str, params) {
|
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
20
|
var serverLocale = atom(null);
|
|
22
|
-
var localePreference =
|
|
23
|
-
encode: (value) => value,
|
|
24
|
-
decode: (value) => value
|
|
25
|
-
});
|
|
21
|
+
var localePreference = atom("en");
|
|
26
22
|
var effectiveLocale = computed(
|
|
27
23
|
[serverLocale, localePreference],
|
|
28
24
|
(server, client) => server ?? client
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zachhandley/ez-i18n",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -56,12 +56,10 @@
|
|
|
56
56
|
"tinyglobby": "^0.2.15"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@nanostores/persistent": "^0.10.0",
|
|
60
59
|
"astro": "^4.0.0 || ^5.0.0",
|
|
61
60
|
"nanostores": "^0.9.0 || ^0.10.0 || ^0.11.0"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
64
|
-
"@nanostores/persistent": "^0.10.2",
|
|
65
63
|
"@types/node": "^22.0.0",
|
|
66
64
|
"astro": "^5.1.1",
|
|
67
65
|
"nanostores": "^0.11.3",
|