fix(client): register locale + use ctx.slots.inject(settings.section) so DSHWatch settings appears as top-level entry
This commit is contained in:
Vendored
BIN
Binary file not shown.
+27
-6
@@ -84,19 +84,40 @@ window.__ModuleLoader__.load({
|
|||||||
// 注入:连接 API 等
|
// 注入:连接 API 等
|
||||||
const inject = ["slots", "locale", "connection", "remote", "settingsScope"];
|
const inject = ["slots", "locale", "connection", "remote", "settingsScope"];
|
||||||
|
|
||||||
|
// 文案
|
||||||
|
const zh = {
|
||||||
|
nav: "DSHWatch 设置",
|
||||||
|
title: "DSHWatch 设置",
|
||||||
|
desc: "手机/手表远程控制 DeepSeek Harness 的配置。",
|
||||||
|
save: "保存",
|
||||||
|
saved: "已保存 ✓",
|
||||||
|
loading: "加载中…",
|
||||||
|
readErr: "读取失败",
|
||||||
|
saveErr: "保存失败"
|
||||||
|
};
|
||||||
|
const en = {
|
||||||
|
nav: "DSHWatch Settings",
|
||||||
|
title: "DSHWatch Settings",
|
||||||
|
desc: "Config for remote-controlling this Harness from DSHWatch phone/watch.",
|
||||||
|
save: "Save",
|
||||||
|
saved: "Saved ✓",
|
||||||
|
loading: "Loading…",
|
||||||
|
readErr: "Failed to read",
|
||||||
|
saveErr: "Failed to save"
|
||||||
|
};
|
||||||
|
|
||||||
function apply(ctx) {
|
function apply(ctx) {
|
||||||
ctx.inject(["slots", "locale", "connection", "remote", "settingsScope"], (scope) => {
|
ctx.locale.register("dsh-watch.settings", { zh, en });
|
||||||
const api = scope.get("connection").api;
|
const { api } = ctx.get("connection");
|
||||||
const injected = () => ({ api });
|
const injected = () => ({ api });
|
||||||
scope.slots.register({
|
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
||||||
name: "settings.section",
|
name: "settings.section",
|
||||||
id: "dsh-watch",
|
id: "dsh-watch",
|
||||||
order: 30,
|
order: 30,
|
||||||
label: () => "DSHWatch 设置",
|
label: () => ctx.locale.bind("dsh-watch.settings")("nav"),
|
||||||
locale: "dsh-watch.settings",
|
locale: "dsh-watch.settings",
|
||||||
inject: injected
|
inject: injected
|
||||||
}, Section);
|
}, Section));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.apply = apply;
|
exports.apply = apply;
|
||||||
|
|||||||
Reference in New Issue
Block a user