diff --git a/src/renderer/src/components/ports/RuntimePortAutoForwarder.tsx b/src/renderer/src/components/ports/RuntimePortAutoForwarder.tsx index c4d17042573..83ef656e273 100644 --- a/src/renderer/src/components/ports/RuntimePortAutoForwarder.tsx +++ b/src/renderer/src/components/ports/RuntimePortAutoForwarder.tsx @@ -122,7 +122,10 @@ function announceMany(environmentId: string, count: number): void { id: `runtime-port-forward:${environmentId}:many`, duration: FORWARDED_TOAST_MS, action: { - label: translate('auto.components.ports.RuntimePortAutoForwarder.openPorts', 'Open Ports'), + label: translate( + 'auto.components.ports.RuntimePortAutoForwarder.openPortsPanel', + 'Open ports' + ), onClick: () => { const state = useAppStore.getState() state.setRightSidebarOpen(true) diff --git a/src/renderer/src/components/right-sidebar/host-scoped-ports-panel.tsx b/src/renderer/src/components/right-sidebar/host-scoped-ports-panel.tsx index bbbde4b768b..38aa331fe49 100644 --- a/src/renderer/src/components/right-sidebar/host-scoped-ports-panel.tsx +++ b/src/renderer/src/components/right-sidebar/host-scoped-ports-panel.tsx @@ -117,7 +117,7 @@ export function HostScopedPortsPanel({ return (
- + {t('auto.components.right.sidebar.PortsPanel.6bc058dbe1', 'Ports')} diff --git a/src/renderer/src/components/right-sidebar/local-port-row.tsx b/src/renderer/src/components/right-sidebar/local-port-row.tsx index 41c519091f0..3377dd1ccd5 100644 --- a/src/renderer/src/components/right-sidebar/local-port-row.tsx +++ b/src/renderer/src/components/right-sidebar/local-port-row.tsx @@ -114,7 +114,7 @@ export function LocalPortRow({
- + {title} {ports.length > 0 && ( - {ports.length} + {ports.length} )} {!collapsed && ( diff --git a/src/renderer/src/components/right-sidebar/local-workspace-ports-panel.tsx b/src/renderer/src/components/right-sidebar/local-workspace-ports-panel.tsx index c5a1aaf8343..896331c7af5 100644 --- a/src/renderer/src/components/right-sidebar/local-workspace-ports-panel.tsx +++ b/src/renderer/src/components/right-sidebar/local-workspace-ports-panel.tsx @@ -226,7 +226,7 @@ export function LocalWorkspacePortsPanel({ return (
- + {t('auto.components.right.sidebar.PortsPanel.6bc058dbe1', 'Ports')} diff --git a/src/renderer/src/components/right-sidebar/runtime-forwarded-ports-section.tsx b/src/renderer/src/components/right-sidebar/runtime-forwarded-ports-section.tsx index 0644786edb3..c440652a961 100644 --- a/src/renderer/src/components/right-sidebar/runtime-forwarded-ports-section.tsx +++ b/src/renderer/src/components/right-sidebar/runtime-forwarded-ports-section.tsx @@ -35,10 +35,10 @@ export function RuntimeForwardedPortsSection({ size={12} className={cn('shrink-0 motion-safe:transition-transform', !collapsed && 'rotate-90')} /> - + {t('auto.components.right.sidebar.RuntimeForwardedPorts.title', 'Other forwards')} - {forwards.length} + {forwards.length} {collapsed ? null : (
@@ -58,13 +58,14 @@ function OtherForwardRow({ forward }: { forward: RuntimePortForward }): React.JS const connections = forward.openConnections === 0 ? null - : forward.openConnections === 1 - ? t('auto.components.right.sidebar.RuntimeForwardedPorts.oneConnection', '1 connection') - : t( - 'auto.components.right.sidebar.RuntimeForwardedPorts.manyConnections', - '{{value0}} connections', - { value0: forward.openConnections } - ) + : t( + 'auto.components.right.sidebar.RuntimeForwardedPorts.connectionCount', + '{{count}} connections', + { + count: forward.openConnections, + defaultValue_one: '{{count}} connection' + } + ) const detail = [address, connections].filter(Boolean).join(' · ') return (
diff --git a/src/renderer/src/components/right-sidebar/runtime-port-forward-status.tsx b/src/renderer/src/components/right-sidebar/runtime-port-forward-status.tsx index 58a7fd941ed..8909ce9c1cc 100644 --- a/src/renderer/src/components/right-sidebar/runtime-port-forward-status.tsx +++ b/src/renderer/src/components/right-sidebar/runtime-port-forward-status.tsx @@ -14,7 +14,8 @@ export type RuntimePortForwardRowState = const FOCUS = 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring' -const ACTION = 'h-5 px-1 text-xs font-normal text-foreground' +const ACTION = + 'h-5 px-1 text-2xs font-normal text-muted-foreground hover:text-foreground [&_svg]:size-3' /** The line under a remote port: where it lands on this computer, or a control to forward it. */ export function RuntimePortForwardStatus({ @@ -46,11 +47,9 @@ export function RuntimePortForwardStatus({ ) : remapped ? t( - 'auto.components.right.sidebar.RuntimePortForward.remappedInUse', - '{{value0}} in use', - { - value0: remotePort - } + 'auto.components.right.sidebar.RuntimePortForward.remappedInUseHere', + '({{value0}} in use here)', + { value0: remotePort } ) : null const localAddress = t( @@ -95,11 +94,11 @@ export function RuntimePortForwardStatus({ {note ? ( - · {note} + {note} ) : null} {offline && onReconnect ? ( diff --git a/src/renderer/src/components/right-sidebar/runtime-ports-empty-text.tsx b/src/renderer/src/components/right-sidebar/runtime-ports-empty-text.tsx index 9c5427ed50e..7ac6d940809 100644 --- a/src/renderer/src/components/right-sidebar/runtime-ports-empty-text.tsx +++ b/src/renderer/src/components/right-sidebar/runtime-ports-empty-text.tsx @@ -31,7 +31,10 @@ export function RuntimePortsEmptyText(): React.JSX.Element { className="rounded-sm text-foreground underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring" onClick={() => openSettingsTarget({ pane: 'ports', repoId: null })} > - {t('auto.components.right.sidebar.PortsPanel.portsSettingsLink', 'Ports settings')} + {t( + 'auto.components.right.sidebar.PortsPanel.turnOnInSettings', + 'Turn on in Ports settings' + )} ) diff --git a/src/renderer/src/components/right-sidebar/ssh-forwarded-ports-section.tsx b/src/renderer/src/components/right-sidebar/ssh-forwarded-ports-section.tsx index 1fee94ef272..30a71573f19 100644 --- a/src/renderer/src/components/right-sidebar/ssh-forwarded-ports-section.tsx +++ b/src/renderer/src/components/right-sidebar/ssh-forwarded-ports-section.tsx @@ -43,10 +43,10 @@ export function SshForwardedPortsSection({ size={12} className={cn('text-muted-foreground transition-transform', !collapsed && 'rotate-90')} /> - + {t('auto.components.right.sidebar.PortsPanel.ddbe58d74e', 'Forwarded')} - {count > 0 && {count}} + {count > 0 && {count}}
} /> - {rangeError ? : null} + {rangeError && !off ? ( +
+ +
+ ) : null} update({ notify: !forwarding.notify })} disabled={off} /> diff --git a/src/renderer/src/i18n/en-runtime-required.json b/src/renderer/src/i18n/en-runtime-required.json index 8e0d0f7bda3..a7339c5466d 100644 --- a/src/renderer/src/i18n/en-runtime-required.json +++ b/src/renderer/src/i18n/en-runtime-required.json @@ -408,6 +408,10 @@ "selectedCount_one": "{{count}} selected", "selectedCount_other": "{{count}} selected" }, + "RuntimeForwardedPorts": { + "connectionCount_one": "{{count}} connection", + "connectionCount_other": "{{count}} connections" + }, "Search": { "fileCount_one": "{{count}} file", "fileCount_other": "{{count}} files", diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index df83f6def47..fee24d39e11 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -2159,10 +2159,11 @@ "runtimePortForwards": { "desktopOnly": "Port forwarding needs the desktop app.", "forwardedAnnouncement": "Forwarded :{{value0}} to localhost:{{value1}}", - "busyInUse": "localhost:{{value0}} in use", "updateHost": "Update Orca on this host", - "listenFailedHere": "Could not listen on this computer", - "hostNotReachable": "Host not reachable" + "hostNotReachable": "Host not reachable", + "failedAnnouncement": "Couldn't forward :{{value0}}. {{value1}}", + "busyInUseHere": "localhost:{{value0}} in use on this computer", + "listenFailedRetry": "Couldn't listen on this computer. Retry or pick another port" } }, "hooks": { @@ -14064,7 +14065,6 @@ }, "ports": { "autoForward": "Auto-forward ports", - "autoForwardDescription": "Forward dev servers on remote hosts to localhost here.", "exclusive": "Same port number only", "exclusiveDescription": "If the port is taken here, skip it instead of remapping.", "range": "Auto-forward port range", @@ -14081,7 +14081,9 @@ "devServer": "dev server", "descriptionSandboxes": "Forward dev servers in sandboxes and on remote hosts to this computer." }, - "rangeInvalid": "\"{{value0}}\" isn't a usable port. Use a port from 1 to 65535, lowest first." + "rangeInvalid": "\"{{value0}}\" isn't a usable port. Use a port from 1 to 65535, lowest first.", + "needsAutoForward": "Turn on Auto-forward ports to change this.", + "autoForwardDescriptionSandboxes": "Forward dev servers in sandboxes and on remote hosts to this computer." } }, "right": { @@ -14314,7 +14316,7 @@ "localPortRequiresPrivileges": "Port {{port}} requires elevated privileges. Use a local port ≥ 1024.", "remoteEmpty": "No ports yet. Dev servers started here are forwarded to localhost.", "remoteEmptyOff": "No ports yet. Auto-forward is off.", - "portsSettingsLink": "Ports settings" + "turnOnInSettings": "Turn on in Ports settings" }, "Search": { "1abfb25a66": "Type to search in files", @@ -15642,8 +15644,8 @@ "ssh": "SSH access", "stopped": "stopped", "stopLabel": "Stop forwarding port {{value0}}", - "oneConnection": "1 connection", - "manyConnections": "{{value0}} connections" + "connectionCount_one": "{{count}} connection", + "connectionCount_other": "{{count}} connections" }, "RuntimePortForward": { "pending": "Forwarding…", @@ -15655,12 +15657,12 @@ "stopForwarding": "Stop forwarding", "hostOfflineNote": "Host offline", "notAnswering": "Nothing answering on :{{value0}} yet", - "remappedInUse": "{{value0}} in use", "forwardedToLabel": "Port {{value0}} is forwarded to {{value1}}. Open in browser", "reconnect": "Reconnect", "actionLabel": "{{value0}} for port {{value1}}", "copyLocalUrl": "Copy local URL", - "stopAndSkip": "Stop and don't auto-forward :{{value0}}" + "stopAndSkip": "Stop and don't auto-forward :{{value0}}", + "remappedInUseHere": "({{value0}} in use here)" }, "CloudShare": { "alreadyShared": "Already shared", @@ -19989,8 +19991,8 @@ "forwarded": "Forwarded :{{value0}} to localhost:{{value1}}", "remappedInUse": "{{value0}} · {{value1}} in use on this computer", "many": "{{value0}} ports forwarded", - "openPorts": "Open Ports", - "busyInUse": "localhost:{{value0}} in use on this computer" + "busyInUse": "localhost:{{value0}} in use on this computer", + "openPortsPanel": "Open ports" } } }, diff --git a/src/renderer/src/lib/runtime-port-forwards/runtime-port-forwards-store.ts b/src/renderer/src/lib/runtime-port-forwards/runtime-port-forwards-store.ts index ad9ba4a16eb..3ef8ad9166f 100644 --- a/src/renderer/src/lib/runtime-port-forwards/runtime-port-forwards-store.ts +++ b/src/renderer/src/lib/runtime-port-forwards/runtime-port-forwards-store.ts @@ -67,7 +67,14 @@ export function runtimePortForwardingAvailable(): boolean { return typeof bridge()?.openPortForward === 'function' } +let announcementRepeat = 0 + function emit(next: ForwardState): void { + if (next.announcement && next.announcement === state.announcement.replace(/\u00a0+$/, '')) { + // Live regions only speak changed text; a trailing no-break space marks a repeat. + announcementRepeat = (announcementRepeat + 1) % 2 + next = { ...next, announcement: next.announcement + '\u00a0'.repeat(announcementRepeat + 1) } + } state = next for (const listener of listeners) { listener() @@ -189,10 +196,17 @@ export async function openRuntimePortForward( 'Forwarded :{{value0}} to localhost:{{value1}}', { value0: request.remotePort, value1: result.forward.localPort } ) - : `:${request.remotePort} ${runtimePortForwardFailureText({ - code: result.code, - localPort: request.localPort ?? request.remotePort - })}` + : translate( + 'auto.lib.runtimePortForwards.failedAnnouncement', + "Couldn't forward :{{value0}}. {{value1}}", + { + value0: request.remotePort, + value1: runtimePortForwardFailureText({ + code: result.code, + localPort: request.localPort ?? request.remotePort + }) + } + ) }) return result } @@ -219,16 +233,20 @@ export async function closeRuntimePortForward( export function runtimePortForwardFailureText(failure: RuntimePortForwardFailure): string { switch (failure.code) { case 'port_busy': - return translate('auto.lib.runtimePortForwards.busyInUse', 'localhost:{{value0}} in use', { - value0: failure.localPort - }) + return translate( + 'auto.lib.runtimePortForwards.busyInUseHere', + 'localhost:{{value0}} in use on this computer', + { + value0: failure.localPort + } + ) case 'host_unsupported': return translate('auto.lib.runtimePortForwards.updateHost', 'Update Orca on this host') case 'invalid_request': case 'listen_failed': return translate( - 'auto.lib.runtimePortForwards.listenFailedHere', - 'Could not listen on this computer' + 'auto.lib.runtimePortForwards.listenFailedRetry', + "Couldn't listen on this computer. Retry or pick another port" ) case 'tunnel_failed': return translate('auto.lib.runtimePortForwards.hostNotReachable', 'Host not reachable')