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.
+33
-12
@@ -84,19 +84,40 @@ window.__ModuleLoader__.load({
|
||||
// 注入:连接 API 等
|
||||
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) {
|
||||
ctx.inject(["slots", "locale", "connection", "remote", "settingsScope"], (scope) => {
|
||||
const api = scope.get("connection").api;
|
||||
const injected = () => ({ api });
|
||||
scope.slots.register({
|
||||
name: "settings.section",
|
||||
id: "dsh-watch",
|
||||
order: 30,
|
||||
label: () => "DSHWatch 设置",
|
||||
locale: "dsh-watch.settings",
|
||||
inject: injected
|
||||
}, Section);
|
||||
});
|
||||
ctx.locale.register("dsh-watch.settings", { zh, en });
|
||||
const { api } = ctx.get("connection");
|
||||
const injected = () => ({ api });
|
||||
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
||||
name: "settings.section",
|
||||
id: "dsh-watch",
|
||||
order: 30,
|
||||
label: () => ctx.locale.bind("dsh-watch.settings")("nav"),
|
||||
locale: "dsh-watch.settings",
|
||||
inject: injected
|
||||
}, Section));
|
||||
}
|
||||
|
||||
exports.apply = apply;
|
||||
|
||||
Reference in New Issue
Block a user