首页汉化
This commit is contained in:
1 parent
89a2def042
commit
a852ac2176
7 files changed
+175
-23
No files matched your search
@@ -663,7 +663,7 @@ export async function readGlobalStateFromDisk(context: ExtensionContext): Promis
|
||||
autoApprovalSettings: autoApprovalSettings || DEFAULT_AUTO_APPROVAL_SETTINGS, // default value can be 0 or empty string
|
||||
globalClineRulesToggles: globalClineRulesToggles || {},
|
||||
browserSettings: { ...DEFAULT_BROWSER_SETTINGS, ...browserSettings }, // this will ensure that older versions of browserSettings (e.g. before remoteBrowserEnabled was added) are merged with the default values (false for remoteBrowserEnabled)
|
||||
preferredLanguage: preferredLanguage || "English",
|
||||
preferredLanguage: preferredLanguage || "Simplified Chinese - 简体中文",
|
||||
openaiReasoningEffort: (openaiReasoningEffort as OpenaiReasoningEffort) || "medium",
|
||||
mode: mode || "act",
|
||||
userInfo,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { BANNER_DATA, BannerAction, BannerActionType, BannerCardData } from "@shared/cline/banner"
|
||||
import { EmptyRequest, Int64Request } from "@shared/proto/index.cline"
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import BannerCarousel from "@/components/common/BannerCarousel"
|
||||
import { CURRENT_CLI_BANNER_VERSION } from "@/components/common/CliInstallBanner"
|
||||
import { CURRENT_INFO_BANNER_VERSION } from "@/components/common/InfoBanner"
|
||||
@@ -35,6 +36,7 @@ export const WelcomeSection: React.FC<WelcomeSectionProps> = ({
|
||||
const [hasShownWhatsNewModal, setHasShownWhatsNewModal] = useState(false)
|
||||
const [showWhatsNewModal, setShowWhatsNewModal] = useState(false)
|
||||
|
||||
const { t } = useTranslation()
|
||||
const { clineUser } = useClineAuth()
|
||||
const { openRouterModels, setShowChatModelSelector, navigateToSettings, subagentsEnabled } = useExtensionState()
|
||||
const { handleFieldsChange } = useApiConfigurationHandlers()
|
||||
@@ -79,7 +81,7 @@ export const WelcomeSection: React.FC<WelcomeSectionProps> = ({
|
||||
*/
|
||||
const bannerConfig = useMemo((): BannerCardData[] => {
|
||||
// Filter banners based on version tracking and user status
|
||||
return BANNER_DATA.filter((banner) => {
|
||||
const filteredBanners = BANNER_DATA.filter((banner) => {
|
||||
if (isBannerDismissed(banner.id)) {
|
||||
return false
|
||||
}
|
||||
@@ -94,7 +96,61 @@ export const WelcomeSection: React.FC<WelcomeSectionProps> = ({
|
||||
|
||||
return true
|
||||
})
|
||||
}, [isBannerDismissed, clineUser])
|
||||
|
||||
// Apply translations to banner titles and descriptions
|
||||
return filteredBanners.map((banner) => {
|
||||
const translatedBanner = { ...banner }
|
||||
|
||||
// Translate based on banner ID
|
||||
switch (banner.id) {
|
||||
case "info-banner-v1":
|
||||
translatedBanner.title = t("banner.rightSidebar.title")
|
||||
translatedBanner.description = t("banner.rightSidebar.description")
|
||||
break
|
||||
case "new-model-opus-4-5-cline-users":
|
||||
translatedBanner.title = t("banner.opus45ClineUsers.title")
|
||||
translatedBanner.description = t("banner.opus45ClineUsers.description")
|
||||
if (translatedBanner.actions) {
|
||||
translatedBanner.actions = translatedBanner.actions.map((action) => ({
|
||||
...action,
|
||||
title: action.title === "Try Now" ? t("banner.opus45ClineUsers.tryNow") : action.title,
|
||||
}))
|
||||
}
|
||||
break
|
||||
case "new-model-opus-4-5-non-cline-users":
|
||||
translatedBanner.title = t("banner.opus45NonClineUsers.title")
|
||||
translatedBanner.description = t("banner.opus45NonClineUsers.description")
|
||||
if (translatedBanner.actions) {
|
||||
translatedBanner.actions = translatedBanner.actions.map((action) => ({
|
||||
...action,
|
||||
title: action.title === "Get Started" ? t("banner.opus45NonClineUsers.getStarted") : action.title,
|
||||
}))
|
||||
}
|
||||
break
|
||||
case "cli-install-unix-v1":
|
||||
translatedBanner.title = t("banner.cliInstallUnix.title")
|
||||
translatedBanner.description = t("banner.cliInstallUnix.description")
|
||||
if (translatedBanner.actions) {
|
||||
translatedBanner.actions = translatedBanner.actions.map((action) => {
|
||||
if (action.title === "Install") {
|
||||
return { ...action, title: t("banner.cliInstallUnix.install") }
|
||||
}
|
||||
if (action.title === "Enable Subagents") {
|
||||
return { ...action, title: t("banner.cliInstallUnix.enableSubagents") }
|
||||
}
|
||||
return action
|
||||
})
|
||||
}
|
||||
break
|
||||
case "cli-info-windows-v1":
|
||||
translatedBanner.title = t("banner.cliInfoWindows.title")
|
||||
translatedBanner.description = t("banner.cliInfoWindows.description")
|
||||
break
|
||||
}
|
||||
|
||||
return translatedBanner
|
||||
})
|
||||
}, [isBannerDismissed, clineUser, t])
|
||||
|
||||
/**
|
||||
* Action handler - maps action types to actual implementations
|
||||
|
||||
@@ -2,6 +2,7 @@ import { EmptyRequest, Int64Request } from "@shared/proto/index.cline"
|
||||
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
|
||||
import { Terminal, XIcon } from "lucide-react"
|
||||
import { useCallback, useEffect, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { useExtensionState } from "@/context/ExtensionStateContext"
|
||||
import { StateServiceClient } from "@/services/grpc-client"
|
||||
@@ -11,6 +12,7 @@ import { getAsVar, VSC_INACTIVE_SELECTION_BACKGROUND } from "@/utils/vscStyles"
|
||||
export const CURRENT_CLI_BANNER_VERSION = 1
|
||||
|
||||
export const CliInstallBanner: React.FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const { navigateToSettings, subagentsEnabled } = useExtensionState()
|
||||
const [isCopied, setIsCopied] = useState(false)
|
||||
const [isClineCliInstalled, setIsClineCliInstalled] = useState(false)
|
||||
@@ -92,31 +94,29 @@ export const CliInstallBanner: React.FC = () => {
|
||||
}}>
|
||||
<h4 className="m-0 flex items-center gap-2" style={{ paddingRight: "24px" }}>
|
||||
<Terminal className="w-4 h-4" />
|
||||
{isMacOSOrLinux() ? "Cline for CLI is here!" : "Cline CLI Information"}
|
||||
{isMacOSOrLinux() ? t("banner.cliInstallBanner.titleUnix") : t("banner.cliInstallBanner.titleWindows")}
|
||||
</h4>
|
||||
<p className="m-0">
|
||||
{isMacOSOrLinux() ? (
|
||||
<>
|
||||
Install to use Cline directly in your terminal and enable subagent capabilities. Cline can spawn{" "}
|
||||
<code>cline</code> commands to handle focused tasks like exploring large codebases for information. This
|
||||
keeps your main context window clean by running these operations in separate subprocesses.{" "}
|
||||
<span dangerouslySetInnerHTML={{ __html: t("banner.cliInstallBanner.descriptionUnix") }} />{" "}
|
||||
<a
|
||||
href="https://docs.cline.bot/cline-cli/overview"
|
||||
rel="noopener noreferrer"
|
||||
style={{ color: "var(--vscode-textLink-foreground)" }}
|
||||
target="_blank">
|
||||
Learn more
|
||||
{t("banner.cliInstallBanner.learnMore")}
|
||||
</a>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
Cline CLI is available for macOS and Linux! Coming <code>soon</code> to other platforms.{" "}
|
||||
<span dangerouslySetInnerHTML={{ __html: t("banner.cliInstallBanner.descriptionWindows") }} />{" "}
|
||||
<a
|
||||
href="https://docs.cline.bot/cline-cli/overview"
|
||||
rel="noopener noreferrer"
|
||||
style={{ color: "var(--vscode-textLink-foreground)" }}
|
||||
target="_blank">
|
||||
Learn more
|
||||
{t("banner.cliInstallBanner.learnMore")}
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
@@ -134,7 +134,7 @@ export const CliInstallBanner: React.FC = () => {
|
||||
appearance="icon"
|
||||
onClick={handleCopyCommand}
|
||||
style={{ marginLeft: "8px", flexShrink: 0 }}
|
||||
title={isCopied ? "Copied!" : "Copy command"}>
|
||||
title={isCopied ? t("banner.cliInstallBanner.copied") : t("banner.cliInstallBanner.copyCommand")}>
|
||||
<span className={`codicon ${isCopied ? "codicon-check" : "codicon-copy"}`}></span>
|
||||
</VSCodeButton>
|
||||
</div>
|
||||
@@ -148,10 +148,10 @@ export const CliInstallBanner: React.FC = () => {
|
||||
{isClineCliInstalled ? (
|
||||
<>
|
||||
<span className="codicon codicon-check" style={{ marginRight: "4px" }}></span>
|
||||
Installed
|
||||
{t("banner.cliInstallBanner.installed")}
|
||||
</>
|
||||
) : (
|
||||
"Install"
|
||||
t("banner.cliInstallBanner.install")
|
||||
)}
|
||||
</VSCodeButton>
|
||||
<VSCodeButton
|
||||
@@ -159,8 +159,8 @@ export const CliInstallBanner: React.FC = () => {
|
||||
className="flex-1"
|
||||
disabled={subagentsEnabled}
|
||||
onClick={handleEnableSubagents}
|
||||
title="Configure Subagents">
|
||||
Enable Subagents
|
||||
title={t("banner.cliInstallBanner.configureSubagents")}>
|
||||
{t("banner.cliInstallBanner.enableSubagents")}
|
||||
</VSCodeButton>
|
||||
</div>
|
||||
) : (
|
||||
@@ -173,18 +173,18 @@ export const CliInstallBanner: React.FC = () => {
|
||||
{isClineCliInstalled ? (
|
||||
<>
|
||||
<span className="codicon codicon-check" style={{ marginRight: "4px" }}></span>
|
||||
Installed
|
||||
{t("banner.cliInstallBanner.installed")}
|
||||
</>
|
||||
) : (
|
||||
"Install CLI"
|
||||
t("banner.cliInstallBanner.installCli")
|
||||
)}
|
||||
</VSCodeButton>
|
||||
<VSCodeButton
|
||||
appearance="secondary"
|
||||
className="flex-1"
|
||||
disabled
|
||||
title="Cline CLI & subagents are only available on macOS & Linux">
|
||||
Subagents (Windows coming soon)
|
||||
title={t("banner.cliInstallBanner.subagentsWindowsTooltip")}>
|
||||
{t("banner.cliInstallBanner.subagentsWindows")}
|
||||
</VSCodeButton>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { XIcon } from "lucide-react"
|
||||
import { useCallback } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { PlatformType } from "@/config/platform.config"
|
||||
import { usePlatform } from "@/context/PlatformContext"
|
||||
import { StateServiceClient } from "@/services/grpc-client"
|
||||
export const CURRENT_INFO_BANNER_VERSION = 1
|
||||
export const InfoBanner: React.FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const handleClose = useCallback((e: React.MouseEvent) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
@@ -19,10 +21,10 @@ export const InfoBanner: React.FC = () => {
|
||||
rel="noopener noreferrer"
|
||||
style={{ color: "var(--vscode-foreground)", outline: "none" }}
|
||||
target="_blank">
|
||||
<h4 className="m-0">💡 Cline in the Right Sidebar</h4>
|
||||
<h4 className="m-0">{t("banner.infoBanner.title")}</h4>
|
||||
<p className="m-0">
|
||||
Keep your files visible when chatting with Cline. Drag the Cline icon to the right sidebar panel for a better
|
||||
experience. <span className="text-link cursor-pointer">See how →</span>
|
||||
{t("banner.infoBanner.description")}{" "}
|
||||
<span className="text-link cursor-pointer">{t("banner.infoBanner.seeHow")}</span>
|
||||
</p>
|
||||
|
||||
{/* Close button */}
|
||||
|
||||
@@ -199,7 +199,7 @@ export const ExtensionStateContextProvider: React.FC<{
|
||||
browserSettings: DEFAULT_BROWSER_SETTINGS,
|
||||
dictationSettings: DEFAULT_DICTATION_SETTINGS,
|
||||
focusChainSettings: DEFAULT_FOCUS_CHAIN_SETTINGS,
|
||||
preferredLanguage: "English",
|
||||
preferredLanguage: "Simplified Chinese - 简体中文",
|
||||
openaiReasoningEffort: "medium",
|
||||
mode: "act",
|
||||
platform: DEFAULT_PLATFORM,
|
||||
|
||||
@@ -517,5 +517,52 @@
|
||||
"webFetch": "Web Fetch",
|
||||
"webFetchLlm": "Web Fetch (LLM)"
|
||||
}
|
||||
},
|
||||
"banner": {
|
||||
"infoBanner": {
|
||||
"title": "💡 Cline in the Right Sidebar",
|
||||
"description": "Keep your files visible when chatting with Cline. Drag the Cline icon to the right sidebar panel for a better experience.",
|
||||
"seeHow": "See how →"
|
||||
},
|
||||
"rightSidebar": {
|
||||
"title": "Use Cline in Right Sidebar",
|
||||
"description": "For the best experience, drag the Cline icon to your right sidebar. This keeps your file explorer and editor visible while you chat with Cline, making it easier to navigate your codebase and see changes in real-time. [See how →](https://docs.cline.bot/features/customization/opening-cline-in-sidebar)"
|
||||
},
|
||||
"opus45ClineUsers": {
|
||||
"title": "Claude Opus 4.5 Now Available",
|
||||
"description": "State-of-the-art performance at 3x lower cost than Opus 4.1. Available now in the Cline provider.",
|
||||
"tryNow": "Try Now"
|
||||
},
|
||||
"opus45NonClineUsers": {
|
||||
"title": "Claude Opus 4.5 Now Available",
|
||||
"description": "State-of-the-art performance at 3x lower cost than Opus 4.1. Available now in the Cline provider.",
|
||||
"getStarted": "Get Started"
|
||||
},
|
||||
"cliInstallUnix": {
|
||||
"title": "CLI & Subagents Available",
|
||||
"description": "Use Cline in your terminal and enable subagent capabilities. [Learn more](https://docs.cline.bot/cline-cli/overview)",
|
||||
"install": "Install",
|
||||
"enableSubagents": "Enable Subagents"
|
||||
},
|
||||
"cliInfoWindows": {
|
||||
"title": "Cline CLI Info",
|
||||
"description": "Available for macOS and Linux. Coming soon to other platforms. [Learn more](https://docs.cline.bot/cline-cli/overview)"
|
||||
},
|
||||
"cliInstallBanner": {
|
||||
"titleUnix": "Cline for CLI is here!",
|
||||
"titleWindows": "Cline CLI Information",
|
||||
"descriptionUnix": "Install to use Cline directly in your terminal and enable subagent capabilities. Cline can spawn <code>cline</code> commands to handle focused tasks like exploring large codebases for information. This keeps your main context window clean by running these operations in separate subprocesses.",
|
||||
"descriptionWindows": "Cline CLI is available for macOS and Linux! Coming <code>soon</code> to other platforms.",
|
||||
"learnMore": "Learn more",
|
||||
"installed": "Installed",
|
||||
"install": "Install",
|
||||
"installCli": "Install CLI",
|
||||
"enableSubagents": "Enable Subagents",
|
||||
"configureSubagents": "Configure Subagents",
|
||||
"subagentsWindows": "Subagents (Windows coming soon)",
|
||||
"subagentsWindowsTooltip": "Cline CLI & subagents are only available on macOS & Linux",
|
||||
"copyCommand": "Copy command",
|
||||
"copied": "Copied!"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -517,5 +517,52 @@
|
||||
"webFetch": "网页抓取",
|
||||
"webFetchLlm": "网页抓取 (LLM)"
|
||||
}
|
||||
},
|
||||
"banner": {
|
||||
"infoBanner": {
|
||||
"title": "💡 在右侧边栏使用 Cline",
|
||||
"description": "与 Cline 聊天时保持文件可见。将 Cline 图标拖到右侧边栏面板以获得更好的体验。",
|
||||
"seeHow": "查看方法 →"
|
||||
},
|
||||
"rightSidebar": {
|
||||
"title": "在右侧边栏使用 Cline",
|
||||
"description": "为了获得最佳体验,请将 Cline 图标拖到您的右侧边栏。这样可以在与 Cline 聊天时保持文件资源管理器和编辑器可见,使您更容易浏览代码库并实时查看更改。[查看方法 →](https://docs.cline.bot/features/customization/opening-cline-in-sidebar)"
|
||||
},
|
||||
"opus45ClineUsers": {
|
||||
"title": "Claude Opus 4.5 现已推出",
|
||||
"description": "最先进的性能,成本比 Opus 4.1 低 3 倍。现已在 Cline 提供商中可用。",
|
||||
"tryNow": "立即试用"
|
||||
},
|
||||
"opus45NonClineUsers": {
|
||||
"title": "Claude Opus 4.5 现已推出",
|
||||
"description": "最先进的性能,成本比 Opus 4.1 低 3 倍。现已在 Cline 提供商中可用。",
|
||||
"getStarted": "开始使用"
|
||||
},
|
||||
"cliInstallUnix": {
|
||||
"title": "CLI 和子代理已推出",
|
||||
"description": "在终端中使用 Cline 并启用子代理功能。[了解更多](https://docs.cline.bot/cline-cli/overview)",
|
||||
"install": "安装",
|
||||
"enableSubagents": "启用子代理"
|
||||
},
|
||||
"cliInfoWindows": {
|
||||
"title": "Cline CLI 信息",
|
||||
"description": "适用于 macOS 和 Linux。即将在其他平台上推出。[了解更多](https://docs.cline.bot/cline-cli/overview)"
|
||||
},
|
||||
"cliInstallBanner": {
|
||||
"titleUnix": "Cline CLI 已推出!",
|
||||
"titleWindows": "Cline CLI 信息",
|
||||
"descriptionUnix": "安装后可直接在终端中使用 Cline 并启用子代理功能。Cline 可以生成 <code>cline</code> 命令来处理重点任务,如探索大型代码库以获取信息。这通过在不同的子进程中运行这些操作来保持主上下文窗口整洁。",
|
||||
"descriptionWindows": "Cline CLI 适用于 macOS 和 Linux!即将在其他平台上推出。",
|
||||
"learnMore": "了解更多",
|
||||
"installed": "已安装",
|
||||
"install": "安装",
|
||||
"installCli": "安装 CLI",
|
||||
"enableSubagents": "启用子代理",
|
||||
"configureSubagents": "配置子代理",
|
||||
"subagentsWindows": "子代理(Windows 即将推出)",
|
||||
"subagentsWindowsTooltip": "Cline CLI 和子代理仅在 macOS 和 Linux 上可用",
|
||||
"copyCommand": "复制命令",
|
||||
"copied": "已复制!"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user