diff --git a/application/i18n/locales/en.ts b/application/i18n/locales/en.ts index ee716bb37..8a76fc770 100644 --- a/application/i18n/locales/en.ts +++ b/application/i18n/locales/en.ts @@ -86,6 +86,27 @@ const en: Messages = { 'vault.nav.knownHosts': 'Known Hosts', 'vault.nav.logs': 'Logs', + 'vault.groups.title': 'Groups', + 'vault.groups.total': '{count} total', + 'vault.groups.hostsCount': '{count} Hosts', + 'vault.groups.newSubgroup': 'New Subgroup', + 'vault.groups.rename': 'Rename Group', + 'vault.groups.delete': 'Delete Group', + 'vault.groups.createSubfolder': 'Create Subfolder', + 'vault.groups.createRoot': 'Create Root Group', + 'vault.groups.createDialog.desc': 'Create a new group for organizing hosts.', + 'vault.groups.renameDialogTitle': 'Rename Group', + 'vault.groups.renameDialog.desc': 'Rename an existing group.', + 'vault.groups.field.name': 'Group Name', + 'vault.groups.placeholder.example': 'e.g. Production', + 'vault.groups.parentLabel': 'Parent', + 'vault.groups.pathLabel': 'Path', + 'vault.groups.errors.required': 'Group name is required.', + 'vault.groups.errors.invalidChars': "Group name cannot include '/' or '\\\\'.", + + 'vault.hosts.header.entries': '{count} entries', + 'vault.hosts.header.live': '{count} live', + // Vault hosts header/actions 'vault.hosts.search.placeholder': 'Find a host or ssh user@hostname...', 'vault.hosts.connect': 'Connect', @@ -164,6 +185,10 @@ const en: Messages = { 'qs.jumpTo': 'Jump To', 'qs.localTerminal': 'Local Terminal', + // Select Host panel + 'selectHost.title': 'Select Host', + 'selectHost.noHostsFound': 'No hosts found', + // Protocol select dialog 'protocolSelect.chooseProtocol': 'Choose protocol', 'protocolSelect.port': 'port:', diff --git a/application/i18n/locales/zh-CN.ts b/application/i18n/locales/zh-CN.ts index e1534b502..9998158c3 100644 --- a/application/i18n/locales/zh-CN.ts +++ b/application/i18n/locales/zh-CN.ts @@ -57,14 +57,14 @@ const zhCN: Messages = { 'settings.appearance.language.desc': '选择界面语言', // Context menus / common actions - 'action.newHost': '新建 Host', + 'action.newHost': '新建主机', 'action.newSubfolder': '新建文件夹', 'action.copyPublicKey': '复制公钥', 'action.keyExport': '导出密钥', 'action.edit': '编辑', 'action.delete': '删除', 'action.remove': '移除', - 'action.convertToHost': '转换为 Host', + 'action.convertToHost': '转换为主机', // Sync 'sync.cloudSync': '云同步', @@ -85,6 +85,27 @@ const zhCN: Messages = { 'vault.nav.knownHosts': '已知主机', 'vault.nav.logs': '日志', + 'vault.groups.title': '分组', + 'vault.groups.total': '共 {count} 个', + 'vault.groups.hostsCount': '{count} 台主机', + 'vault.groups.newSubgroup': '新建子分组', + 'vault.groups.rename': '重命名分组', + 'vault.groups.delete': '删除分组', + 'vault.groups.createSubfolder': '创建子分组', + 'vault.groups.createRoot': '创建根分组', + 'vault.groups.createDialog.desc': '创建新的分组用于组织主机。', + 'vault.groups.renameDialogTitle': '重命名分组', + 'vault.groups.renameDialog.desc': '重命名已有分组。', + 'vault.groups.field.name': '分组名称', + 'vault.groups.placeholder.example': '例如:Production', + 'vault.groups.parentLabel': '父级', + 'vault.groups.pathLabel': '路径', + 'vault.groups.errors.required': '分组名称不能为空。', + 'vault.groups.errors.invalidChars': "分组名称不能包含 '/' 或 '\\\\'.", + + 'vault.hosts.header.entries': '{count} 条', + 'vault.hosts.header.live': '{count} 个在线', + // Vault hosts header/actions 'vault.hosts.search.placeholder': '查找主机或 ssh user@hostname…', 'vault.hosts.connect': '连接', @@ -163,12 +184,16 @@ const zhCN: Messages = { 'qs.jumpTo': '跳转到', 'qs.localTerminal': '本地终端', + // Select Host panel + 'selectHost.title': '选择主机', + 'selectHost.noHostsFound': '未找到主机', + // Protocol select dialog 'protocolSelect.chooseProtocol': '选择协议', 'protocolSelect.port': '端口:', // Host Details - 'hostDetails.title.details': 'Host 详情', - 'hostDetails.title.new': '新建 Host', + 'hostDetails.title.details': '主机详情', + 'hostDetails.title.new': '新建主机', 'hostDetails.saveAria': '保存', 'hostDetails.section.address': '地址', 'hostDetails.hostname.placeholder': 'IP 或 主机名', @@ -227,10 +252,10 @@ const zhCN: Messages = { 'hostForm.placeholder.addTag': '添加标签…', 'hostForm.auth.method': '认证方式', 'hostForm.auth.password': '密码', - 'hostForm.auth.sshKey': 'SSH Key', - 'hostForm.auth.selectKey': '选择 SSH Key', - 'hostForm.auth.noKeys': '暂无 keys', - 'hostForm.auth.noKeysHint': 'Keychain 中未找到 SSH keys,请先创建一个。', + 'hostForm.auth.sshKey': 'SSH密钥', + 'hostForm.auth.selectKey': '选择 SSH密钥', + 'hostForm.auth.noKeys': '暂无密钥', + 'hostForm.auth.noKeysHint': '钥匙串中未找到 SSH密钥,请先创建一个。', 'hostForm.saveHost': '保存主机', // Connection logs diff --git a/components/SelectHostPanel.tsx b/components/SelectHostPanel.tsx index 9a2898c28..66804bd96 100644 --- a/components/SelectHostPanel.tsx +++ b/components/SelectHostPanel.tsx @@ -9,6 +9,7 @@ import { } from "lucide-react"; import React, { useMemo, useState } from "react"; import { cn } from "../lib/utils"; +import { useI18n } from "../application/i18n/I18nProvider"; import { Host, SSHKey } from "../types"; import { DistroAvatar } from "./DistroAvatar"; import HostDetailsPanel from "./HostDetailsPanel"; @@ -48,10 +49,12 @@ const SelectHostPanel: React.FC = ({ availableKeys = [], onSaveHost, onCreateGroup, - title = "Select Host", + title, subtitle, className, }) => { + const { t } = useI18n(); + const panelTitle = title ?? t("selectHost.title"); const [searchQuery, setSearchQuery] = useState(""); const [currentPath, setCurrentPath] = useState(null); const [sortMode, setSortMode] = useState("az"); @@ -214,7 +217,7 @@ const SelectHostPanel: React.FC = ({
-

{title}

+

{panelTitle}

{subtitle && (

{subtitle}

)} @@ -279,7 +282,7 @@ const SelectHostPanel: React.FC = ({ onClick={() => setCurrentPath(null)} className="text-primary hover:underline" > - All hosts + {t("vault.hosts.allHosts")} {breadcrumbs.map((crumb, index) => ( @@ -301,7 +304,7 @@ const SelectHostPanel: React.FC = ({ )} {groupsWithCounts.length > 0 && (
-

Groups

+

{t("vault.groups.title")}

{groupsWithCounts.map((group) => (
= ({
{group.name}
- {group.count} Host{group.count !== 1 ? "s" : ""} + {t("vault.groups.hostsCount", { count: group.count })}
@@ -327,7 +330,7 @@ const SelectHostPanel: React.FC = ({ {/* Hosts Section */} {filteredHosts.length > 0 && (
-

Hosts

+

{t("vault.nav.hosts")}

{filteredHosts.map((host) => { const isSelected = selectedHostIds.includes(host.id); @@ -367,7 +370,7 @@ const SelectHostPanel: React.FC = ({ {/* Empty state */} {groupsWithCounts.length === 0 && filteredHosts.length === 0 && (
-

No hosts found

+

{t("selectHost.noHostsFound")}

)}
diff --git a/components/VaultView.tsx b/components/VaultView.tsx index 92d38a04d..c4e219a92 100644 --- a/components/VaultView.tsx +++ b/components/VaultView.tsx @@ -482,11 +482,11 @@ const VaultViewInner: React.FC = ({ const nextName = renameGroupName.trim(); if (!nextName) { - setRenameGroupError("Group name is required."); + setRenameGroupError(t("vault.groups.errors.required")); return; } if (nextName.includes("/") || nextName.includes("\\")) { - setRenameGroupError("Group name cannot include '/' or '\\'."); + setRenameGroupError(t("vault.groups.errors.invalidChars")); return; } @@ -608,7 +608,7 @@ const VaultViewInner: React.FC = ({ setSelectedGroupPath(null); }} > - Hosts + {t("vault.nav.hosts")}
- {node.hosts.length} Hosts + {t("vault.groups.hostsCount", { count: node.hosts.length })}
@@ -947,8 +947,7 @@ const VaultViewInner: React.FC = ({ setIsNewFolderOpen(true); }} > - New - Subgroup + {t("vault.groups.newSubgroup")} { @@ -958,13 +957,13 @@ const VaultViewInner: React.FC = ({ setIsRenameGroupOpen(true); }} > - Rename Group + {t("vault.groups.rename")} deleteGroupPath(node.path)} > - Delete Group + {t("vault.groups.delete")} @@ -975,12 +974,14 @@ const VaultViewInner: React.FC = ({

- Hosts + {t("vault.nav.hosts")}

- {displayedHosts.length} entries + + {t("vault.hosts.header.entries", { count: displayedHosts.length })} +
- {sessions.length} live + {t("vault.hosts.header.live", { count: sessions.length })}
@@ -1211,36 +1212,39 @@ const VaultViewInner: React.FC = ({ /> )} - + - {targetParentPath ? `Create Subfolder` : "Create Root Group"} + {targetParentPath + ? t("vault.groups.createSubfolder") + : t("vault.groups.createRoot")} - Create a new group for organizing hosts. + {t("vault.groups.createDialog.desc")}
- + setNewFolderName(e.target.value)} - placeholder="e.g. Production" + placeholder={t("vault.groups.placeholder.example")} autoFocus onKeyDown={(e) => e.key === "Enter" && submitNewFolder()} /> {targetParentPath && (

- Parent: {targetParentPath} + {t("vault.groups.parentLabel")}:{" "} + {targetParentPath}

)}
- +
@@ -1256,28 +1260,29 @@ const VaultViewInner: React.FC = ({ } }} > - + - Rename Group + {t("vault.groups.renameDialogTitle")} - Rename an existing group. + {t("vault.groups.renameDialog.desc")}
- + { setRenameGroupName(e.target.value); setRenameGroupError(null); }} - placeholder="e.g. Production" + placeholder={t("vault.groups.placeholder.example")} autoFocus onKeyDown={(e) => e.key === "Enter" && submitRenameGroup()} /> {renameTargetPath && (

- Path: {renameTargetPath} + {t("vault.groups.pathLabel")}:{" "} + {renameTargetPath}

)} {renameGroupError && ( @@ -1286,9 +1291,9 @@ const VaultViewInner: React.FC = ({
- +