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
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>
189 lines
8.9 KiB
TypeScript
189 lines
8.9 KiB
TypeScript
const commandNames: Record<string, string> = {
|
||
"Client: Logout": "客户端:退出登录",
|
||
"Client: Reload UI": "客户端:重新加载界面",
|
||
"Client: Version": "客户端:查看版本",
|
||
"Client: Wipe": "客户端:清除本地数据",
|
||
"Comment: Add": "批注:添加批注",
|
||
"Configuration: Keyboard Shortcuts": "设置:键盘快捷键",
|
||
"Configuration: Open": "设置:打开设置",
|
||
"Debug: Parse Document": "调试:解析文档",
|
||
"Delete Line": "编辑器:删除当前行",
|
||
"Document: Delete": "文档:删除",
|
||
"Document: Rename Document": "文档:重命名",
|
||
"Editor: Close Completion": "编辑器:关闭自动补全",
|
||
"Editor: Cursor Char Left": "编辑器:光标左移一个字符",
|
||
"Editor: Cursor Char Right": "编辑器:光标右移一个字符",
|
||
"Editor: Cursor Doc End": "编辑器:光标移到文档末尾",
|
||
"Editor: Cursor Doc Start": "编辑器:光标移到文档开头",
|
||
"Editor: Cursor Group Left": "编辑器:光标左移一个词组",
|
||
"Editor: Cursor Group Right": "编辑器:光标右移一个词组",
|
||
"Editor: Cursor Line Boundary Left": "编辑器:光标移到左侧行边界",
|
||
"Editor: Cursor Line Boundary Right": "编辑器:光标移到右侧行边界",
|
||
"Editor: Cursor Line Down": "编辑器:光标下移一行",
|
||
"Editor: Cursor Line End": "编辑器:光标移到行尾",
|
||
"Editor: Cursor Line Start": "编辑器:光标移到行首",
|
||
"Editor: Cursor Line Up": "编辑器:光标上移一行",
|
||
"Editor: Cursor Page Down": "编辑器:光标下移一页",
|
||
"Editor: Cursor Page Up": "编辑器:光标上移一页",
|
||
"Editor: Delete Char Backward": "编辑器:删除前一个字符",
|
||
"Editor: Delete Char Forward": "编辑器:删除后一个字符",
|
||
"Editor: Delete Group Backward": "编辑器:删除前一个词组",
|
||
"Editor: Delete Group Forward": "编辑器:删除后一个词组",
|
||
"Editor: Delete Line Boundary Backward": "编辑器:删除到行首",
|
||
"Editor: Delete Line Boundary Forward": "编辑器:删除到行尾",
|
||
"Editor: Find in Page": "编辑器:在当前页面查找",
|
||
"Editor: Indent": "编辑器:增加缩进",
|
||
"Editor: Insert Newline": "编辑器:插入换行",
|
||
"Editor: New Window": "编辑器:在新窗口打开",
|
||
"Editor: Outdent": "编辑器:减少缩进",
|
||
"Editor: Redo": "编辑器:重做",
|
||
"Editor: Select All": "编辑器:全选",
|
||
"Editor: Select Char Left": "编辑器:向左选择一个字符",
|
||
"Editor: Select Char Right": "编辑器:向右选择一个字符",
|
||
"Editor: Select Doc End": "编辑器:选择到文档末尾",
|
||
"Editor: Select Doc Start": "编辑器:选择到文档开头",
|
||
"Editor: Select Group Left": "编辑器:向左选择一个词组",
|
||
"Editor: Select Group Right": "编辑器:向右选择一个词组",
|
||
"Editor: Select Line Boundary Left": "编辑器:选择到左侧行边界",
|
||
"Editor: Select Line Boundary Right": "编辑器:选择到右侧行边界",
|
||
"Editor: Select Line Down": "编辑器:向下选择一行",
|
||
"Editor: Select Line End": "编辑器:选择到行尾",
|
||
"Editor: Select Line Start": "编辑器:选择到行首",
|
||
"Editor: Select Line Up": "编辑器:向上选择一行",
|
||
"Editor: Select Page Down": "编辑器:向下选择一页",
|
||
"Editor: Select Page Up": "编辑器:向上选择一页",
|
||
"Editor: Start Completion": "编辑器:开始自动补全",
|
||
"Editor: Toggle Dark Mode": "编辑器:切换深色模式",
|
||
"Editor: Toggle Markdown Syntax Rendering": "编辑器:切换 Markdown 语法渲染",
|
||
"Editor: Toggle Vim Mode": "编辑器:切换 Vim 模式",
|
||
"Editor: Toggle X-Ray": "编辑器:切换透视模式",
|
||
"Editor: Transpose Chars": "编辑器:交换相邻字符",
|
||
"Editor: Undo": "编辑器:撤销",
|
||
"Editor: Vim: Load Vim Config": "编辑器:加载 Vim 配置",
|
||
"Flash: Custom Message": "通知:显示自定义消息",
|
||
"Graph: Explore": "关系图:查看当前页面",
|
||
"Graph: Global Page Map": "关系图:查看全部页面",
|
||
"Image Viewer: Show Info": "图片查看器:显示图片信息",
|
||
"Libraries: Manager": "扩展库:管理",
|
||
"Library: Add Repository": "扩展库:添加仓库",
|
||
"Library: Install": "扩展库:安装",
|
||
"Library: Manager": "扩展库:管理",
|
||
"Library: Update All": "扩展库:全部更新",
|
||
"Library: Update All Repositories": "扩展库:更新全部仓库",
|
||
"Navigate: Anything Picker": "导航:打开任意内容",
|
||
"Navigate: Back in History": "导航:后退",
|
||
"Navigate: Center Cursor": "导航:将光标移到视图中央",
|
||
"Navigate: Copy Link To Current Position": "导航:复制当前位置链接",
|
||
"Navigate: Copy Ref To Current Position": "导航:复制当前位置引用",
|
||
"Navigate: Document Picker": "导航:打开文档",
|
||
"Navigate: Forward in History": "导航:前进",
|
||
"Navigate: Home": "导航:返回首页",
|
||
"Navigate: Meta Picker": "导航:打开元页面",
|
||
"Navigate: Page Picker": "导航:打开页面",
|
||
"Navigate: Tag Picker": "导航:选择标签",
|
||
"Navigate: To Line": "导航:跳转到行",
|
||
"Navigate: To Page": "导航:跳转到页面",
|
||
"Navigate: To Position": "导航:跳转到位置",
|
||
"Navigate: To This Page": "导航:打开光标处页面",
|
||
"Navigate: To URL": "导航:打开网址",
|
||
"Open Command Palette": "打开命令面板",
|
||
"Outline: Fold": "大纲:折叠当前部分",
|
||
"Outline: Fold All": "大纲:全部折叠",
|
||
"Outline: Move Down": "大纲:向下移动",
|
||
"Outline: Move Left": "大纲:降低层级",
|
||
"Outline: Move Right": "大纲:提高层级",
|
||
"Outline: Move Up": "大纲:向上移动",
|
||
"Outline: Toggle Fold": "大纲:切换折叠状态",
|
||
"Outline: Unfold": "大纲:展开当前部分",
|
||
"Outline: Unfold All": "大纲:全部展开",
|
||
"Page: Batch Rename Prefix": "页面:批量重命名前缀",
|
||
"Page: Copy": "页面:复制",
|
||
"Page: Create Under Cursor": "页面:创建光标处链接页面",
|
||
"Page: Delete": "页面:删除",
|
||
"Page: Extract": "页面:提取内容到新页面",
|
||
"Page: Rename": "页面:重命名",
|
||
"Page: Rename Linked Page": "页面:重命名链接页面",
|
||
"Plugs: Reload": "插件:重新加载",
|
||
"Space: Reindex": "空间:重建索引",
|
||
"Stats: Show": "统计:显示空间统计",
|
||
"Sync: File": "同步:同步当前文件",
|
||
"Sync: Space": "同步:同步整个空间",
|
||
"System: Reload": "系统:重新加载",
|
||
"Task: Cycle State": "任务:切换任务状态",
|
||
"Task: Remove Completed": "任务:移除已完成任务",
|
||
"Text: Bold": "文本:加粗",
|
||
"Text: Italic": "文本:斜体",
|
||
"Text: Link Selection": "文本:为选中内容添加链接",
|
||
"Text: Listify Selection": "文本:转换为无序列表",
|
||
"Text: Marker": "文本:高亮",
|
||
"Text: Number Listify Selection": "文本:转换为有序列表",
|
||
"Text: Quote Selection": "文本:转换为引用",
|
||
"Text: Strikethrough": "文本:删除线",
|
||
"Upload: File": "上传:上传文件",
|
||
"Widgets: Refresh All": "组件:全部刷新",
|
||
"Baked Sections: Update": "固化区块:更新",
|
||
"Baked Sections: Unbake Section At Cursor": "固化区块:取消光标处固化",
|
||
};
|
||
|
||
const namespaceNames: Record<string, string> = {
|
||
Client: "客户端",
|
||
Comment: "批注",
|
||
Configuration: "设置",
|
||
Debug: "调试",
|
||
Document: "文档",
|
||
Editor: "编辑器",
|
||
Flash: "通知",
|
||
Graph: "关系图",
|
||
Libraries: "扩展库",
|
||
Library: "扩展库",
|
||
Navigate: "导航",
|
||
Outline: "大纲",
|
||
Page: "页面",
|
||
Plugs: "插件",
|
||
Space: "空间",
|
||
Stats: "统计",
|
||
Sync: "同步",
|
||
System: "系统",
|
||
Task: "任务",
|
||
Text: "文本",
|
||
Upload: "上传",
|
||
Widgets: "组件",
|
||
};
|
||
|
||
const actionDescriptions: Record<string, string> = {
|
||
"Go to the index page": "返回首页",
|
||
"Open page": "打开页面",
|
||
"Run command": "运行命令",
|
||
"Go back": "后退",
|
||
"Go forward": "前进",
|
||
};
|
||
|
||
/** Returns a Chinese display label without changing the registered command ID. */
|
||
export function commandNameZhCN(name: string): string {
|
||
const translated = commandNames[name];
|
||
if (translated) return translated;
|
||
|
||
const separator = name.indexOf(": ");
|
||
if (separator === -1) return name;
|
||
const namespace = name.slice(0, separator);
|
||
const translatedNamespace = namespaceNames[namespace];
|
||
return translatedNamespace
|
||
? `${translatedNamespace}:${name.slice(separator + 2)}`
|
||
: name;
|
||
}
|
||
|
||
/** Returns the Chinese display name while preserving the actual page name. */
|
||
export function pageNameZhCN(name: string, indexPage = "index"): string {
|
||
return name === indexPage ? "首页" : name;
|
||
}
|
||
|
||
/** Adds stable product identity to the browser tab without renaming the file. */
|
||
export function pageTitleZhCN(name: string, indexPage = "index"): string {
|
||
return `${pageNameZhCN(name, indexPage)} · Plainleaf`;
|
||
}
|
||
|
||
/** Translates built-in action tooltips without changing their command IDs. */
|
||
export function actionDescriptionZhCN(description: string): string {
|
||
return actionDescriptions[description] ?? description;
|
||
}
|