继续汉化

This commit is contained in:
HybridTalentComputing committed 2025-12-23 22:27:51 +08:00
1 parent a852ac2176
commit e33feb513f
16 files changed
+417 -102

No files matched your search

+1 -2
View File
@@ -13,7 +13,7 @@
"cline.walkthrough.step5.title": "您始终拥有控制权",
"cline.walkthrough.step5.description": "查看 Cline 的计划和差异。在更改发生前予以批准。没有意外。",
"cline.command.newTask": "新任务",
"cline.command.mcpServers": "MCP 服务端",
"cline.command.mcpServers": "MCP 服务器",
"cline.command.history": "历史记录",
"cline.command.account": "账户",
"cline.command.settings": "设置",
@@ -27,4 +27,3 @@
"cline.command.openWalkthrough": "打开入门教程",
"cline.command.reconstructTaskHistory": "重建任务历史"
}
@@ -222,9 +222,16 @@ export class ExecuteCommandToolHandler implements IFullyManagedTool {
if (didAutoApprove && config.autoApprovalSettings.enableNotifications) {
// if the command was auto-approved, and it's long running we need to notify the user after some time has passed without proceeding
timeoutId = setTimeout(() => {
const preferredLanguage = config.services.stateManager.getGlobalSettingsKey("preferredLanguage")
const isChinese =
preferredLanguage === "Simplified Chinese - 简体中文" ||
preferredLanguage === "zh-CN" ||
preferredLanguage === "zh-TW"
showSystemNotification({
subtitle: "Command is still running",
message: "An auto-approved command has been running for 30s, and may need your attention.",
subtitle: isChinese ? "命令仍在运行" : "Command is still running",
message: isChinese
? "一个自动批准的命令已运行 30 秒,可能需要您的注意。"
: "An auto-approved command has been running for 30s, and may need your attention.",
})
}, 30_000)
}
@@ -3,6 +3,7 @@ import { McpServers } from "@shared/proto/cline/mcp"
import { convertProtoMcpServersToMcpServers } from "@shared/proto-conversions/mcp/mcp-server-conversion"
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
import React, { useEffect, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
import { useClickAway, useWindowSize } from "react-use"
import PopupModalContainer from "@/components/common/PopupModalContainer"
import ServersToggleList from "@/components/mcp/configuration/tabs/installed/ServersToggleList"
@@ -11,6 +12,7 @@ import { useExtensionState } from "@/context/ExtensionStateContext"
import { McpServiceClient } from "@/services/grpc-client"
const ServersToggleModal: React.FC = () => {
const { t } = useTranslation()
const { mcpServers, navigateToMcp, setMcpServers } = useExtensionState()
const [isVisible, setIsVisible] = useState(false)
const buttonRef = useRef<HTMLDivElement>(null)
@@ -55,11 +57,11 @@ const ServersToggleModal: React.FC = () => {
<div className="inline-flex min-w-0 max-w-full items-center" ref={modalRef}>
<div className="inline-flex w-full items-center" ref={buttonRef}>
<Tooltip>
{!isVisible && <TooltipContent>Manage MCP Servers</TooltipContent>}
{!isVisible && <TooltipContent>{t("mcp.serversToggle.manageServers")}</TooltipContent>}
<TooltipTrigger>
<VSCodeButton
appearance="icon"
aria-label={isVisible ? "Hide MCP Servers" : "Show MCP Servers"}
aria-label={isVisible ? t("mcp.serversToggle.hideServers") : t("mcp.serversToggle.showServers")}
className="p-0 m-0 flex items-center"
onClick={() => setIsVisible(!isVisible)}>
<i className="codicon codicon-server" style={{ fontSize: "12.5px" }} />
@@ -72,10 +74,10 @@ const ServersToggleModal: React.FC = () => {
<PopupModalContainer $arrowPosition={arrowPosition} $menuPosition={menuPosition}>
<div className="flex-shrink-0 px-3 pt-2">
<div className="flex justify-between items-center mb-2.5">
<div className="m-0 text-sm font-medium">MCP Servers</div>
<div className="m-0 text-sm font-medium">{t("mcp.title")}</div>
<VSCodeButton
appearance="icon"
aria-label="Go to MCP server settings"
aria-label={t("mcp.serversToggle.goToSettings")}
onClick={() => {
setIsVisible(false)
navigateToMcp("configure")
@@ -1,4 +1,5 @@
import { useRef, useState } from "react"
import { useTranslation } from "react-i18next"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { getAsVar, VSC_TITLEBAR_INACTIVE_FOREGROUND } from "@/utils/vscStyles"
import AutoApproveModal from "./AutoApproveModal"
@@ -9,6 +10,7 @@ interface AutoApproveBarProps {
}
const AutoApproveBar = ({ style }: AutoApproveBarProps) => {
const { t } = useTranslation()
const { autoApprovalSettings, yoloModeToggled, navigateToSettings } = useExtensionState()
const [isModalVisible, setIsModalVisible] = useState(false)
@@ -46,17 +48,38 @@ const AutoApproveBar = ({ style }: AutoApproveBarProps) => {
})
if (actionsToShow.length === 0) {
return <span className={baseClasses}>None</span>
return <span className={baseClasses}>{t("autoApprove.bar.none")}</span>
}
// 根据 action.id 获取翻译键
const getShortNameTranslationKey = (id: string): string => {
const keyMap: Record<string, string> = {
readFiles: "autoApprove.actions.shortNames.readFiles",
readFilesExternally: "autoApprove.actions.shortNames.readFilesExternally",
editFiles: "autoApprove.actions.shortNames.editFiles",
editFilesExternally: "autoApprove.actions.shortNames.editFilesExternally",
executeSafeCommands: "autoApprove.actions.shortNames.executeSafeCommands",
executeAllCommands: "autoApprove.actions.shortNames.executeAllCommands",
useBrowser: "autoApprove.actions.shortNames.useBrowser",
useMcp: "autoApprove.actions.shortNames.useMcp",
}
return keyMap[id] || ""
}
return (
<span className={baseClasses}>
{actionsToShow.map((action, index) => (
<span key={action?.id}>
{action?.shortName}
{index < actionsToShow.length - 1 && ", "}
</span>
))}
{actionsToShow.map((action, index) => {
const translationKey = getShortNameTranslationKey(action?.id || "")
const displayText = translationKey
? t(translationKey, { defaultValue: action?.shortName })
: action?.shortName
return (
<span key={action?.id}>
{displayText}
{index < actionsToShow.length - 1 && ", "}
</span>
)
})}
</span>
)
}
@@ -99,11 +122,11 @@ const AutoApproveBar = ({ style }: AutoApproveBarProps) => {
/>
<div className="pt-4 pb-3.5 px-3.5">
<div className="text-sm mb-1">Auto-approve: YOLO</div>
<div className="text-sm mb-1">{t("autoApprove.bar.yoloTitle")}</div>
<div className="text-muted-foreground text-xs">
YOLO mode is enabled.{" "}
{t("autoApprove.bar.yoloDescription")}{" "}
<span className="underline cursor-pointer hover:text-foreground" onClick={handleNavigateToFeatures}>
Disable it in Settings
{t("autoApprove.bar.disableInSettings")}
</span>
.
</div>
@@ -143,7 +166,7 @@ const AutoApproveBar = ({ style }: AutoApproveBarProps) => {
/>
<div
aria-label={isModalVisible ? "Close auto-approve settings" : "Open auto-approve settings"}
aria-label={isModalVisible ? t("autoApprove.bar.closeSettings") : t("autoApprove.bar.openSettings")}
className="group cursor-pointer pt-3 pb-3.5 pr-2 px-3.5 flex items-center justify-between gap-0"
onClick={() => {
setIsModalVisible((prev) => !prev)
@@ -158,7 +181,7 @@ const AutoApproveBar = ({ style }: AutoApproveBarProps) => {
ref={buttonRef}
tabIndex={0}>
<div className="flex flex-nowrap items-center gap-1 min-w-0 flex-1">
<span className="whitespace-nowrap">Auto-approve:</span>
<span className="whitespace-nowrap">{t("autoApprove.bar.title")}</span>
{getEnabledActionsText()}
</div>
{isModalVisible ? (
@@ -1,4 +1,5 @@
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
import { useTranslation } from "react-i18next"
import styled from "styled-components"
import { ActionMetadata } from "./types"
@@ -29,8 +30,26 @@ const CheckboxWrapper = styled.div<{ $disabled: boolean }>`
`
const AutoApproveMenuItem = ({ action, isChecked, onToggle, showIcon = true, disabled = false }: AutoApproveMenuItemProps) => {
const { t } = useTranslation()
const checked = isChecked(action)
// 根据 action.id 获取翻译键
const getLabelTranslationKey = (id: string): string => {
const keyMap: Record<string, string> = {
readFiles: "autoApprove.actions.readProjectFiles",
readFilesExternally: "autoApprove.actions.readAllFiles",
editFiles: "autoApprove.actions.editProjectFiles",
editFilesExternally: "autoApprove.actions.editAllFiles",
executeSafeCommands: "autoApprove.actions.executeSafeCommands",
executeAllCommands: "autoApprove.actions.executeAllCommands",
useBrowser: "autoApprove.actions.useBrowser",
useMcp: "autoApprove.actions.useMcpServers",
}
return keyMap[id] || action.label
}
const translatedLabel = getLabelTranslationKey(action.id)
const onChange = async (e: React.MouseEvent) => {
if (disabled) {
return
@@ -45,7 +64,7 @@ const AutoApproveMenuItem = ({ action, isChecked, onToggle, showIcon = true, dis
<VSCodeCheckbox checked={checked} disabled={disabled}>
<div className="w-full flex text-sm items-center justify-start text-foreground gap-2">
{showIcon && <span className={`codicon ${action.icon} icon`}></span>}
<span className="label">{action.label}</span>
<span className="label">{t(translatedLabel, { defaultValue: action.label })}</span>
</div>
</VSCodeCheckbox>
</CheckboxWrapper>
@@ -1,5 +1,6 @@
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
import React, { useEffect, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
import { useClickAway } from "react-use"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { useAutoApproveActions } from "@/hooks/useAutoApproveActions"
@@ -18,6 +19,7 @@ interface AutoApproveModalProps {
}
const AutoApproveModal: React.FC<AutoApproveModalProps> = ({ isVisible, setIsVisible, buttonRef, ACTION_METADATA }) => {
const { t } = useTranslation()
const { autoApprovalSettings } = useExtensionState()
const { isChecked, updateAction } = useAutoApproveActions()
const modalRef = useRef<HTMLDivElement>(null)
@@ -72,14 +74,14 @@ const AutoApproveModal: React.FC<AutoApproveModalProps> = ({ isVisible, setIsVis
maxHeight: "60vh",
}}>
<div className="mb-2.5 text-muted-foreground text-xs cursor-pointer" onClick={() => setIsVisible(false)}>
Let Cline take these actions without asking for approval.{" "}
{t("autoApprove.modal.description")}{" "}
<a
className="text-link hover:text-link-hover"
href="https://docs.cline.bot/features/auto-approve#auto-approve"
rel="noopener"
style={{ fontSize: "inherit" }}
target="_blank">
Docs
{t("autoApprove.modal.docs")}
</a>
</div>
@@ -129,7 +131,7 @@ const AutoApproveModal: React.FC<AutoApproveModalProps> = ({ isVisible, setIsVis
enableNotifications: checked,
})
}}>
<span className="text-sm">Enable notifications</span>
<span className="text-sm">{t("autoApprove.modal.enableNotifications")}</span>
</VSCodeCheckbox>
</div>
</div>
@@ -11,6 +11,7 @@ import {
} from "@shared/proto/cline/file"
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
import React, { useEffect, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
import { useClickAway, useWindowSize } from "react-use"
import styled from "styled-components"
import PopupModalContainer from "@/components/common/PopupModalContainer"
@@ -24,6 +25,7 @@ import RuleRow from "./RuleRow"
import RulesToggleList from "./RulesToggleList"
const ClineRulesToggleModal: React.FC = () => {
const { t } = useTranslation()
const {
globalClineRulesToggles = {},
localClineRulesToggles = {},
@@ -362,11 +364,11 @@ const ClineRulesToggleModal: React.FC = () => {
<div className="inline-flex min-w-0 max-w-full items-center" ref={modalRef}>
<div className="inline-flex w-full items-center" ref={buttonRef}>
<Tooltip>
{!isVisible && <TooltipContent>Manage Cline Rules & Workflows</TooltipContent>}
{!isVisible && <TooltipContent>{t("clineRules.manageRulesAndWorkflows")}</TooltipContent>}
<TooltipTrigger>
<VSCodeButton
appearance="icon"
aria-label={isVisible ? "Hide Cline Rules & Workflows" : "Show Cline Rules & Workflows"}
aria-label={isVisible ? t("clineRules.hideRulesAndWorkflows") : t("clineRules.showRulesAndWorkflows")}
className="p-0 m-0 flex items-center"
onClick={() => setIsVisible(!isVisible)}>
<i className="codicon codicon-law" style={{ fontSize: "12.5px" }} />
@@ -393,14 +395,14 @@ const ClineRulesToggleModal: React.FC = () => {
borderBottom: "1px solid var(--vscode-panel-border)",
}}>
<TabButton isActive={currentView === "rules"} onClick={() => setCurrentView("rules")}>
Rules
{t("clineRules.tabs.rules")}
</TabButton>
<TabButton isActive={currentView === "workflows"} onClick={() => setCurrentView("workflows")}>
Workflows
{t("clineRules.tabs.workflows")}
</TabButton>
{hooksEnabled && (
<TabButton isActive={currentView === "hooks"} onClick={() => setCurrentView("hooks")}>
Hooks
{t("clineRules.tabs.hooks")}
</TabButton>
)}
</div>
@@ -412,8 +414,8 @@ const ClineRulesToggleModal: React.FC = () => {
<i className="codicon codicon-lock text-sm" />
<span className="text-base">
{currentView === "rules"
? "Your organization manages some rules"
: "Your organization manages some workflows"}
? t("clineRules.remoteBanner.rules")
: t("clineRules.remoteBanner.workflows")}
</span>
</div>
) : null}
@@ -422,31 +424,27 @@ const ClineRulesToggleModal: React.FC = () => {
<div className="text-xs text-description mb-4">
{currentView === "rules" ? (
<p>
Rules allow you to provide Cline with system-level guidance. Think of them as a persistent way
to include context and preferences for your projects or globally for every conversation.{" "}
{t("clineRules.descriptions.rules")}{" "}
<VSCodeLink
className="text-xs"
href="https://docs.cline.bot/features/cline-rules"
style={{ display: "inline", fontSize: "inherit" }}>
Docs
{t("clineRules.docs")}
</VSCodeLink>
</p>
) : currentView === "workflows" ? (
<p>
Workflows allow you to define a series of steps to guide Cline through a repetitive set of
tasks, such as deploying a service or submitting a PR. To invoke a workflow, type{" "}
<span className="text-foreground font-bold">/workflow-name</span> in the chat.{" "}
{t("clineRules.descriptions.workflows")}{" "}
<span className="text-foreground font-bold">/workflow-name</span>{" "}
{t("clineRules.descriptions.workflowsInvoke")}{" "}
<VSCodeLink
className="text-xs inline"
href="https://docs.cline.bot/features/slash-commands/workflows">
Docs
{t("clineRules.docs")}
</VSCodeLink>
</p>
) : (
<p>
Hooks allow you to execute custom scripts at specific points in Cline's execution lifecycle,
enabling automation and integration with external tools.
</p>
<p>{t("clineRules.descriptions.hooks")}</p>
)}
</div>
</div>
@@ -458,7 +456,7 @@ const ClineRulesToggleModal: React.FC = () => {
{/* Remote Rules Section */}
{hasRemoteRules && (
<div className="mb-3">
<div className="text-sm font-normal mb-2">Enterprise Rules</div>
<div className="text-sm font-normal mb-2">{t("clineRules.sections.enterpriseRules")}</div>
<div className="flex flex-col gap-0">
{remoteGlobalRules.map((rule) => {
const enabled = rule.alwaysEnabled || remoteRulesToggles[rule.name] === true
@@ -481,7 +479,7 @@ const ClineRulesToggleModal: React.FC = () => {
{/* Global Rules Section */}
<div className="mb-3">
<div className="text-sm font-normal mb-2">Global Rules</div>
<div className="text-sm font-normal mb-2">{t("clineRules.sections.globalRules")}</div>
{/* File-based Global Rules */}
<RulesToggleList
@@ -497,7 +495,7 @@ const ClineRulesToggleModal: React.FC = () => {
{/* Local Rules Section */}
<div style={{ marginBottom: -10 }}>
<div className="text-sm font-normal mb-2">Workspace Rules</div>
<div className="text-sm font-normal mb-2">{t("clineRules.sections.workspaceRules")}</div>
<RulesToggleList
isGlobal={false}
listGap="small"
@@ -542,7 +540,9 @@ const ClineRulesToggleModal: React.FC = () => {
{/* Remote Workflows Section */}
{hasRemoteWorkflows && (
<div className="mb-3">
<div className="text-sm font-normal mb-2">Enterprise Workflows</div>
<div className="text-sm font-normal mb-2">
{t("clineRules.sections.enterpriseWorkflows")}
</div>
<div className="flex flex-col gap-0">
{remoteGlobalWorkflows.map((workflow) => {
const enabled =
@@ -566,7 +566,7 @@ const ClineRulesToggleModal: React.FC = () => {
{/* Global Workflows Section */}
<div className="mb-3">
<div className="text-sm font-normal mb-2">Global Workflows</div>
<div className="text-sm font-normal mb-2">{t("clineRules.sections.globalWorkflows")}</div>
{/* File-based Global Workflows */}
<RulesToggleList
@@ -582,7 +582,7 @@ const ClineRulesToggleModal: React.FC = () => {
{/* Local Workflows Section */}
<div style={{ marginBottom: -10 }}>
<div className="text-sm font-normal mb-2">Workspace Workflows</div>
<div className="text-sm font-normal mb-2">{t("clineRules.sections.workspaceWorkflows")}</div>
<RulesToggleList
isGlobal={false}
listGap="small"
@@ -598,12 +598,12 @@ const ClineRulesToggleModal: React.FC = () => {
<>
<div className="text-xs text-description mb-4">
<p>
Toggle to enable/disable (chmod +x/-x).{" "}
{t("clineRules.descriptions.hooksToggle")}{" "}
<VSCodeLink
className="text-xs"
href="https://docs.cline.bot/features/hooks"
style={{ display: "inline", fontSize: "inherit" }}>
Docs
{t("clineRules.docs")}
</VSCodeLink>
</p>
</div>
@@ -612,16 +612,13 @@ const ClineRulesToggleModal: React.FC = () => {
{isWindows && (
<div className="flex items-center gap-2 px-5 py-3 mb-4 bg-vscode-inputValidation-warningBackground border-l-[3px] border-vscode-inputValidation-warningBorder">
<i className="codicon codicon-warning text-sm" />
<span className="text-base">
Hook toggling is not supported on Windows. Hooks can be created, edited, and deleted,
but cannot be enabled/disabled and will not execute.
</span>
<span className="text-base">{t("clineRules.hooks.windowsWarning")}</span>
</div>
)}
{/* Global Hooks */}
<div className="mb-3">
<div className="text-sm font-normal mb-2">Global Hooks</div>
<div className="text-sm font-normal mb-2">{t("clineRules.sections.globalHooks")}</div>
<div className="flex flex-col gap-0">
{globalHooks
.sort((a, b) => a.name.localeCompare(b.name))
@@ -1,6 +1,7 @@
import { StringRequest } from "@shared/proto/cline/common"
import { DeleteHookRequest, HooksToggles } from "@shared/proto/cline/file"
import { PenIcon, Trash2Icon } from "lucide-react"
import { useTranslation } from "react-i18next"
import { Button } from "@/components/ui/button"
import { Switch } from "@/components/ui/switch"
import { FileServiceClient } from "@/services/grpc-client"
@@ -26,6 +27,7 @@ const HookRow: React.FC<HookRowProps> = ({
onToggle,
onDelete,
}) => {
const { t } = useTranslation()
const handleEditClick = () => {
FileServiceClient.openFile(StringRequest.create({ value: absolutePath })).catch((err) =>
console.error("Failed to open file:", err),
@@ -57,12 +59,7 @@ const HookRow: React.FC<HookRowProps> = ({
{/* Toggle Switch */}
<div className="flex items-center space-x-2 gap-2">
<div
title={
isWindows
? "Hook toggling not supported on Windows. Hooks can be edited and deleted, but won't execute."
: undefined
}>
<div title={isWindows ? t("clineRules.hooks.windowsTooltip") : undefined}>
<Switch
checked={enabled}
className="mx-1"
@@ -72,14 +69,19 @@ const HookRow: React.FC<HookRowProps> = ({
style={isWindows ? { opacity: 0.5, cursor: "not-allowed" } : undefined}
/>
</div>
<Button aria-label="Edit hook file" onClick={handleEditClick} size="xs" title="Edit hook file" variant="icon">
<Button
aria-label={t("clineRules.ruleRow.editRuleFile")}
onClick={handleEditClick}
size="xs"
title={t("clineRules.ruleRow.editRuleFile")}
variant="icon">
<PenIcon />
</Button>
<Button
aria-label="Delete hook file"
aria-label={t("clineRules.ruleRow.deleteRuleFile")}
onClick={handleDeleteClick}
size="xs"
title="Delete hook file"
title={t("clineRules.ruleRow.deleteRuleFile")}
variant="icon">
<Trash2Icon />
</Button>
@@ -1,6 +1,7 @@
import { CreateHookRequest, RuleFileRequest } from "@shared/proto/index.cline"
import { PlusIcon } from "lucide-react"
import { useEffect, useMemo, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
import { useClickAway } from "react-use"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
@@ -25,6 +26,7 @@ const HOOK_TYPES = [
]
const NewRuleRow: React.FC<NewRuleRowProps> = ({ isGlobal, ruleType, existingHooks = [], workspaceName }) => {
const { t } = useTranslation()
const [isExpanded, setIsExpanded] = useState(false)
const [filename, setFilename] = useState("")
const inputRef = useRef<HTMLInputElement>(null)
@@ -86,7 +88,7 @@ const NewRuleRow: React.FC<NewRuleRowProps> = ({ isGlobal, ruleType, existingHoo
const extension = getExtension(trimmedFilename)
if (!isValidExtension(extension)) {
setError("Only .md, .txt, or no file extension allowed")
setError(t("clineRules.newRuleRow.invalidExtension"))
return
}
@@ -139,15 +141,14 @@ const NewRuleRow: React.FC<NewRuleRowProps> = ({ isGlobal, ruleType, existingHoo
{ruleType === "hook" ? (
<>
<label className="sr-only" htmlFor="hook-type-select">
Select hook type to create
{t("clineRules.hooks.selectHookType")}
</label>
<span className="sr-only" id="hook-select-description">
Choose a hook type to create. Hooks execute at specific points in Cline's lifecycle. Available:{" "}
{availableHookTypes.map((h) => h.name).join(", ")}
{t("clineRules.hooks.chooseHookType")} {availableHookTypes.map((h) => h.name).join(", ")}
</span>
<select
aria-describedby="hook-select-description"
aria-label="Select hook type to create"
aria-label={t("clineRules.hooks.selectHookType")}
className="flex-1 bg-input-background text-input-foreground border-0 outline-0 rounded focus:outline-none focus:ring-0 focus:border-transparent px-2 cursor-pointer"
disabled={availableHookTypes.length === 0}
id="hook-type-select"
@@ -168,7 +169,9 @@ const NewRuleRow: React.FC<NewRuleRowProps> = ({ isGlobal, ruleType, existingHoo
}}
value="">
<option disabled value="">
{availableHookTypes.length === 0 ? "All hooks created" : "New hook..."}
{availableHookTypes.length === 0
? t("clineRules.hooks.allHooksCreated")
: t("clineRules.hooks.newHook")}
</option>
{availableHookTypes.map((hook) => (
<option key={hook.name} title={hook.description} value={hook.name}>
@@ -190,11 +193,11 @@ const NewRuleRow: React.FC<NewRuleRowProps> = ({ isGlobal, ruleType, existingHoo
placeholder={
isExpanded
? ruleType === "workflow"
? "workflow-name (.md, .txt, or no extension)"
: "rule-name (.md, .txt, or no extension)"
? t("clineRules.newRuleRow.workflowPlaceholder")
: t("clineRules.newRuleRow.rulePlaceholder")
: ruleType === "workflow"
? "New workflow file..."
: "New rule file..."
? t("clineRules.newRuleRow.newWorkflowFile")
: t("clineRules.newRuleRow.newRuleFile")
}
ref={inputRef}
type="text"
@@ -204,10 +207,10 @@ const NewRuleRow: React.FC<NewRuleRowProps> = ({ isGlobal, ruleType, existingHoo
<Button
aria-label={
isExpanded
? "Create file"
? t("clineRules.newRuleRow.createFile")
: ruleType === "workflow"
? "New workflow file..."
: "New rule file..."
? t("clineRules.newRuleRow.newWorkflowFile")
: t("clineRules.newRuleRow.newRuleFile")
}
className="mx-0.5"
onClick={(e) => {
@@ -217,7 +220,7 @@ const NewRuleRow: React.FC<NewRuleRowProps> = ({ isGlobal, ruleType, existingHoo
}
}}
size="icon"
title={isExpanded ? "Create file" : "New file"}
title={isExpanded ? t("clineRules.newRuleRow.createFile") : t("clineRules.newRuleRow.newFile")}
type={isExpanded ? "submit" : "button"}
variant="icon">
<PlusIcon />
@@ -2,6 +2,7 @@ import { StringRequest } from "@shared/proto/cline/common"
import { RuleFileRequest } from "@shared/proto/index.cline"
import { REMOTE_URI_SCHEME } from "@shared/remote-config/constants"
import { EyeIcon, InfoIcon, PenIcon, Trash2Icon } from "lucide-react"
import { useTranslation } from "react-i18next"
import { Button } from "@/components/ui/button"
import { Switch } from "@/components/ui/switch"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
@@ -16,6 +17,7 @@ const RuleRow: React.FC<{
isRemote?: boolean
alwaysEnabled?: boolean
}> = ({ rulePath, enabled, isGlobal, toggleRule, ruleType, isRemote = false, alwaysEnabled = false }) => {
const { t } = useTranslation()
// Check if the path type is Windows
const win32Path = /^[a-zA-Z]:\\/.test(rulePath)
// Get the filename from the path for display
@@ -109,9 +111,7 @@ const RuleRow: React.FC<{
<TooltipTrigger asChild className="cursor-help">
<InfoIcon className="ml-1.5 opacity-70 size-[0.85rem]" />
</TooltipTrigger>
<TooltipContent>
Searches recursively for all AGENTS.md files in the workspace when a top-level AGENTS.md exists
</TooltipContent>
<TooltipContent>{t("clineRules.hooks.agentsInfo")}</TooltipContent>
</Tooltip>
)}
</span>
@@ -124,22 +124,22 @@ const RuleRow: React.FC<{
disabled={isDisabled}
key={rulePath}
onClick={() => toggleRule(rulePath, !enabled)}
title={isDisabled ? "This rule is required and cannot be disabled" : undefined}
title={isDisabled ? t("clineRules.ruleRow.ruleRequired") : undefined}
/>
<Button
aria-label={isRemote ? "View rule file" : "Edit rule file"}
aria-label={isRemote ? t("clineRules.ruleRow.viewRuleFile") : t("clineRules.ruleRow.editRuleFile")}
onClick={handleEditClick}
size="xs"
title={isRemote ? "View rule file (read-only)" : "Edit rule file"}
title={isRemote ? t("clineRules.ruleRow.viewRuleFileReadOnly") : t("clineRules.ruleRow.editRuleFile")}
variant="icon">
{isRemote ? <EyeIcon /> : <PenIcon />}
</Button>
<Button
aria-label="Delete rule file"
aria-label={t("clineRules.ruleRow.deleteRuleFile")}
disabled={isRemote}
onClick={handleDeleteClick}
size="xs"
title="Delete rule file"
title={t("clineRules.ruleRow.deleteRuleFile")}
variant="icon">
<Trash2Icon />
</Button>
@@ -1,3 +1,4 @@
import { useTranslation } from "react-i18next"
import NewRuleRow from "./NewRuleRow"
import RuleRow from "./RuleRow"
@@ -22,6 +23,7 @@ const RulesToggleList = ({
isRemote?: boolean
alwaysEnabledMap?: Record<string, boolean>
}) => {
const { t } = useTranslation()
const gapClasses = {
small: "gap-0",
medium: "gap-2.5",
@@ -52,7 +54,7 @@ const RulesToggleList = ({
<>
{showNoRules && (
<div className="flex flex-col items-center gap-3 my-3 text-(--vscode-descriptionForeground)">
{ruleType === "workflow" ? "No workflows found" : "No rules found"}
{ruleType === "workflow" ? t("clineRules.noWorkflowsFound") : t("clineRules.noRulesFound")}
</div>
)}
{showNewRule && <NewRuleRow isGlobal={isGlobal} ruleType={ruleType} />}
@@ -1,4 +1,5 @@
import { McpServer } from "@shared/mcp"
import { useTranslation } from "react-i18next"
import ServerRow from "./server-row/ServerRow"
const ServersToggleList = ({
@@ -12,6 +13,7 @@ const ServersToggleList = ({
hasTrashIcon: boolean
listGap?: "small" | "medium" | "large"
}) => {
const { t } = useTranslation()
const gapClasses = {
small: "gap-0",
medium: "gap-2.5",
@@ -28,7 +30,7 @@ const ServersToggleList = ({
</div>
) : (
<div className="flex flex-col items-center gap-3 my-5 text-(--vscode-descriptionForeground)">
No MCP servers installed
{t("mcp.serversToggle.noServersInstalled")}
</div>
)
}
@@ -18,6 +18,7 @@ import {
} from "@vscode/webview-ui-toolkit/react"
import { RefreshCcwIcon, Trash2Icon } from "lucide-react"
import { useState } from "react"
import { useTranslation } from "react-i18next"
import DangerButton from "@/components/common/DangerButton"
import { Button } from "@/components/ui/button"
import { Switch } from "@/components/ui/switch"
@@ -51,6 +52,7 @@ const ServerRow = ({
isExpandable?: boolean
hasTrashIcon?: boolean
}) => {
const { t } = useTranslation()
const { mcpMarketplaceCatalog, autoApprovalSettings, setMcpServers } = useExtensionState()
const [isExpanded, setIsExpanded] = useState(false)
@@ -192,7 +194,7 @@ const ServerRow = ({
handleRestart()
}}
size="icon"
title="Restart Server"
title={t("mcp.serverRow.restartServer")}
variant="icon">
<RefreshCcwIcon />
</Button>
@@ -205,7 +207,7 @@ const ServerRow = ({
handleDelete()
}}
size="icon"
title="Delete Server"
title={t("mcp.serverRow.deleteServer")}
variant="icon">
<Trash2Icon />
</Button>
@@ -257,7 +259,7 @@ const ServerRow = ({
width: "calc(100% - 20px)",
margin: "0 10px 10px 10px",
}}>
Authenticate
{t("mcp.serverRow.authenticate")}
</VSCodeButton>
) : (
<VSCodeButton
@@ -268,7 +270,9 @@ const ServerRow = ({
width: "calc(100% - 20px)",
margin: "0 10px 10px 10px",
}}>
{server.status === "connecting" || isRestarting ? "Retrying..." : "Retry Connection"}
{server.status === "connecting" || isRestarting
? t("mcp.serverRow.retrying")
: t("mcp.serverRow.retryConnection")}
</VSCodeButton>
)}
@@ -276,7 +280,7 @@ const ServerRow = ({
disabled={isDeleting}
onClick={handleDelete}
style={{ width: "calc(100% - 20px)", margin: "0 10px 10px 10px" }}>
{isDeleting ? "Deleting..." : "Delete Server"}
{isDeleting ? t("mcp.serverRow.deleting") : t("mcp.serverRow.deleteServer")}
</DangerButton>
</div>
) : (
@@ -289,9 +293,12 @@ const ServerRow = ({
borderRadius: "0 0 4px 4px",
}}>
<VSCodePanels>
<VSCodePanelTab id="tools">Tools ({server.tools?.length || 0})</VSCodePanelTab>
<VSCodePanelTab id="tools">
{t("mcp.serverRow.tools")} ({server.tools?.length || 0})
</VSCodePanelTab>
<VSCodePanelTab id="resources">
Resources ({[...(server.resourceTemplates || []), ...(server.resources || [])].length || 0})
{t("mcp.serverRow.resources")} (
{[...(server.resourceTemplates || []), ...(server.resources || [])].length || 0})
</VSCodePanelTab>
<VSCodePanelView id="tools-view">
@@ -310,7 +317,7 @@ const ServerRow = ({
data-tool="all-tools"
onChange={handleAutoApproveChange}
style={{ marginBottom: "4px", fontSize: "11px" }}>
Auto-approve all tools
{t("autoApprove.mcp.allTools")}
</VSCodeCheckbox>
)}
{server.tools.map((tool) => (
@@ -323,7 +330,7 @@ const ServerRow = ({
padding: "10px 0",
color: "var(--vscode-descriptionForeground)",
}}>
No tools found
{t("mcp.serverRow.noToolsFound")}
</div>
)}
</VSCodePanelView>
@@ -352,14 +359,16 @@ const ServerRow = ({
padding: "10px 0",
color: "var(--vscode-descriptionForeground)",
}}>
No resources found
{t("mcp.serverRow.noResourcesFound")}
</div>
)}
</VSCodePanelView>
</VSCodePanels>
<div style={{ margin: "10px 7px" }}>
<label style={{ display: "block", marginBottom: "4px", fontSize: "13px" }}>Request Timeout</label>
<label style={{ display: "block", marginBottom: "4px", fontSize: "13px" }}>
{t("mcp.serverRow.requestTimeout")}
</label>
<VSCodeDropdown onChange={handleTimeoutChange} style={{ width: "100%" }} value={timeoutValue}>
{TimeoutOptions}
</VSCodeDropdown>
@@ -372,14 +381,16 @@ const ServerRow = ({
width: "calc(100% - 14px)",
margin: "0 7px 3px 7px",
}}>
{server.status === "connecting" || isRestarting ? "Restarting..." : "Restart Server"}
{server.status === "connecting" || isRestarting
? t("mcp.serverRow.restarting")
: t("mcp.serverRow.restartServer")}
</VSCodeButton>
<DangerButton
disabled={isDeleting}
onClick={handleDelete}
style={{ width: "calc(100% - 14px)", margin: "5px 7px 3px 7px" }}>
{isDeleting ? "Deleting..." : "Delete Server"}
{isDeleting ? t("mcp.serverRow.deleting") : t("mcp.serverRow.deleteServer")}
</DangerButton>
</div>
)
+3 -1
View File
@@ -1,5 +1,6 @@
import { HistoryIcon, PlusIcon, SettingsIcon, UserCircleIcon } from "lucide-react"
import { useMemo } from "react"
import { useTranslation } from "react-i18next"
import { Button } from "@/components/ui/button"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { TaskServiceClient } from "@/services/grpc-client"
@@ -14,6 +15,7 @@ const McpServerIcon = ({ className, size }: { className?: string; size?: number
)
export const Navbar = () => {
const { t } = useTranslation()
const { navigateToHistory, navigateToSettings, navigateToAccount, navigateToMcp, navigateToChat } = useExtensionState()
const SETTINGS_TABS = useMemo(
@@ -35,7 +37,7 @@ export const Navbar = () => {
{
id: "mcp",
name: "MCP",
tooltip: "MCP Servers",
tooltip: t("mcp.title"),
icon: McpServerIcon,
navigate: navigateToMcp,
},
+122
View File
@@ -403,6 +403,27 @@
"parameters": "Parameters",
"noDescription": "No description"
},
"serversToggle": {
"manageServers": "Manage MCP Servers",
"hideServers": "Hide MCP Servers",
"showServers": "Show MCP Servers",
"goToSettings": "Go to MCP server settings",
"noServersInstalled": "No MCP servers installed"
},
"serverRow": {
"restartServer": "Restart Server",
"deleteServer": "Delete Server",
"retrying": "Retrying...",
"retryConnection": "Retry Connection",
"deleting": "Deleting...",
"restarting": "Restarting...",
"authenticate": "Authenticate",
"tools": "Tools",
"resources": "Resources",
"requestTimeout": "Request Timeout",
"noToolsFound": "No tools found",
"noResourcesFound": "No resources found"
},
"unknown": "unknown"
},
"onboarding": {
@@ -564,5 +585,106 @@
"copyCommand": "Copy command",
"copied": "Copied!"
}
},
"autoApprove": {
"bar": {
"title": "Auto-approve:",
"yoloTitle": "Auto-approve: YOLO",
"yoloDescription": "YOLO mode is enabled.",
"disableInSettings": "Disable it in Settings",
"openSettings": "Open auto-approve settings",
"closeSettings": "Close auto-approve settings",
"none": "None"
},
"modal": {
"description": "Let Cline take these actions without asking for approval.",
"docs": "Docs",
"enableNotifications": "Enable notifications"
},
"mcp": {
"allTools": "Auto-approve all tools"
},
"notification": {
"message": "An auto-approved command has been running for 30s, and may need your attention."
},
"actions": {
"readProjectFiles": "Read project files",
"readAllFiles": "Read all files",
"editProjectFiles": "Edit project files",
"editAllFiles": "Edit all files",
"executeSafeCommands": "Execute safe commands",
"executeAllCommands": "Execute all commands",
"useBrowser": "Use the browser",
"useMcpServers": "Use MCP servers",
"shortNames": {
"readFiles": "Read",
"readFilesExternally": "Read (all)",
"editFiles": "Edit",
"editFilesExternally": "Edit (all)",
"executeSafeCommands": "Safe Commands",
"executeAllCommands": "All Commands",
"useBrowser": "Browser",
"useMcp": "MCP"
}
}
},
"clineRules": {
"manageRulesAndWorkflows": "Manage Cline Rules & Workflows",
"hideRulesAndWorkflows": "Hide Cline Rules & Workflows",
"showRulesAndWorkflows": "Show Cline Rules & Workflows",
"tabs": {
"rules": "Rules",
"workflows": "Workflows",
"hooks": "Hooks"
},
"remoteBanner": {
"rules": "Your organization manages some rules",
"workflows": "Your organization manages some workflows"
},
"descriptions": {
"rules": "Rules allow you to provide Cline with system-level guidance. Think of them as a persistent way to include context and preferences for your projects or globally for every conversation.",
"workflows": "Workflows allow you to define a series of steps to guide Cline through a repetitive set of tasks, such as deploying a service or submitting a PR. To invoke a workflow, type",
"workflowsInvoke": "in the chat.",
"hooks": "Hooks allow you to execute custom scripts at specific points in Cline's execution lifecycle, enabling automation and integration with external tools.",
"hooksToggle": "Toggle to enable/disable (chmod +x/-x)."
},
"sections": {
"enterpriseRules": "Enterprise Rules",
"globalRules": "Global Rules",
"workspaceRules": "Workspace Rules",
"enterpriseWorkflows": "Enterprise Workflows",
"globalWorkflows": "Global Workflows",
"workspaceWorkflows": "Workspace Workflows",
"globalHooks": "Global Hooks",
"workspaceHooks": "Workspace Hooks"
},
"noRulesFound": "No rules found",
"noWorkflowsFound": "No workflows found",
"docs": "Docs",
"ruleRow": {
"viewRuleFile": "View rule file",
"editRuleFile": "Edit rule file",
"viewRuleFileReadOnly": "View rule file (read-only)",
"deleteRuleFile": "Delete rule file",
"ruleRequired": "This rule is required and cannot be disabled"
},
"hooks": {
"windowsWarning": "Hook toggling is not supported on Windows. Hooks can be created, edited, and deleted, but cannot be enabled/disabled and will not execute.",
"windowsTooltip": "Hook toggling not supported on Windows. Hooks can be edited and deleted, but won't execute.",
"chooseHookType": "Choose a hook type to create. Hooks execute at specific points in Cline's lifecycle. Available:",
"agentsInfo": "Searches recursively for all AGENTS.md files in the workspace when a top-level AGENTS.md exists",
"newHook": "New hook...",
"allHooksCreated": "All hooks created",
"selectHookType": "Select hook type to create"
},
"newRuleRow": {
"newWorkflowFile": "New workflow file...",
"newRuleFile": "New rule file...",
"createFile": "Create file",
"newFile": "New file",
"workflowPlaceholder": "workflow-name (.md, .txt, or no extension)",
"rulePlaceholder": "rule-name (.md, .txt, or no extension)",
"invalidExtension": "Only .md, .txt, or no file extension allowed"
}
}
}
+122
View File
@@ -403,6 +403,27 @@
"parameters": "参数",
"noDescription": "无描述"
},
"serversToggle": {
"manageServers": "管理 MCP 服务器",
"hideServers": "隐藏 MCP 服务器",
"showServers": "显示 MCP 服务器",
"goToSettings": "转到 MCP 服务器设置",
"noServersInstalled": "未安装 MCP 服务器"
},
"serverRow": {
"restartServer": "重启服务器",
"deleteServer": "删除服务器",
"retrying": "重试中...",
"retryConnection": "重试连接",
"deleting": "删除中...",
"restarting": "重启中...",
"authenticate": "认证",
"tools": "工具",
"resources": "资源",
"requestTimeout": "请求超时",
"noToolsFound": "未找到工具",
"noResourcesFound": "未找到资源"
},
"unknown": "未知"
},
"onboarding": {
@@ -564,5 +585,106 @@
"copyCommand": "复制命令",
"copied": "已复制!"
}
},
"autoApprove": {
"bar": {
"title": "自动批准:",
"yoloTitle": "自动批准:YOLO",
"yoloDescription": "YOLO 模式已启用。",
"disableInSettings": "在设置中禁用它",
"openSettings": "打开自动批准设置",
"closeSettings": "关闭自动批准设置",
"none": "无"
},
"modal": {
"description": "让 Cline 执行这些操作而无需请求批准。",
"docs": "文档",
"enableNotifications": "启用通知"
},
"mcp": {
"allTools": "自动批准所有工具"
},
"notification": {
"message": "一个自动批准的命令已运行 30 秒,可能需要您的注意。"
},
"actions": {
"readProjectFiles": "读取项目文件",
"readAllFiles": "读取所有文件",
"editProjectFiles": "编辑项目文件",
"editAllFiles": "编辑所有文件",
"executeSafeCommands": "执行安全命令",
"executeAllCommands": "执行所有命令",
"useBrowser": "使用浏览器",
"useMcpServers": "使用 MCP 服务器",
"shortNames": {
"readFiles": "读取",
"readFilesExternally": "读取(全部)",
"editFiles": "编辑",
"editFilesExternally": "编辑(全部)",
"executeSafeCommands": "安全命令",
"executeAllCommands": "所有命令",
"useBrowser": "浏览器",
"useMcp": "MCP"
}
}
},
"clineRules": {
"manageRulesAndWorkflows": "管理 Cline 规则和工作流",
"hideRulesAndWorkflows": "隐藏 Cline 规则和工作流",
"showRulesAndWorkflows": "显示 Cline 规则和工作流",
"tabs": {
"rules": "规则",
"workflows": "工作流",
"hooks": "钩子"
},
"remoteBanner": {
"rules": "您的组织管理部分规则",
"workflows": "您的组织管理部分工作流"
},
"descriptions": {
"rules": "规则允许您为 Cline 提供系统级指导。将它们视为一种持久的方式,用于为您的项目或全局的每次对话包含上下文和偏好。",
"workflows": "工作流允许您定义一系列步骤,引导 Cline 完成重复性任务,例如部署服务或提交 PR。要调用工作流,请在聊天中输入",
"workflowsInvoke": "。",
"hooks": "钩子允许您在 Cline 执行生命周期的特定点执行自定义脚本,实现自动化并与外部工具集成。",
"hooksToggle": "切换以启用/禁用 (chmod +x/-x)。"
},
"sections": {
"enterpriseRules": "企业规则",
"globalRules": "全局规则",
"workspaceRules": "工作区规则",
"enterpriseWorkflows": "企业工作流",
"globalWorkflows": "全局工作流",
"workspaceWorkflows": "工作区工作流",
"globalHooks": "全局钩子",
"workspaceHooks": "工作区钩子"
},
"noRulesFound": "未找到规则",
"noWorkflowsFound": "未找到工作流",
"docs": "文档",
"ruleRow": {
"viewRuleFile": "查看规则文件",
"editRuleFile": "编辑规则文件",
"viewRuleFileReadOnly": "查看规则文件(只读)",
"deleteRuleFile": "删除规则文件",
"ruleRequired": "此规则是必需的,无法禁用"
},
"hooks": {
"windowsWarning": "Windows 不支持钩子切换。可以创建、编辑和删除钩子,但无法启用/禁用,也不会执行。",
"windowsTooltip": "Windows 不支持钩子切换。可以编辑和删除钩子,但不会执行。",
"chooseHookType": "选择要创建的钩子类型。钩子在 Cline 生命周期的特定点执行。可用类型:",
"agentsInfo": "当存在顶级 AGENTS.md 文件时,递归搜索工作区中的所有 AGENTS.md 文件",
"newHook": "新建钩子...",
"allHooksCreated": "所有钩子已创建",
"selectHookType": "选择要创建的钩子类型"
},
"newRuleRow": {
"newWorkflowFile": "新建工作流文件...",
"newRuleFile": "新建规则文件...",
"createFile": "创建文件",
"newFile": "新建文件",
"workflowPlaceholder": "工作流名称 (.md, .txt 或无扩展名)",
"rulePlaceholder": "规则名称 (.md, .txt 或无扩展名)",
"invalidExtension": "仅允许 .md、.txt 或无文件扩展名"
}
}
}