diff --git a/src/ui/Desktop/Apps/File Manager/FileManagerContextMenu.tsx b/src/ui/Desktop/Apps/File Manager/FileManagerContextMenu.tsx
index 5c7a15b8..844a2ec2 100644
--- a/src/ui/Desktop/Apps/File Manager/FileManagerContextMenu.tsx
+++ b/src/ui/Desktop/Apps/File Manager/FileManagerContextMenu.tsx
@@ -107,7 +107,7 @@ export function FileManagerContextMenu({
useEffect(() => {
if (!isVisible) return;
- // 调整菜单位置避免超出屏幕
+ // Adjust menu position to avoid going off screen
const adjustPosition = () => {
const menuWidth = 200;
const menuHeight = 300;
@@ -130,13 +130,13 @@ export function FileManagerContextMenu({
adjustPosition();
- // 延迟添加事件监听器,避免捕获到触发菜单的那次点击
+ // Delay adding event listeners to avoid capturing the click that triggered the menu
let cleanupFn: (() => void) | null = null;
const timeoutId = setTimeout(() => {
- // 点击外部关闭菜单
+ // Click outside to close menu
const handleClickOutside = (event: MouseEvent) => {
- // 检查点击是否在菜单内部
+ // Check if click is inside menu
const target = event.target as Element;
const menuElement = document.querySelector("[data-context-menu]");
@@ -145,13 +145,13 @@ export function FileManagerContextMenu({
}
};
- // 右键点击关闭菜单(Windows行为)
+ // Right-click to close menu (Windows behavior)
const handleRightClick = (event: MouseEvent) => {
event.preventDefault();
onClose();
};
- // 键盘支持
+ // Keyboard support
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === "Escape") {
event.preventDefault();
@@ -159,12 +159,12 @@ export function FileManagerContextMenu({
}
};
- // 窗口失焦关闭菜单
+ // Close menu on window blur
const handleBlur = () => {
onClose();
};
- // 滚动时关闭菜单(Windows行为)
+ // Close menu on scroll (Windows behavior)
const handleScroll = () => {
onClose();
};
@@ -175,7 +175,7 @@ export function FileManagerContextMenu({
window.addEventListener("blur", handleBlur);
window.addEventListener("scroll", handleScroll, true);
- // 设置清理函数
+ // Set cleanup function
cleanupFn = () => {
document.removeEventListener("mousedown", handleClickOutside, true);
document.removeEventListener("contextmenu", handleRightClick);
@@ -183,7 +183,7 @@ export function FileManagerContextMenu({
window.removeEventListener("blur", handleBlur);
window.removeEventListener("scroll", handleScroll, true);
};
- }, 50); // 50ms延迟,确保不会捕获到触发菜单的点击
+ }, 50); // 50ms delay to ensure we don't capture the click that triggered the menu
return () => {
clearTimeout(timeoutId);
@@ -204,13 +204,13 @@ export function FileManagerContextMenu({
(f) => f.type === "file" && f.executable,
);
- // 构建菜单项
+ // Build menu items
const menuItems: MenuItem[] = [];
if (isFileContext) {
- // 文件/文件夹选中时的菜单
+ // Menu when files/folders are selected
- // 打开终端功能 - 支持文件和文件夹
+ // Open terminal function - supports files and folders
if (onOpenTerminal) {
const targetPath = isSingleFile
? files[0].type === "directory"
@@ -229,7 +229,7 @@ export function FileManagerContextMenu({
});
}
- // 运行可执行文件功能 - 仅对单个可执行文件显示
+ // Run executable file function - only show for single executable files
if (isSingleFile && hasExecutableFiles && onRunExecutable) {
menuItems.push({
icon:
@@ -1359,7 +1359,7 @@ export function FileManagerGrid({
正在加载文件对比...
+{t("fileManager.loadingFileComparison")}
{error}
初始化编辑器...
+{t("fileManager.initializingEditor")}
;
}
-// 获取文件类型和图标
+// Get file type and icon
function getFileType(filename: string): {
type: string;
icon: React.ReactNode;
@@ -209,17 +209,17 @@ function getFileType(filename: string): {
}
}
-// 获取CodeMirror语言扩展
+// Get CodeMirror language extension
function getLanguageExtension(filename: string) {
const ext = filename.split(".").pop()?.toLowerCase() || "";
const baseName = filename.toLowerCase();
- // 特殊文件名处理
+ // Special filename handling
if (["dockerfile", "makefile", "rakefile", "gemfile"].includes(baseName)) {
return loadLanguage(baseName);
}
- // 根据扩展名映射
+ // Map by file extension
const langMap: Record