diff --git a/src/backend/utils/data-crypto.ts b/src/backend/utils/data-crypto.ts index 0ad495ef..fb9aa387 100644 --- a/src/backend/utils/data-crypto.ts +++ b/src/backend/utils/data-crypto.ts @@ -22,7 +22,7 @@ class DataCrypto { } /** - * 加密记录 - 简单直接 + * Encrypt record - simple and direct */ static encryptRecord(tableName: string, record: any, userId: string, userDataKey: Buffer): any { const encryptedRecord = { ...record }; @@ -74,7 +74,7 @@ class DataCrypto { } /** - * 批量解密 + * Batch decrypt */ static decryptRecords(tableName: string, records: any[], userId: string, userDataKey: Buffer): any[] { if (!Array.isArray(records)) return records; @@ -82,14 +82,14 @@ class DataCrypto { } /** - * 获取用户数据密钥 + * Get user data key */ static getUserDataKey(userId: string): Buffer | null { return this.userCrypto.getUserDataKey(userId); } /** - * 验证用户访问权限 - 简单直接 + * Verify user access permissions - simple and direct */ static validateUserAccess(userId: string): Buffer { const userDataKey = this.getUserDataKey(userId); @@ -100,7 +100,7 @@ class DataCrypto { } /** - * 便捷方法:自动获取用户密钥并加密 + * Convenience method: automatically get user key and encrypt */ static encryptRecordForUser(tableName: string, record: any, userId: string): any { const userDataKey = this.validateUserAccess(userId); @@ -108,7 +108,7 @@ class DataCrypto { } /** - * 便捷方法:自动获取用户密钥并解密 + * Convenience method: automatically get user key and decrypt */ static decryptRecordForUser(tableName: string, record: any, userId: string): any { const userDataKey = this.validateUserAccess(userId); @@ -116,7 +116,7 @@ class DataCrypto { } /** - * 便捷方法:批量解密 + * Convenience method: batch decrypt */ static decryptRecordsForUser(tableName: string, records: any[], userId: string): any[] { const userDataKey = this.validateUserAccess(userId); @@ -124,14 +124,14 @@ class DataCrypto { } /** - * 检查用户是否可以访问数据 + * Check if user can access data */ static canUserAccessData(userId: string): boolean { return this.userCrypto.isUserUnlocked(userId); } /** - * 测试加密功能 + * Test encryption functionality */ static testUserEncryption(userId: string): boolean { try { diff --git a/src/ui/Desktop/Admin/AdminSettings.tsx b/src/ui/Desktop/Admin/AdminSettings.tsx index 47f3ab35..269f518e 100644 --- a/src/ui/Desktop/Admin/AdminSettings.tsx +++ b/src/ui/Desktop/Admin/AdminSettings.tsx @@ -839,7 +839,7 @@ export function AdminSettings({
{t("admin.encryptionStatus")}
-
已启用 (v2-kek-dek)
+
{t("admin.encryptionEnabled")}
diff --git a/src/ui/components/DragIndicator.tsx b/src/ui/components/DragIndicator.tsx index ff279bf9..d883f270 100644 --- a/src/ui/components/DragIndicator.tsx +++ b/src/ui/components/DragIndicator.tsx @@ -1,5 +1,6 @@ import React from "react"; import { cn } from "@/lib/utils"; +import { useTranslation } from "react-i18next"; import { Download, FileDown, @@ -30,6 +31,8 @@ export function DragIndicator({ error, className, }: DragIndicatorProps) { + const { t } = useTranslation(); + if (!isVisible) return null; const getIcon = () => { @@ -54,18 +57,22 @@ export function DragIndicator({ const getStatusText = () => { if (error) { - return `错误: ${error}`; + return t("dragIndicator.error", { error }); } if (isDragging) { - return `正在拖拽${fileName ? ` ${fileName}` : ""}到桌面...`; + return t("dragIndicator.dragging", { fileName: fileName || "" }); } if (isDownloading) { - return `正在准备拖拽${fileName ? ` ${fileName}` : ""}...`; + return t("dragIndicator.preparing", { fileName: fileName || "" }); } - return `准备拖拽${fileCount > 1 ? ` ${fileCount} 个文件` : fileName ? ` ${fileName}` : ""}`; + if (fileCount > 1) { + return t("dragIndicator.readyMultiple", { count: fileCount }); + } + + return t("dragIndicator.readySingle", { fileName: fileName || "" }); }; return ( @@ -86,7 +93,7 @@ export function DragIndicator({
{/* Title */}
- {fileCount > 1 ? "批量拖拽到桌面" : "拖拽到桌面"} + {fileCount > 1 ? t("dragIndicator.batchDrag") : t("dragIndicator.dragToDesktop")}
{/* Status text */} @@ -127,7 +134,7 @@ export function DragIndicator({ {isDragging && !error && (
- 现在可以拖拽到桌面任意位置 + {t("dragIndicator.canDragAnywhere")}
)}