From 4e9e5da13cba2372dbf09025d8339174dcc6fe31 Mon Sep 17 00:00:00 2001 From: "LAPTOP-O016UC3M\\Qi Chen" <16399091+binaricat@users.noreply.github.com> Date: Wed, 17 Dec 2025 14:25:05 +0800 Subject: [PATCH] Localizes UI and improves dynamic translation support Integrates all user-facing strings into the translation system and expands locale files for comprehensive coverage, enabling dynamic i18n across the interface. Replaces hardcoded labels, button texts, and prompts with translation keys, benefiting maintainability and future language support. Improves translation ergonomics in forms, dialogs, wizards, and settings, ensuring consistent user experience in both English and Chinese. --- application/i18n/locales/en.ts | 373 ++++++++++++++++++ application/i18n/locales/zh-CN.ts | 371 +++++++++++++++++ application/state/useAutoSync.ts | 23 +- components/AuthDialog.tsx | 30 +- components/KeyManager.tsx | 40 +- components/KeychainManager.tsx | 182 +++++---- components/PortForwardingNew.tsx | 43 +- components/QuickConnectWizard.tsx | 99 ++--- components/SftpView.tsx | 12 +- components/SnippetsManager.tsx | 111 +++--- components/SyncStatusButton.tsx | 43 +- components/Terminal.tsx | 6 +- components/TopTabs.tsx | 12 +- components/VaultView.tsx | 6 +- components/host-details/ChainPanel.tsx | 18 +- components/host-details/CreateGroupPanel.tsx | 18 +- components/host-details/EnvVarsPanel.tsx | 24 +- components/host-details/ProxyPanel.tsx | 24 +- components/keychain/EditKeyPanel.tsx | 20 +- components/keychain/ExportKeyPanel.tsx | 77 ++-- components/keychain/GenerateStandardPanel.tsx | 18 +- components/keychain/IdentityPanel.tsx | 34 +- components/keychain/ImportKeyPanel.tsx | 22 +- components/keychain/ViewKeyPanel.tsx | 12 +- components/port-forwarding/EditPanel.tsx | 34 +- components/port-forwarding/NewFormPanel.tsx | 37 +- components/port-forwarding/RuleCard.tsx | 16 +- components/port-forwarding/WizardContent.tsx | 78 ++-- components/port-forwarding/index.ts | 11 +- components/port-forwarding/utils.tsx | 34 +- .../settings/tabs/SettingsShortcutsTab.tsx | 29 +- .../settings/tabs/SettingsTerminalTab.tsx | 127 +++--- components/sftp/SftpConflictDialog.tsx | 28 +- components/sftp/SftpHostPicker.tsx | 16 +- components/sftp/SftpPermissionsDialog.tsx | 22 +- components/ui/dialog.tsx | 45 ++- domain/quickConnect.ts | 52 +++ 37 files changed, 1537 insertions(+), 610 deletions(-) create mode 100644 domain/quickConnect.ts diff --git a/application/i18n/locales/en.ts b/application/i18n/locales/en.ts index 8a76fc770..74da749ee 100644 --- a/application/i18n/locales/en.ts +++ b/application/i18n/locales/en.ts @@ -7,15 +7,35 @@ const en: Messages = { 'common.close': 'Close', 'common.settings': 'Settings', 'common.search': 'Search', + 'common.searchPlaceholder': 'Search...', 'common.connect': 'Connect', 'common.terminal': 'Terminal', 'common.create': 'Create', + 'common.import': 'Import', + 'common.generate': 'Generate', + 'common.delete': 'Delete', + 'common.optional': 'Optional', + 'common.selectPlaceholder': 'Select...', 'common.rename': 'Rename', 'common.refresh': 'Refresh', 'common.continue': 'Continue', 'common.enabled': 'Enabled', 'common.disabled': 'Disabled', + 'common.error': 'Error', + 'common.validation': 'Validation', 'common.unknownError': 'Unknown error', + 'common.back': 'Back', + 'common.apply': 'Apply', + 'common.saveChanges': 'Save Changes', + 'common.advanced': 'Advanced', + 'common.left': 'Left', + 'common.right': 'Right', + 'common.selectAHost': 'Select a host', + 'common.selectAHostPlaceholder': 'Select a host...', + 'field.label': 'Label', + 'field.type': 'Type', + 'auth.keyType': 'Type {type}', + 'auth.showAllKeys': 'Show all keys', // Dialogs / prompts 'confirm.deleteHost': 'Delete Host "{name}"?', @@ -57,6 +77,85 @@ const en: Messages = { 'settings.appearance.language': 'Language', 'settings.appearance.language.desc': 'Choose the UI language', + // Settings > Terminal + 'settings.terminal.section.theme': 'Terminal Theme', + 'settings.terminal.section.font': 'Font', + 'settings.terminal.section.cursor': 'Cursor', + 'settings.terminal.section.keyboard': 'Keyboard', + 'settings.terminal.section.accessibility': 'Accessibility', + 'settings.terminal.section.behavior': 'Behavior', + 'settings.terminal.section.scrollback': 'Scrollback', + 'settings.terminal.section.keywordHighlight': 'Keyword highlighting', + 'settings.terminal.font.family': 'Font', + 'settings.terminal.font.family.desc': 'Terminal font family', + 'settings.terminal.font.size': 'Font size', + 'settings.terminal.font.size.desc': 'Terminal text size', + 'settings.terminal.font.weight': 'Font weight', + 'settings.terminal.font.weight.desc': 'Weight for regular text (100-900)', + 'settings.terminal.font.weightBold': 'Bold font weight', + 'settings.terminal.font.weightBold.desc': 'Weight for bold text (100-900)', + 'settings.terminal.font.linePadding': 'Line padding', + 'settings.terminal.font.linePadding.desc': 'Additional space between lines (0-10)', + 'settings.terminal.font.emulationType': 'Terminal emulation type', + 'settings.terminal.cursor.style': 'Cursor style', + 'settings.terminal.cursor.style.block': 'Block', + 'settings.terminal.cursor.style.bar': 'Bar', + 'settings.terminal.cursor.style.underline': 'Underline', + 'settings.terminal.cursor.blink': 'Cursor blink', + 'settings.terminal.keyboard.altAsMeta': 'Use Option as Meta key', + 'settings.terminal.keyboard.altAsMeta.desc': + 'Use Option (Alt) as the Meta key instead of for special characters', + 'settings.terminal.accessibility.minimumContrastRatio': 'Minimum contrast ratio', + 'settings.terminal.accessibility.minimumContrastRatio.desc': + 'Adjust colors to meet contrast requirements (1 = disabled, 21 = max)', + 'settings.terminal.behavior.rightClick': 'Right-click behavior', + 'settings.terminal.behavior.rightClick.desc': 'Action when right-clicking in terminal', + 'settings.terminal.behavior.rightClick.menu': 'Show menu', + 'settings.terminal.behavior.rightClick.paste': 'Paste', + 'settings.terminal.behavior.rightClick.selectWord': 'Select word', + 'settings.terminal.behavior.copyOnSelect': 'Copy on select', + 'settings.terminal.behavior.copyOnSelect.desc': 'Automatically copy selected text', + 'settings.terminal.behavior.middleClickPaste': 'Middle-click paste', + 'settings.terminal.behavior.middleClickPaste.desc': + 'Paste clipboard content on middle-click', + 'settings.terminal.behavior.scrollOnInput': 'Scroll on input', + 'settings.terminal.behavior.scrollOnInput.desc': 'Scroll terminal to bottom when typing', + 'settings.terminal.behavior.scrollOnOutput': 'Scroll on output', + 'settings.terminal.behavior.scrollOnOutput.desc': + 'Scroll terminal to bottom when new output arrives', + 'settings.terminal.behavior.scrollOnKeyPress': 'Scroll on key press', + 'settings.terminal.behavior.scrollOnKeyPress.desc': + 'Scroll terminal to bottom when pressing a key (e.g., Enter)', + 'settings.terminal.behavior.scrollOnPaste': 'Scroll on paste', + 'settings.terminal.behavior.scrollOnPaste.desc': + 'Scroll terminal to bottom when pasting text', + 'settings.terminal.behavior.linkModifier': 'Link modifier key', + 'settings.terminal.behavior.linkModifier.desc': 'Hold this key to click on links in terminal', + 'settings.terminal.behavior.linkModifier.none': 'None (click directly)', + 'settings.terminal.behavior.linkModifier.ctrl': 'Ctrl', + 'settings.terminal.behavior.linkModifier.alt': 'Alt / Option', + 'settings.terminal.behavior.linkModifier.meta': 'Cmd / Win', + 'settings.terminal.scrollback.desc': 'Limit number of terminal rows. Set to 0 for no limit.', + 'settings.terminal.scrollback.rows': 'Number of rows *', + 'settings.terminal.keywordHighlight.title': 'Keyword highlighting', + 'settings.terminal.keywordHighlight.resetColors': 'Reset to default colors', + + // Settings > Shortcuts + 'settings.shortcuts.section.scheme': 'Hotkey Scheme', + 'settings.shortcuts.scheme.label': 'Keyboard shortcuts', + 'settings.shortcuts.scheme.desc': 'Choose which keyboard layout to use for shortcuts', + 'settings.shortcuts.scheme.disabled': 'Disabled', + 'settings.shortcuts.scheme.mac': 'Mac (Cmd)', + 'settings.shortcuts.scheme.pc': 'PC (Ctrl)', + 'settings.shortcuts.section.custom': 'Custom Shortcuts', + 'settings.shortcuts.resetAll': 'Reset All', + 'settings.shortcuts.recording': 'Press keys...', + 'settings.shortcuts.none': 'None', + 'settings.shortcuts.category.tabs': 'Tabs', + 'settings.shortcuts.category.terminal': 'Terminal', + 'settings.shortcuts.category.navigation': 'Navigation', + 'settings.shortcuts.category.app': 'App', + // Context menus / common actions 'action.newHost': 'New Host', 'action.newSubfolder': 'New Subfolder', @@ -64,6 +163,12 @@ const en: Messages = { 'action.keyExport': 'Key Export', 'action.edit': 'Edit', 'action.delete': 'Delete', + 'action.duplicate': 'Duplicate', + 'action.open': 'Open', + 'action.copy': 'Copy', + 'action.run': 'Run', + 'action.start': 'Start', + 'action.stop': 'Stop', 'action.remove': 'Remove', 'action.convertToHost': 'Convert to Host', @@ -74,6 +179,23 @@ const en: Messages = { 'sync.syncing': 'Syncing...', 'sync.error': 'Sync Error', 'sync.notConfigured': 'Not Configured', + 'sync.failed': 'Sync failed', + 'sync.connected': 'Connected', + 'sync.syncNow': 'Sync Now', + 'sync.recentActivity': 'Recent activity', + 'sync.history.uploaded': 'Uploaded', + 'sync.history.downloaded': 'Downloaded', + 'sync.history.resolved': 'Resolved', + 'sync.toast.completedMessage': 'Sync completed successfully', + 'sync.toast.errorTitle': 'Sync Error', + 'sync.autoSync.failedTitle': 'Sync failed', + 'sync.autoSync.syncedTitle': 'Synced from cloud', + 'sync.autoSync.syncedMessage': 'Your data has been updated from the cloud.', + 'sync.autoSync.noProvider': 'No cloud provider connected. Open Settings → Sync & Cloud to connect one.', + 'sync.autoSync.alreadySyncing': 'Sync is already in progress.', + 'sync.autoSync.vaultLocked': 'Vault is locked. Open Settings → Sync & Cloud to unlock.', + 'sync.autoSync.conflictDetected': 'Sync conflict detected. Open Settings → Sync & Cloud to resolve.', + 'sync.autoSync.syncFailed': 'Sync failed', 'time.never': 'Never', 'time.justNow': 'Just now', 'time.minutesAgo': '{minutes}m ago', @@ -131,6 +253,46 @@ const en: Messages = { 'pf.wizard.skipWizard': 'Skip wizard', 'pf.error.hostNotFound': 'Host not found', 'pf.toast.titleWithLabel': 'Port Forwarding: {label}', + 'pf.type.local': 'Local', + 'pf.type.remote': 'Remote', + 'pf.type.dynamic': 'Dynamic', + 'pf.type.local.desc': "Local forwarding lets you access a remote server's listening port as though it were local.", + 'pf.type.remote.desc': 'Remote forwarding opens a port on the remote machine and forwards connections to the local (current) host.', + 'pf.type.dynamic.desc': 'Dynamic port forwarding turns Netcatty into a SOCKS proxy server.', + 'pf.wizard.type.title': 'Select the port forwarding type:', + 'pf.wizard.localConfig.title': 'Set the local port and binding address:', + 'pf.wizard.localConfig.desc': 'This port will be open on the local (current) device, and it will receive the traffic.', + 'pf.wizard.localConfig.localPort': 'Local port number *', + 'pf.wizard.bindAddress': 'Bind address', + 'pf.wizard.remoteHost.title': 'Select the remote host:', + 'pf.wizard.remoteHost.desc': 'Select a host where the port will be open. Traffic from this port will be forwarded to the destination host.', + 'pf.wizard.remoteConfig.title': 'Set the port and binding address:', + 'pf.wizard.remoteConfig.desc': 'Traffic will be forwarded from the specified port and interface address of the selected host.', + 'pf.wizard.remoteConfig.remotePort': 'Remote port number *', + 'pf.wizard.destination.title': 'Select the destination host:', + 'pf.wizard.destination.desc.local': 'Enter the remote destination that you want to access through the tunnel.', + 'pf.wizard.destination.desc.remote': 'The destination address and port where the traffic will be forwarded.', + 'pf.wizard.destination.address': 'Destination address *', + 'pf.wizard.destination.addressPlaceholder': 'e.g. 127.0.0.1 or 192.168.1.100', + 'pf.wizard.destination.port': 'Destination port number *', + 'pf.wizard.sshServer.title': 'Select the SSH server:', + 'pf.wizard.sshServer.desc.dynamic': 'Select the SSH server that will act as your SOCKS proxy.', + 'pf.wizard.sshServer.desc.default': 'Select the SSH server that will tunnel your traffic to the destination.', + 'pf.wizard.label.title': 'Select the label:', + 'pf.wizard.label.placeholder.dynamic': 'e.g. SOCKS Proxy', + 'pf.wizard.label.placeholder.default': 'e.g. MySQL Production', + 'pf.wizard.label.placeholder.remoteRule': 'e.g. Remote Rule', + 'pf.wizard.placeholders.portExample': 'e.g. {port}', + 'pf.action.newForwarding': 'New Forwarding', + 'pf.form.labelPlaceholder': 'Rule label', + 'pf.form.intermediateHost': 'Intermediate host *', + 'pf.form.createRule': 'Create Rule', + 'pf.form.openWizard': 'Open Wizard', + 'pf.form.openWizardTitle': 'Open Port Forwarding Wizard', + 'pf.view.grid': 'Grid', + 'pf.view.list': 'List', + 'pf.rule.summary.dynamic': 'SOCKS on {bindAddress}:{localPort}', + 'pf.rule.summary.default': '{bindAddress}:{localPort} -> {remoteHost}:{remotePort}', // SFTP 'sftp.newFolder': 'New Folder', @@ -176,6 +338,35 @@ const en: Messages = { 'sftp.error.uploadFailed': 'Upload failed', 'sftp.error.deleteFailed': 'Delete failed', 'sftp.error.createFolderFailed': 'Failed to create folder', + 'sftp.picker.title': 'Select Host', + 'sftp.picker.desc': 'Pick a host for the {side} pane', + 'sftp.picker.searchPlaceholder': 'Search hosts...', + 'sftp.picker.local.title': 'Local filesystem', + 'sftp.picker.local.desc': 'Browse local files', + 'sftp.picker.local.badge': 'Local', + 'sftp.picker.noMatch': 'No matching hosts', + 'sftp.permissions.title': 'Edit Permissions', + 'sftp.permissions.owner': 'Owner', + 'sftp.permissions.group': 'Group', + 'sftp.permissions.others': 'Others', + 'sftp.permissions.octal': 'Octal', + 'sftp.permissions.symbolic': 'Symbolic', + 'sftp.pane.local': 'Local', + 'sftp.pane.remote': 'Remote', + 'sftp.pane.selectHost': 'Select host', + 'sftp.pane.selectHostToStart': 'Select a host to start', + 'sftp.pane.chooseFilesystem': 'Choose a local or remote filesystem to browse', + 'sftp.conflict.title': 'File Conflict', + 'sftp.conflict.desc': 'A file with the same name already exists at the destination', + 'sftp.conflict.alreadyExistsSuffix': 'already exists', + 'sftp.conflict.existingFile': 'Existing file', + 'sftp.conflict.newFile': 'New file', + 'sftp.conflict.size': 'Size:', + 'sftp.conflict.modified': 'Modified:', + 'sftp.conflict.applyToAll': 'Apply this action to all {count} remaining conflicts', + 'sftp.conflict.action.skip': 'Skip', + 'sftp.conflict.action.keepBoth': 'Keep Both', + 'sftp.conflict.action.replace': 'Replace', // Quick Switcher 'qs.search.placeholder': 'Search hosts or tabs', @@ -189,6 +380,17 @@ const en: Messages = { 'selectHost.title': 'Select Host', 'selectHost.noHostsFound': 'No hosts found', + // Quick Connect + 'quickConnect.knownHost.title': 'Are you sure you want to connect?', + 'quickConnect.knownHost.authenticity': 'The authenticity of {hostname} can not be established.', + 'quickConnect.knownHost.fingerprintLabel': '{keyType} fingerprint is SHA256:', + 'quickConnect.knownHost.addQuestion': 'Do you want to add it to the list of known hosts?', + 'quickConnect.knownHost.addAndContinue': 'Add and continue', + 'quickConnect.addKey': 'Add key', + + // Terminal + 'terminal.connectionErrorTitle': 'Connection Error', + // Protocol select dialog 'protocolSelect.chooseProtocol': 'Choose protocol', 'protocolSelect.port': 'port:', @@ -221,8 +423,35 @@ const en: Messages = { 'hostDetails.proxy.none': 'None', 'hostDetails.proxy.edit': 'Edit Proxy', 'hostDetails.proxy.configure': 'Configure Proxy', + 'hostDetails.proxyPanel.title': 'Proxy', + 'hostDetails.proxyPanel.hostPlaceholder': 'Proxy host', + 'hostDetails.proxyPanel.credentials': 'Credentials', + 'hostDetails.proxyPanel.usernamePlaceholder': 'Username', + 'hostDetails.proxyPanel.passwordPlaceholder': 'Password', + 'hostDetails.proxyPanel.identities': 'Identities', + 'hostDetails.proxyPanel.remove': 'Remove Proxy', 'hostDetails.envVars': 'Environment Variables', 'hostDetails.envVars.add': 'Add Environment Variable', + 'hostDetails.envVars.title': 'Environment Variables', + 'hostDetails.envVars.desc': 'Set an environment variable for {host}.', + 'hostDetails.envVars.note': + 'Some SSH servers by default only allow variables with prefix LC_ and LANG_.', + 'hostDetails.envVars.variable': 'Variable', + 'hostDetails.envVars.value': 'Value', + 'hostDetails.envVars.newVariable': 'New Variable', + 'hostDetails.envVars.variableName': 'Variable name', + 'hostDetails.chain.title': 'Edit Chain', + 'hostDetails.chain.desc': 'Adding another host will create a connection to {host}.', + 'hostDetails.chain.addHost': 'Add a Host', + 'hostDetails.chain.target': 'Target', + 'hostDetails.chain.availableHosts': 'Available Hosts', + 'hostDetails.chain.clear': 'Clear', + 'hostDetails.group.title': 'New Group', + 'hostDetails.group.general': 'General', + 'hostDetails.group.namePlaceholder': 'Group name', + 'hostDetails.group.parentPlaceholder': 'Parent Group', + 'hostDetails.group.cloudSync': 'Cloud Sync', + 'hostDetails.group.addProtocol': 'Add protocol', 'hostDetails.startupCommand': 'Startup Command', 'hostDetails.startupCommand.placeholder': 'Command to run on connect (e.g., cd /app && ls)', 'hostDetails.startupCommand.help': @@ -421,6 +650,150 @@ const en: Messages = { 'cloudSync.resolve.downloaded': 'Downloaded cloud data', 'cloudSync.resolve.uploaded': 'Uploaded local data', 'cloudSync.resolve.failedTitle': 'Conflict resolution failed', + + // Keychain + 'keychain.filter.key': 'KEY', + 'keychain.filter.certificate': 'CERTIFICATE', + 'keychain.action.generateKey': 'Generate Key', + 'keychain.action.importKey': 'Import Key', + 'keychain.action.newIdentity': 'New Identity', + 'keychain.action.importCertificate': 'Import Certificate', + 'keychain.view.grid': 'Grid', + 'keychain.view.list': 'List', + 'keychain.section.keys': 'Keys', + 'keychain.section.identities': 'Identities', + 'keychain.count.items': '{count} items', + 'keychain.empty.title': 'Set up your keys', + 'keychain.empty.desc': 'Import or generate SSH keys for secure authentication.', + 'keychain.panel.generateKey': 'Generate Key', + 'keychain.panel.newKey': 'New Key', + 'keychain.panel.keyDetails': 'Key Details', + 'keychain.panel.editKey': 'Edit Key', + 'keychain.panel.editIdentity': 'Edit Identity', + 'keychain.panel.newIdentity': 'New Identity', + 'keychain.panel.keyExport': 'Key Export', + 'keychain.validation.labelRequired': 'Please enter a label for the key', + 'keychain.validation.labelAndPrivateKeyRequired': 'Label and private key are required', + 'keychain.validation.labelAndUsernameRequired': 'Label and username are required', + 'keychain.error.generationUnavailable': + 'Key generation not available - please ensure the app is running in Electron', + 'keychain.error.generateKeyPairFailed': 'Failed to generate key pair', + 'keychain.error.generateKeyFailed': 'Failed to generate key', + 'keychain.error.keyGenerationTitle': 'Key Generation', + 'keychain.export.exportTo': 'Export to *', + 'keychain.export.selectHost': 'Select Host', + 'keychain.export.location': 'Location ~ $1 *', + 'keychain.export.filename': 'Filename ~ $2 *', + 'keychain.export.note': + 'Key export currently supports only {unix} systems. Use the {advanced} section to customize the export script.', + 'keychain.export.script': 'Script *', + 'keychain.export.scriptPlaceholder': 'Export script...', + 'keychain.export.missingCredentials': + 'Host has no saved password or key. Please add password credentials to the host first.', + 'keychain.export.successTitle': 'Export Successful', + 'keychain.export.successMessage': 'Public key exported and attached to {host}', + 'keychain.export.failedTitle': 'Export Failed', + 'keychain.export.failedMessage': 'Failed to export key: {error}', + 'keychain.export.failedPrefix': 'Export failed: {error}', + 'keychain.export.exitCode': 'Command exited with code {code}', + 'keychain.export.exporting': 'Exporting...', + 'keychain.export.exportAndAttach': 'Export and Attach', + 'keychain.export.title': 'Key export', + 'keychain.export.exportToRequired': 'Export to *', + 'keychain.export.selectHostPlaceholder': 'Select a host...', + 'keychain.export.locationLabel': 'Location ~ $1 *', + 'keychain.export.filenameLabel': 'Filename ~ $2 *', + 'keychain.export.advanced': 'Advanced', + 'keychain.export.note.supportsOnly': 'Key export currently supports only', + 'keychain.export.note.systems': 'systems.', + 'keychain.export.note.use': 'Use', + 'keychain.export.note.customize': 'section to customize the export script.', + 'keychain.export.scriptRequired': 'Script *', + 'keychain.export.exportToHost': 'Export to host', + 'keychain.export.failedGeneric': 'Export failed: {message}', + 'keychain.field.label': 'Label', + 'keychain.field.labelRequired': 'Label *', + 'keychain.field.labelPlaceholder': 'Key label', + 'keychain.field.privateKeyRequired': 'Private key *', + 'keychain.field.publicKey': 'Public key', + 'keychain.field.certificatePlaceholder': 'Certificate content (optional)', + 'keychain.generate.keyType': 'Key type', + 'keychain.generate.keySize': 'Key size', + 'keychain.generate.labelPlaceholder': 'Key label', + 'keychain.generate.passphrasePlaceholder': 'Passphrase (optional)', + 'keychain.generate.savePassphrase': 'Save passphrase', + 'keychain.generate.generate': 'Generate', + 'keychain.generate.generateSave': 'Generate & Save', + 'keychain.import.dropHint': 'Drop a key file here', + 'keychain.import.importFromFile': 'Import from file', + 'keychain.import.saveKey': 'Save Key', + 'keychain.import.importedKeyLabel': 'Imported Key', + 'keychain.identity.usernameRequired': 'Username *', + 'keychain.identity.method.passwordOnly': 'Password', + 'keychain.identity.selectCredential': 'Select {kind}', + 'keychain.identity.save': 'Save', + 'keychain.identity.update': 'Update', + 'keychain.keyDialog.newTitle': 'New Key', + 'keychain.keyDialog.newDesc': 'Add a new SSH key', + 'keychain.keyDialog.editTitle': 'Edit Key', + 'keychain.keyDialog.editDesc': 'Update this SSH key', + 'keychain.keyDialog.updateKey': 'Update Key', + + // Tabs + 'tabs.closeSessionAria': 'Close session', + 'tabs.closeLogViewAria': 'Close log view', + 'tabs.logPrefix': 'Log:', + 'tabs.logLocal': 'Local', + 'keychain.edit.labelRequired': 'Label *', + 'keychain.edit.keyLabelPlaceholder': 'Key label', + 'keychain.edit.privateKeyRequired': 'Private key *', + 'keychain.edit.publicKey': 'Public key', + 'keychain.edit.certificate': 'Certificate', + 'keychain.edit.certificatePlaceholder': 'Certificate content (optional)', + 'keychain.edit.keyExport': 'Key export', + 'keychain.edit.exportToHost': 'Export to host', + + // Snippets + 'snippets.searchPlaceholder': 'Search snippets...', + 'snippets.action.newSnippet': 'New Snippet', + 'snippets.action.newPackage': 'New Package', + 'snippets.panel.newTitle': 'New Snippet', + 'snippets.panel.editTitle': 'Edit Snippet', + 'snippets.field.description': 'Action description', + 'snippets.field.descriptionPlaceholder': 'Example: check network load', + 'snippets.field.package': 'Add a Package', + 'snippets.field.packagePlaceholder': 'Select or create package', + 'snippets.field.createPackage': 'Create Package', + 'snippets.field.scriptRequired': 'Script *', + 'snippets.targets.title': 'Targets', + 'snippets.targets.add': 'Add targets', + 'snippets.history.title': 'Shell History', + 'snippets.history.subtitle': '{count} commands', + 'snippets.history.emptyTitle': 'No shell history yet', + 'snippets.history.emptyDesc': 'Commands you execute will appear here', + 'snippets.history.loadMore': 'Load more', + 'snippets.history.separator': '•', + 'snippets.history.labelPlaceholder': 'Set a label for this snippet', + 'snippets.history.saveAsSnippet': 'Save as Snippet', + 'snippets.history.time.justNow': 'just now', + 'snippets.history.time.minutesAgo': '{count}m ago', + 'snippets.history.time.hoursAgo': '{count}h ago', + 'snippets.history.time.daysAgo': '{count}d ago', + 'snippets.breadcrumb.allPackages': 'All packages', + 'snippets.breadcrumb.separator': '›', + 'snippets.empty.title': 'Create snippet', + 'snippets.empty.desc': 'Save your most used commands as snippets to reuse them in one click.', + 'snippets.section.packages': 'Packages', + 'snippets.section.snippets': 'Snippets', + 'snippets.package.count': '{count} snippet(s)', + 'snippets.commandFallback': 'Command', + 'snippets.view.grid': 'Grid', + 'snippets.view.list': 'List', + 'snippets.packageDialog.title': 'New Package', + 'snippets.packageDialog.parent': 'Parent: {parent}', + 'snippets.packageDialog.root': 'Root', + 'snippets.packageDialog.placeholder': 'e.g. ops/maintenance', + 'snippets.packageDialog.hint': 'Use "/" to create nested packages.', }; export default en; diff --git a/application/i18n/locales/zh-CN.ts b/application/i18n/locales/zh-CN.ts index 9998158c3..1043bc72a 100644 --- a/application/i18n/locales/zh-CN.ts +++ b/application/i18n/locales/zh-CN.ts @@ -16,6 +16,15 @@ const zhCN: Messages = { 'common.enabled': '已启用', 'common.disabled': '已禁用', 'common.unknownError': '未知错误', + 'common.back': '返回', + 'common.apply': '应用', + 'common.left': '左侧', + 'common.right': '右侧', + 'common.selectAHost': '选择主机', + 'field.label': 'Label', + 'field.type': '类型', + 'auth.keyType': '类型 {type}', + 'auth.showAllKeys': '显示全部 keys', // Dialogs / prompts 'confirm.deleteHost': '删除主机 "{name}"?', @@ -73,6 +82,23 @@ const zhCN: Messages = { 'sync.syncing': '正在同步…', 'sync.error': '同步错误', 'sync.notConfigured': '未配置', + 'sync.failed': '同步失败', + 'sync.connected': '已连接', + 'sync.syncNow': '立即同步', + 'sync.recentActivity': '最近活动', + 'sync.history.uploaded': '已 Upload', + 'sync.history.downloaded': '已 Download', + 'sync.history.resolved': '已处理', + 'sync.toast.completedMessage': '同步完成', + 'sync.toast.errorTitle': '同步错误', + 'sync.autoSync.failedTitle': '同步失败', + 'sync.autoSync.syncedTitle': '已从云端同步', + 'sync.autoSync.syncedMessage': '你的数据已从云端更新。', + 'sync.autoSync.noProvider': '未连接云同步 provider。请打开 设置 → Sync & Cloud 进行连接。', + 'sync.autoSync.alreadySyncing': '同步正在进行中。', + 'sync.autoSync.vaultLocked': 'Vault 处于锁定状态。请打开 设置 → Sync & Cloud 解锁。', + 'sync.autoSync.conflictDetected': '检测到同步冲突。请打开 设置 → Sync & Cloud 处理。', + 'sync.autoSync.syncFailed': '同步失败', 'time.never': '从未', 'time.justNow': '刚刚', 'time.minutesAgo': '{minutes} 分钟前', @@ -130,6 +156,36 @@ const zhCN: Messages = { 'pf.wizard.skipWizard': '跳过向导', 'pf.error.hostNotFound': '未找到主机', 'pf.toast.titleWithLabel': '端口转发规则: {label}', + 'pf.type.local': '本地转发', + 'pf.type.remote': '远程转发', + 'pf.type.dynamic': '动态转发', + 'pf.type.local.desc': '本地转发让你像访问本地一样访问远程服务端口。', + 'pf.type.remote.desc': '远程转发在远端开启端口,并将连接转发到本地(当前)主机。', + 'pf.type.dynamic.desc': '动态转发将 Netcatty 作为 SOCKS 代理使用。', + 'pf.wizard.type.title': '选择端口转发类型:', + 'pf.wizard.localConfig.title': '设置本地端口与绑定地址:', + 'pf.wizard.localConfig.desc': '该端口会在本地(当前设备)打开,并接收流量。', + 'pf.wizard.localConfig.localPort': '本地端口 *', + 'pf.wizard.bindAddress': '绑定地址', + 'pf.wizard.remoteHost.title': '选择远端主机:', + 'pf.wizard.remoteHost.desc': '选择要打开端口的远端主机。该端口的流量将转发到目标地址。', + 'pf.wizard.remoteConfig.title': '设置端口与绑定地址:', + 'pf.wizard.remoteConfig.desc': '将从所选主机的指定端口与网卡地址转发流量。', + 'pf.wizard.remoteConfig.remotePort': '远端端口 *', + 'pf.wizard.destination.title': '设置目标地址:', + 'pf.wizard.destination.desc.local': '输入你希望通过 tunnel 访问的远端目标地址。', + 'pf.wizard.destination.desc.remote': '要转发流量到的目标地址与端口。', + 'pf.wizard.destination.address': '目标地址 *', + 'pf.wizard.destination.addressPlaceholder': '例如:127.0.0.1 或 192.168.1.100', + 'pf.wizard.destination.port': '目标端口 *', + 'pf.wizard.sshServer.title': '选择 SSH server:', + 'pf.wizard.sshServer.desc.dynamic': '选择作为 SOCKS proxy 的 SSH server。', + 'pf.wizard.sshServer.desc.default': '选择用于将流量 tunnel 到目标地址的 SSH server。', + 'pf.wizard.label.title': '设置 Label:', + 'pf.wizard.label.placeholder.dynamic': '例如:SOCKS Proxy', + 'pf.wizard.label.placeholder.default': '例如:MySQL Production', + 'pf.wizard.label.placeholder.remoteRule': '例如:Remote Rule', + 'pf.wizard.placeholders.portExample': '例如:{port}', // SFTP 'sftp.newFolder': '新建文件夹', @@ -175,6 +231,19 @@ const zhCN: Messages = { 'sftp.error.uploadFailed': '上传失败', 'sftp.error.deleteFailed': '删除失败', 'sftp.error.createFolderFailed': '创建文件夹失败', + 'sftp.picker.title': '选择主机', + 'sftp.picker.desc': '为{side}窗格选择主机', + 'sftp.picker.searchPlaceholder': '搜索主机...', + 'sftp.picker.local.title': '本地文件系统', + 'sftp.picker.local.desc': '浏览本地文件', + 'sftp.picker.local.badge': '本地', + 'sftp.picker.noMatch': '没有匹配的主机', + 'sftp.permissions.title': '编辑权限', + 'sftp.permissions.owner': 'Owner', + 'sftp.permissions.group': 'Group', + 'sftp.permissions.others': 'Others', + 'sftp.permissions.octal': 'Octal', + 'sftp.permissions.symbolic': 'Symbolic', // Quick Switcher 'qs.search.placeholder': '搜索主机或标签页', @@ -188,6 +257,14 @@ const zhCN: Messages = { 'selectHost.title': '选择主机', 'selectHost.noHostsFound': '未找到主机', + // Quick Connect + 'quickConnect.knownHost.title': '确认要连接吗?', + 'quickConnect.knownHost.authenticity': '无法验证 {hostname} 的真实性。', + 'quickConnect.knownHost.fingerprintLabel': '{keyType} fingerprint (SHA256):', + 'quickConnect.knownHost.addQuestion': '是否将它加入 Known Hosts?', + 'quickConnect.knownHost.addAndContinue': '加入并继续', + 'quickConnect.addKey': '添加 key', + // Protocol select dialog 'protocolSelect.chooseProtocol': '选择协议', 'protocolSelect.port': '端口:', @@ -310,6 +387,7 @@ const zhCN: Messages = { 'terminal.auth.selectKey': '选择密钥', 'terminal.auth.noKeysHint': '暂无密钥,请先在钥匙串中添加。', 'terminal.auth.continueSave': '继续并保存', + 'terminal.connectionErrorTitle': '连接错误', 'terminal.progress.timeoutIn': '将在 {seconds}s 后超时', 'terminal.progress.disconnected': '已断开', 'terminal.progress.cancelling': '正在取消...', @@ -415,6 +493,299 @@ const zhCN: Messages = { 'cloudSync.resolve.downloaded': '已下载云端数据', 'cloudSync.resolve.uploaded': '已上传本地数据', 'cloudSync.resolve.failedTitle': '冲突处理失败', + + // Common (additional) + 'common.searchPlaceholder': '搜索...', + 'common.import': '导入', + 'common.generate': '生成', + 'common.delete': '删除', + 'common.optional': '可选', + 'common.selectPlaceholder': '请选择...', + 'common.error': '错误', + 'common.validation': '验证', + 'common.saveChanges': '保存修改', + 'common.advanced': '高级', + 'common.selectAHostPlaceholder': '选择主机...', + + // Actions + 'action.duplicate': '复制', + 'action.open': '打开', + 'action.copy': '复制', + 'action.run': '运行', + 'action.start': '启动', + 'action.stop': '停止', + + // Port Forwarding (form) + 'pf.form.labelPlaceholder': '规则标签', + 'pf.form.intermediateHost': '中转主机 *', + 'pf.form.createRule': '创建规则', + 'pf.form.openWizard': '打开向导', + 'pf.form.openWizardTitle': '打开端口转发向导', + 'pf.action.newForwarding': '新建转发', + 'pf.view.grid': '网格', + 'pf.view.list': '列表', + 'pf.rule.summary.dynamic': 'SOCKS 监听于 {bindAddress}:{localPort}', + 'pf.rule.summary.default': '{bindAddress}:{localPort} -> {remoteHost}:{remotePort}', + + // SFTP (pane + conflict) + 'sftp.pane.local': '本地', + 'sftp.pane.remote': '远端', + 'sftp.pane.selectHost': '选择主机', + 'sftp.pane.selectHostToStart': '先选择一个主机', + 'sftp.pane.chooseFilesystem': '选择要浏览的本地或远端文件系统', + 'sftp.conflict.title': '文件冲突', + 'sftp.conflict.desc': '目标位置已存在同名文件', + 'sftp.conflict.alreadyExistsSuffix': '已存在', + 'sftp.conflict.existingFile': '已有文件', + 'sftp.conflict.newFile': '新文件', + 'sftp.conflict.size': '大小:', + 'sftp.conflict.modified': '修改时间:', + 'sftp.conflict.applyToAll': '将此操作应用到剩余的 {count} 个冲突', + 'sftp.conflict.action.skip': '跳过', + 'sftp.conflict.action.keepBoth': '保留两者', + 'sftp.conflict.action.replace': '替换', + + // Settings > Terminal + 'settings.terminal.section.theme': '终端主题', + 'settings.terminal.section.font': '字体', + 'settings.terminal.section.cursor': '光标', + 'settings.terminal.section.keyboard': '键盘', + 'settings.terminal.section.accessibility': '无障碍', + 'settings.terminal.section.behavior': '行为', + 'settings.terminal.section.scrollback': '回滚', + 'settings.terminal.section.keywordHighlight': '关键字高亮', + 'settings.terminal.font.family': '字体', + 'settings.terminal.font.family.desc': '终端字体', + 'settings.terminal.font.size': '字体大小', + 'settings.terminal.font.size.desc': '终端文字大小', + 'settings.terminal.font.weight': '字重', + 'settings.terminal.font.weight.desc': '常规文本字重 (100-900)', + 'settings.terminal.font.weightBold': '粗体字重', + 'settings.terminal.font.weightBold.desc': '粗体文本字重 (100-900)', + 'settings.terminal.font.linePadding': '行间距', + 'settings.terminal.font.linePadding.desc': '行之间的额外间距 (0-10)', + 'settings.terminal.font.emulationType': '终端仿真类型', + 'settings.terminal.cursor.style': '光标样式', + 'settings.terminal.cursor.style.block': '块', + 'settings.terminal.cursor.style.bar': '竖线', + 'settings.terminal.cursor.style.underline': '下划线', + 'settings.terminal.cursor.blink': '光标闪烁', + 'settings.terminal.keyboard.altAsMeta': '将 Option 作为 Meta 键', + 'settings.terminal.keyboard.altAsMeta.desc': '使用 Option (Alt) 作为 Meta 键,而不是用于输入特殊字符', + 'settings.terminal.accessibility.minimumContrastRatio': '最小对比度', + 'settings.terminal.accessibility.minimumContrastRatio.desc': '调整颜色以满足对比度要求 (1 = 禁用, 21 = 最大)', + 'settings.terminal.behavior.rightClick': '右键行为', + 'settings.terminal.behavior.rightClick.desc': '在终端中右键时执行的操作', + 'settings.terminal.behavior.rightClick.menu': '显示菜单', + 'settings.terminal.behavior.rightClick.paste': '粘贴', + 'settings.terminal.behavior.rightClick.selectWord': '选择单词', + 'settings.terminal.behavior.copyOnSelect': '选择即复制', + 'settings.terminal.behavior.copyOnSelect.desc': '自动复制选中的文本', + 'settings.terminal.behavior.middleClickPaste': '中键粘贴', + 'settings.terminal.behavior.middleClickPaste.desc': '中键点击时粘贴剪贴板内容', + 'settings.terminal.behavior.scrollOnInput': '输入时自动滚动', + 'settings.terminal.behavior.scrollOnInput.desc': '输入时将终端滚动到底部', + 'settings.terminal.behavior.scrollOnOutput': '输出时自动滚动', + 'settings.terminal.behavior.scrollOnOutput.desc': '有新输出时将终端滚动到底部', + 'settings.terminal.behavior.scrollOnKeyPress': '按键时自动滚动', + 'settings.terminal.behavior.scrollOnKeyPress.desc': '按键(例如 Enter)时将终端滚动到底部', + 'settings.terminal.behavior.scrollOnPaste': '粘贴时自动滚动', + 'settings.terminal.behavior.scrollOnPaste.desc': '粘贴文本时将终端滚动到底部', + 'settings.terminal.behavior.linkModifier': '链接修饰键', + 'settings.terminal.behavior.linkModifier.desc': '按住此键再点击终端中的链接', + 'settings.terminal.behavior.linkModifier.none': '无(直接点击)', + 'settings.terminal.behavior.linkModifier.ctrl': 'Ctrl', + 'settings.terminal.behavior.linkModifier.alt': 'Alt / Option', + 'settings.terminal.behavior.linkModifier.meta': 'Cmd / Win', + 'settings.terminal.scrollback.desc': '限制终端行数。设为 0 表示不限制。', + 'settings.terminal.scrollback.rows': '行数 *', + 'settings.terminal.keywordHighlight.title': '关键字高亮', + 'settings.terminal.keywordHighlight.resetColors': '重置为默认颜色', + + // Settings > Shortcuts + 'settings.shortcuts.section.scheme': '快捷键方案', + 'settings.shortcuts.scheme.label': '键盘快捷键', + 'settings.shortcuts.scheme.desc': '选择快捷键使用的键盘布局', + 'settings.shortcuts.scheme.disabled': '禁用', + 'settings.shortcuts.scheme.mac': 'Mac (Cmd)', + 'settings.shortcuts.scheme.pc': 'PC (Ctrl)', + 'settings.shortcuts.section.custom': '自定义快捷键', + 'settings.shortcuts.resetAll': '全部重置', + 'settings.shortcuts.recording': '请按键...', + 'settings.shortcuts.none': '无', + 'settings.shortcuts.category.tabs': '标签页', + 'settings.shortcuts.category.terminal': '终端', + 'settings.shortcuts.category.navigation': '导航', + 'settings.shortcuts.category.app': '应用', + + // Host Details (sub-panels) + 'hostDetails.proxyPanel.title': 'Proxy', + 'hostDetails.proxyPanel.hostPlaceholder': 'Proxy host', + 'hostDetails.proxyPanel.credentials': 'Credentials', + 'hostDetails.proxyPanel.usernamePlaceholder': 'Username', + 'hostDetails.proxyPanel.passwordPlaceholder': 'Password', + 'hostDetails.proxyPanel.identities': 'Identities', + 'hostDetails.proxyPanel.remove': '移除 Proxy', + 'hostDetails.envVars.title': '环境变量', + 'hostDetails.envVars.desc': '为 {host} 设置环境变量。', + 'hostDetails.envVars.note': '部分 SSH 服务器默认只允许以 LC_ 和 LANG_ 为前缀的变量。', + 'hostDetails.envVars.variable': '变量', + 'hostDetails.envVars.value': '值', + 'hostDetails.envVars.newVariable': '新变量', + 'hostDetails.envVars.variableName': '变量名', + 'hostDetails.chain.title': '编辑链路', + 'hostDetails.chain.desc': '添加另一台主机将创建到 {host} 的连接。', + 'hostDetails.chain.addHost': '添加主机', + 'hostDetails.chain.target': '目标', + 'hostDetails.chain.availableHosts': '可用主机', + 'hostDetails.chain.clear': '清空', + 'hostDetails.group.title': '新建分组', + 'hostDetails.group.general': '常规', + 'hostDetails.group.namePlaceholder': '分组名称', + 'hostDetails.group.parentPlaceholder': '父分组', + 'hostDetails.group.cloudSync': '云同步', + 'hostDetails.group.addProtocol': '添加协议', + + // Keychain + 'keychain.filter.key': '密钥', + 'keychain.filter.certificate': '证书', + 'keychain.action.generateKey': '生成密钥', + 'keychain.action.importKey': '导入密钥', + 'keychain.action.newIdentity': '新建身份', + 'keychain.action.importCertificate': '导入证书', + 'keychain.view.grid': '网格', + 'keychain.view.list': '列表', + 'keychain.section.keys': '密钥', + 'keychain.section.identities': '身份', + 'keychain.count.items': '{count} 项', + 'keychain.empty.title': '设置密钥', + 'keychain.empty.desc': '导入或生成 SSH 密钥用于安全认证。', + 'keychain.panel.generateKey': '生成密钥', + 'keychain.panel.newKey': '新建密钥', + 'keychain.panel.keyDetails': '密钥详情', + 'keychain.panel.editKey': '编辑密钥', + 'keychain.panel.editIdentity': '编辑身份', + 'keychain.panel.newIdentity': '新建身份', + 'keychain.panel.keyExport': '密钥导出', + 'keychain.validation.labelRequired': '请填写密钥的 Label', + 'keychain.validation.labelAndPrivateKeyRequired': 'Label 和私钥为必填项', + 'keychain.validation.labelAndUsernameRequired': 'Label 和用户名为必填项', + 'keychain.error.generationUnavailable': '无法生成密钥:请确保应用运行在 Electron 环境', + 'keychain.error.generateKeyPairFailed': '生成密钥对失败', + 'keychain.error.generateKeyFailed': '生成密钥失败', + 'keychain.error.keyGenerationTitle': '密钥生成', + 'keychain.export.exportTo': '导出到 *', + 'keychain.export.selectHost': '选择主机', + 'keychain.export.location': '位置 ~ $1 *', + 'keychain.export.filename': '文件名 ~ $2 *', + 'keychain.export.note': '密钥导出目前仅支持 {unix} 系统。请在 {advanced} 部分自定义导出脚本。', + 'keychain.export.script': '脚本 *', + 'keychain.export.scriptPlaceholder': '导出脚本...', + 'keychain.export.missingCredentials': '主机未保存密码或密钥。请先为该主机添加密码凭据。', + 'keychain.export.successTitle': '导出成功', + 'keychain.export.successMessage': '已导出公钥并绑定到 {host}', + 'keychain.export.failedTitle': '导出失败', + 'keychain.export.failedMessage': '导出密钥失败:{error}', + 'keychain.export.failedPrefix': '导出失败:{error}', + 'keychain.export.exitCode': '命令退出码 {code}', + 'keychain.export.exporting': '导出中...', + 'keychain.export.exportAndAttach': '导出并绑定', + 'keychain.export.title': '密钥导出', + 'keychain.export.exportToRequired': '导出到 *', + 'keychain.export.selectHostPlaceholder': '选择主机...', + 'keychain.export.locationLabel': '位置 ~ $1 *', + 'keychain.export.filenameLabel': '文件名 ~ $2 *', + 'keychain.export.advanced': '高级', + 'keychain.export.note.supportsOnly': '密钥导出目前仅支持', + 'keychain.export.note.systems': '系统。', + 'keychain.export.note.use': '请使用', + 'keychain.export.note.customize': '部分自定义导出脚本。', + 'keychain.export.scriptRequired': '脚本 *', + 'keychain.export.exportToHost': '导出到主机', + 'keychain.export.failedGeneric': '导出失败:{message}', + 'keychain.field.label': 'Label', + 'keychain.field.labelRequired': 'Label *', + 'keychain.field.labelPlaceholder': '密钥 Label', + 'keychain.field.privateKeyRequired': '私钥 *', + 'keychain.field.publicKey': '公钥', + 'keychain.field.certificatePlaceholder': '证书内容(可选)', + 'keychain.generate.keyType': '密钥类型', + 'keychain.generate.keySize': '密钥长度', + 'keychain.generate.labelPlaceholder': '密钥 Label', + 'keychain.generate.passphrasePlaceholder': 'Passphrase(可选)', + 'keychain.generate.savePassphrase': '保存 Passphrase', + 'keychain.generate.generate': '生成', + 'keychain.generate.generateSave': '生成并保存', + 'keychain.import.dropHint': '将密钥文件拖到这里', + 'keychain.import.importFromFile': '从文件导入', + 'keychain.import.saveKey': '保存密钥', + 'keychain.import.importedKeyLabel': '已导入密钥', + 'keychain.identity.usernameRequired': '用户名 *', + 'keychain.identity.method.passwordOnly': '密码', + 'keychain.identity.selectCredential': '选择{kind}', + 'keychain.identity.save': '保存', + 'keychain.identity.update': '更新', + 'keychain.keyDialog.newTitle': '新建密钥', + 'keychain.keyDialog.newDesc': '添加新的 SSH 密钥', + 'keychain.keyDialog.editTitle': '编辑密钥', + 'keychain.keyDialog.editDesc': '更新此 SSH 密钥', + 'keychain.keyDialog.updateKey': '更新密钥', + + // Tabs + 'tabs.closeSessionAria': '关闭会话', + 'tabs.closeLogViewAria': '关闭日志视图', + 'tabs.logPrefix': '日志:', + 'tabs.logLocal': '本地', + 'keychain.edit.labelRequired': 'Label *', + 'keychain.edit.keyLabelPlaceholder': '密钥 Label', + 'keychain.edit.privateKeyRequired': '私钥 *', + 'keychain.edit.publicKey': '公钥', + 'keychain.edit.certificate': '证书', + 'keychain.edit.certificatePlaceholder': '证书内容(可选)', + 'keychain.edit.keyExport': '密钥导出', + 'keychain.edit.exportToHost': '导出到主机', + + // Snippets + 'snippets.searchPlaceholder': '搜索代码片段...', + 'snippets.action.newSnippet': '新建代码片段', + 'snippets.action.newPackage': '新建 Package', + 'snippets.panel.newTitle': '新建代码片段', + 'snippets.panel.editTitle': '编辑代码片段', + 'snippets.field.description': '描述', + 'snippets.field.descriptionPlaceholder': '例如:check network load', + 'snippets.field.package': '添加 Package', + 'snippets.field.packagePlaceholder': '选择或创建 Package', + 'snippets.field.createPackage': '创建 Package', + 'snippets.field.scriptRequired': '脚本 *', + 'snippets.targets.title': '目标主机', + 'snippets.targets.add': '添加目标主机', + 'snippets.history.title': 'Shell History', + 'snippets.history.subtitle': '{count} 条命令', + 'snippets.history.emptyTitle': '暂无 Shell History', + 'snippets.history.emptyDesc': '你执行过的命令会显示在这里', + 'snippets.history.loadMore': '加载更多', + 'snippets.history.separator': '•', + 'snippets.history.labelPlaceholder': '为此代码片段设置一个 Label', + 'snippets.history.saveAsSnippet': '保存为代码片段', + 'snippets.history.time.justNow': '刚刚', + 'snippets.history.time.minutesAgo': '{count} 分钟前', + 'snippets.history.time.hoursAgo': '{count} 小时前', + 'snippets.history.time.daysAgo': '{count} 天前', + 'snippets.breadcrumb.allPackages': '全部 Packages', + 'snippets.breadcrumb.separator': '›', + 'snippets.empty.title': '创建代码片段', + 'snippets.empty.desc': '将常用命令保存为代码片段,一键复用。', + 'snippets.section.packages': 'Packages', + 'snippets.section.snippets': '代码片段', + 'snippets.package.count': '{count} 个代码片段', + 'snippets.commandFallback': '命令', + 'snippets.view.grid': '网格', + 'snippets.view.list': '列表', + 'snippets.packageDialog.title': '新建 Package', + 'snippets.packageDialog.parent': '父级:{parent}', + 'snippets.packageDialog.root': '根目录', + 'snippets.packageDialog.placeholder': '例如:ops/maintenance', + 'snippets.packageDialog.hint': '使用 "/" 创建嵌套 Package。', }; export default zhCN; diff --git a/application/state/useAutoSync.ts b/application/state/useAutoSync.ts index 1763f0b6b..c576b3a85 100644 --- a/application/state/useAutoSync.ts +++ b/application/state/useAutoSync.ts @@ -9,6 +9,7 @@ import { useCallback, useEffect, useRef } from 'react'; import { useCloudSync } from './useCloudSync'; +import { useI18n } from '../i18n/I18nProvider'; import { getCloudSyncManager } from '../../infrastructure/services/CloudSyncManager'; import { netcattyBridge } from '../../infrastructure/services/netcattyBridge'; import type { SyncPayload } from '../../domain/sync'; @@ -37,6 +38,7 @@ interface SyncNowOptions { } export const useAutoSync = (config: AutoSyncConfig) => { + const { t } = useI18n(); const sync = useCloudSync(); const syncTimeoutRef = useRef(null); const lastSyncedDataRef = useRef(''); @@ -79,10 +81,10 @@ export const useAutoSync = (config: AutoSyncConfig) => { const syncing = state.syncState === 'SYNCING'; if (!hasProvider) { - throw new Error('No cloud provider connected. Open Settings → Sync & Cloud to connect one.'); + throw new Error(t('sync.autoSync.noProvider')); } if (syncing) { - throw new Error('Sync is already in progress.'); + throw new Error(t('sync.autoSync.alreadySyncing')); } // If another window unlocked, reuse the in-memory session password from main process. @@ -100,7 +102,7 @@ export const useAutoSync = (config: AutoSyncConfig) => { // Re-check after unlock attempt state = manager.getState(); if (state.securityState !== 'UNLOCKED') { - throw new Error('Vault is locked. Open Settings → Sync & Cloud to unlock.'); + throw new Error(t('sync.autoSync.vaultLocked')); } const payload = buildPayload(); @@ -109,9 +111,9 @@ export const useAutoSync = (config: AutoSyncConfig) => { for (const result of results.values()) { if (!result.success) { if (result.conflictDetected) { - throw new Error('Sync conflict detected. Open Settings → Sync & Cloud to resolve.'); + throw new Error(t('sync.autoSync.conflictDetected')); } - throw new Error(result.error || 'Sync failed'); + throw new Error(result.error || t('sync.autoSync.syncFailed')); } } @@ -121,9 +123,12 @@ export const useAutoSync = (config: AutoSyncConfig) => { throw error; } console.error('[AutoSync] Sync failed:', error); - toast.error('Sync failed', error instanceof Error ? error.message : 'Unknown error'); + toast.error( + error instanceof Error ? error.message : t('common.unknownError'), + t('sync.autoSync.failedTitle'), + ); } - }, [sync, buildPayload, getDataHash]); + }, [sync, buildPayload, getDataHash, t]); // Check remote version and pull if newer (on startup) const checkRemoteVersion = useCallback(async () => { @@ -152,13 +157,13 @@ export const useAutoSync = (config: AutoSyncConfig) => { if (remotePayload && remotePayload.syncedAt > state.localUpdatedAt) { console.log('[AutoSync] Remote is newer, applying...'); config.onApplyPayload(remotePayload); - toast.success('Synced from cloud', 'Your data has been updated from the cloud.'); + toast.success(t('sync.autoSync.syncedMessage'), t('sync.autoSync.syncedTitle')); } } catch (error) { console.error('[AutoSync] Failed to check remote version:', error); // Don't show error toast for initial check - it's not critical } - }, [sync, config]); + }, [sync, config, t]); // Debounced auto-sync when data changes useEffect(() => { diff --git a/components/AuthDialog.tsx b/components/AuthDialog.tsx index b3f11fd3a..ace3f1810 100644 --- a/components/AuthDialog.tsx +++ b/components/AuthDialog.tsx @@ -1,5 +1,6 @@ import { ChevronDown, Eye, EyeOff, Key, Lock, User } from "lucide-react"; import React, { useState } from "react"; +import { useI18n } from "../application/i18n/I18nProvider"; import { cn } from "../lib/utils"; import { Host, SSHKey } from "../types"; import { DistroAvatar } from "./DistroAvatar"; @@ -28,6 +29,7 @@ const AuthDialog: React.FC = ({ onSubmit, onCancel, }) => { + const { t } = useI18n(); const [username, setUsername] = useState(host.username || "root"); const [authMethod, setAuthMethod] = useState<"password" | "key">("password"); const [password, setPassword] = useState(""); @@ -114,7 +116,7 @@ const AuthDialog: React.FC = ({ onClick={() => setAuthMethod("password")} > - Password + {t("terminal.auth.password")} @@ -136,12 +138,12 @@ const AuthDialog: React.FC = ({ {/* Username field (shown when no username on host) */} {!host.username && (
- + setUsername(e.target.value)} - placeholder="root" + placeholder={t("terminal.auth.username.placeholder")} autoFocus />
@@ -150,14 +152,16 @@ const AuthDialog: React.FC = ({ {/* Password field */} {authMethod === "password" && (
- +
setPassword(e.target.value)} - placeholder="Enter password" + placeholder={t("terminal.auth.password.placeholder")} className="pr-10" autoFocus={!!host.username} onKeyDown={(e) => { @@ -180,10 +184,10 @@ const AuthDialog: React.FC = ({ {/* Key selection */} {authMethod === "key" && (
- + {keys.length === 0 ? (
- No keys available. Add keys in the Keychain section. + {t("terminal.auth.noKeysHint")}
) : (
@@ -214,7 +218,7 @@ const AuthDialog: React.FC = ({ {key.label}
- Type {key.type} + {t("auth.keyType", { type: key.type })}
@@ -226,7 +230,7 @@ const AuthDialog: React.FC = ({ > @@ -272,13 +276,13 @@ const AuthDialog: React.FC = ({ {/* Footer */}
@@ -291,7 +295,7 @@ const AuthDialog: React.FC = ({ }} disabled={!isValid} > - Continue + {t("common.continue")} diff --git a/components/KeyManager.tsx b/components/KeyManager.tsx index f33f81705..e1299e07a 100755 --- a/components/KeyManager.tsx +++ b/components/KeyManager.tsx @@ -9,6 +9,7 @@ import { Trash2, } from "lucide-react"; import React, { useMemo, useState } from "react"; +import { useI18n } from "../application/i18n/I18nProvider"; import { KeyType } from "../domain/models"; import { cn } from "../lib/utils"; import { SSHKey } from "../types"; @@ -33,6 +34,7 @@ interface KeyManagerProps { } const KeyManager: React.FC = ({ keys, onSave, onDelete }) => { + const { t } = useI18n(); const [isDialogOpen, setIsDialogOpen] = useState(false); const [panelMode, setPanelMode] = useState<"new" | "edit">("new"); const [draftKey, setDraftKey] = useState>({ @@ -282,29 +284,31 @@ const KeyManager: React.FC = ({ keys, onSave, onDelete }) => { - {panelMode === "new" ? "New Key" : "Edit Key"} + {panelMode === "new" + ? t("keychain.keyDialog.newTitle") + : t("keychain.keyDialog.editTitle")} {panelMode === "new" - ? "Create a new SSH key entry" - : "Edit the selected SSH key entry"} + ? t("keychain.keyDialog.newDesc") + : t("keychain.keyDialog.editDesc")}
- + setDraftKey({ ...draftKey, label: e.target.value }) } - placeholder="Key label" + placeholder={t("keychain.field.labelPlaceholder")} required />
- +