From 90697091d02c9d1925d5f404558f552b8bf005a5 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Sat, 7 Nov 2026 19:39:19 -0800 Subject: [PATCH] refactor(i18n): read render-path translations from useTranslate in the review animated visuals (#39696) The codemod skipped both visuals because a timer-clearing callback named its parameter `t`. Rename it to `timer` and convert their copy to useTranslate. Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- config/render-path-translate-baseline.txt | 2 - .../ReviewNotesAnimatedVisual.tsx | 33 ++++------ .../feature-wall/ReviewShipAnimatedVisual.tsx | 63 ++++++------------- 3 files changed, 31 insertions(+), 67 deletions(-) diff --git a/config/render-path-translate-baseline.txt b/config/render-path-translate-baseline.txt index 2f6afe81d50..ff52fc75798 100644 --- a/config/render-path-translate-baseline.txt +++ b/config/render-path-translate-baseline.txt @@ -204,8 +204,6 @@ 1 src/renderer/src/components/feature-tips/use-session-search-tip-setup.ts 3 src/renderer/src/components/feature-wall/AgentCapabilitiesSetupAction.tsx 2 src/renderer/src/components/feature-wall/FeatureWallTourSurface.tsx -8 src/renderer/src/components/feature-wall/ReviewNotesAnimatedVisual.tsx -17 src/renderer/src/components/feature-wall/ReviewShipAnimatedVisual.tsx 2 src/renderer/src/components/file-actions/OpenInContextSubmenu.tsx 5 src/renderer/src/components/floating-terminal/FloatingTerminalEmptyState.tsx 3 src/renderer/src/components/floating-terminal/FloatingTerminalIconContextMenu.tsx diff --git a/src/renderer/src/components/feature-wall/ReviewNotesAnimatedVisual.tsx b/src/renderer/src/components/feature-wall/ReviewNotesAnimatedVisual.tsx index 320d71fcff4..50587c8266f 100644 --- a/src/renderer/src/components/feature-wall/ReviewNotesAnimatedVisual.tsx +++ b/src/renderer/src/components/feature-wall/ReviewNotesAnimatedVisual.tsx @@ -13,11 +13,12 @@ import { import { ReviewNotesVisualStyles } from './review-animated-visual-notes-styles' import { ReviewDiffRows } from './review-notes-diff-rows' import { resetTerminal, runTerminalPhase } from './review-notes-terminal-phase' -import { translate } from '@/i18n/i18n' +import { useTranslate } from '@/i18n/use-translate' import { forceLayoutReflow } from '@/lib/force-layout-reflow' // The animation owns timed DOM mutations to avoid React overwriting intermediate beats. export function ReviewNotesAnimatedVisual(props: { reducedMotion: boolean }): JSX.Element { + const t = useTranslate() const { reducedMotion } = props const rootRef = useRef(null) @@ -325,7 +326,7 @@ export function ReviewNotesAnimatedVisual(props: { reducedMotion: boolean }): JS return () => { cancelled = true - timers.forEach((t) => window.clearTimeout(t)) + timers.forEach((timer) => window.clearTimeout(timer)) } }, [reducedMotion]) @@ -333,7 +334,7 @@ export function ReviewNotesAnimatedVisual(props: { reducedMotion: boolean }): JS
- {translate( + {t( 'auto.components.feature.wall.ReviewNotesAnimatedVisual.1eee3a397e', 'src/server/migrate.ts (diff)' )} @@ -341,10 +342,7 @@ export function ReviewNotesAnimatedVisual(props: { reducedMotion: boolean }): JS
- {translate('auto.components.feature.wall.ReviewNotesAnimatedVisual.a7a89d8f94', 'Line')}{' '} + {t('auto.components.feature.wall.ReviewNotesAnimatedVisual.a7a89d8f94', 'Line')}{' '} ?
- {translate( + {t( 'auto.components.feature.wall.ReviewNotesAnimatedVisual.294aaff104', 'Send notes to' )} @@ -403,7 +395,7 @@ export function ReviewNotesAnimatedVisual(props: { reducedMotion: boolean }): JS
- {translate( + {t( 'auto.components.feature.wall.ReviewNotesAnimatedVisual.09094f25e2', 'Claude Code' )} @@ -412,10 +404,7 @@ export function ReviewNotesAnimatedVisual(props: { reducedMotion: boolean }): JS
- {translate( - 'auto.components.feature.wall.ReviewNotesAnimatedVisual.5dbd27c4c2', - 'Codex' - )} + {t('auto.components.feature.wall.ReviewNotesAnimatedVisual.5dbd27c4c2', 'Codex')}
diff --git a/src/renderer/src/components/feature-wall/ReviewShipAnimatedVisual.tsx b/src/renderer/src/components/feature-wall/ReviewShipAnimatedVisual.tsx index 969fdcf7fc0..6523f9c48d1 100644 --- a/src/renderer/src/components/feature-wall/ReviewShipAnimatedVisual.tsx +++ b/src/renderer/src/components/feature-wall/ReviewShipAnimatedVisual.tsx @@ -13,10 +13,11 @@ import { SHIP_FILES } from './review-animated-visual-shared' import { ReviewShipVisualStyles } from './review-animated-visual-ship-styles' -import { translate } from '@/i18n/i18n' +import { useTranslate } from '@/i18n/use-translate' import { forceLayoutReflow } from '@/lib/force-layout-reflow' export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX.Element { + const t = useTranslate() const { reducedMotion } = props const rootRef = useRef(null) @@ -236,7 +237,7 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX return () => { cancelled = true - timers.forEach((t) => window.clearTimeout(t)) + timers.forEach((timer) => window.clearTimeout(timer)) } }, [reducedMotion]) @@ -247,7 +248,7 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX
{' '} - {translate( + {t( 'auto.components.feature.wall.ReviewShipAnimatedVisual.cd8a3a39d7', '3 commits ahead' )} @@ -259,7 +260,7 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX type="button" className="ravs-sc-sparkle" data-commit-sparkle - aria-label={translate( + aria-label={t( 'auto.components.feature.wall.ReviewShipAnimatedVisual.d1a7f15876', 'Generate commit message with AI' )} @@ -267,10 +268,7 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX - {translate( - 'auto.components.feature.wall.ReviewShipAnimatedVisual.7347fa5839', - 'Message' - )} + {t('auto.components.feature.wall.ReviewShipAnimatedVisual.7347fa5839', 'Message')} @@ -278,10 +276,7 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX
{' '} - {translate( - 'auto.components.feature.wall.ReviewShipAnimatedVisual.a079083a6c', - 'Commit' - )} + {t('auto.components.feature.wall.ReviewShipAnimatedVisual.a079083a6c', 'Commit')} @@ -290,17 +285,11 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX
- {translate( - 'auto.components.feature.wall.ReviewShipAnimatedVisual.e725000cd7', - 'Changes' - )}{' '} + {t('auto.components.feature.wall.ReviewShipAnimatedVisual.e725000cd7', 'Changes')}{' '} {SHIP_FILES.length} - {translate( - 'auto.components.feature.wall.ReviewShipAnimatedVisual.ea0100dd15', - 'View all' - )} + {t('auto.components.feature.wall.ReviewShipAnimatedVisual.ea0100dd15', 'View all')}
@@ -319,7 +308,7 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX
- {translate( + {t( 'auto.components.feature.wall.ReviewShipAnimatedVisual.c30cd930ff', 'Create Pull Request' )} @@ -328,11 +317,11 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX type="button" className="ravs-pr-gen-btn" data-pr-gen-btn - aria-label={translate( + aria-label={t( 'auto.components.feature.wall.ReviewShipAnimatedVisual.e4473d438f', 'Generate with AI' )} - title={translate( + title={t( 'auto.components.feature.wall.ReviewShipAnimatedVisual.e4473d438f', 'Generate with AI' )} @@ -343,29 +332,23 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX
- {translate( + {t( 'auto.components.feature.wall.ReviewShipAnimatedVisual.ce7d5d3a18', 'Base branch' )}
{' '} - {translate( - 'auto.components.feature.wall.ReviewShipAnimatedVisual.3b9b96d6a6', - 'main' - )} + {t('auto.components.feature.wall.ReviewShipAnimatedVisual.3b9b96d6a6', 'main')}
- {translate( - 'auto.components.feature.wall.ReviewShipAnimatedVisual.54a093c52d', - 'Title' - )} + {t('auto.components.feature.wall.ReviewShipAnimatedVisual.54a093c52d', 'Title')}
- {translate( + {t( 'auto.components.feature.wall.ReviewShipAnimatedVisual.07da9245cc', 'Pull request title' )} @@ -375,14 +358,14 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX
- {translate( + {t( 'auto.components.feature.wall.ReviewShipAnimatedVisual.3774b80eae', 'Description' )}
- {translate( + {t( 'auto.components.feature.wall.ReviewShipAnimatedVisual.bcd5cae3c4', 'Pull request description' )} @@ -392,16 +375,10 @@ export function ReviewShipAnimatedVisual(props: { reducedMotion: boolean }): JSX