Files
plainleaf/client/lib/zh_cn.test.ts
T
wushenghuaandCodex 7928ebf4f2
CI / config (push) Canceled after 0s
CI / test-frontend (push) Canceled after 0s
CI / test-rust (push) Canceled after 0s
CI / test-e2e (push) Canceled after 0s
CI / test-e2e-release (push) Canceled after 0s
CI / build (push) Canceled after 0s
CI / release (push) Canceled after 0s
CI / docker (push) Canceled after 0s
CI / docker-website (push) Canceled after 0s
feat: complete Plainleaf Chinese branding
Replace visible SilverBullet branding, localize the primary login and editor surfaces, and seed new spaces with a Chinese home page while preserving Markdown file names and command IDs.

Co-Authored-By: Codex <noreply@anthropic.com>
2026-08-12 14:55:58 +08:00

34 lines
1.2 KiB
TypeScript

import { expect, test } from "vitest";
import {
actionDescriptionZhCN,
commandNameZhCN,
pageNameZhCN,
pageTitleZhCN,
} from "./zh_cn.ts";
test("translates common command names without changing unknown commands", () => {
expect(commandNameZhCN("Editor: Toggle Dark Mode")).toBe(
"编辑器:切换深色模式",
);
expect(commandNameZhCN("Navigate: Page Picker")).toBe("导航:打开页面");
expect(commandNameZhCN("My Plug: Custom Action")).toBe(
"My Plug: Custom Action",
);
});
test("translates known namespaces for commands added by compatible plugs", () => {
expect(commandNameZhCN("Page: Custom Action")).toBe("页面:Custom Action");
});
test("uses a Chinese display name for the index page only", () => {
expect(pageNameZhCN("index")).toBe("首页");
expect(pageNameZhCN("Projects/index")).toBe("Projects/index");
expect(pageTitleZhCN("index")).toBe("首页 · Plainleaf");
expect(pageTitleZhCN("日记/今天")).toBe("日记/今天 · Plainleaf");
});
test("translates built-in action descriptions and preserves custom ones", () => {
expect(actionDescriptionZhCN("Open page")).toBe("打开页面");
expect(actionDescriptionZhCN("自定义操作")).toBe("自定义操作");
});