@deepseek-ai/dsh-client-locale 0.0.1-rc.2 → 0.0.1-rc.3
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.i18n.yaml +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +6 -6
- package/lib/types/client/index.d.ts +2 -2
- package/package.json +15 -15
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/client/locale/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: a63807f093dc12831a41196e61008151868e3205
|
|
6
|
+
README.zh.md: b302e6055ba30d2db0948c0a6f1551c4a9dcb24c
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
Locale plugin:
|
|
5
|
+
Locale plugin: LocaleRuntime — the `zh`/`en` preference stored as `locale.preference` in `$DSH_HOME/settings.yaml`; when that explicit Host value is absent, a fresh browser starts provisionally in the language `navigator` asks for (primary-subtag matching, with `zh` when it asks for no language this app ships). The Host read runs after plugin activation so an unavailable settings service cannot block the page; its result replaces the provisional browser value live. Remote browsers retain only a process-local selection because the settings API is loopback-only. `locale/change` fires on switches. The service also owns the ns×locale dictionary registry (typed `register(ns, {zh, en})` checked against `LocaleNamespaceMap`, `bind(ns)`→`TranslateNS<ns>`; lookup chain ns → common → zh → key), implements the slot system's `LocaleFace`, and installs itself through `ctx.slots.installLocale`, backing the framework-injected `t` standard seat (`Translate`/`TranslateNS` are ui-slots types; import them from there — this package only re-exports for dictionary owners' convenience). The [Host-backed preferences decision](../../../.agents/notes/implemented/bug-fix/2026-08-06-host-backed-web-preferences.md) owns the persistence boundary.
|
|
6
6
|
|
|
7
7
|
## Model Experience
|
|
8
8
|
|
package/README.zh.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
locale 插件:
|
|
5
|
+
locale 插件:LocaleRuntime——`zh`/`en` 偏好以 `locale.preference` 存储在 `$DSH_HOME/settings.yaml` 中;若没有显式 Host 值,全新浏览器会暂时使用 `navigator` 请求的语言(按主子标签匹配;若其请求的语言本应用都不提供,则使用 `zh`)。Host 读取在插件激活后执行,因此 settings 服务不可用不会阻塞页面;读取结果会实时替换浏览器暂定值。settings API 仅限回环请求,因此远程浏览器的选择仅保留在进程内。`locale/change` 仅在切换语言时触发。该服务还拥有 ns×locale 字典注册表(类型化 `register(ns, {zh, en})` 按 `LocaleNamespaceMap` 校验,`bind(ns)`→`TranslateNS<ns>`;查找链 ns → common → zh → key),实现 slot 系统的 `LocaleFace`,并经 `ctx.slots.installLocale` 自行安装,支撑框架注入的 `t` 标准席位(`Translate`/`TranslateNS` 是 ui-slots 的类型;请从那里导入——本包的再导出仅为字典所有者提供便利)。该持久化边界由[Host settings 支撑的偏好决策](../../../.agents/notes/implemented/bug-fix/2026-08-06-host-backed-web-preferences.md)拥有。
|
|
6
6
|
|
|
7
7
|
## 模型体验
|
|
8
8
|
|
package/lib/client.js
CHANGED
|
@@ -886,11 +886,11 @@ window.__ModuleLoader__.load({
|
|
|
886
886
|
document.head.appendChild(tag);
|
|
887
887
|
}
|
|
888
888
|
var LanguageRow_module_css_default = {
|
|
889
|
-
"title": "hVGvvW_title",
|
|
890
889
|
"rowText": "hVGvvW_rowText",
|
|
891
|
-
"
|
|
890
|
+
"title": "hVGvvW_title",
|
|
891
|
+
"selector": "hVGvvW_selector",
|
|
892
892
|
"chevron": "hVGvvW_chevron",
|
|
893
|
-
"
|
|
893
|
+
"row": "hVGvvW_row"
|
|
894
894
|
};
|
|
895
895
|
//#endregion
|
|
896
896
|
//#region lib/types/client/LanguageRow.js
|
|
@@ -999,7 +999,7 @@ window.__ModuleLoader__.load({
|
|
|
999
999
|
* LocaleFace getSnapshot/subscribe pair the render machinery consumes
|
|
1000
1000
|
* (installed via `ctx.slots.installLocale`).
|
|
1001
1001
|
*/
|
|
1002
|
-
var
|
|
1002
|
+
var LocaleRuntime = class {
|
|
1003
1003
|
dicts = /* @__PURE__ */ new Map();
|
|
1004
1004
|
bound = /* @__PURE__ */ new Map();
|
|
1005
1005
|
snapshot;
|
|
@@ -1181,7 +1181,7 @@ window.__ModuleLoader__.load({
|
|
|
1181
1181
|
* @param ctx - client cordis context.
|
|
1182
1182
|
*/
|
|
1183
1183
|
function apply(ctx) {
|
|
1184
|
-
const locale = new
|
|
1184
|
+
const locale = new LocaleRuntime(ctx, ctx.settingsScope.bind({ namespace: LOCALE_SETTINGS_NAMESPACE }));
|
|
1185
1185
|
locale.register(COMMON_NS, {
|
|
1186
1186
|
zh: zh$1,
|
|
1187
1187
|
en: en$1
|
|
@@ -1220,7 +1220,7 @@ window.__ModuleLoader__.load({
|
|
|
1220
1220
|
//#endregion
|
|
1221
1221
|
exports.COMMON_NS = COMMON_NS;
|
|
1222
1222
|
exports.FALLBACK_LOCALE = FALLBACK_LOCALE;
|
|
1223
|
-
exports.
|
|
1223
|
+
exports.LocaleRuntime = LocaleRuntime;
|
|
1224
1224
|
exports.SETTINGS_NS = SETTINGS_NS;
|
|
1225
1225
|
exports.apply = apply;
|
|
1226
1226
|
exports.inject = inject;
|
|
@@ -43,7 +43,7 @@ export interface LocaleSnapshot {
|
|
|
43
43
|
}
|
|
44
44
|
declare module '@deepseek-ai/cordis' {
|
|
45
45
|
interface Context {
|
|
46
|
-
locale:
|
|
46
|
+
locale: LocaleRuntime;
|
|
47
47
|
}
|
|
48
48
|
interface Events {
|
|
49
49
|
/**
|
|
@@ -73,7 +73,7 @@ export declare const SETTINGS_NS = "settings.locale";
|
|
|
73
73
|
* LocaleFace getSnapshot/subscribe pair the render machinery consumes
|
|
74
74
|
* (installed via `ctx.slots.installLocale`).
|
|
75
75
|
*/
|
|
76
|
-
export declare class
|
|
76
|
+
export declare class LocaleRuntime {
|
|
77
77
|
private dicts;
|
|
78
78
|
private bound;
|
|
79
79
|
private snapshot;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-client-locale",
|
|
3
3
|
"description": "Locale plugin: Host-backed zh/en preference, browser-derived fallback, locale snapshots, and typed namespace dictionaries",
|
|
4
|
-
"version": "0.0.1-rc.
|
|
4
|
+
"version": "0.0.1-rc.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "restricted"
|
|
7
7
|
},
|
|
@@ -45,27 +45,27 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": "^18.2.0",
|
|
47
47
|
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
48
|
-
"@deepseek-ai/dsh-api-remotes": "^0.0.1-rc.
|
|
49
|
-
"@deepseek-ai/dsh-client-connection": "^0.0.1-rc.
|
|
50
|
-
"@deepseek-ai/dsh-client-
|
|
51
|
-
"@deepseek-ai/dsh-client-ui-
|
|
52
|
-
"@deepseek-ai/dsh-client-ui-
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
54
|
-
"@deepseek-ai/dsh-
|
|
48
|
+
"@deepseek-ai/dsh-api-remotes": "^0.0.1-rc.3",
|
|
49
|
+
"@deepseek-ai/dsh-client-connection": "^0.0.1-rc.3",
|
|
50
|
+
"@deepseek-ai/dsh-client-runtime": "^0.0.1-rc.3",
|
|
51
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.0.1-rc.3",
|
|
52
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.0.1-rc.3",
|
|
53
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.0.1-rc.3",
|
|
54
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.3"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/react": "~18.3.1",
|
|
58
58
|
"react": "^18.2.0",
|
|
59
|
-
"@deepseek-ai/dsh-api-remotes": "^0.0.1-rc.2",
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.0.1-rc.2",
|
|
61
59
|
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
62
|
-
"@deepseek-ai/dsh-
|
|
63
|
-
"@deepseek-ai/dsh-client-
|
|
64
|
-
"@deepseek-ai/dsh-client-ui-
|
|
65
|
-
"@deepseek-ai/dsh-
|
|
60
|
+
"@deepseek-ai/dsh-api-remotes": "^0.0.1-rc.3",
|
|
61
|
+
"@deepseek-ai/dsh-client-runtime": "^0.0.1-rc.3",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.0.1-rc.3",
|
|
63
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.0.1-rc.3",
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.0.1-rc.3",
|
|
65
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.3"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@deepseek-ai/dsh-settings": "^0.0.1-rc.
|
|
68
|
+
"@deepseek-ai/dsh-settings": "^0.0.1-rc.3",
|
|
69
69
|
"@deepseek-ai/schemastery": "^3.18.1-rc.1"
|
|
70
70
|
},
|
|
71
71
|
"files": [
|