Cursor 编辑器设置界面汉化教程 | 一键脚本实现中文本地化

前言

Cursor 作为目前最火热的 AI 编程助手,深受开发者喜爱。然而,其设置界面目前仍为英文,对于国内开发者来说使用体验不够友好。本文将分享一个一键汉化脚本,帮助你将 Cursor 的设置界面完全汉化为中文。

适用版本:Cursor 最新版本(2024/2025)汉化范围:设置界面(Cursor Settings)全部页面技术栈:Node.js 脚本 + 字符串替换


效果预览

汉化前(英文界面)

在这里插入图片描述

汉化前:设置界面为全英文,包括 General、Agents、Tab、Models 等菜单项

汉化后(中文界面)

在这里插入图片描述

汉化后:设置界面已完全汉化为中文,包括"通用"、“Agents 智能体”、“Tab 补全”、"模型"等

翻译对照表

汉化前(英文)汉化后(中文)
General通用
AgentsAgents 智能体
TabTab 补全
Models模型
Cloud Agents云端 Agents
Tools & MCP工具与 MCP
Rules, Skills, Subagents规则、技能、子代理
Indexing & Docs索引与文档
Network网络
Beta测试版
Manage Account管理账户
Invite Team Members邀请团队成员
Sync layouts across windows跨窗口同步布局
Editor Settings编辑器设置
Keyboard Shortcuts键盘快捷键
Import Settings from VS Code从 VS Code 导入设置
Default Mode默认模式
Default Location默认位置
Text Size文字大小
Auto-Clear Chat自动清除聊天
Max Tab Count最大标签数
Queue Messages消息排队

汉化原理

Cursor 基于 VS Code 开发,其界面字符串存储在 workbench.desktop.main.js 文件中。我们通过 Node.js 脚本进行精确的字符串替换,将英文 UI 文本替换为对应的中文翻译。

核心技术点:

  1. 定位目标文件:resources/app/out/vs/workbench/workbench.desktop.main.js
  2. 创建备份文件,确保可恢复
  3. 使用精确字符串匹配进行替换
  4. 处理特殊字符(如 Unicode 转义序列 \u2019)

使用教程

环境准备

  • Node.js:v14 或更高版本
  • 管理员权限:需要以管理员身份运行终端

第一步:找到 Cursor 安装路径

默认安装路径通常为:

C:\Users\{用户名}\AppData\Local\Programs\cursor\resources\app\out\vs\workbench\

或自定义安装路径,例如:

E:\softWare\cursor\cursor\resources\app\out\vs\workbench\

第二步:创建汉化脚本

在任意目录创建 patch_cursor.js 文件,将以下完整代码复制进去:

/**
 * Cursor 编辑器汉化补丁脚本
 * 
 * @author 略
 * @version 2.0
 * 
 * 版本历史:
 * - v1.0  2026年1月21日  首个版本
 * - v2.0  2026年1月22日  第二版本
 */
 
  const fs = require('fs');
  const path = require('path');

// 这里的路径是根据您当前环境自动获取的
const filePath = 'e:\\softWare\\cursor\\resources\\app\\out\\vs\\workbench\\workbench.desktop.main.js';
const backupPath = filePath + '.bak';

