Complete Chinese comment cleanup in File Manager components

- FileManagerModern.tsx: Translate all Chinese comments to English, replace hardcoded text with i18n
- TerminalWindow.tsx: Complete translation and add i18n support
- DiffWindow.tsx: Complete translation and add i18n support
- FileManagerOperations.tsx: Complete translation
- Fix missed comment in FileManagerGrid.tsx

All File Manager components now have clean English comments and proper internationalization.
Follow Linus principles: simple, direct, no unnecessary complexity.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ZacharyZcR
2025-09-22 02:19:27 +08:00
parent d693dc5a14
commit 35145aeced
5 changed files with 113 additions and 109 deletions

View File

@@ -2,6 +2,7 @@ import React from "react";
import { DraggableWindow } from "./DraggableWindow";
import { DiffViewer } from "./DiffViewer";
import { useWindowManager } from "./WindowManager";
import { useTranslation } from "react-i18next";
import type { FileItem, SSHHost } from "../../../../types/index.js";
interface DiffWindowProps {
@@ -23,12 +24,13 @@ export function DiffWindow({
initialX = 150,
initialY = 100,
}: DiffWindowProps) {
const { t } = useTranslation();
const { closeWindow, minimizeWindow, maximizeWindow, focusWindow, windows } =
useWindowManager();
const currentWindow = windows.find((w) => w.id === windowId);
// 窗口操作处理
// Window operation handling
const handleClose = () => {
closeWindow(windowId);
};
@@ -51,7 +53,7 @@ export function DiffWindow({
return (
<DraggableWindow
title={`文件对比: ${file1.name}${file2.name}`}
title={t("fileManager.fileComparison", { file1: file1.name, file2: file2.name })}
initialX={initialX}
initialY={initialY}
initialWidth={1200}

View File

@@ -2,6 +2,7 @@ import React from "react";
import { DraggableWindow } from "./DraggableWindow";
import { Terminal } from "../../Terminal/Terminal";
import { useWindowManager } from "./WindowManager";
import { useTranslation } from "react-i18next";
interface SSHHost {
id: number;
@@ -34,10 +35,11 @@ export function TerminalWindow({
initialY = 150,
executeCommand,
}: TerminalWindowProps) {
const { t } = useTranslation();
const { closeWindow, minimizeWindow, maximizeWindow, focusWindow, windows } =
useWindowManager();
// 获取当前窗口状态
// Get current window state
const currentWindow = windows.find((w) => w.id === windowId);
if (!currentWindow) {
console.warn(`Window with id ${windowId} not found`);
@@ -61,10 +63,10 @@ export function TerminalWindow({
};
const terminalTitle = executeCommand
? `运行 - ${hostConfig.name}:${executeCommand}`
? t("terminal.runTitle", { host: hostConfig.name, command: executeCommand })
: initialPath
? `终端 - ${hostConfig.name}:${initialPath}`
: `终端 - ${hostConfig.name}`;
? t("terminal.terminalWithPath", { host: hostConfig.name, path: initialPath })
: t("terminal.terminalTitle", { host: hostConfig.name });
return (
<DraggableWindow