diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index cc6416c9..3fa9396b 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -150,7 +150,10 @@ "generateRSA": "Generate RSA", "keyPairGeneratedSuccessfully": "{{keyType}} key pair generated successfully", "failedToGenerateKeyPair": "Failed to generate key pair", - "generateKeyPairNote": "Generate a new SSH key pair directly. This will replace any existing keys in the form." + "generateKeyPairNote": "Generate a new SSH key pair directly. This will replace any existing keys in the form.", + "invalidKey": "Invalid Key", + "detectionError": "Detection Error", + "unknown": "Unknown" }, "sshTools": { "title": "SSH Tools", @@ -852,6 +855,11 @@ "find": "Find...", "replaceWith": "Replace with...", "startTyping": "Start typing...", + "unknownSize": "Unknown size", + "fileIsEmpty": "File is empty", + "modified": "Modified", + "largeFileWarning": "Large File Warning", + "largeFileWarningDesc": "This file is {{size}} in size, which may cause performance issues when opened as text.", "fileSavedSuccessfully": "File saved successfully", "autoSaveFailed": "Auto-save failed", "fileAutoSaved": "File auto-saved", diff --git a/src/locales/zh/translation.json b/src/locales/zh/translation.json index eac14415..495f784b 100644 --- a/src/locales/zh/translation.json +++ b/src/locales/zh/translation.json @@ -149,7 +149,10 @@ "generateRSA": "生成 RSA", "keyPairGeneratedSuccessfully": "{{keyType}} 密钥对生成成功", "failedToGenerateKeyPair": "生成密钥对失败", - "generateKeyPairNote": "直接生成新的SSH密钥对。这将替换表单中的现有密钥。" + "generateKeyPairNote": "直接生成新的SSH密钥对。这将替换表单中的现有密钥。", + "invalidKey": "无效密钥", + "detectionError": "检测错误", + "unknown": "未知" }, "sshTools": { "title": "SSH 工具", @@ -761,6 +764,11 @@ "filesCopiedToClipboard": "{{count}} 个项目已复制到剪贴板", "filesCutToClipboard": "{{count}} 个项目已剪切到剪贴板", "movedItems": "已移动 {{count}} 个项目", + "unknownSize": "未知大小", + "fileIsEmpty": "文件为空", + "modified": "修改时间", + "largeFileWarning": "大文件警告", + "largeFileWarningDesc": "此文件大小为 {{size}},以文本形式打开可能会导致性能问题。", "failedToDeleteItem": "删除项目失败", "itemRenamedSuccessfully": "{{type}}重命名成功", "failedToRenameItem": "重命名项目失败", diff --git a/src/ui/Desktop/Apps/Credentials/CredentialEditor.tsx b/src/ui/Desktop/Apps/Credentials/CredentialEditor.tsx index c430f0c4..03933b4b 100644 --- a/src/ui/Desktop/Apps/Credentials/CredentialEditor.tsx +++ b/src/ui/Desktop/Apps/Credentials/CredentialEditor.tsx @@ -315,9 +315,9 @@ export function CredentialEditor({ "ssh-dss": "DSA (SSH)", "rsa-sha2-256": "RSA-SHA2-256", "rsa-sha2-512": "RSA-SHA2-512", - invalid: "Invalid Key", - error: "Detection Error", - unknown: "Unknown", + invalid: t("credentials.invalidKey"), + error: t("credentials.detectionError"), + unknown: t("credentials.unknown"), }; return keyTypeMap[keyType] || keyType; }; diff --git a/src/ui/Desktop/Apps/File Manager/components/FileViewer.tsx b/src/ui/Desktop/Apps/File Manager/components/FileViewer.tsx index 05a90902..a3dc3531 100644 --- a/src/ui/Desktop/Apps/File Manager/components/FileViewer.tsx +++ b/src/ui/Desktop/Apps/File Manager/components/FileViewer.tsx @@ -261,8 +261,8 @@ function getLanguageExtension(filename: string) { } // Format file size -function formatFileSize(bytes?: number): string { - if (!bytes) return "Unknown size"; +function formatFileSize(bytes?: number, t?: any): string { + if (!bytes) return t ? t("fileManager.unknownSize") : "Unknown size"; const sizes = ["B", "KB", "MB", "GB"]; const i = Math.floor(Math.log(bytes) / Math.log(1024)); return `${(bytes / Math.pow(1024, i)).toFixed(1)} ${sizes[i]}`; @@ -504,8 +504,8 @@ export function FileViewer({

{file.name}

- {formatFileSize(file.size)} - {file.modified && Modified: {file.modified}} + {formatFileSize(file.size, t)} + {file.modified && {t("fileManager.modified")}: {file.modified}}

- Large File Warning + {t("fileManager.largeFileWarning")}

- This file is {formatFileSize(file.size)} in size, which may - cause performance issues when opened as text. + {t("fileManager.largeFileWarningDesc", { size: formatFileSize(file.size, t) })}

{isTooLarge ? (
@@ -854,7 +853,7 @@ export function FileViewer({ ) : ( // Only show as read-only for non-editable files (media files)
- {editedContent || content || "File is empty"} + {editedContent || content || t("fileManager.fileIsEmpty")}
)}