diff --git a/apps/web/components/task/add-workspace-sources/add-workspace-sources-availability.ts b/apps/web/components/task/add-workspace-sources/add-workspace-sources-availability.ts index c1e46b0534..f39175778c 100644 --- a/apps/web/components/task/add-workspace-sources/add-workspace-sources-availability.ts +++ b/apps/web/components/task/add-workspace-sources/add-workspace-sources-availability.ts @@ -10,13 +10,13 @@ export function hasActiveTaskSourceWork( ): boolean { return taskSessionIds.some((sessionId) => Boolean(activeTurnBySession[sessionId])); } +import { t } from "@/lib/i18n"; export function getAddSourcesDisabledReason({ isLoading, hasActiveTurn, }: AvailabilityInput): string | undefined { - if (isLoading) return "Wait for task sources to finish loading before adding sources."; - if (hasActiveTurn) - return "Wait for the active turn or tool call to finish before adding sources."; + if (isLoading) return t("task:waitForTaskSourcesToLoad"); + if (hasActiveTurn) return t("task:waitForActiveTurnToFinish"); return undefined; } diff --git a/apps/web/components/task/add-workspace-sources/add-workspace-sources-dialog.tsx b/apps/web/components/task/add-workspace-sources/add-workspace-sources-dialog.tsx index 3d963a45fe..3470e8e796 100644 --- a/apps/web/components/task/add-workspace-sources/add-workspace-sources-dialog.tsx +++ b/apps/web/components/task/add-workspace-sources/add-workspace-sources-dialog.tsx @@ -54,6 +54,8 @@ import { useWorkspaceRepositoryOptions } from "./use-workspace-repository-option import { useWorkspaceSourceRows } from "./use-workspace-source-rows"; import { WorkspaceChangeConsequences } from "./workspace-change-consequences"; import { cn } from "@/lib/utils"; +import { useTranslation } from "react-i18next"; +import { t } from "@/lib/i18n"; type Props = { open: boolean; @@ -205,6 +207,7 @@ function AddWorkspaceSourcesSurface({ onCancel, onSubmit, }: AddWorkspaceSourcesSurfaceProps) { + const { t } = useTranslation(); const footer = (
); @@ -244,10 +247,8 @@ function AddWorkspaceSourcesSurface({ className="h-dvh !max-h-dvh rounded-none flex flex-col overflow-hidden data-[vaul-drawer-direction=bottom]:!mt-0" > - Add to workspace - - Choose repositories or folders to make available in this task. - + {t("task:addToWorkspace")} + {t("task:chooseRepositoriesOrFoldersToMake")}
{errorMessage} @@ -268,10 +269,8 @@ function AddWorkspaceSourcesSurface({ onCloseAutoFocus={onCloseAutoFocus} > - Add to workspace - - Choose repositories or folders to make available in this task. - + {t("task:addToWorkspace")} + {t("task:chooseRepositoriesOrFoldersToMake")}
) => void; isMobile: boolean; }) { + const { t } = useTranslation(); return (
@@ -326,14 +326,13 @@ function SourceForm({ onClick={() => onAdd("folder")} > - Add folder + {t("task:addFolder")} )}
{capabilities.requiresCloneableLocalRepository && (

- Saved and local Git repositories must have a cloneable origin for this executor. Local - folders are unavailable. + {t("task:savedAndLocalGitRepositoriesMust")}

)} {rows.map((row) => ( @@ -362,6 +361,7 @@ function RepositorySourceMenu({ isMobile: boolean; onAdd: (kind: "saved_repository" | "local_repository" | "remote_repository") => void; }) { + const { t } = useTranslation(); const itemClass = cn("cursor-pointer items-start gap-3", isMobile ? "min-h-11" : "py-2"); return ( @@ -372,28 +372,28 @@ function RepositorySourceMenu({ className={cn("cursor-pointer", isMobile ? "min-h-11" : "h-9 px-3")} > - Add repository + {t("task:addRepository")} } className={itemClass} onSelect={() => onAdd("saved_repository")} /> } className={itemClass} onSelect={() => onAdd("local_repository")} /> } className={itemClass} onSelect={() => onAdd("remote_repository")} @@ -450,6 +450,7 @@ function SourceRow({ onRemove: (key: string) => void; onUpdate: (key: string, patch: Partial) => void; }) { + const { t } = useTranslation(); const type = row.sourceType ?? (row.kind === "folder" ? "folder" : "saved_repository"); return (
@@ -457,7 +458,7 @@ function SourceRow({ {labelFor(type)}
{restartsWorkspace ? : }
- Full impact details + {t("task:fullImpactDetails")}
{restartsWorkspace ? : }

- - Cancel leaves the workspace unchanged. - {" "} - If you continue, the batch is all-or-nothing: when any source fails, none of the new - sources are attached. + + + Cancel leaves the workspace unchanged. + {" "} + If you continue, the batch is all-or-nothing: when any source fails, none of the new + sources are attached. +

@@ -48,31 +51,21 @@ export function WorkspaceChangeConsequences({ restartsWorkspace }: { restartsWor } function RestartSummary() { + const { t } = useTranslation(); return ( ); } function LiveUpdateSummary() { + const { t } = useTranslation(); return ( ); } @@ -81,23 +74,30 @@ function RestartConsequences() { return ( ); @@ -107,14 +107,19 @@ function LiveUpdateConsequences() { return ( ); diff --git a/apps/web/components/task/document/document-controls.tsx b/apps/web/components/task/document/document-controls.tsx index 029ec321af..f6db56f668 100644 --- a/apps/web/components/task/document/document-controls.tsx +++ b/apps/web/components/task/document/document-controls.tsx @@ -5,12 +5,14 @@ import { IconLayoutSidebarLeftCollapse, IconLayoutSidebarRightCollapse } from "@ import { Button } from "@kandev/ui/button"; import { Tooltip, TooltipContent, TooltipTrigger } from "@kandev/ui/tooltip"; import { useLayoutStore } from "@/lib/state/layout-store"; +import { useTranslation } from "react-i18next"; type DocumentControlsProps = { activeSessionId: string | null; }; export function DocumentControls({ activeSessionId }: DocumentControlsProps) { + const { t } = useTranslation(); const toggleColumn = useLayoutStore((state) => state.toggleColumn); const showColumn = useLayoutStore((state) => state.showColumn); const toggleRightPanel = useLayoutStore((state) => state.toggleRightPanel); @@ -42,7 +44,7 @@ export function DocumentControls({ activeSessionId }: DocumentControlsProps) { - Show sidebar + {t("task:showSidebar")} ) : ( @@ -56,7 +58,7 @@ export function DocumentControls({ activeSessionId }: DocumentControlsProps) { - Hide sidebar + {t("task:hideSidebar")} )} {rightHidden ? ( @@ -71,7 +73,7 @@ export function DocumentControls({ activeSessionId }: DocumentControlsProps) { - Show right panel + {t("task:showRightPanel")} ) : ( @@ -85,7 +87,7 @@ export function DocumentControls({ activeSessionId }: DocumentControlsProps) { - Hide right panel + {t("task:hideRightPanel")} )} diff --git a/apps/web/components/task/inspector/annotations-panel.tsx b/apps/web/components/task/inspector/annotations-panel.tsx index f1d8f68cb8..5238e7977d 100644 --- a/apps/web/components/task/inspector/annotations-panel.tsx +++ b/apps/web/components/task/inspector/annotations-panel.tsx @@ -6,6 +6,8 @@ import { Button } from "@kandev/ui/button"; import type { Annotation } from "@/lib/preview-inspect-bridge"; import { formatAnnotations } from "@/lib/preview-inspect-bridge"; import { copyToClipboard } from "@/lib/utils/copy-to-clipboard"; +import { useTranslation } from "react-i18next"; +import { t } from "@/lib/i18n"; interface AnnotationsPanelProps { annotations: Annotation[]; @@ -13,20 +15,25 @@ interface AnnotationsPanelProps { onClear: () => void; } +// Module-level `t` rather than a hook: this runs from render, after a locale is +// active. The `tag`/`#id`/`.class` suffix is inspected DOM data, never copy. function describeAnnotation(a: Annotation): string { if (a.kind === "pin") { const el = a.element; - if (!el) return "Pin"; + if (!el) return t("task:annotationPin"); let suffix = ""; if (el.id) suffix = `#${el.id}`; else if (el.classes) suffix = `.${el.classes.split(/\s+/)[0]}`; return `${el.tag}${suffix}`; } const r = a.rect; - return r ? `Area ${Math.round(r.w)}x${Math.round(r.h)}` : "Area"; + return r + ? t("task:annotationAreaSized", { w: Math.round(r.w), h: Math.round(r.h) }) + : t("task:annotationArea"); } export function AnnotationsPanel({ annotations, onRemove, onClear }: AnnotationsPanelProps) { + const { t } = useTranslation(); const [copied, setCopied] = useState(false); if (annotations.length === 0) return null; @@ -46,7 +53,7 @@ export function AnnotationsPanel({ annotations, onRemove, onClear }: Annotations >
- {annotations.length} annotation{annotations.length === 1 ? "" : "s"} + {t("task:annotationCount", { count: annotations.length })}
@@ -66,8 +73,8 @@ export function AnnotationsPanel({ annotations, onRemove, onClear }: Annotations className="h-6 px-2 cursor-pointer" onClick={onClear} data-testid="preview-annotations-clear" - aria-label="Clear all annotations" - title="Clear all annotations" + aria-label={t("task:clearAllAnnotations")} + title={t("task:clearAllAnnotations")} > @@ -92,7 +99,7 @@ export function AnnotationsPanel({ annotations, onRemove, onClear }: Annotations variant="ghost" className="h-5 w-5 p-0 cursor-pointer shrink-0" onClick={() => onRemove(a.id)} - aria-label={`Remove annotation ${a.number}`} + aria-label={t("task:removeAnnotation", { number: a.number })} data-testid="preview-annotation-remove" > diff --git a/apps/web/components/task/inspector/inspect-button.tsx b/apps/web/components/task/inspector/inspect-button.tsx index 541864093b..258012d871 100644 --- a/apps/web/components/task/inspector/inspect-button.tsx +++ b/apps/web/components/task/inspector/inspect-button.tsx @@ -2,6 +2,7 @@ import { IconClick } from "@tabler/icons-react"; import { Button } from "@kandev/ui/button"; +import { useTranslation } from "react-i18next"; interface InspectButtonProps { active: boolean; @@ -11,9 +12,8 @@ interface InspectButtonProps { } export function InspectButton({ active, disabled, count = 0, onToggle }: InspectButtonProps) { - const title = active - ? "Inspecting - click to pin, drag to select an area, Esc to exit" - : "Inspect: click to pin or drag to select an area of the preview"; + const { t } = useTranslation(); + const title = active ? t("task:inspectingClickToPin") : t("task:inspectClickToPinOrDrag"); return ( ); @@ -196,6 +207,7 @@ export const MobileDiffSheet = memo(function MobileDiffSheet({ onClearSelected, sourceCounts, }: MobileDiffSheetProps) { + const { i18n } = useTranslation(); const [activeSource, setActiveSource] = useState(() => { if (typeof window === "undefined") return "uncommitted"; const saved = localStorage.getItem(MOBILE_DIFF_SOURCE_FILTER_KEY); @@ -212,12 +224,23 @@ export const MobileDiffSheet = memo(function MobileDiffSheet({ if (mode?.kind !== "all") return; localStorage.setItem(MOBILE_DIFF_SOURCE_FILTER_KEY, activeSource); }, [mode?.kind, activeSource]); - const sourceTabs = useMemo(() => buildSourceTabs(sourceCounts), [sourceCounts]); + // `buildSourceTabs` and `deriveTitle` resolve their labels through the + // module-level `t`, so the language has to be a dependency for them to follow + // a runtime locale switch. + const sourceTabs = useMemo( + () => buildSourceTabs(sourceCounts), + // eslint-disable-next-line react-hooks/exhaustive-deps -- i18n.language is the locale trigger + [sourceCounts, i18n.language], + ); const activeSourceLabel = useMemo( () => sourceTabs.find((t) => t.key === activeSource)?.label ?? null, [sourceTabs, activeSource], ); - const title = useMemo(() => deriveTitle(mode, sourceTabs), [mode, sourceTabs]); + const title = useMemo( + () => deriveTitle(mode, sourceTabs), + // eslint-disable-next-line react-hooks/exhaustive-deps -- i18n.language is the locale trigger + [mode, sourceTabs, i18n.language], + ); const panelContent = useMemo( () => renderPanel(mode, activeSource, selectedDiff, onClearSelected, onOpenFile), [mode, activeSource, selectedDiff, onClearSelected, onOpenFile], diff --git a/apps/web/components/task/mobile/mobile-file-viewer-panel.tsx b/apps/web/components/task/mobile/mobile-file-viewer-panel.tsx index 9c1000e870..1a7bedea4d 100644 --- a/apps/web/components/task/mobile/mobile-file-viewer-panel.tsx +++ b/apps/web/components/task/mobile/mobile-file-viewer-panel.tsx @@ -16,6 +16,7 @@ import { ExternalVcsFileLink, useExternalVcsFileStatus, } from "@/components/editors/external-vcs-file-link"; +import { useTranslation } from "react-i18next"; type MobileFileViewerPanelProps = { file: OpenFileTab; @@ -88,6 +89,7 @@ export function MobileFileViewerPanel({ onClose, initialMarkdownPreview = false, }: MobileFileViewerPanelProps) { + const { t } = useTranslation(); const activeSession = useAppStore((state) => sessionId ? (state.taskSessions.items[sessionId] ?? null) : null, ); @@ -134,13 +136,13 @@ export function MobileFileViewerPanel({ className="cursor-pointer px-2" onClick={() => setMarkdownPreview(true)} data-testid="markdown-preview-toggle" - aria-label="Open markdown preview" + aria-label={t("task:openMarkdownPreview")} > )}
} diff --git a/apps/web/components/task/mobile/mobile-sessions-section.tsx b/apps/web/components/task/mobile/mobile-sessions-section.tsx index 64a5691347..4207b33ef1 100644 --- a/apps/web/components/task/mobile/mobile-sessions-section.tsx +++ b/apps/web/components/task/mobile/mobile-sessions-section.tsx @@ -39,6 +39,8 @@ import { repositorySlug } from "@/lib/repository-slug"; import { useSessionPendingInput, type PendingInput } from "@/hooks/use-task-pending-input"; import type { ForegroundActivity, TaskSession, TaskSessionState } from "@/lib/types/http"; import type { AgentProfileOption } from "@/lib/state/slices"; +import { useTranslation } from "react-i18next"; +import { t } from "@/lib/i18n"; type SessionRow = { id: string; @@ -69,7 +71,7 @@ function buildSessionRows( agentName: profile?.agent_name ?? null, // User-supplied session name wins over the derived profile label, // matching the desktop session tab title precedence. - agentLabel: s.name || labelParts[1] || labelParts[0] || profile?.label || "Agent", + agentLabel: s.name || labelParts[1] || labelParts[0] || profile?.label || t("task:agent"), repositoryLabel: s.repository_id ? (repositoryLabelsById.get(s.repository_id) ?? null) : null, state: (s.state as TaskSessionState | undefined) ?? null, foregroundActivity: s.foreground_activity ?? null, @@ -88,7 +90,8 @@ function buildSessionRows( // grayscale scan. The label reinforces the distinction in words: while spawned // background work runs, the row reads "Working in background" rather than the // bare "Running", so background is never confused with generating. -const BACKGROUND_RUNNING_LABEL = "Working in background"; +// A catalog key, not copy: `t()` at module scope would freeze at the boot locale. +const BACKGROUND_RUNNING_LABEL_KEY = "task:workingInBackground"; function sessionStateLabel( state: TaskSessionState, @@ -96,11 +99,13 @@ function sessionStateLabel( pending: PendingInput, ): string { const canRequestInput = state === "RUNNING" || state === "WAITING_FOR_INPUT"; - if (canRequestInput && pending.permission) return "Permission requested"; + if (canRequestInput && pending.permission) return t("task:permissionRequested"); if (canRequestInput && pending.clarification) { return formatTaskSessionStateLabel("WAITING_FOR_INPUT"); } - if (canRequestInput && foregroundActivity === "background") return BACKGROUND_RUNNING_LABEL; + if (canRequestInput && foregroundActivity === "background") { + return t(BACKGROUND_RUNNING_LABEL_KEY); + } return formatTaskSessionStateLabel(state); } @@ -155,6 +160,7 @@ function SessionActionsMenu({ onAskDelete: () => void; onHandoffProfile: (profileId: string) => void; }) { + const { t } = useTranslation(); const hasLifecycleAction = !!state && (isSessionStoppable(state) || isSessionResumable(state) || isSessionDeletable(state)); @@ -167,7 +173,7 @@ function SessionActionsMenu({ size="icon-sm" className="cursor-pointer h-7 w-7" onClick={(e) => e.stopPropagation()} - aria-label="Session actions" + aria-label={t("task:sessionActions")} > @@ -178,17 +184,17 @@ function SessionActionsMenu({ onSelect={onSetPrimary} disabled={isPrimary || !state} > - Set as Primary + {t("task:setAsPrimary")} {state && isSessionStoppable(state) && ( - Stop + {t("task:stop")} )} {state && isSessionResumable(state) && ( - Resume + {t("task:resume")} )} {state && isSessionDeletable(state) && ( @@ -196,7 +202,7 @@ function SessionActionsMenu({ className="cursor-pointer text-destructive focus:text-destructive" onSelect={onAskDelete} > - Delete + {t("task:delete")} )} {hasLifecycleAction && } @@ -219,27 +225,26 @@ function DeleteSessionConfirmDialog({ isOnlySession: boolean; onConfirm: () => void; }) { + const { t } = useTranslation(); return ( - Delete session? + {t("task:deleteSession")}
-

This will permanently delete the conversation history with this session.

+

{t("task:thisWillPermanentlyDeleteTheConversation")}

{isPrimary && !isOnlySession && ( -

- This is the primary session. Another session will be set as primary. -

+

{t("task:thisIsThePrimarySessionAnother")}

)} {isOnlySession && ( -

This is the only session for this task.

+

{t("task:thisIsTheOnlySessionFor")}

)}
- Cancel + {t("common:cancel")} { onOpenChange(false); @@ -247,7 +252,7 @@ function DeleteSessionConfirmDialog({ }} className="cursor-pointer bg-destructive text-destructive-foreground hover:bg-destructive/90" > - Delete + {t("task:delete")}
@@ -366,6 +371,10 @@ function SessionRowItem({ } function useSessionRows(taskId: string | null) { + // `buildSessionRows` resolves its agent-name fallback through the module-level + // `t`, so the language has to reach the memo below for that label to follow a + // runtime locale switch. + const { i18n } = useTranslation(); const agentProfiles = useAppStore((s) => s.agentProfiles.items); const repositoriesByWorkspace = useAppStore((s) => s.repositories.itemsByWorkspaceId); const primarySessionId = useAppStore((s) => { @@ -389,7 +398,8 @@ function useSessionRows(taskId: string | null) { }, [repositoriesByWorkspace, sessions]); const rows = useMemo( () => buildSessionRows(sessions, agentProfiles, primarySessionId, repositoryLabelsById), - [sessions, agentProfiles, primarySessionId, repositoryLabelsById], + // eslint-disable-next-line react-hooks/exhaustive-deps -- i18n.language is the locale trigger + [sessions, agentProfiles, primarySessionId, repositoryLabelsById, i18n.language], ); return { rows, isLoading, primarySessionId }; } @@ -403,6 +413,7 @@ const MobileSessionsList = memo(function MobileSessionsList({ activeSessionId: string | null; onClose: () => void; }) { + const { t } = useTranslation(); const setActiveSession = useAppStore((s) => s.setActiveSession); const { rows, isLoading } = useSessionRows(taskId); const [launchOpen, setLaunchOpen] = useState(false); @@ -418,7 +429,9 @@ const MobileSessionsList = memo(function MobileSessionsList({ if (!taskId) { return ( -
No active task
+
+ {t("task:noActiveTask")} +
); } @@ -426,7 +439,7 @@ const MobileSessionsList = memo(function MobileSessionsList({
- {rows.length} session{rows.length === 1 ? "" : "s"} + {t("task:sessionCount", { count: rows.length })}
{isLoading && rows.length === 0 && (
- Loading sessions… + {t("task:loadingSessions")}
)} {!isLoading && rows.length === 0 && (
- No sessions yet. Launch one to get started. + {t("task:noSessionsYetLaunchOneTo")}
)} {rows.map((row) => ( @@ -478,6 +491,7 @@ function useActiveSessionPillLabel( effectiveSessionId: string | null; ariaLabel: string; } { + const { t } = useTranslation(); const storedActiveSessionId = useAppStore((s) => s.tasks.activeSessionId); const { rows } = useSessionRows(taskId); const effectiveSessionId = sessionId === undefined ? storedActiveSessionId : sessionId; @@ -487,7 +501,7 @@ function useActiveSessionPillLabel( let count: string | undefined; if (total > 1 && idx) count = `${idx}/${total}`; else if (total > 1) count = `${total}`; - const agentLabel = activeRow?.agentLabel ?? "Session"; + const agentLabel = activeRow?.agentLabel ?? t("task:sessionFallbackLabel"); const repositoryLabel = activeRow?.repositoryLabel; return { label: repositoryLabel ? `${agentLabel} · ${repositoryLabel}` : agentLabel, @@ -495,8 +509,8 @@ function useActiveSessionPillLabel( agentName: activeRow?.agentName ?? null, effectiveSessionId, ariaLabel: repositoryLabel - ? `Active session: ${agentLabel}. Repository: ${repositoryLabel}. Tap to switch.` - : `Active session: ${agentLabel}. Tap to switch.`, + ? t("task:activeSessionRepositoryTapToSwitch", { agentLabel, repositoryLabel }) + : t("task:activeSessionTapToSwitch", { agentLabel }), }; } @@ -511,6 +525,7 @@ export const MobileSessionsPicker = memo(function MobileSessionsPicker({ compact?: boolean; fullWidth?: boolean; }) { + const { t } = useTranslation(); const [open, setOpen] = useState(false); const { label, count, agentName, effectiveSessionId, ariaLabel } = useActiveSessionPillLabel( taskId, @@ -540,7 +555,7 @@ export const MobileSessionsPicker = memo(function MobileSessionsPicker({ data-testid="mobile-sessions-pill" ariaLabel={ariaLabel} /> - + s.ctrl); @@ -59,30 +61,40 @@ export function MobileTerminalKeybar({ style={{ ...position, height: `${KEYBAR_HEIGHT_PX}px` }} >
- + tapSend(KEY_SEQUENCES.ctrlC)} variant="destructive" > ^C - tapSend(KEY_SEQUENCES.ctrlD)}> + tapSend(KEY_SEQUENCES.ctrlD)} + > ^D {KEYS.map((key) => ( tapSend(key.seq)} > {key.label} diff --git a/apps/web/components/task/mobile/mobile-terminal-pane.tsx b/apps/web/components/task/mobile/mobile-terminal-pane.tsx index 1ce7f766bf..e63c20b36c 100644 --- a/apps/web/components/task/mobile/mobile-terminal-pane.tsx +++ b/apps/web/components/task/mobile/mobile-terminal-pane.tsx @@ -8,6 +8,7 @@ import { MobileTerminalsPicker } from "./mobile-terminals-section"; import { MobileTerminalsProvider, useMobileTerminalsContext } from "./mobile-terminals-context"; import type { Terminal as XtermTerminal } from "@xterm/xterm"; import type { Terminal } from "@/hooks/domains/session/use-terminals"; +import { useTranslation } from "react-i18next"; function TerminalSlot({ terminal, @@ -79,13 +80,14 @@ function TerminalSlot({ } function MobileTerminalPaneInner({ sessionId }: { sessionId: string | null }) { + const { t } = useTranslation(); const { terminals, terminalTabValue, environmentId } = useMobileTerminalsContext(); const activeId = terminals.find((t) => t.id === terminalTabValue)?.id ?? terminals[0]?.id; if (!sessionId || !environmentId) { return (
- Terminal unavailable — no active session. + {t("task:terminalUnavailableNoActiveSession")}
); } @@ -98,7 +100,7 @@ function MobileTerminalPaneInner({ sessionId }: { sessionId: string | null }) {
{terminals.length === 0 && (
- Starting terminal… + {t("task:startingTerminal")}
)} {terminals.map((t) => ( diff --git a/apps/web/components/task/mobile/mobile-terminals-section.tsx b/apps/web/components/task/mobile/mobile-terminals-section.tsx index 7719b5cdee..0f0f594556 100644 --- a/apps/web/components/task/mobile/mobile-terminals-section.tsx +++ b/apps/web/components/task/mobile/mobile-terminals-section.tsx @@ -13,6 +13,7 @@ import { MobilePillButton } from "./mobile-pill-button"; import { MobilePickerSheet } from "./mobile-picker-sheet"; import { useMobileTerminalsContext } from "./mobile-terminals-context"; import type { Terminal } from "@/hooks/domains/session/use-terminals"; +import { useTranslation } from "react-i18next"; function TerminalRow({ terminal, @@ -27,6 +28,7 @@ function TerminalRow({ onSelect: (id: string) => void; onAskClose: (terminal: Terminal) => void; }) { + const { t } = useTranslation(); return (
{terminal.label} {isRunning && ( - running + {t("task:running")} )} {terminal.closable && (
{terminals.length === 0 && (
- No terminals yet. + {t("task:noTerminalsYet")}
)} {terminals.map((t) => ( @@ -219,7 +224,7 @@ const MobileTerminalsList = memo(function MobileTerminalsList({
{ if (!open) setPendingClose(null); }} @@ -230,6 +235,7 @@ const MobileTerminalsList = memo(function MobileTerminalsList({ }); function useActiveTerminalPillLabel(): { label: string; count: string | undefined } { + const { t } = useTranslation(); const { terminals, terminalTabValue } = useMobileTerminalsContext(); const activeIdx = terminals.findIndex((t) => t.id === terminalTabValue); const idx = activeIdx >= 0 ? activeIdx : 0; @@ -237,7 +243,7 @@ function useActiveTerminalPillLabel(): { label: string; count: string | undefine const total = terminals.length; let count: string | undefined; if (total > 1) count = `${idx + 1}/${total}`; - return { label: active?.label ?? "Terminal", count }; + return { label: active?.label ?? t("task:terminal"), count }; } export const MobileTerminalsPicker = memo(function MobileTerminalsPicker({ @@ -249,6 +255,7 @@ export const MobileTerminalsPicker = memo(function MobileTerminalsPicker({ compact?: boolean; fullWidth?: boolean; }) { + const { t } = useTranslation(); const [open, setOpen] = useState(false); const { label, count } = useActiveTerminalPillLabel(); if (!sessionId) return null; @@ -262,9 +269,9 @@ export const MobileTerminalsPicker = memo(function MobileTerminalsPicker({ isOpen={open} onClick={() => setOpen(true)} data-testid="mobile-terminals-pill" - ariaLabel={`Active terminal: ${label}. Tap to switch.`} + ariaLabel={t("task:activeTerminalTapToSwitch", { label })} /> - + setOpen(false)} /> diff --git a/apps/web/components/task/mobile/session-mobile-bottom-nav.tsx b/apps/web/components/task/mobile/session-mobile-bottom-nav.tsx index 3cff4e2a4b..d709100a74 100644 --- a/apps/web/components/task/mobile/session-mobile-bottom-nav.tsx +++ b/apps/web/components/task/mobile/session-mobile-bottom-nav.tsx @@ -68,12 +68,12 @@ function buildMobileNavItems({ return [ { panel: "chat", - label: "Chat", + label: t("task:chat"), icon: , }, { panel: "plan", - label: "Plan", + label: t("task:plan"), icon: , badge: planBadge ? ( @@ -81,7 +81,7 @@ function buildMobileNavItems({ }, { panel: "changes", - label: "Changes", + label: t("task:changes"), icon: , badge: changesBadge > 0 ? ( @@ -95,21 +95,21 @@ function buildMobileNavItems({ }, { panel: "files", - label: "Files", + label: t("task:files"), icon: , }, ...(hasReview ? [ { panel: "review" as const, - label: "Review", + label: t("task:review"), icon: , }, ] : []), { panel: "terminal", - label: "Terminal", + label: t("task:terminal"), icon: , }, ...(hasMobilePluginPanels() @@ -125,7 +125,7 @@ function buildMobileNavItems({ ...(showStatus ? [ { - label: "Status", + label: t("task:status"), icon: , onClick: onOpenStatus, ...(connectionIssueSeverity !== "none" && { connectionIssueSeverity }), diff --git a/apps/web/components/task/mobile/session-mobile-layout.tsx b/apps/web/components/task/mobile/session-mobile-layout.tsx index f3a5c2f8c0..ad63b59444 100644 --- a/apps/web/components/task/mobile/session-mobile-layout.tsx +++ b/apps/web/components/task/mobile/session-mobile-layout.tsx @@ -31,6 +31,7 @@ import { MRDetailPanelComponent, mrTaskKey } from "@/components/gitlab/mr-detail import { PluginTaskPanel } from "../plugin-task-panel"; import { parsePluginPanelId } from "@/lib/state/layout-manager/plugin-panels"; import { useEffectiveMobilePanel, type MobileReviewSource } from "./mobile-plugin-panel-lifecycle"; +import { useTranslation } from "react-i18next"; export { resolveMobilePluginPanel } from "./mobile-plugin-panel-lifecycle"; @@ -91,10 +92,11 @@ function MobileChatPanelContent({ effectiveSessionId: string | null; onOpenFile: (path: string, repo?: string) => void; }) { + const { t } = useTranslation(); if (!activeTaskId) { return (
- No task selected + {t("task:noTaskSelected")}
); } diff --git a/apps/web/components/task/mobile/session-mobile-top-bar-dialog-parts.tsx b/apps/web/components/task/mobile/session-mobile-top-bar-dialog-parts.tsx index d734db9cd3..53ecf82f80 100644 --- a/apps/web/components/task/mobile/session-mobile-top-bar-dialog-parts.tsx +++ b/apps/web/components/task/mobile/session-mobile-top-bar-dialog-parts.tsx @@ -2,6 +2,7 @@ import { IconGitPullRequest, IconLoader2 } from "@tabler/icons-react"; import { Button } from "@kandev/ui/button"; +import { Trans, useTranslation } from "react-i18next"; export function MobilePRBranchSummary({ displayBranch, @@ -16,14 +17,24 @@ export function MobilePRBranchSummary({
{baseBranch ? ( - Creating {terminology.shortName} from{" "} - {displayBranch} to{" "} - {baseBranch} + + Creating {{ shortName: terminology.shortName }} from{" "} + {displayBranch} to{" "} + {baseBranch} + ) : ( - Creating {terminology.shortName} from{" "} - {displayBranch} + + Creating {{ shortName: terminology.shortName }} from{" "} + {displayBranch} + )}
@@ -39,11 +50,17 @@ export function CommitSummary({ uncommittedAdditions: number; uncommittedDeletions: number; }) { - if (uncommittedCount <= 0) return No changes to commit; + const { t } = useTranslation(); + if (uncommittedCount <= 0) return {t("task:noChangesToCommit")}; return ( - {uncommittedCount} file - {uncommittedCount !== 1 ? "s" : ""} changed + + {uncommittedCount} files changed + {(uncommittedAdditions > 0 || uncommittedDeletions > 0) && ( (+{uncommittedAdditions} @@ -72,6 +89,7 @@ export function PRSubmitButton({ terminology: { shortName: string }; branchPushed: boolean; }) { + const { t } = useTranslation(); return ( diff --git a/apps/web/components/task/mobile/session-mobile-top-bar-git-controls.tsx b/apps/web/components/task/mobile/session-mobile-top-bar-git-controls.tsx index b6751616e1..e16dbbb361 100644 --- a/apps/web/components/task/mobile/session-mobile-top-bar-git-controls.tsx +++ b/apps/web/components/task/mobile/session-mobile-top-bar-git-controls.tsx @@ -54,6 +54,10 @@ import { MobilePRBranchSummary, PRSubmitButton, } from "./session-mobile-top-bar-dialog-parts"; +import { useTranslation } from "react-i18next"; + +// A Git branch name, not copy: shown when the task has no recorded base branch. +const DEFAULT_BASE_BRANCH = "main"; export function computeUncommittedStats(files: Record | undefined) { let additions = 0; @@ -70,6 +74,7 @@ export function computeUncommittedStats(files: Record | undefi type GitOperationRunner = () => Promise<{ success: boolean; output: string; error?: string }>; function useGitToast() { + const { t } = useTranslation(); const { toast } = useToast(); return useCallback( @@ -78,26 +83,27 @@ function useGitToast() { const result = await operation(); if (result.success) { toast({ - title: `${operationName} successful`, - description: result.output.slice(0, 200) || `${operationName} completed successfully`, + title: t("task:successful", { operationName }), + description: + result.output.slice(0, 200) || t("task:completedSuccessfully", { operationName }), variant: "success", }); } else { toast({ - title: `${operationName} failed`, - description: result.error || "An error occurred", + title: t("task:failed2", { operationName }), + description: result.error || t("task:anErrorOccurred"), variant: "error", }); } } catch (error) { toast({ - title: `${operationName} failed`, - description: error instanceof Error ? error.message : "An unexpected error occurred", + title: t("task:failed2", { operationName }), + description: error instanceof Error ? error.message : t("task:anUnexpectedErrorOccurred"), variant: "error", }); } }, - [toast], + [toast, t], ); } @@ -154,6 +160,7 @@ export function CommitDialog({ isGitLoading: boolean; onCommit: (message: string, stageAll: boolean) => void; }) { + const { t } = useTranslation(); const form = useCommitDialogForm(onOpenChange, onCommit); return ( @@ -162,7 +169,7 @@ export function CommitDialog({ - Commit Changes + {t("task:commitChanges")}
@@ -175,19 +182,19 @@ export function CommitDialog({
form.setCommitMessage(e.target.value)} autoFocus />