You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(i18n): reactive translate in terminal pane, tab bar and work-item dialogs - #39418
This is a batch of the reactive-translate rollout from #39353. It applies pnpm i18n:reactive-translate --helpers to terminal pane, tab bar and work-item dialogs:
components/terminal-pane
components/tab-bar
components/github-item-dialog
components/github-project
Codemod result: Rewrote 543 call(s), threaded 79 helper(s) into 66 render call site(s), in 147 file(s); left 16 for manual review. Total diff: 148 files, including helper files outside the directory that gain a defaulted t / intlLocale parameter.
This is a mechanical rewrite and behavior is unchanged with React Compiler off:
t from useTranslate() delegates to translate(), so every string is identical. Only its identity changes, and only on a language or resource change, when the tree already re-renders.
A threaded helper defaults its new parameter (t: Translate = translate), so callers that don't pass it are unchanged.
useMemo deps gain t only where they already include a useUiLanguageRevision() value.
Left for manual work because the rewrite would push these files over the max-lines budget. They stay untouched until someone splits them:
Skipped by the codemod (16 call sites, still counted by the ratchet):
components/github-item-dialog/inspect-pull-request/checks-tab-header.tsx:55 translate: ChecksTabActions is also called as a plain function
components/github-item-dialog/inspect-pull-request/checks-tab-header.tsx:61 translate: ChecksTabActions is also called as a plain function
components/github-item-dialog/inspect-pull-request/checks-tab-header.tsx:83 translate: ChecksTabActions is also called as a plain function
components/github-item-dialog/inspect-pull-request/checks-tab-header.tsx:84 translate: ChecksTabActions is also called as a plain function
components/github-item-dialog/inspect-pull-request/checks-tab-header.tsx:88 translate: ChecksTabActions is also called as a plain function
components/github-item-dialog/inspect-pull-request/checks-tab-header.tsx:111 translate: ChecksTabActions is also called as a plain function
components/github-item-dialog/inspect-pull-request/checks-tab-header.tsx:121 translate: ChecksTabActions is also called as a plain function
components/github-item-dialog/inspect-pull-request/checks-tab-header.tsx:125 translate: ChecksTabActions is also called as a plain function
components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-viewer.tsx:125 components/pull-request-page/files/inline-comments.ts#buildInlineReviewComments: useMemo without a language dependency (adding one changes when it recomputes)
components/tab-bar/TabBarAgentPickerEntry.tsx:21 components/tab-bar/tab-agent-launch-options.ts#buildAgentPickerLaunchOptions: useMemo without a language dependency (adding one changes when it recomputes)
components/tab-bar/TabBarCreateEntry.tsx:124 components/tab-bar/tab-create-entry-classifier.ts#getTabEntryOptions: useMemo without a language dependency (adding one changes when it recomputes)
components/tab-bar/use-open-tab-search.ts:67 components/tab-bar/open-tab-search-entries.ts#buildOpenTabSearchEntries: useMemo without a language dependency (adding one changes when it recomputes)
components/tab-bar/use-plugin-new-file-menu-options.ts:19 components/tab-bar/tab-create-menu-options.ts#withPluginNewFileMenuOptions: useMemo without a language dependency (adding one changes when it recomputes)
components/tab-bar/use-tab-bar-create-menu-controller.ts:141 components/tab-bar/tab-bar-windows-shell-options.ts#buildWindowsShellMenuEntries: useMemo without a language dependency (adding one changes when it recomputes)
components/tab-bar/use-tab-bar-create-menu-controller.ts:159 components/tab-bar/tab-create-menu-options.ts#buildTabCreateMenuOptions: useMemo without a language dependency (adding one changes when it recomputes)
components/tab-bar/use-tab-bar-item-projection.ts:145 components/tab-bar/tab-bar-item-model.ts#buildTabStripLayoutKey: useMemo without a language dependency (adding one changes when it recomputes)
The render-path-translate ratchet baseline drops to 2780.
Testing
pnpm tc
ORCA_CODE_QUALITY_BASE=origin/main pnpm check:changed (lint, ratchets, related unit tests)
…rminal pane, tab bar and work-item dialogs
Applies pnpm i18n:reactive-translate --helpers. Output is unchanged: t delegates
to translate() and helpers default the threaded parameter.
The change replaces many direct renderer translation calls with the useTranslate hook. Helper APIs now accept optional translators and pass them through rendering, search, validation, error-copy, and recovery paths. Selected relative-time labels now use the active locale. The listed UI text, conditional behavior, and fallback translation behavior remain unchanged.
Merge Risk: Low · up to 1053e
Changing language while these menus or searches remain open can leave some labels, validation messages, and search terms in the previous language. The issues are bounded and do not block merging, but should be fixed or accepted as follow-up.
Pre-merge checks: 4 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 2.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title names the main change: a refactor that moves render-path translations to the reactive useTranslate hook in the terminal pane, tab bar, and work-item dialog components. The changeset matches …
Description check
The description covers the template's core sections in substance. The Summary explains the codemod and the scope. It states the mechanical, behavior-neutral nature of the change and the defaulting of …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: a refactor that moves render-path translations to the reactive useTranslate hook in the terminal pane, tab bar, and work-item dialog components. The changeset matches this. The title is long at 82 characters, but it stays specific and readable.
Full details: Description check
Explanation
The description covers the template's core sections in substance. The Summary explains the codemod and the scope. It states the mechanical, behavior-neutral nature of the change and the defaulting of new helper parameters, and it lists the files left for manual work and the call sites the codemod skipped. The Testing section lists commands run. Several template sections are missing or incomplete: ELI5, Why (alternatives considered), Linked Issue (the template requires an issue link, and this PR links none, though it refers to #39353), Visual Proof (marked N/A or required for behavior changes, not addressed), the manual testing checkbox, Risk level and rollback plan, AI Disclosure, the Agent skill upstream boundary checkbox, and the Checklist. Because the core content is present but several required sections are absent, the check is marginal and I judge it a pass with gaps.
Resolution
Consider adding the following to the description: an ELI5 section; a Why section that names the alternatives considered; a Linked Issue entry (Fixes # or an actual issue link); a Visual Proof entry (write N/A with a reason, since the change is claimed to be behavior-neutral); a Risk section with a level and a rollback plan (a revert is likely sufficient, and this should be stated); and the completed checklist items. Also reconcile the counts in the description with the PR objectives, which report different numbers (for example 77 vs 79 helpers threaded, 59 vs 66 call sites, and baseline 2846 vs 2780).
Full details: Docstring Coverage
Explanation
Docstring coverage is 2.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 75 functions across 50 files. (98 skipped: 1 unsupported, 97 over the file limit.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
30-30: Trivial · Maintainability & Code Quality · Low value
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Pass t to projectViewErrorMessage in this component.
SlugDialogBody now calls useTranslate(). The calls to projectViewErrorMessage(res.error) on Lines 80, 120, 137, 238 and 258 omit the new optional translator. Comments.tsx has the same gap. Those error strings use the global translate, while other project components pass t. The fallback keeps output unchanged, so this is a minor consistency gap.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 4179ca23-1e81-436a-8fad-0226afa2fa56
Commits
Reviewing files that changed from the base of the PR and between dab4c41 and 1053eb0.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Supported by static analysis
Script executed:
sed -n '120,170p' src/renderer/src/components/tab-bar/use-tab-bar-create-menu-controller.ts
sed -n '1,80p' src/renderer/src/components/tab-bar/tab-bar-windows-shell-options.ts
If the shell dependencies stay unchanged during a language change, the cached CMD label can remain in the previous language while the prefix updates. Pass useTranslate() to the shell builder and include it in the memo dependencies.
Suggested fix
import { useEffect, useMemo, useRef, useState } from 'react'
+import { useTranslate } from '@/i18n/use-translate'
}): TabBarCreateMenuController {
+ const t = useTranslate()
// Why: <webview> clicks are out-of-process, so Radix's document-pointerdown outside-click check misses them; use window blur.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Supported by static analysis
Script executed:
nl -ba src/renderer/src/components/tab-bar/TabBarCreateEntry.tsx | sed -n '100,205p;330,380p'
nl -ba src/renderer/src/components/tab-bar/tab-create-entry-classifier.ts | sed -n '1,240p'
nl -ba src/renderer/src/i18n/use-translate.ts | sed -n '1,130p'
nl -ba src/renderer/src/i18n/i18n.ts | sed -n '70,125p'
Repository: stablyai/orca
Length of output: 20859
Pass the entry component’s translator into classification.
When translations change while the entry is open, the memo can retain an old status message while the placeholder updates. Pass t and include it in the memo dependencies.
Refresh the create-menu options when the translation scope changes.
After a language change, search-result labels and keywords can remain in the previous language. Depend on t in the controller memo. The plugin memo will also rebuild because it depends on the controller’s options array.
Suggested fix
import { buildTabCreateMenuOptions, type TabCreateMenuOption } from './tab-create-menu-options'
+import { useTranslate } from '@/i18n/use-translate'
@@
}): TabBarCreateMenuController {
+ const t = useTranslate()
@@
- }),+ }, t),
@@
terminalOnly,
+ t,
windowsShellEntries,
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
entries memo omits the translator, so simulator titles can use a different translator than the search.
buildOpenTabSearchEntries (Line 69) is called without t. buildSearchableSimulatorTabs therefore bakes the default-label title into document using the global translate. The entries memo also does not depend on t or languageRevision. The search at Lines 81-91 passes t, but the title already sits in the prebuilt document. Matching and displayed titles can lag a language change until entries rebuilds. Pass t and add languageRevision and t to the memo dependencies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a batch of the reactive-translate rollout from #39353. It applies
pnpm i18n:reactive-translate --helpersto terminal pane, tab bar and work-item dialogs:components/terminal-panecomponents/tab-barcomponents/github-item-dialogcomponents/github-projectCodemod result: Rewrote 543 call(s), threaded 79 helper(s) into 66 render call site(s), in 147 file(s); left 16 for manual review. Total diff: 148 files, including helper files outside the directory that gain a defaulted
t/intlLocaleparameter.This is a mechanical rewrite and behavior is unchanged with React Compiler off:
tfromuseTranslate()delegates totranslate(), so every string is identical. Only its identity changes, and only on a language or resource change, when the tree already re-renders.t: Translate = translate), so callers that don't pass it are unchanged.useMemodeps gaintonly where they already include auseUiLanguageRevision()value.Left for manual work because the rewrite would push these files over the
max-linesbudget. They stay untouched until someone splits them:src/renderer/src/components/automations/use-external-automation-actions.tssrc/renderer/src/components/tab-bar/EditorFileTab.tsxSkipped by the codemod (16 call sites, still counted by the ratchet):
The render-path-translate ratchet baseline drops to 2780.
Testing
pnpm tcORCA_CODE_QUALITY_BASE=origin/main pnpm check:changed(lint, ratchets, related unit tests)