try {
    console.log('正在检查文件...');
    if (!fs.existsSync(filePath)) {
        console.error('未找到目标文件,请确认路径正确。');
        process.exit(1);
    }
    // 1. 创建备份(非常重要)
    if (!fs.existsSync(backupPath)) {
        console.log('正在创建备份...');
        fs.copyFileSync(filePath, backupPath);
        console.log('备份已创建:' + backupPath);
    } else {
        console.log('备份已存在,跳过备份步骤。');
    }

    // 2. 读取文件
    console.log('正在读取文件内容...');
    let content = fs.readFileSync(filePath, 'utf8');

    // 3. 定义替换规则(包含特殊字符处理)
    const replacements = [
        // ========== 设置页面左侧导航菜单 ==========
        { o: 'general:"General"', t: 'general:"通用"' },
        { o: '"plan-usage":"Plan & Usage"', t: '"plan-usage":"计划与用量"' },
        { o: 'chat:"Agents"', t: 'chat:"Agents 智能体"' },
        { o: 'tab:"Tab"', t: 'tab:"Tab 补全"' },
        { o: 'models:"Models"', t: 'models:"模型"' },
        { o: 'rules:"Rules, Subagents, Commands"', t: 'rules:"规则、子代理、命令"' },
        { o: 'indexing:"Indexing & Docs"', t: 'indexing:"索引与文档"' },
        { o: 'mcp:"Tools & MCP"', t: 'mcp:"工具与 MCP"' },
        { o: 'hooks:"Hooks"', t: 'hooks:"钩子"' },
        { o: 'beta:"Beta"', t: 'beta:"测试版"' },
        { o: 'network:"Network"', t: 'network:"网络"' },
        { o: '"background-composer":"Cloud Agents"', t: '"background-composer":"云端 Agents"' },
        
        // ========== 动态规则菜单标题 ==========
        { o: '"Rules, Skills, Subagents"', t: '"规则、技能、子代理"' },
        { o: '"Rules, Skills, Commands"', t: '"规则、技能、命令"' },
        { o: '"Rules, Subagents, Commands"', t: '"规则、子代理、命令"' },
        { o: '"Rules & Commands"', t: '"规则与命令"' },
        
        // ========== 代码库索引设置 ==========
        { o: 'label:"Codebase Indexing"', t: 'label:"代码库索引"' },
        { o: 'helpTooltipLabel:"Learn about codebase indexing"', t: 'helpTooltipLabel:"了解代码库索引"' },
        
        // ========== 自动运行模式设置 ==========
        // 注意:更长的字符串需要放在前面,避免短字符串先匹配
        { o: '"Auto-Run Mode Disabled by Team Admin"', t: '"团队管理员已禁用自动运行模式"' },
        { o: '"Auto-Run Mode Controlled by Team Admin (Sandbox Enabled)"', t: '"团队管理员控制的自动运行模式(已启用沙盒)"' },
        { o: '"Auto-Run Mode Controlled by Team Admin"', t: '"团队管理员控制的自动运行模式"' },
        { o: '"Auto-Run Mode"', t: '"自动运行模式"' },
        { o: '"Ask Every Time"', t: '"每次询问"' },
        { o: '"Use Allowlist"', t: '"使用白名单"' },
        { o: '"Run Everything (Unsandboxed)"', t: '"运行全部(无沙盒)"' },
        { o: '"Run Everything"', t: '"运行全部"' },
        { o: '"Auto-Run in Sandbox"', t: '"在沙盒中自动运行"' },
        
        // ========== 获取域名白名单 ==========
        { o: 'label:"Fetch Domain Allowlist"', t: 'label:"获取域名白名单"' },
        { o: `description:"Domains that Agent can fetch from automatically. Use '*' for all domains, '*.example.com' for wildcard subdomains."`, t: `description:"Agent 可自动获取的域名。使用 '*' 表示所有域名,'*.example.com' 表示通配符子域名。"` },
        
        // ========== 日志显示 ==========
        { o: '"Hide Logs"', t: '"隐藏日志"' },
        { o: '"Show Logs"', t: '"显示日志"' },
        
        // ========== 升级相关 ==========
        { o: '>Upgrade Available<', t: '>可升级<' },
        { o: '> day<!> left', t: '> 天<!>剩余' },
        
        // ========== 管理员阻止 ==========
        { o: '>Blocked by admin<', t: '>被管理员阻止<' },
        
        // ========== 审查相关 ==========
        { o: '"Stop review"', t: '"停止审查"' },
        { o: '"Start Agent Review"', t: '"开始 Agent 审查"' },
        
        // ========== 创建密钥相关 ==========
        { o: '"Failed to create secrets"', t: '"创建密钥失败"' },
        
        // ========== 规则页面相关 ==========
        { o: '>Reproduction Steps<', t: '>重现步骤<' },
        
        // ========== Cloud Agent 相关 ==========
        { o: '"Cloud Agent"', t: '"云端 Agent"' },
        { o: '"Cloud Agents"', t: '"云端 Agents"' },
        { o: '"Running in cloud"', t: '"在云端运行"' },
        { o: 'title:"Cloud Agent"', t: 'title:"云端 Agent"' },
        { o: 'title:"Cloud Agents"', t: 'title:"云端 Agents"' },
        { o: '"Get Started"', t: '"开始使用"' },
        { o: '"Cloud Agents require a Git repository in an open folder."', t: '"云端 Agents 需要在已打开的文件夹中有 Git 仓库。"' },
        { o: '"Open a Git repository"', t: '"打开 Git 仓库"' },
        { o: '"Background agents only work in folders with a git repository. Please open a folder that contains a git repository to use this feature."', t: '"后台 Agent 仅在包含 Git 仓库的文件夹中工作。请打开包含 Git 仓库的文件夹以使用此功能。"' },
        { o: '"Open Folder"', t: '"打开文件夹"' },
        
        // ========== 评分反馈相关 ==========
        { o: '>Rate this chat session<', t: '>为此聊天会话评分<' },
        
        // ========== 常规设置 ==========
        { o: 'label:"Manage Account"', t: 'label:"管理账户"' },
        { o: 'description:"Manage your account and billing"', t: 'description:"管理您的账户和账单"' },
        { o: 'label:"Invite Team Members"', t: 'label:"邀请团队成员"' },
        { o: 'description:"Accelerate development, shared knowledge, and context across your team"', t: 'description:"加速团队开发、共享知识和上下文"' },
        
        // ========== 偏好设置 ==========
        { o: 'label:"Sync layouts across windows"', t: 'label:"跨窗口同步布局"' },
        { o: 'description:"When enabled, all windows share the same layout"', t: 'description:"启用后,所有窗口共享相同的布局"' },
        { o: 'label:"Editor Settings"', t: 'label:"编辑器设置"' },
        { o: 'description:"Configure font, formatting, minimap and more"', t: 'description:"配置字体、格式化、小地图等"' },
        { o: 'label:"Keyboard Shortcuts"', t: 'label:"键盘快捷键"' },
        { o: 'description:"Configure keyboard shortcuts"', t: 'description:"配置键盘快捷键"' },
        { o: 'label:"Import Settings from VS Code"', t: 'label:"从 VS Code 导入设置"' },
        { o: 'description:"Import settings, extensions, and keybindings from VS Code"', t: 'description:"从 VS Code 导入设置、扩展和快捷键"' },
        
        // ========== 特殊字符处理 (Don't 和 you've 使用了智能引号 \u2019) ==========
        // 注意:文件中使用的是 \\u2019 转义序列
        { o: 'label:\'Reset "Don\\u2019t Ask Again" Dialogs\'', t: 'label:\'重置「不再询问」对话框\'' },
        { o: 'description:"See warnings and tips that you\\u2019ve hidden"', t: 'description:"查看您已隐藏的警告和提示"' },
        
        // ========== 通知设置 ==========
        { o: 'label:"System Notifications"', t: 'label:"系统通知"' },
        { o: 'description:"Show system notifications when Agent completes or needs attention"', t: 'description:"当 Agent 完成任务或需要注意时显示系统通知"' },
        
        // ========== 系统托盘 ==========
        { o: '"Show Cursor in system tray"', t: '"在系统托盘显示 Cursor"' },
        { o: '"Show Cursor in menu bar"', t: '"在菜单栏显示 Cursor"' },
        
        // ========== 完成提示音 ==========
        { o: 'label:"Completion Sound"', t: 'label:"完成提示音"' },
        { o: 'description:"Play a sound when Agent finishes responding"', t: 'description:"当 Agent 完成回复时播放提示音"' },
        
        // ========== 隐私模式 ==========
        { o: 'title:"Privacy"', t: 'title:"隐私"' },
        { o: 'label:"Privacy Mode"', t: 'label:"隐私模式"' },
        { o: 'label:"Privacy Mode (Legacy)"', t: 'label:"隐私模式(旧版)"' },
        { o: 'label:"Share Data"', t: 'label:"共享数据"' },
        { o: '"Your code data will not be trained on or used to improve the product. Code may be stored to provide features such as Background Agent."', t: '"您的代码数据不会被用于训练或改进产品。代码可能会被存储以提供后台 Agent 等功能。"' },
        { o: '"Data Sharing is controlled by your team admin."', t: '"数据共享由您的团队管理员控制。"' },
        { o: '"Learn more about Data Sharing."', t: '"了解更多关于数据共享的信息。"' },
        { o: '>Learn more about Data Sharing.<', t: '>了解更多关于数据共享的信息。<' },
        
        // ========== 登出 ==========
        { o: 'title:"Log Out"', t: 'title:"退出登录"' },

        // ========== 标题 ==========
        { o: 'title:"Cursor Settings"', t: 'title:"Cursor 设置"' },
        { o: 'getName(){return"Cursor Settings"}', t: 'getName(){return"Cursor 设置"}' },
        
        // ========== 对话相关 ==========
        { o: '"New Chat with Selections"', t: '"使用选中内容新建聊天"' },
        { o: '"Cancel Chat"', t: '"取消聊天"' },
        { o: '"Start new thread with summary"', t: '"使用摘要开始新对话"' },
        { o: '"Resume"', t: '"继续"' },
        { o: '"Try again"', t: '"重试"' },
        { o: '"Copy Request ID: "', t: '"复制请求 ID:"' },
        
        // ========== MCP 工具相关 ==========
        { o: '>Blocked by admin<', t: '>被管理员阻止<' },
        
        // ========== 计划相关 ==========
        { o: '"Untitled Plan"', t: '"未命名计划"' },
        
        // ========== 环境相关 ==========
        { o: '"Save Snapshot"', t: '"保存快照"' },
        { o: '"Taking Snapshot"', t: '"正在保存快照"' },
        { o: '"Exit Setup"', t: '"退出设置"' },
        { o: '"Restart Setup"', t: '"重新开始设置"' },
        
        // ========== 帮助命令 ==========
        { o: '"Interactive Editor Playground"', t: '"交互式编辑器演练"' },
        
        // ========== 调试日志 ==========
        { o: 'title:it(13613,"Enable Debug Log upload")', t: 'title:it(13613,"启用调试日志上传")' },
        
        // ========== 其他常见 UI 元素 ==========
        { o: '"Embed codebase for improved contextual understanding and knowledge. Embeddings and metadata are stored in the"', t: '"嵌入代码库以提升上下文理解和知识。嵌入和元数据存储在"' },
        { o: '", but all code is stored locally."', t: '"中,但所有代码都存储在本地。"' },
        
        // ========== 规则过滤器 ==========
        { o: 'onFilterChange("all")', t: 'onFilterChange("all")' },
        { o: 'onFilterChange("user")', t: 'onFilterChange("user")' },
        { o: 'onFilterChange("project")', t: 'onFilterChange("project")' },
        { o: 'onFilterChange("team")', t: 'onFilterChange("team")' },
        
        // ========== Agents 页面 - 基本设置 ==========
        { o: 'label:"Default Mode"', t: 'label:"默认模式"' },
        { o: 'description:"Mode for new agents"', t: 'description:"新 Agent 的模式"' },
        { o: 'label:"Default Location"', t: 'label:"默认位置"' },
        { o: 'description:"Where to open new agents"', t: 'description:"在哪里打开新 Agent"' },
        { o: 'label:"Text Size"', t: 'label:"文字大小"' },
        { o: 'description:"Adjust the conversation text size"', t: 'description:"调整对话文字大小"' },
        { o: 'label:"Auto-Clear Chat"', t: 'label:"自动清除聊天"' },
        { o: 'description:"After periods of inactivity, open the Agent Pane to a new conversation"', t: 'description:"一段时间不活动后,将 Agent 面板打开为新对话"' },
        { o: 'label:"Max Tab Count"', t: 'label:"最大标签数"' },
        { o: 'description:"Limit how many chat tabs can be open at once"', t: 'description:"限制同时打开的聊天标签数量"' },
        { o: 'label:"Queue Messages"', t: 'label:"消息排队"' },
        { o: 'description:"Adjust the default behavior of sending a message while Agent is running"', t: 'description:"调整在 Agent 运行时发送消息的默认行为"' },
        
        // ========== Agents 页面 - Agent Review ==========
        { o: 'title:"Agent Review"', t: 'title:"Agent 审查"' },
        { o: 'label:"Start Agent Review on Commit"', t: 'label:"提交时启动 Agent 审查"' },
        { o: 'description:"Automatically review your changes for issues after each commit"', t: 'description:"每次提交后自动审查您的更改是否存在问题"' },
        { o: 'label:"Include Submodules in Agent Review"', t: 'label:"在 Agent 审查中包含子模块"' },
        { o: 'description:"Include changes from Git submodules in the review"', t: 'description:"在审查中包含 Git 子模块的更改"' },
        { o: 'label:"Include Untracked Files in Agent Review"', t: 'label:"在 Agent 审查中包含未跟踪文件"' },
        { o: 'description:"Include untracked files (new files not yet added to Git) in the review"', t: 'description:"在审查中包含未跟踪的文件(尚未添加到 Git 的新文件)"' },
        { o: 'label:"Default Approach"', t: 'label:"默认方式"' },
        { o: 'description:"Choose between quick or more thorough, higher-cost analysis"', t: 'description:"选择快速分析或更彻底但成本更高的分析"' },
        
        // ========== Agents 页面 - Context ==========
        { o: 'title:"Context"', t: 'title:"上下文"' },
        { o: '"Web Search Tool"', t: '"网页搜索工具"' },
        { o: 'label:"Web Search Tool"', t: 'label:"网页搜索工具"' },
        { o: 'description:"Allow Agent to search the web for relevant information"', t: 'description:"允许 Agent 在网页上搜索相关信息"' },
        { o: '"Auto-Accept Web Search"', t: '"自动接受网页搜索"' },
        { o: 'label:"Auto-Accept Web Search"', t: 'label:"自动接受网页搜索"' },
        { o: '"Enabled by Run Everything Auto-Run Mode: Agent bypasses approval prompts for tools including Web Search."', t: '"由运行全部自动运行模式启用:Agent 跳过包括网页搜索在内的工具审批提示。"' },
        { o: 'description:"Enabled by Run Everything Auto-Run Mode: Agent bypasses approval prompts for tools including Web Search."', t: 'description:"由运行全部自动运行模式启用:Agent 跳过包括网页搜索在内的工具审批提示。"' },
        { o: '"Hierarchical Cursor Ignore"', t: '"层级化 Cursor 忽略"' },
        { o: 'label:"Hierarchical Cursor Ignore"', t: 'label:"层级化 Cursor 忽略"' },
        { o: '"Apply .cursorignore files to all subdirectories. Changing this setting will require a restart of Cursor."', t: '"将 .cursorignore 文件应用于所有子目录。更改此设置需要重启 Cursor。"' },
        { o: 'description:"Apply .cursorignore files to all subdirectories. Changing this setting will require a restart of Cursor."', t: 'description:"将 .cursorignore 文件应用于所有子目录。更改此设置需要重启 Cursor。"' },
        { o: '"Ignore Symlinks in Cursor Ignore Search"', t: '"在 Cursor 忽略搜索中跳过符号链接"' },
        { o: 'label:"Ignore Symlinks in Cursor Ignore Search"', t: 'label:"在 Cursor 忽略搜索中跳过符号链接"' },
        { o: '"Use with caution. Skip symlinks during .cursorignore file discovery. Only enable if your repository has many symlinks and all .cursorignore files are reachable without them. Changing this setting will require a restart of Cursor."', t: '"请谨慎使用。在 .cursorignore 文件发现过程中跳过符号链接。仅当您的仓库有很多符号链接且所有 .cursorignore 文件在没有它们的情况下也可访问时才启用。更改此设置需要重启 Cursor。"' },
        { o: 'description:"Use with caution. Skip symlinks during .cursorignore file discovery. Only enable if your repository has many symlinks and all .cursorignore files are reachable without them. Changing this setting will require a restart of Cursor."', t: 'description:"请谨慎使用。在 .cursorignore 文件发现过程中跳过符号链接。仅当您的仓库有很多符号链接且所有 .cursorignore 文件在没有它们的情况下也可访问时才启用。更改此设置需要重启 Cursor。"' },
        
        // ========== Agents 页面 - Applying Changes ==========
        { o: 'title:"Applying Changes"', t: 'title:"应用更改"' },
        { o: 'label:"Auto-Accept on Commit"', t: 'label:"提交时自动接受"' },
        { o: 'description:"Automatically accept all changes when files are committed and no longer in the worktree"', t: 'description:"当文件已提交且不再在工作树中时自动接受所有更改"' },
        { o: 'label:"Jump to Next Diff on Accept"', t: 'label:"接受时跳转到下一个差异"' },
        { o: 'description:"Automatically jump to the next diff when accepting changes with Cmd+Y"', t: 'description:"使用 Cmd+Y 接受更改时自动跳转到下一个差异"' },
        
        // ========== Agents 页面 - Auto-Run ==========
        { o: 'title:"Auto-Run"', t: 'title:"自动运行"' },
        { o: '"Choose how Agent runs tools like command execution, MCP, and file writes."', t: '"选择 Agent 如何运行命令执行、MCP 和文件写入等工具。"' },
        { o: 'description:"Choose how Agent runs tools like command execution, MCP, and file writes."', t: 'description:"选择 Agent 如何运行命令执行、MCP 和文件写入等工具。"' },
        { o: 'label:"Auto-Approved Mode Transitions"', t: 'label:"自动批准的模式切换"' },
        { o: 'description:"Mode transitions that will be automatically approved without prompting."', t: 'description:"将自动批准而无需提示的模式切换。"' },
        { o: 'label:"Browser Protection"', t: 'label:"浏览器保护"' },
        { o: '"Prevent Agent from automatically running Browser tools"', t: '"阻止 Agent 自动运行浏览器工具"' },
        { o: 'description:"Prevent Agent from automatically running Browser tools"', t: 'description:"阻止 Agent 自动运行浏览器工具"' },
        { o: 'label:"MCP Tools Protection"', t: 'label:"MCP 工具保护"' },
        { o: '"Prevent Agent from automatically running MCP tools"', t: '"阻止 Agent 自动运行 MCP 工具"' },
        { o: 'description:"Prevent Agent from automatically running MCP tools"', t: 'description:"阻止 Agent 自动运行 MCP 工具"' },
        { o: 'label:"File-Deletion Protection"', t: 'label:"文件删除保护"' },
        { o: '"Prevent Agent from deleting files automatically"', t: '"阻止 Agent 自动删除文件"' },
        { o: 'description:"Prevent Agent from deleting files automatically"', t: 'description:"阻止 Agent 自动删除文件"' },
        { o: 'label:"Dotfile Protection"', t: 'label:"点文件保护"' },
        { o: '"Prevent Agent from modifying dot files like .gitignore automatically"', t: '"阻止 Agent 自动修改 .gitignore 等点文件"' },
        { o: 'description:"Prevent Agent from modifying dot files like .gitignore automatically"', t: 'description:"阻止 Agent 自动修改 .gitignore 等点文件"' },
        { o: 'label:"External-File Protection"', t: 'label:"外部文件保护"' },
        { o: '"Prevent Agent from creating or modifying files outside of the workspace automatically"', t: '"阻止 Agent 自动创建或修改工作区外的文件"' },
        { o: 'description:"Prevent Agent from creating or modifying files outside of the workspace automatically"', t: 'description:"阻止 Agent 自动创建或修改工作区外的文件"' },
        
        // ========== Agents 页面 - Inline Editing & Terminal ==========
        { o: 'title:"Inline Editing & Terminal"', t: 'title:"内联编辑与终端"' },
        { o: 'label:"Legacy Terminal Tool"', t: 'label:"旧版终端工具"' },
        { o: 'description:"Use the legacy terminal tool in agent mode, for use on systems with unsupported shell configurations"', t: 'description:"在 Agent 模式中使用旧版终端工具,适用于不支持的 shell 配置的系统"' },
        { o: 'label:"Toolbar on Selection"', t: 'label:"选择时显示工具栏"' },
        { o: 'description:"Show Add to Chat & Quick Edit buttons when selecting code"', t: 'description:"选择代码时显示添加到聊天和快速编辑按钮"' },
        { o: 'label:"Auto-Parse Links"', t: 'label:"自动解析链接"' },
        { o: '"Automatically parse links when pasted into Quick Edit (Ctrl+K) input"', t: '"粘贴到快速编辑 (Ctrl+K) 输入框时自动解析链接"' },
        { o: 'description:"Automatically parse links when pasted into Quick Edit (Ctrl+K) input"', t: 'description:"粘贴到快速编辑 (Ctrl+K) 输入框时自动解析链接"' },
        { o: 'label:"Themed Diff Backgrounds"', t: 'label:"主题化差异背景"' },
        { o: 'description:"Use themed background colors for inline code diffs"', t: 'description:"为内联代码差异使用主题背景色"' },
        { o: 'label:"Terminal Hint"', t: 'label:"终端提示"' },
        { o: '"Show a hint for Ctrl+K in the Terminal"', t: '"在终端中显示 Ctrl+K 提示"' },
        { o: 'description:"Show a hint for Ctrl+K in the Terminal"', t: 'description:"在终端中显示 Ctrl+K 提示"' },
        { o: '"Preview Box for Terminal Ctrl+K"', t: '"终端 Ctrl+K 预览框"' },
        { o: 'label:"Preview Box for Terminal Ctrl+K"', t: 'label:"终端 Ctrl+K 预览框"' },
        { o: 'description:"Use a preview box instead of streaming responses directly into the shell"', t: 'description:"使用预览框而不是直接将响应流式输出到 shell"' },
        
        // ========== Agents 页面 - Voice Mode ==========
        { o: 'title:"Voice Mode"', t: 'title:"语音模式"' },
        { o: 'label:"Submit Keywords"', t: 'label:"提交关键词"' },
        { o: 'description:"Custom keywords that trigger auto-submit in voice mode. Only single words (no spaces) are allowed. Punctuation and capitalization are ignored."', t: 'description:"在语音模式下触发自动提交的自定义关键词。仅允许单个词(无空格)。标点和大小写将被忽略。"' },
        
        // ========== Agents 页面 - Attribution ==========
        { o: 'title:"Attribution"', t: 'title:"署名"' },
        { o: 'label:"Commit Attribution"', t: 'label:"提交署名"' },
        { o: 'description:"Mark Agent commits as co-authored with Cursor"', t: 'description:"将 Agent 提交标记为与 Cursor 共同编写"' },
        { o: 'label:"PR Attribution"', t: 'label:"PR 署名"' },
        { o: 'description:"Mark pull requests as made with Cursor"', t: 'description:"将拉取请求标记为使用 Cursor 创建"' },
        
        // ========== 下拉选项翻译 ==========
        { o: 'label:"Small"', t: 'label:"小"' },
        { o: 'label:"Default"', t: 'label:"默认"' },
        { o: 'label:"Large"', t: 'label:"大"' },
        { o: 'label:"Quick"', t: 'label:"快速"' },
        { o: 'label:"Deep"', t: 'label:"深度"' },
        { o: 'label:"Pane"', t: 'label:"面板"' },
        { o: 'label:"Editor"', t: 'label:"编辑器"' },
        
        // ========== Tab 补全设置页面 ==========
        { o: 'label:"Cursor Tab",description:"Context-aware, multi-line suggestions around your cursor based on recent edits"', t: 'label:"Cursor Tab",description:"根据最近编辑,在光标周围提供上下文感知的多行建议"' },
        { o: 'label:"Partial Accepts"', t: 'label:"部分接受"' },
        { o: 'Accept the next word of a suggestion via', t: '通过以下快捷键接受建议的下一个单词:' },
        { o: 'label:"Suggestions While Commenting",description:"Allow Tab to trigger while in a comment region"', t: 'label:"注释时提供建议",description:"允许在注释区域内触发 Tab"' },
        { o: 'label:"Whitespace-Only Suggestions",description:"Suggest edits like new lines and indentation that modify whitespace only"', t: 'label:"仅空白字符建议",description:"建议仅修改空白字符的编辑,如新行和缩进"' },
        { o: 'label:"Imports",description:', t: 'label:"导入",description:' },
        { o: 'Automatically import necessary modules for', t: '自动导入所需模块,适用于' },
        { o: '"Auto Import for Python"', t: '"Python 自动导入"' },
        { o: 'description:"Enable auto import for Python. This is a beta feature."', t: 'description:"启用 Python 自动导入。这是一个测试功能。"' },
        
        // ========== Tools(工具)页面 ==========
        { o: 'title:"Tools"', t: 'title:"工具"' },
        { o: 'title:"Browser"', t: 'title:"浏览器"' },
        { o: '"Browser Automation"', t: '"浏览器自动化"' },
        { o: 'label:"Browser Automation"', t: 'label:"浏览器自动化"' },
        { o: '"Browser automation disabled"', t: '"浏览器自动化已禁用"' },
        { o: 'description:"Browser automation disabled"', t: 'description:"浏览器自动化已禁用"' },
        { o: '"Off"', t: '"关闭"' },
        { o: 'label:"Show Localhost Links in Browser"', t: 'label:"在浏览器中显示本地链接"' },
        { o: 'description:"Automatically open localhost links in the Browser Tab"', t: 'description:"自动在浏览器标签页中打开本地链接"' },
        { o: '"Installed MCP Servers"', t: '"已安装的MCP服务器"' },
        { o: '"No MCP Tools"', t: '"无MCP工具"' },
        { o: '"Add a custom MCP tool here or configure project-specific tools"', t: '"在此添加自定义MCP工具或配置项目特定工具"' },
        { o: '"Add a custom MCP tool here or configure project-specific tools in"', t: '"在此添加自定义 MCP 工具或在以下位置配置项目特定工具:"' },
        { o: '"Add Custom MCP"', t: '"添加自定义MCP"' },
        
        // ========== 规则、技能、子代理页面 ==========
        { o: 'title:"Rules and Commands"', t: 'title:"规则与命令"' },
        { o: '"Rules and Commands"', t: '"规则与命令"' },
        { o: '"Apply additional workflows, guardrails, and conventions to your Agent. Having issues with a rule?"', t: '"为您的 Agent 应用额外的工作流、护栏和约定。规则有问题?"' },
        { o: '"Debug my rule"', t: '"调试我的规则"' },
        { o: '>Debug my rule<', t: '>调试我的规则<' },
        { o: '"Import Settings"', t: '"导入设置"' },
        { o: 'title:"Import Settings"', t: 'title:"导入设置"' },
        { o: '"Include CLAUDE.md in context"', t: '"在上下文中包含 CLAUDE.md"' },
        { o: 'label:"Include CLAUDE.md in context"', t: 'label:"在上下文中包含 CLAUDE.md"' },
        { o: '"CLAUDE.md and CLAUDE.local.md files will be added to the Agent\\u2019s context, when relevant."', t: '"相关时,CLAUDE.md 和 CLAUDE.local.md 文件将被添加到 Agent 的上下文中。"' },
        { o: `"CLAUDE.md and CLAUDE.local.md files will be added to the Agent's context, when relevant."`, t: `"相关时,CLAUDE.md 和 CLAUDE.local.md 文件将被添加到 Agent 的上下文中。"` },
        { o: '"Import Claude Commands"', t: '"导入 Claude 命令"' },
        { o: 'label:"Import Claude Commands"', t: 'label:"导入 Claude 命令"' },
        { o: '"Load commands from .claude/commands directories alongside .cursor/commands."', t: '"从 .claude/commands 目录加载命令,与 .cursor/commands 一起使用。"' },
        { o: '"User Rules"', t: '"用户规则"' },
        { o: 'title:"User Rules"', t: 'title:"用户规则"' },
        { o: '"Manage your custom user rules and preferences"', t: '"管理您的自定义用户规则和偏好设置"' },
        { o: '"+ Add Rule"', t: '"+ 添加规则"' },
        { o: '>+ Add Rule<', t: '>+ 添加规则<' },
        { o: '"Add Rule"', t: '"添加规则"' },
        { o: '>Add Rule<', t: '>添加规则<' },
        { o: '"Project Rules"', t: '"项目规则"' },
        { o: 'title:"Project Rules"', t: 'title:"项目规则"' },
        { o: '"Help Agent understand conventions in this project directory"', t: '"帮助 Agent 理解此项目目录中的约定"' },
        { o: '"No Project Rules Yet"', t: '"暂无项目规则"' },
        { o: '"Create rules specific to this project"', t: '"创建此项目特定的规则"' },
        { o: '"Team Commands"', t: '"团队命令"' },
        { o: 'title:"Team Commands"', t: 'title:"团队命令"' },
        { o: '"Commands shared across your team"', t: '"在团队中共享的命令"' },
        { o: '"No Team Commands"', t: '"暂无团队命令"' },
        { o: `"Your team hasn't created any commands yet"`, t: `"您的团队尚未创建任何命令"` },
        { o: '"Your team hasn\\u2019t created any commands yet"', t: '"您的团队尚未创建任何命令"' },
        { o: '"Project Commands"', t: '"项目命令"' },
        { o: 'title:"Project Commands"', t: 'title:"项目命令"' },
        { o: '"Commands specific to this workspace"', t: '"此工作区特定的命令"' },
        { o: '"+ Add Command"', t: '"+ 添加命令"' },
        { o: '>+ Add Command<', t: '>+ 添加命令<' },
        { o: '"Add Command"', t: '"添加命令"' },
        { o: '>Add Command<', t: '>添加命令<' },
        { o: '"No Project Commands"', t: '"暂无项目命令"' },
        { o: '"Create commands specific to this project"', t: '"创建此项目特定的命令"' },
        { o: '"Include third-party skills, subagents, and other configs"', t: '"包含第三方技能、子代理和其他配置"' },
        { o: '"Automatically apply agent configs from other tools"', t: '"自动应用其他工具的代理配置"' },
        { o: '"Use Rules to guide agent behavior, like enforcing best practices or coding standards. Rules can be applied always, by file path, or manually."', t: '"使用规则来指导代理行为,例如强制执行最佳实践或编码标准。规则可以始终应用、按文件路径应用或手动应用。"' },
        { o: '"No Rules Yet"', t: '"暂无规则"' },
        { o: '"Create rules to guide Agent behavior"', t: '"创建规则以指导代理行为"' },
        { o: '"New User Rule"', t: '"新建用户规则"' },
        { o: '"Skills are specialized capabilities that help the agent accomplish specific tasks. Skills will be invoked by the agent when relevant or can be triggered manually with / in chat."', t: '"技能是帮助代理完成特定任务的专门能力。当相关时,代理会自动调用技能,也可以在聊天中使用 / 手动触发。"' },
        { o: '"No Skills Yet"', t: '"暂无技能"' },
        { o: '"Skills help the agent accomplish specific tasks"', t: '"技能帮助代理完成特定任务"' },
        { o: '"New Skill"', t: '"新建技能"' },
        { o: '"Create specialized agents for complex tasks. Subagents can be invoked by the agent to handle focused work in parallel."', t: '"为复杂任务创建专门的代理。子代理可以被代理调用以并行处理专注的工作。"' },
        { o: '"No Subagents Yet"', t: '"暂无子代理"' },
        { o: '"Create specialized agents to handle focused tasks"', t: '"创建专门的代理来处理专注的任务"' },
        { o: '"New Subagent"', t: '"新建子代理"' },
        { o: '"Create reusable workflows triggered with / prefix in chat. Use commands to standardize processes and make common tasks more efficient."', t: '"创建在聊天中使用 / 前缀触发的可重用工作流。使用命令来标准化流程并使常见任务更高效。"' },
        { o: '"No Commands Yet"', t: '"暂无命令"' },
        { o: '"Create commands to build reusable workflows"', t: '"创建命令以构建可重用工作流"' },
        { o: '"New Command"', t: '"新建命令"' },
        { o: '>+ New<', t: '>+ 新建<' },
        
        // ========== User Commands 区块 ==========
        { o: '"User Commands"', t: '"用户命令"' },
        { o: 'title:"User Commands"', t: 'title:"用户命令"' },
        { o: '"Your personal commands from ~/.cursor/commands and ~/.claude/commands"', t: '"您在 ~/.cursor/commands 和 ~/.claude/commands 中的个人命令"' },
        { o: '"No User Commands"', t: '"暂无用户命令"' },
        { o: '"Create personal commands to reuse frequently"', t: '"创建常用的个人命令"' },
        
        // ========== 索引与文档页面 ==========
        { o: 'title:"Indexing & Docs"', t: 'title:"索引与文档"' },
        { o: '"Indexing & Docs"', t: '"索引与文档"' },
        { o: 'title:"Codebase"', t: 'title:"代码库"' },
        { o: '"Codebase"', t: '"代码库"' },
        { o: 'label:"Index New Folders"', t: 'label:"索引新文件夹"' },
        { o: '"Automatically index any new folders with fewer than 250,000 files"', t: '"自动索引少于 250,000 个文件的新文件夹"' },
        { o: 'description:"Automatically index any new folders with fewer than 250,000 files"', t: 'description:"自动索引少于250,000个文件的新文件夹"' },
        { o: 'label:"Ignore Files in .cursorignore"', t: 'label:"忽略 .cursorignore 中的文件"' },
        { o: '"Files to exclude from indexing in addition to .gitignore."', t: '"除 .gitignore 外要排除索引的文件。"' },
        { o: 'description:"Files to exclude from indexing in addition to .gitignore."', t: 'description:"除 .gitignore 外要排除索引的文件。"' },
        { o: '"View included files."', t: '"查看已包含的文件。"' },
        { o: '>View included files.<', t: '>查看已包含的文件。<' },
        { o: 'label:"Team-Level Repository Control"', t: 'label:"团队级仓库控制"' },
        { o: 'description:"Disable AI features in specific repositories based on file pattern"', t: 'description:"根据文件模式禁用特定仓库中的AI功能"' },
        { o: 'title:"Docs"', t: 'title:"文档"' },
        { o: '"Crawl and index custom resources and developer docs"', t: '"爬取和索引自定义资源和开发者文档"' },
        { o: '"No Docs Added"', t: '"暂无文档"' },
        { o: '"Add documentation to use as context. You can also use @Add in Chat or while editing to add a doc."', t: '"添加文档作为上下文使用。您也可以在聊天中使用 @Add 或在编辑时添加文档。"' },
        { o: '"Add Doc"', t: '"添加文档"' },
        { o: '"+ Add Doc"', t: '"+ 添加文档"' },
        { o: '>+ Add Doc<', t: '>+ 添加文档<' },
        { o: '"Sync"', t: '"同步"' },
        { o: '>Sync<', t: '>同步<' },
        { o: '"Delete Index"', t: '"删除索引"' },
        { o: '>Delete Index<', t: '>删除索引<' },
        { o: '"Edit"', t: '"编辑"' },
        { o: '>Edit<', t: '>编辑<' },
        { o: '" files"', t: '" 个文件"' },
        
        // ========== 网络页面 ==========
        { o: 'label:"HTTP Compatibility Mode"', t: 'label:"HTTP兼容模式"' },
        { o: 'description:"HTTP/2 is recommended for low-latency streaming. In some corporate proxy and VPN environments, the compatibility mode may need to be lowered."', t: 'description:"建议使用HTTP/2以实现低延迟流式传输。在某些企业代理和VPN环境中,可能需要降低兼容模式。"' },
        { o: 'label:"Network Diagnostics"', t: 'label:"网络诊断"' },
        { o: 'description:"Check network connectivity to backend AI services"', t: 'description:"检查与后端AI服务的网络连接"' },
        { o: '"Run Diagnostic"', t: '"运行诊断"' },
        
        // ========== 测试版页面 ==========
        { o: 'label:"Update Access"', t: 'label:"更新访问"' },
        { o: 'description:"By default, get notifications for stable updates. In Early Access, pre-release builds may be unstable for production work."', t: 'description:"默认情况下,获取稳定更新通知。在抢先体验中,预发布版本可能不稳定,不适合生产工作。"' },
        { o: 'label:"Agent Autocomplete"', t: 'label:"代理自动完成"' },
        { o: 'description:"Contextual suggestions while prompting Agent"', t: 'description:"提示代理时的上下文建议"' },
        { o: 'label:"Extension RPC Tracer"', t: 'label:"扩展RPC追踪器"' },
        { o: 'description:"Log extension host RPC messages to JSON files viewable in Perfetto for performance analysis. Requires a restart to take effect."', t: 'description:"将扩展主机RPC消息记录到可在Perfetto中查看的JSON文件以进行性能分析。需要重启才能生效。"' },
        { o: '"Development"', t: '"开发"' },
        { o: '"Plugins"', t: '"插件"' },
        { o: 'label:"Import Plugins"', t: 'label:"导入插件"' },
        { o: 'description:"When enabled, plugins from tools such as Claude Code are automatically imported for the current workspace on startup."', t: 'description:"启用后,来自Claude Code等工具的插件将在启动时自动导入到当前工作区。"' }
    ];

    // 4. 执行替换
    let count = 0;
    replacements.forEach(item => {
        if (content.includes(item.o)) {
            content = content.split(item.o).join(item.t);
            console.log(`已替换: ${item.t}`);
            count++;
        } else {
            console.log(`未找到匹配项 (可能已汉化): ${item.o}`);
        }
    });

    // 5. 写入文件
    if (count > 0) {
        console.log(`正在写入文件 (共 ${count} 处修改)...`);
        fs.writeFileSync(filePath, content, 'utf8');
        console.log('汉化完成!请重启 Cursor 生效。');
    } else {
        console.log('未进行任何修改。');
    }

} catch (e) {
    console.error('发生错误:', e.message);
    console.error('如果提示 EPERM 权限错误,请尝试以管理员身份运行终端,或确保 Cursor 已完全关闭。');
}


