diff --git a/Dockerfile.nas b/Dockerfile.nas index d64a43c7..30bbd619 100644 --- a/Dockerfile.nas +++ b/Dockerfile.nas @@ -55,6 +55,7 @@ ENV SB_HOSTNAME=0.0.0.0 \ SB_FOLDER=/space \ SB_PORT=3000 \ SB_NAME=Plainleaf \ + SB_DESCRIPTION="原生 Markdown 的中文个人知识库" \ SB_SHELL_BACKEND=off COPY --from=server-builder /plainleaf /usr/local/bin/plainleaf diff --git a/bin/silverbullet/space_template/index.md b/bin/silverbullet/space_template/index.md index 86eb5297..555d700c 100644 --- a/bin/silverbullet/space_template/index.md +++ b/bin/silverbullet/space_template/index.md @@ -1,24 +1,20 @@ -Hello 👋! +# 首页 -Welcome to the wondrous world of SilverBullet. A world that once you discover and appreciate, you’ll never want to leave. +欢迎使用 Plainleaf。这是一个基于原生 Markdown 文件的个人知识空间,你可以直接修改或删除本页内容。 -_One of us!_ +## 最近的随手记 -If you’re confused and don’t know what to do, have a look at the [Manual](https://silverbullet.md/Manual), or perhaps more specifically, the [Getting Started](https://silverbullet.md/Getting%20Started) page. Got questions? Head over to [the community forums](https://community.silverbullet.md/). - -This page serves purely as a starting point to not start with a blank slate. Feel free to ditch it completely or adjust it to your needs. This space is fully yours. Own it. - -# Recent quick notes -${widgets.commandButton("Create quick note", "Quick Note")} +${widgets.commandButton("新建随手记", "Quick Note")} ${some(query[[ from p = index.subPages("Inbox") order by p.lastModified desc limit 10 select templates.fullPageItem(p) -]]) or "_No quick notes yet!_"} +]]) or "_还没有随手记_"} -# Recent journal entries -${widgets.commandButton("Today's entry", "Journal: Today")} +## 最近日记 + +${widgets.commandButton("今天的日记", "Journal: Today")} ${some(query[[ from j = index.pages(config.get("journal.tag")) @@ -26,21 +22,23 @@ ${some(query[[ order by j.date desc limit 14 select templates.pageItem(j) -]]) or "_No journal entries yet!_"} +]]) or "_还没有日记_"} + +## 待办事项 -# Recent incomplete tasks ${some(query[[ from t = index.tasks() where not t.done order by t.pageLastModified desc limit 10 select templates.taskItem(t) -]]) or "_All tasks done!_"} +]]) or "_待办事项已全部完成_"} + +## 最近修改 -# Recently modified pages ${query[[ from p = index.contentPages() order by p.lastModified desc limit 10 - select templates.fullPageItem(p) + select templates.fullPageItem(p) ]]} diff --git a/bin/silverbullet/tests/smoke.rs b/bin/silverbullet/tests/smoke.rs index 2af1175d..97661296 100644 --- a/bin/silverbullet/tests/smoke.rs +++ b/bin/silverbullet/tests/smoke.rs @@ -70,7 +70,7 @@ async fn boots_and_serves_ping_config_and_bundle() { assert_eq!(index.status(), reqwest::StatusCode::OK); let index_body = index.text().await.unwrap(); assert!( - index_body.contains("Welcome to the wondrous world of SilverBullet"), + index_body.contains("欢迎使用 Plainleaf"), "got: {index_body}" ); diff --git a/client/boot.ts b/client/boot.ts index 9ca9a4f4..1017c2ce 100644 --- a/client/boot.ts +++ b/client/boot.ts @@ -66,9 +66,7 @@ async function findEncryptionKey( } if (!crypto.subtle) { - alert( - "You are likely accessing SilverBullet via HTTP (rather than HTTPS or localhost), this is not a supported configuration. See https://silverbullet.md/TLS", - ); + alert("当前使用的是 HTTP。请改用 HTTPS 或 localhost 访问 Plainleaf。"); } safeRun(async () => { @@ -329,7 +327,7 @@ async function augmentBootConfig(bootConfig: BootConfig, config: Config) { if (!globalThis.indexedDB) { alert( - "SilverBullet requires IndexedDB to operate and it is not available in your browser. Please use a recent version of Chrome, Firefox (not in private mode) or Safari.", + "Plainleaf 需要浏览器支持 IndexedDB。请使用新版 Chrome、Firefox(非隐私模式)或 Safari。", ); } diff --git a/client/client.ts b/client/client.ts index cf7ee96a..a8584557 100644 --- a/client/client.ts +++ b/client/client.ts @@ -1131,11 +1131,11 @@ export class Client { } else if (!this.versionMismatchNotified) { this.versionMismatchNotified = true; this.ui.flashNotification( - "A new version of SilverBullet client is available. A reload or two is required to update.", + "Plainleaf 已更新,请刷新页面以使用新版本。", "warning", { timeout: 0, - actions: [{ name: "Reload", run: () => location.reload() }], + actions: [{ name: "刷新", run: () => location.reload() }], }, ); } diff --git a/client/editor_ui.tsx b/client/editor_ui.tsx index 7f347e1a..bcab2ed4 100644 --- a/client/editor_ui.tsx +++ b/client/editor_ui.tsx @@ -33,6 +33,7 @@ import { parseToRef, type Path, } from "@silverbulletmd/silverbullet/lib/ref"; +import { actionDescriptionZhCN, pageTitleZhCN } from "./lib/zh_cn.ts"; export class MainUI { viewState: AppViewState = initialViewState; @@ -270,9 +271,13 @@ export class MainUI { useEffect(() => { if (viewState.current) { - document.title = + const pageName = (this.client.currentPageMeta()?.pageDecoration?.prefix ?? "") + getNameFromPath(viewState.current.path); + document.title = pageTitleZhCN( + pageName, + this.client.bootConfig.indexPage, + ); } }, [viewState.current]); @@ -591,7 +596,9 @@ export class MainUI { featherIcon = featherIcons.HelpCircle; } // Build description with keyboard shortcut hint - let description = button.description || ""; + let description = actionDescriptionZhCN( + button.description || "", + ); if (button.command) { const cmd = viewState.commands.get(button.command); if (cmd) { diff --git a/client/html/auth.html b/client/html/auth.html index cbf34e27..74bc78dc 100644 --- a/client/html/auth.html +++ b/client/html/auth.html @@ -1,5 +1,5 @@ - +