修复核心UI文本的i18n问题:支持多语言切换

主要修复:
- 右键菜单:在此处打开终端、运行、保存到系统
- 拖拽提示:拖拽系统文件到此处上传、拖拽文件到窗口外下载
- 终端窗口标题和状态提示
- 错误消息:没有选择主机、只能运行可执行文件
- 添加完整的中英文翻译条目

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ZacharyZcR
2025-09-17 01:32:15 +08:00
parent 948704055b
commit a0c3ce307d
5 changed files with 38 additions and 14 deletions

View File

@@ -206,7 +206,7 @@ export function FileManagerContextMenu({
menuItems.push({
icon: <Terminal className="w-4 h-4" />,
label: files[0].type === 'directory' ? "在此文件夹打开终端" : "在文件位置打开终端",
label: files[0].type === 'directory' ? t("fileManager.openTerminalInFolder") : t("fileManager.openTerminalInFileLocation"),
action: () => onOpenTerminal(targetPath),
shortcut: "Ctrl+T"
});
@@ -216,7 +216,7 @@ export function FileManagerContextMenu({
if (isSingleFile && hasExecutableFiles && onRunExecutable) {
menuItems.push({
icon: <Play className="w-4 h-4" />,
label: "运行",
label: t("fileManager.run"),
action: () => onRunExecutable(files[0]),
shortcut: "Enter"
});
@@ -322,7 +322,7 @@ export function FileManagerContextMenu({
if (onOpenTerminal && currentPath) {
menuItems.push({
icon: <Terminal className="w-4 h-4" />,
label: "在此处打开终端",
label: t("fileManager.openTerminalHere"),
action: () => onOpenTerminal(currentPath),
shortcut: "Ctrl+T"
});

View File

@@ -894,10 +894,10 @@ export function FileManagerGrid({
<div className="text-center p-8 bg-background/95 border-2 border-dashed border-primary rounded-lg shadow-lg">
<Upload className="w-16 h-16 mx-auto mb-4 text-primary" />
<p className="text-xl font-semibold text-foreground mb-2">
{t("fileManager.dragFilesToUpload")}
</p>
<p className="text-sm text-muted-foreground">
{t("fileManager.dragSystemFilesToUpload")}
</p>
</div>
</div>
@@ -912,11 +912,11 @@ export function FileManagerGrid({
<div className="space-y-3">
<div className="flex items-center justify-center gap-2 text-sm text-muted-foreground bg-muted/50 rounded-md px-3 py-2">
<Upload className="w-4 h-4" />
{t("fileManager.dragSystemFilesToUpload")}
</div>
<div className="flex items-center justify-center gap-2 text-sm text-muted-foreground bg-muted/50 rounded-md px-3 py-2">
<Download className="w-4 h-4" />
{t("fileManager.dragFilesToWindowToDownload")}
</div>
</div>
</div>

View File

@@ -1141,7 +1141,7 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) {
// 打开终端处理函数
function handleOpenTerminal(path: string) {
if (!currentHost) {
toast.error("没有选择主机");
toast.error(t("fileManager.noHostSelected"));
return;
}
@@ -1172,18 +1172,18 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) {
component: createTerminalComponent
});
toast.success(`${path} 打开终端`);
toast.success(t("fileManager.terminalWithPath", { host: currentHost.name, path }));
}
// 运行可执行文件处理函数
function handleRunExecutable(file: FileItem) {
if (!currentHost) {
toast.error("没有选择主机");
toast.error(t("fileManager.noHostSelected"));
return;
}
if (file.type !== 'file' || !file.executable) {
toast.error("只能运行可执行文件");
toast.error(t("fileManager.onlyRunExecutableFiles"));
return;
}
@@ -1209,7 +1209,7 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) {
);
openWindow({
title: `运行 - ${file.name}`,
title: t("fileManager.runningFile", { file: file.name }),
x: offsetX,
y: offsetY,
width: 800,
@@ -1219,7 +1219,7 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) {
component: createExecutionTerminal
});
toast.success(`正在运行: ${file.name}`);
toast.success(t("fileManager.runningFile", { file: file.name }));
}
// 过滤文件并添加新建的临时项目