第三步:运行汉化脚本

  1. 完全关闭 Cursor(包括系统托盘图标)

  2. 以管理员身份打开 PowerShell 或命令提示符

  3. 运行脚本:

    node patch_cursor.js

  4. 重启 Cursor 即可看到中文界面


恢复英文界面

如果需要恢复英文界面,使用备份文件:

# Windows PowerShell
Copy-Item "workbench.desktop.main.js.bak" "workbench.desktop.main.js" -Force

汉化覆盖范围

本脚本包含 150+ 条翻译规则,覆盖以下页面:

页面汉化项目
通用设置账户管理、团队邀请、编辑器设置、快捷键等
Agents 智能体默认模式、Agent 审查、自动运行、保护设置等
Tab 补全部分接受、注释建议、自动导入等
模型模型选择相关
工具与 MCP浏览器自动化、MCP 服务器等
规则、技能、子代理规则创建、技能管理、命令配置等
索引与文档文件夹索引、忽略文件、文档管理等
网络HTTP 兼容模式、网络诊断等
测试版更新访问、代理自动完成、插件导入等

常见问题

Q1: 运行脚本提示 “EPERM: operation not permitted”

原因:Cursor 正在运行,文件被占用。

解决:

  1. 完全关闭 Cursor(包括托盘图标)
  2. 以管理员身份运行终端
  3. 重新执行脚本

Q2: Cursor 更新后汉化失效

原因:Cursor 更新会覆盖 workbench.desktop.main.js 文件。

解决:重新运行汉化脚本即可。

Q3: 部分内容未汉化

原因:可能是 Cursor 版本更新导致部分字符串变化。

解决:欢迎在评论区反馈未汉化的内容,我会持续更新脚本。


注意事项

  1. 备份重要:脚本会自动创建 .bak 备份文件,请勿删除
  2. 版本兼容:不同版本的 Cursor 可能存在字符串差异
  3. 权限要求:需要管理员权限才能修改系统文件
  4. 及时更新:Cursor 更新后需要重新运行脚本

总结

通过本文提供的汉化脚本,你可以轻松将 Cursor 的设置界面汉化为中文,提升使用体验。脚本采用精确字符串匹配,不会影响 Cursor 的正常功能。

如果本文对你有帮助,欢迎点赞、收藏、关注!有任何问题欢迎在评论区交流。


关键词:Cursor 汉化、Cursor 中文、Cursor 设置界面汉化、Cursor 本地化、AI 编程助手汉化

标签:Cursor 汉化 中文化 AI编程 开发工具


版权声明:本文为原创文章,转载请注明出处

Logo

更多推荐