From 800ed1976e58710a14c1e75dfbd5ffbf0dcdf1c0 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Sat, 7 Nov 2026 22:03:03 -0800 Subject: [PATCH] refactor(i18n): read render-path translations from useTranslate in the remaining renderer files (top-level components, app shell, entry points, hooks, lib) (#39427) Applies pnpm i18n:reactive-translate --helpers. Output is unchanged: t delegates to translate() and helpers default the threaded parameter. Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- config/render-path-translate-baseline.txt | 91 ------------- .../src/app-shell/AppRootSurfaces.tsx | 22 ++- .../src/app-shell/AppWorkspaceShell.tsx | 29 ++-- .../src/app-shell/TitlebarLeftControls.tsx | 30 ++--- .../src/app-shell/TitlebarMainStrip.tsx | 12 +- src/renderer/src/app-shell/WindowControls.tsx | 11 +- .../BrowserCookieImportDisclosure.tsx | 7 +- .../BrowserCookieImportMachineNotice.tsx | 11 +- .../components/ClaudeAccountSwitchDialog.tsx | 29 ++-- .../ClaudeAccountSwitchSessionTree.tsx | 51 ++++--- .../src/components/CodexRestartChip.tsx | 13 +- .../CodexSharedSettingsNoticeCard.tsx | 12 +- .../src/components/FirstLaunchBanner.tsx | 20 ++- .../components/HostedReviewUnlinkMenuItem.tsx | 7 +- .../src/components/JiraIssueRowCopyMenu.tsx | 15 ++- .../src/components/JiraIssueWorkspace.tsx | 7 +- .../components/JiraLinkedWorkspaceAction.tsx | 7 +- .../components/JiraPromptTemplatePopover.tsx | 31 ++--- src/renderer/src/components/Landing.tsx | 36 ++--- .../LinearIssueMarkdownDescriptionEditor.tsx | 8 +- .../components/LinearIssueMarkdownToolbar.tsx | 60 +++------ .../src/components/LinearIssueTextEditor.tsx | 9 +- .../src/components/LinearIssueWorkspace.tsx | 7 +- .../src/components/LinearItemDrawer.tsx | 35 +++-- .../LinuxPackageInstallRecoveryCard.tsx | 23 ++-- .../NativeChatRemoteResumeActions.tsx | 9 +- .../components/NativeChatResumeAutoNote.tsx | 12 +- .../NativeChatResumeDialogHeader.tsx | 13 +- .../NativeChatResumeFailureDetails.tsx | 27 ++-- .../NativeChatResumeOnRestartAgentRow.tsx | 9 +- .../NativeChatResumeOnRestartModal.tsx | 35 +++-- .../components/NativeChatResumeRunPanel.tsx | 41 +++--- .../NativeChatResumeRunStatusIcon.tsx | 37 ++--- .../components/NativeChatResumeRunSummary.tsx | 31 +++-- .../components/NativeChatResumeTreeRow.tsx | 10 +- .../components/NewWorkspaceComposerCard.tsx | 8 +- .../components/NewWorkspaceComposerModal.tsx | 12 +- .../src/components/OrcaSignInProgress.tsx | 14 +- src/renderer/src/components/QuickOpen.tsx | 27 ++-- .../src/components/SelectedTextCopyMenu.tsx | 5 +- .../src/components/ShortcutKeyCombo.tsx | 5 +- src/renderer/src/components/StarNagCard.tsx | 19 +-- .../TerminalLegacyEditorSurface.tsx | 5 +- .../src/components/TerminalSearch.tsx | 17 +-- .../components/TerminalWorkspaceDialogs.tsx | 28 ++-- .../src/components/UnexpectedSignoutCard.tsx | 36 ++--- src/renderer/src/components/UpdateCard.tsx | 40 +++--- .../src/components/UpdateErrorCardContent.tsx | 26 ++-- .../components/WorktreeBaseFallbackDialog.tsx | 9 +- src/renderer/src/components/ZoomOverlay.tsx | 9 +- .../browser-extension-install-dialog.tsx | 50 +++---- .../browser-extension-permission-messages.ts | 76 +++++------ .../browser-extension-removal-description.ts | 10 +- .../browser-webauthn-account-dialog.tsx | 17 ++- .../src/components/confirmation-dialog.tsx | 9 +- .../AgentCapabilitiesSetupAction.tsx | 5 +- .../components/gitlab-item-dialog-parts.tsx | 28 ++-- .../components/host-picker/HostCombobox.tsx | 10 +- .../host-picker/HostListSearchField.tsx | 6 +- .../host-picker/host-picker-copy.ts | 4 +- .../src/components/jira-attachment-image.tsx | 9 +- .../jira-connect-credential-guide.tsx | 14 +- .../src/components/jira-connect-dialog.tsx | 92 +++++-------- .../jira-credential-storage-copy.ts | 10 +- .../jira-issue-assignee-control.tsx | 11 +- .../jira-issue-transition-control.tsx | 26 ++-- .../jira-issue-workspace-actions.ts | 19 +-- .../jira-issue-workspace-chrome.tsx | 17 ++- .../jira-issue-workspace-content.tsx | 40 +++--- .../src/components/jira-list-columns-menu.tsx | 7 +- .../src/components/jira-project-picker.tsx | 7 +- .../src/components/jira-prompt-templates.ts | 11 +- .../jira-transition-fields-form.tsx | 11 +- .../src/components/jira-user-picker.tsx | 13 +- .../components/landing-preflight-issues.ts | 22 +-- .../src/components/linear-api-key-dialog.tsx | 53 ++++---- .../linear-custom-view-table-content.tsx | 33 +++-- .../src/components/linear-issue-activity.tsx | 20 +-- ...issue-attribute-filter-coverage-notice.tsx | 23 +++- ...inear-issue-attribute-filter-dropdowns.tsx | 48 +++---- .../linear-issue-attribute-filter-pills.ts | 50 +++---- ...linear-issue-attribute-filter-sections.tsx | 58 ++++---- .../linear-issue-project-selector.tsx | 20 ++- .../components/linear-issue-sub-issues.tsx | 13 +- .../linear-issue-workspace-header.tsx | 41 +++--- .../linear-issue-workspace-sidebar.tsx | 25 ++-- .../components/linear-issue-workspace-text.ts | 4 +- .../linear-item-drawer-comment-footer.tsx | 15 +-- .../linear-item-drawer-edit-chips-layout.tsx | 33 +++-- .../linear-item-drawer-edit-controls.tsx | 10 +- ...ear-item-drawer-edit-properties-layout.tsx | 45 +++---- .../linear-item-drawer-edit-section.tsx | 6 +- .../components/linear-item-drawer-sheet.tsx | 78 ++++++----- .../src/components/linear-priority-icon.tsx | 9 +- .../linear-project-overview-content.tsx | 59 ++++---- .../linear-project-overview-metadata.tsx | 5 +- .../components/linear-project-presentation.ts | 29 ++-- .../linear-project-table-content.tsx | 38 +++--- .../linear-project-view-surfaces.tsx | 48 ++++--- .../src/components/linear-scope-selector.tsx | 76 +++++------ .../components/linear-workspace-picker.tsx | 19 +-- .../link-routing-preference-dialog.tsx | 40 +++--- .../src/components/local-only-menu-hint.tsx | 5 +- .../update-card/update-card-error-model.ts | 125 +++++++++-------- .../update-card/update-card-visibility.ts | 25 ++-- .../native-chat-resume-activity-label.ts | 32 ++--- .../native-chat-resume-failure-guidance.ts | 33 +++-- .../src/components/pr-check-empty-details.tsx | 17 +-- .../quick-open-install-rg-guidance.tsx | 14 +- .../settings/chat/chat-behavior-search.ts | 4 +- .../settings/chat/chat-launch-search.ts | 4 +- .../chat/chat-turn-activity-search.ts | 4 +- .../settings/terminal/terminal-search.ts | 65 ++++++--- .../folder-workspace-source-selection.ts | 8 +- .../status-bar/SshStatusSegment.tsx | 14 +- .../src/components/tab-bar/EditorFileTab.tsx | 4 +- .../task-project-source-combobox.tsx | 29 ++-- .../src/components/use-google-cookie-clear.ts | 5 +- .../components/wsl-host-mark/WslHostMark.tsx | 4 +- .../hooks/installed-agent-skill-verdict.ts | 6 +- ...settings-navigation-capability-sections.ts | 86 +++++------- .../settings-navigation-interface-sections.ts | 57 ++++---- .../settings-navigation-remote-sections.ts | 88 ++++++------ .../settings-navigation-workflow-sections.ts | 64 +++++---- .../src/hooks/useInstalledAgentSkills.ts | 4 +- .../hooks/useSettingsNavigationMetadata.ts | 126 ++++++++++-------- src/renderer/src/lib/project-skill-runtime.ts | 26 ++-- .../src/lib/task-provider-error-copy.ts | 5 +- src/renderer/src/main.tsx | 7 +- src/renderer/src/popout.tsx | 7 +- .../catalog/plugin-contribution-catalog.ts | 7 +- .../status-bar/plugin-status-bar-items.ts | 6 +- src/renderer/src/web/WebConnect.tsx | 29 ++-- .../src/web/WebPairingSecurityNotice.tsx | 8 +- src/renderer/src/web/main.tsx | 7 +- .../src/web/web-pairing-security-guidance.ts | 15 ++- 136 files changed, 1657 insertions(+), 1772 deletions(-) diff --git a/config/render-path-translate-baseline.txt b/config/render-path-translate-baseline.txt index 4ddea096e40..87172622471 100644 --- a/config/render-path-translate-baseline.txt +++ b/config/render-path-translate-baseline.txt @@ -1,103 +1,12 @@ # Render-path translate()/getIntlLocale() calls in components and hooks, per file. # This is a RATCHET: counts may only go DOWN. Use useTranslate()/useIntlLocale() from # @/i18n/use-translate. Prune after a fix: pnpm check:render-path-translate-ratchet --prune -8 src/renderer/src/app-shell/AppRootSurfaces.tsx -11 src/renderer/src/app-shell/AppWorkspaceShell.tsx -11 src/renderer/src/app-shell/TitlebarLeftControls.tsx -4 src/renderer/src/app-shell/TitlebarMainStrip.tsx -4 src/renderer/src/app-shell/WindowControls.tsx -2 src/renderer/src/components/BrowserCookieImportDisclosure.tsx -4 src/renderer/src/components/BrowserCookieImportMachineNotice.tsx -6 src/renderer/src/components/ClaudeAccountSwitchDialog.tsx -5 src/renderer/src/components/ClaudeAccountSwitchSessionTree.tsx -5 src/renderer/src/components/CodexRestartChip.tsx -3 src/renderer/src/components/CodexSharedSettingsNoticeCard.tsx -7 src/renderer/src/components/FirstLaunchBanner.tsx -2 src/renderer/src/components/HostedReviewUnlinkMenuItem.tsx -6 src/renderer/src/components/JiraIssueRowCopyMenu.tsx -2 src/renderer/src/components/JiraIssueWorkspace.tsx -2 src/renderer/src/components/JiraLinkedWorkspaceAction.tsx -10 src/renderer/src/components/JiraPromptTemplatePopover.tsx -14 src/renderer/src/components/Landing.tsx -3 src/renderer/src/components/LinearIssueMarkdownDescriptionEditor.tsx -14 src/renderer/src/components/LinearIssueMarkdownToolbar.tsx -2 src/renderer/src/components/LinearIssueTextEditor.tsx -2 src/renderer/src/components/LinearIssueWorkspace.tsx -9 src/renderer/src/components/LinuxPackageInstallRecoveryCard.tsx -3 src/renderer/src/components/NativeChatRemoteResumeActions.tsx -3 src/renderer/src/components/NativeChatResumeAutoNote.tsx -5 src/renderer/src/components/NativeChatResumeDialogHeader.tsx -5 src/renderer/src/components/NativeChatResumeFailureDetails.tsx -2 src/renderer/src/components/NativeChatResumeOnRestartAgentRow.tsx 4 src/renderer/src/components/NativeChatResumeOnRestartGroups.tsx -11 src/renderer/src/components/NativeChatResumeOnRestartModal.tsx -1 src/renderer/src/components/NativeChatResumeRunPanel.tsx -1 src/renderer/src/components/NativeChatResumeRunStatusIcon.tsx -6 src/renderer/src/components/NativeChatResumeRunSummary.tsx -3 src/renderer/src/components/NativeChatResumeTreeRow.tsx -3 src/renderer/src/components/NewWorkspaceComposerCard.tsx -4 src/renderer/src/components/NewWorkspaceComposerModal.tsx -4 src/renderer/src/components/OrcaSignInProgress.tsx -12 src/renderer/src/components/QuickOpen.tsx -1 src/renderer/src/components/SelectedTextCopyMenu.tsx -1 src/renderer/src/components/ShortcutKeyCombo.tsx -8 src/renderer/src/components/StarNagCard.tsx -1 src/renderer/src/components/TerminalLegacyEditorSurface.tsx -7 src/renderer/src/components/TerminalSearch.tsx -11 src/renderer/src/components/TerminalWorkspaceDialogs.tsx -12 src/renderer/src/components/UnexpectedSignoutCard.tsx -3 src/renderer/src/components/UpdateCard.tsx -11 src/renderer/src/components/UpdateErrorCardContent.tsx -3 src/renderer/src/components/WorktreeBaseFallbackDialog.tsx -3 src/renderer/src/components/ZoomOverlay.tsx 2 src/renderer/src/components/agent/AgentLaunchPromptComposer.tsx 9 src/renderer/src/components/agent/AgentLaunchSetupPanel.tsx 5 src/renderer/src/components/automations/use-external-automation-actions.ts -10 src/renderer/src/components/browser-extension-install-dialog.tsx -4 src/renderer/src/components/browser-webauthn-account-dialog.tsx -3 src/renderer/src/components/confirmation-dialog.tsx 1 src/renderer/src/components/diff-comments/useDiffCommentDecorator.tsx 2 src/renderer/src/components/editor/markdown-preview/render-tree/use-markdown-preview-components.tsx 3 src/renderer/src/components/editor/review-note-delivery/ReviewNotesSendMenuContent.tsx -10 src/renderer/src/components/gitlab-item-dialog-parts.tsx -1 src/renderer/src/components/jira-attachment-image.tsx -5 src/renderer/src/components/jira-connect-credential-guide.tsx -30 src/renderer/src/components/jira-connect-dialog.tsx -4 src/renderer/src/components/jira-issue-assignee-control.tsx -10 src/renderer/src/components/jira-issue-transition-control.tsx -5 src/renderer/src/components/jira-issue-workspace-chrome.tsx -12 src/renderer/src/components/jira-issue-workspace-content.tsx -1 src/renderer/src/components/jira-list-columns-menu.tsx -2 src/renderer/src/components/jira-project-picker.tsx -4 src/renderer/src/components/jira-transition-fields-form.tsx -4 src/renderer/src/components/jira-user-picker.tsx -19 src/renderer/src/components/linear-api-key-dialog.tsx -10 src/renderer/src/components/linear-custom-view-table-content.tsx -5 src/renderer/src/components/linear-issue-activity.tsx -9 src/renderer/src/components/linear-issue-attribute-filter-dropdowns.tsx -15 src/renderer/src/components/linear-issue-attribute-filter-sections.tsx -6 src/renderer/src/components/linear-issue-project-selector.tsx -3 src/renderer/src/components/linear-issue-sub-issues.tsx -14 src/renderer/src/components/linear-issue-workspace-header.tsx -8 src/renderer/src/components/linear-issue-workspace-sidebar.tsx -5 src/renderer/src/components/linear-item-drawer-comment-footer.tsx -3 src/renderer/src/components/linear-priority-icon.tsx -17 src/renderer/src/components/linear-project-overview-content.tsx -1 src/renderer/src/components/linear-project-overview-metadata.tsx -10 src/renderer/src/components/linear-project-table-content.tsx -9 src/renderer/src/components/linear-project-view-surfaces.tsx -8 src/renderer/src/components/linear-scope-selector.tsx -5 src/renderer/src/components/linear-workspace-picker.tsx -14 src/renderer/src/components/link-routing-preference-dialog.tsx -1 src/renderer/src/components/local-only-menu-hint.tsx -7 src/renderer/src/components/pr-check-empty-details.tsx -5 src/renderer/src/components/quick-open-install-rg-guidance.tsx 1 src/renderer/src/components/tab-group/useTabGroupCreationCommands.ts -4 src/renderer/src/components/task-project-source-combobox.tsx -1 src/renderer/src/components/use-google-cookie-clear.ts 3 src/renderer/src/components/worktree-creation/PendingNativeChatCreation.tsx -2 src/renderer/src/main.tsx -2 src/renderer/src/popout.tsx -12 src/renderer/src/web/WebConnect.tsx -1 src/renderer/src/web/WebPairingSecurityNotice.tsx -2 src/renderer/src/web/main.tsx diff --git a/src/renderer/src/app-shell/AppRootSurfaces.tsx b/src/renderer/src/app-shell/AppRootSurfaces.tsx index e5bddf19a7d..4288c87f2f4 100644 --- a/src/renderer/src/app-shell/AppRootSurfaces.tsx +++ b/src/renderer/src/app-shell/AppRootSurfaces.tsx @@ -5,7 +5,7 @@ import { useLanguageReadiness } from '../i18n/language-readiness' import { memo, Suspense } from 'react' import { createPortal } from 'react-dom' import { lazyWithRetry as lazy } from '@/lib/lazy-with-retry' -import { translate } from '@/i18n/i18n' +import { useTranslate } from '@/i18n/use-translate' import { RecoverableRenderErrorBoundary } from '../components/error-boundaries/RecoverableRenderErrorBoundary' import NewWorkspaceComposerModal from '../components/NewWorkspaceComposerModal' import { CrashReportDialog } from '../components/crash-report/CrashReportDialog' @@ -119,6 +119,7 @@ export const AppRootSurfaces = memo(function AppRootSurfaces(props: { floatingWorkspace: FloatingWorkspacePanelState onboardingGate: OnboardingGate }): React.JSX.Element { + const t = useTranslate() const { floatingWorkspace, onboardingGate } = props // Memoized: subscribe so a language change still repaints its labels. useTranslation() @@ -151,8 +152,8 @@ export const AppRootSurfaces = memo(function AppRootSurfaces(props: { @@ -346,8 +344,8 @@ export const AppRootSurfaces = memo(function AppRootSurfaces(props: { reportAsCrash={false} resetKey={activeModal} compact - title={translate('auto.App.722d03aa62', 'The crash report dialog hit an error.')} - description={translate( + title={t('auto.App.722d03aa62', 'The crash report dialog hit an error.')} + description={t( 'auto.App.acd66311dc', 'Use the Help menu after retrying if you still need diagnostics.' )} @@ -361,8 +359,8 @@ export const AppRootSurfaces = memo(function AppRootSurfaces(props: { boundaryId="modal.onboarding" surface="modal" className="fixed inset-0 z-40 bg-background" - title={translate('auto.App.f02d37278a', 'Onboarding hit an error.')} - description={translate( + title={t('auto.App.f02d37278a', 'Onboarding hit an error.')} + description={t( 'auto.App.221a95ba38', 'Retry onboarding or close it and continue in the app.' )} diff --git a/src/renderer/src/app-shell/AppWorkspaceShell.tsx b/src/renderer/src/app-shell/AppWorkspaceShell.tsx index 9540fe2cb38..4b890eccee7 100644 --- a/src/renderer/src/app-shell/AppWorkspaceShell.tsx +++ b/src/renderer/src/app-shell/AppWorkspaceShell.tsx @@ -1,6 +1,6 @@ import { memo, Suspense, useCallback, useRef } from 'react' import { lazyWithRetry as lazy } from '@/lib/lazy-with-retry' -import { translate } from '@/i18n/i18n' +import { useTranslate } from '@/i18n/use-translate' import { useAppStore } from '@/store' import { usePluginViewCaptureStore } from '@/store/plugins/capture/plugin-view-capture' import { pendingCreationOpensNativeChat } from '@/lib/workspace/creation/pending-worktree-creation' @@ -47,19 +47,20 @@ function WorktreeSidebar({ layout: AppChromeLayout scrollRefs: WorktreeSidebarScrollRefs }): React.JSX.Element { + const t = useTranslate() return ( const titlebarMainStrip = @@ -135,8 +137,8 @@ export function AppWorkspaceShell(props: { boundaryId="app.workspace-shell" surface="workspace-shell" resetKey={layout.activeView} - title={translate('auto.App.df1d56bf87', 'The workspace shell hit an error.')} - description={translate( + title={t('auto.App.df1d56bf87', 'The workspace shell hit an error.')} + description={t( 'auto.App.8504ddf267', 'The app is still running. Retry the shell or use the menu to report the crash details.' )} @@ -214,11 +216,8 @@ export function AppWorkspaceShell(props: { boundaryId="terminal.workbench" surface="terminal-workbench" resetKey="terminal" - title={translate( - 'auto.App.5a9519aef0', - 'The workspace workbench hit an error.' - )} - description={translate( + title={t('auto.App.5a9519aef0', 'The workspace workbench hit an error.')} + description={t( 'auto.App.98d4ea2823', 'Terminal, browser, or editor rendering failed in this workspace. Retry to remount it.' )} @@ -233,8 +232,8 @@ export function AppWorkspaceShell(props: { boundaryId={`page.${layout.activeView}`} surface="page" resetKey={layout.activeView} - title={translate('auto.App.b7a714db1e', 'This page hit an error.')} - description={translate( + title={t('auto.App.b7a714db1e', 'This page hit an error.')} + description={t( 'auto.App.03a14f6b5b', 'Retry the page or navigate to another Orca surface.' )} @@ -263,8 +262,8 @@ export function AppWorkspaceShell(props: { ? `${layout.rightSidebarTab}:${layout.rightSidebarExplorerView}` : layout.rightSidebarTab } - title={translate('auto.App.ed6b168d00', 'The right sidebar hit an error.')} - description={translate( + title={t('auto.App.ed6b168d00', 'The right sidebar hit an error.')} + description={t( 'auto.App.8d1e160ed1', 'Retry the sidebar or switch tabs to reload this surface.' )} diff --git a/src/renderer/src/app-shell/TitlebarLeftControls.tsx b/src/renderer/src/app-shell/TitlebarLeftControls.tsx index b620debd569..368782096ad 100644 --- a/src/renderer/src/app-shell/TitlebarLeftControls.tsx +++ b/src/renderer/src/app-shell/TitlebarLeftControls.tsx @@ -1,6 +1,6 @@ import { ArrowLeft, ArrowRight, MoreHorizontal, PanelLeft } from 'lucide-react' import logo from '../../../../resources/logo.svg' -import { translate } from '@/i18n/i18n' +import { useTranslate } from '@/i18n/use-translate' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { ContextMenu, @@ -20,6 +20,7 @@ import type { AppChromeLayout } from './use-app-chrome-layout' /** Reuse left chrome across full-width and sidebar-width headers so controls/popovers stay consistent. */ export function TitlebarLeftControls({ layout }: { layout: AppChromeLayout }): React.JSX.Element { + const t = useTranslate() const toggleSidebar = useAppStore((s) => s.toggleSidebar) const updateSettings = useAppStore((s) => s.updateSettings) const canGoBackWorktree = useAppStore(canGoBackWorktreeHistory) @@ -47,14 +48,14 @@ export function TitlebarLeftControls({ layout }: { layout: AppChromeLayout }): R - {translate('auto.App.8b0b8eb54f', 'Application menu')} + {t('auto.App.8b0b8eb54f', 'Application menu')} @@ -64,13 +65,8 @@ export function TitlebarLeftControls({ layout }: { layout: AppChromeLayout }): R {layout.showSidebar && !hasCustomTitleBar && layout.showTitlebarAppName && ( -
- - {translate('auto.App.5096cbbc86', 'Orca')} - +
+ {t('auto.App.5096cbbc86', 'Orca')}
@@ -79,7 +75,7 @@ export function TitlebarLeftControls({ layout }: { layout: AppChromeLayout }): R void updateSettings({ showTitlebarAppName: false }) }} > - {translate('auto.App.e81217c1b7', 'Hide App Name')} + {t('auto.App.e81217c1b7', 'Hide App Name')} @@ -90,13 +86,13 @@ export function TitlebarLeftControls({ layout }: { layout: AppChromeLayout }): R - {translate('auto.App.ce37cf5279', 'Toggle sidebar ({{value0}})', { + {t('auto.App.ce37cf5279', 'Toggle sidebar ({{value0}})', { value0: leftSidebarShortcutLabel })} @@ -113,13 +109,13 @@ export function TitlebarLeftControls({ layout }: { layout: AppChromeLayout }): R className="sidebar-toggle sidebar-toggle-compact" onClick={() => useAppStore.getState().goBackWorktree()} disabled={!canGoBackWorktree} - aria-label={translate('auto.App.064bd07810', 'Go back')} + aria-label={t('auto.App.064bd07810', 'Go back')} > - {translate('auto.App.fe21e8f6f5', 'Go back ({{value0}})', { + {t('auto.App.fe21e8f6f5', 'Go back ({{value0}})', { value0: historyBackShortcutLabel })} @@ -130,13 +126,13 @@ export function TitlebarLeftControls({ layout }: { layout: AppChromeLayout }): R className="sidebar-toggle sidebar-toggle-compact" onClick={() => useAppStore.getState().goForwardWorktree()} disabled={!canGoForwardWorktree} - aria-label={translate('auto.App.cf9099fe98', 'Go forward')} + aria-label={t('auto.App.cf9099fe98', 'Go forward')} > - {translate('auto.App.f7aa73e785', 'Go forward ({{value0}})', { + {t('auto.App.f7aa73e785', 'Go forward ({{value0}})', { value0: historyForwardShortcutLabel })} diff --git a/src/renderer/src/app-shell/TitlebarMainStrip.tsx b/src/renderer/src/app-shell/TitlebarMainStrip.tsx index 475ea5c5471..bf9b5576350 100644 --- a/src/renderer/src/app-shell/TitlebarMainStrip.tsx +++ b/src/renderer/src/app-shell/TitlebarMainStrip.tsx @@ -1,5 +1,5 @@ import { Minimize2, PanelRight } from 'lucide-react' -import { translate } from '@/i18n/i18n' +import { useTranslate } from '@/i18n/use-translate' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { TOGGLE_TERMINAL_PANE_EXPAND_EVENT } from '@/constants/terminal' import { ActivityTitlebarControls } from '../components/activity/ActivityTitlebarControls' @@ -10,6 +10,7 @@ import { hasCustomTitleBar } from './app-window-chrome' import type { AppChromeLayout } from './use-app-chrome-layout' export function RightSidebarToggle(): React.JSX.Element { + const t = useTranslate() const toggleRightSidebar = useAppStore((s) => s.toggleRightSidebar) const rightSidebarShortcutLabel = useShortcutLabel('sidebar.right.toggle') return ( @@ -18,13 +19,13 @@ export function RightSidebarToggle(): React.JSX.Element { - {translate('auto.App.c184e056de', 'Toggle right sidebar ({{value0}})', { + {t('auto.App.c184e056de', 'Toggle right sidebar ({{value0}})', { value0: rightSidebarShortcutLabel })} @@ -33,6 +34,7 @@ export function RightSidebarToggle(): React.JSX.Element { } export function TitlebarMainStrip({ layout }: { layout: AppChromeLayout }): React.JSX.Element { + const t = useTranslate() const handleToggleExpand = (): void => { const { effectiveActiveTabId } = selectActiveTerminalChromeState(useAppStore.getState()) if (!effectiveActiveTabId) { @@ -61,14 +63,14 @@ export function TitlebarMainStrip({ layout }: { layout: AppChromeLayout }): Reac - {translate('auto.App.c1cf0b0e4a', 'Collapse pane')} + {t('auto.App.c1cf0b0e4a', 'Collapse pane')} )} diff --git a/src/renderer/src/app-shell/WindowControls.tsx b/src/renderer/src/app-shell/WindowControls.tsx index 409b68241c0..97c1f71ab30 100644 --- a/src/renderer/src/app-shell/WindowControls.tsx +++ b/src/renderer/src/app-shell/WindowControls.tsx @@ -1,8 +1,9 @@ import { useEffect, useState } from 'react' -import { translate } from '@/i18n/i18n' +import { useTranslate } from '@/i18n/use-translate' // Windows/Linux replace native chrome with renderer controls. export function WindowControls(): React.JSX.Element { + const t = useTranslate() const [maximized, setMaximized] = useState(false) useEffect(() => { // Seed maximization from main; transition events alone miss startup-maximized windows. @@ -22,7 +23,7 @@ export function WindowControls(): React.JSX.Element {
@@ -139,18 +140,18 @@ function SwitchPromptDialog({ prompt }: { prompt: ClaudeAccountSwitchPrompt }): ) } -function promptDescription(prompt: ClaudeAccountSwitchPrompt): string { +function promptDescription(prompt: ClaudeAccountSwitchPrompt, t: Translate = translate): string { const { onAccount, elsewhere, cantMove } = prompt.sessions const next = prompt.nextAccountLabel if (prompt.review) { const count = elsewhere.length + cantMove.length - return translate( + return t( 'accounts.claude.switchSessions.reviewBody', "{{count}} other Claude sessions weren't moved to {{next}}.", { count, next, defaultValue_one: "{{count}} other Claude session wasn't moved to {{next}}." } ) } - return translate( + return t( 'accounts.claude.switchSessions.body', '{{count}} Claude sessions are still running on {{previous}}. Restarting continues each conversation on {{next}}. Busy sessions wait for idle before restarting.', { diff --git a/src/renderer/src/components/ClaudeAccountSwitchSessionTree.tsx b/src/renderer/src/components/ClaudeAccountSwitchSessionTree.tsx index 9ec3cb39102..f4e08c63edf 100644 --- a/src/renderer/src/components/ClaudeAccountSwitchSessionTree.tsx +++ b/src/renderer/src/components/ClaudeAccountSwitchSessionTree.tsx @@ -1,6 +1,7 @@ import { Fragment, useLayoutEffect, useRef, useState } from 'react' import { Folder, GitBranch } from 'lucide-react' import { translate } from '@/i18n/i18n' +import { useTranslate, type Translate } from '@/i18n/use-translate' import { AgentIcon } from '@/lib/agent-catalog' import { formatAgentTypeLabel } from '../../../shared/agent-status/presentation/agent-type-label' import type { ClaudeAccountSwitchPromptSessions } from '@/lib/claude-account-switch-sessions' @@ -46,7 +47,8 @@ export function ClaudeAccountSwitchSessionTree({ sessions: ClaudeAccountSwitchPromptSessions previousAccountLabel: string }): React.JSX.Element { - const groups = sessionGroups(sessions, previousAccountLabel) + const t = useTranslate() + const groups = sessionGroups(sessions, previousAccountLabel, t) const treeRef = useRef(null) const pinnedIndex = useNextGroupBelowFold(treeRef, groups.length) return ( @@ -54,10 +56,7 @@ export function ClaudeAccountSwitchSessionTree({ ref={treeRef} role="tree" tabIndex={0} - aria-label={translate( - 'accounts.claude.switchSessions.listLabel', - 'Claude sessions to restart' - )} + aria-label={t('accounts.claude.switchSessions.listLabel', 'Claude sessions to restart')} className="relative max-h-64 min-h-0 scroll-py-8 overflow-y-auto scrollbar-sleek rounded-md bg-worktree-sidebar p-1.5 pb-2" onKeyDown={moveInTree} > @@ -121,29 +120,30 @@ function useNextGroupBelowFold( function sessionGroups( sessions: ClaudeAccountSwitchPromptSessions, - previousAccountLabel: string + previousAccountLabel: string, + t: Translate = translate ): SessionGroup[] { const groups: SessionGroup[] = [ { key: 'on-account', - title: translate('accounts.claude.switchSessions.groupOnAccount', 'Running on {{account}}', { + title: t('accounts.claude.switchSessions.groupOnAccount', 'Running on {{account}}', { account: previousAccountLabel }), sessions: sessions.onAccount }, { key: 'elsewhere', - title: translate('accounts.claude.switchSessions.groupElsewhere', 'Not on {{account}}', { + title: t('accounts.claude.switchSessions.groupElsewhere', 'Not on {{account}}', { account: previousAccountLabel }), sessions: sessions.elsewhere.map((session) => ({ ...session, reason: session.accountLabel })) }, { key: 'cant-move', - title: translate('accounts.claude.switchSessions.groupCantMove', "Can't move"), + title: t('accounts.claude.switchSessions.groupCantMove', "Can't move"), sessions: sessions.cantMove.map((session) => ({ ...session, - reason: cantMoveReasonLabel(session.reason) + reason: cantMoveReasonLabel(session.reason, t) })), fixed: true } @@ -151,24 +151,21 @@ function sessionGroups( return groups.filter((group) => group.sessions.length > 0) } -function cantMoveReasonLabel(reason: ClaudeSessionCantMoveReason): string { +function cantMoveReasonLabel( + reason: ClaudeSessionCantMoveReason, + t: Translate = translate +): string { switch (reason) { case 'wsl-terminal': - return translate('accounts.claude.switchSessions.reasonWsl', 'WSL terminal') + return t('accounts.claude.switchSessions.reasonWsl', 'WSL terminal') case 'own-folder': - return translate( - 'accounts.claude.switchSessions.reasonOwnFolder', - 'Uses your own Claude folder' - ) + return t('accounts.claude.switchSessions.reasonOwnFolder', 'Uses your own Claude folder') case 'unknown-account': - return translate('accounts.claude.switchSessions.reasonUnknownAccount', 'Account unknown') + return t('accounts.claude.switchSessions.reasonUnknownAccount', 'Account unknown') case 'no-session': - return translate('accounts.claude.switchSessions.reasonNoSession', "Can't resume") + return t('accounts.claude.switchSessions.reasonNoSession', "Can't resume") case 'shared-session': - return translate( - 'accounts.claude.switchSessions.reasonSharedSession', - 'Also open in another pane' - ) + return t('accounts.claude.switchSessions.reasonSharedSession', 'Also open in another pane') } } @@ -189,6 +186,7 @@ function GroupHeader({ selected, onToggle }: SessionTreeProps & { group: SessionGroup; pinnedToBottom: boolean }): React.JSX.Element { + const t = useTranslate() const ptyIds = group.sessions.map((session) => session.ptyId) const selection = resumeSelectionState(ptyIds, selected) return ( @@ -203,7 +201,7 @@ function GroupHeader({ disabled={false} checkboxSlot={group.fixed ? EMPTY_CHECKBOX_SLOT : undefined} onCheckedChange={() => toggleResumeSelection(ptyIds, selection, onToggle)} - checkboxLabel={translate( + checkboxLabel={t( 'accounts.claude.switchSessions.selectGroup', 'Select all sessions in {{group}}', { group: group.title } @@ -268,6 +266,7 @@ function SessionRow({ checked: boolean onToggle: (ptyId: string, checked: boolean) => void }): React.JSX.Element { + const t = useTranslate() const paneKey = makePaneKey(session.tabId, session.leafId) const tabTitle = useAppStore((store) => { const tab = store.tabsByWorktree[session.worktreeId]?.find( @@ -278,7 +277,7 @@ function SessionRow({ const lastPrompt = useAppStore((store) => store.agentStatusByPaneKey[paneKey]?.prompt?.trim()) const busy = useAppStore((store) => isClaudePaneMidTurn(store, paneKey)) const title = - lastPrompt || tabTitle || translate('accounts.claude.switchSessions.session', 'Claude session') + lastPrompt || tabTitle || t('accounts.claude.switchSessions.session', 'Claude session') return ( {session.reason ?? (busy - ? translate('accounts.claude.switchSessions.busy', 'Working') - : translate('accounts.claude.switchSessions.idle', 'Idle'))} + ? t('accounts.claude.switchSessions.busy', 'Working') + : t('accounts.claude.switchSessions.idle', 'Idle'))} ) diff --git a/src/renderer/src/components/CodexRestartChip.tsx b/src/renderer/src/components/CodexRestartChip.tsx index 4a522d42b63..04e75cf5470 100644 --- a/src/renderer/src/components/CodexRestartChip.tsx +++ b/src/renderer/src/components/CodexRestartChip.tsx @@ -2,7 +2,7 @@ import { useEffect, useId, useRef } from 'react' import { RefreshCw } from 'lucide-react' import { Button } from '@/components/ui/button' import { useAppStore } from '../store' -import { translate } from '@/i18n/i18n' +import { useTranslate } from '@/i18n/use-translate' import { shouldFocusMobileDriverAction } from './terminal-pane/mobile-driver/mobile-driver-overlay-focus' import { awaitsCodexRestartAnswer } from './codex-restart-notice-state' @@ -73,6 +73,7 @@ function LoudRestartOverlay({ onDismiss: () => void onRestart: () => void }): React.JSX.Element { + const t = useTranslate() const titleId = useId() const bodyId = useId() const rootRef = useRef(null) @@ -129,10 +130,10 @@ function LoudRestartOverlay({
- {translate('auto.components.CodexRestartChip.d3e8a1f4b2', 'Account switched')} + {t('auto.components.CodexRestartChip.d3e8a1f4b2', 'Account switched')}
- {translate( + {t( 'auto.components.CodexRestartChip.a4c8e1b2f7', 'Codex is still signed in as {{value0}}', { value0: restartNotice.previousAccountLabel } @@ -141,7 +142,7 @@ function LoudRestartOverlay({
- {translate( + {t( 'auto.components.CodexRestartChip.9375620cc3', 'Restart this session to use {{value0}}. It stays on the previous account until you do.', { value0: restartNotice.nextAccountLabel } @@ -149,11 +150,11 @@ function LoudRestartOverlay({
diff --git a/src/renderer/src/components/CodexSharedSettingsNoticeCard.tsx b/src/renderer/src/components/CodexSharedSettingsNoticeCard.tsx index ba4d6065a88..e49400101b7 100644 --- a/src/renderer/src/components/CodexSharedSettingsNoticeCard.tsx +++ b/src/renderer/src/components/CodexSharedSettingsNoticeCard.tsx @@ -1,11 +1,12 @@ import { Info, X } from 'lucide-react' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from './ui/card' import { Button } from './ui/button' -import { translate } from '@/i18n/i18n' +import { useTranslate } from '@/i18n/use-translate' import { useCodexSharedSettingsNotice } from './terminal-pane/provider-notices/codex-settings/codex-shared-settings-notice' /** A persistent one-time notice, so it sits with the other cards rather than as a sticky toast. */ export function CodexSharedSettingsNoticeCard(): React.JSX.Element | null { + const t = useTranslate() const { visible, dismiss } = useCodexSharedSettingsNotice() if (!visible) { return null @@ -17,17 +18,14 @@ export function CodexSharedSettingsNoticeCard(): React.JSX.Element | null {
- {translate( - 'terminal.codexSharedSettingsNotice.title', - 'Codex in Orca now uses ~/.codex' - )} + {t('terminal.codexSharedSettingsNotice.title', 'Codex in Orca now uses ~/.codex')}
@@ -35,7 +33,7 @@ export function CodexSharedSettingsNoticeCard(): React.JSX.Element | null { - {translate( + {t( 'terminal.codexSharedSettingsNotice.description', 'Codex may ask again to trust folders or approve commands. Re-add any MCP servers you added only in Orca.' )} diff --git a/src/renderer/src/components/FirstLaunchBanner.tsx b/src/renderer/src/components/FirstLaunchBanner.tsx index 953d598981b..1a40a437175 100644 --- a/src/renderer/src/components/FirstLaunchBanner.tsx +++ b/src/renderer/src/components/FirstLaunchBanner.tsx @@ -6,7 +6,7 @@ import { X } from 'lucide-react' import { Button } from './ui/button' import { acknowledgeBanner, PRIVACY_URL, setOptIn as telemetrySetOptIn } from '../lib/telemetry' import { useMountedRef } from '@/hooks/useMountedRef' -import { translate } from '@/i18n/i18n' +import { useTranslate } from '@/i18n/use-translate' import { openAppHttpLink } from '@/lib/browser/navigation/app-http-link-open' type FirstLaunchBannerProps = { @@ -18,6 +18,7 @@ export function FirstLaunchBanner({ onResolve, fetchSettings }: FirstLaunchBannerProps): React.JSX.Element { + const t = useTranslate() // Prevent duplicate opt-outs being retagged as settings-origin on a second click. const [inFlight, setInFlight] = useState(false) const mountedRef = useMountedRef() @@ -66,19 +67,16 @@ export function FirstLaunchBanner({
{/* Let text shrink without wrapping the action column. */}

- {translate( - 'auto.components.FirstLaunchBanner.9784b4d7bc', - 'Help us decide what to build next' - )} + {t('auto.components.FirstLaunchBanner.9784b4d7bc', 'Help us decide what to build next')}

- {translate( + {t( 'auto.components.FirstLaunchBanner.958d2cc31b', 'Anonymous counts of which features you use help us prioritize what to build. No file contents, prompts, terminal output, or anything that identifies you. Change anytime in Settings -> Privacy & Telemetry.' )}{' '} @@ -87,7 +85,7 @@ export function FirstLaunchBanner({ className="underline underline-offset-2 hover:text-foreground" onClick={(event) => openAppHttpLink(PRIVACY_URL, { event })} > - {translate('auto.components.FirstLaunchBanner.d1deebb050', 'Privacy policy')} + {t('auto.components.FirstLaunchBanner.d1deebb050', 'Privacy policy')} .

@@ -101,16 +99,16 @@ export function FirstLaunchBanner({ disabled={inFlight} className="border-border/60 text-muted-foreground" > - {translate('auto.components.FirstLaunchBanner.fc5cc29955', 'Opt out')} + {t('auto.components.FirstLaunchBanner.fc5cc29955', 'Opt out')}
{/* Dismiss persists opt-in; it does more than hide the notice. */}