- {translate('auto.components.Terminal.5c1d2a32bb', 'Loading editor...')}
+ {t('auto.components.Terminal.5c1d2a32bb', 'Loading editor...')}
}
>
diff --git a/src/renderer/src/components/TerminalSearch.tsx b/src/renderer/src/components/TerminalSearch.tsx
index a5bb7872823..b22321e66d5 100644
--- a/src/renderer/src/components/TerminalSearch.tsx
+++ b/src/renderer/src/components/TerminalSearch.tsx
@@ -4,7 +4,7 @@ import { ChevronUp, ChevronDown, X, CaseSensitive, Regex } from 'lucide-react'
import type { SearchAddon } from '@xterm/addon-search'
import { Button } from '@/components/ui/button'
import type { SearchState } from '@/components/terminal-pane/input/keyboard/terminal-keyboard-shortcut-matching'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { getFindRequestQuery } from '@/lib/find-query-bounds'
import { safeFind } from './terminal-search-safe-find'
import { buildTerminalSearchOptions } from './terminal-search-options'
@@ -36,6 +36,7 @@ export default function TerminalSearch({
searchStateRef,
inputRef
}: TerminalSearchProps): React.JSX.Element | null {
+ const t = useTranslate()
const [query, setQuery] = useState('')
const [caseSensitive, setCaseSensitive] = useState(false)
const [regex, setRegex] = useState(false)
@@ -130,7 +131,7 @@ export default function TerminalSearch({
const matchStatus = !requestQuery
? '0/0'
: results.resultCount === 0
- ? translate('auto.components.TerminalSearch.10e039b591', 'No results')
+ ? t('auto.components.TerminalSearch.10e039b591', 'No results')
: results.resultIndex === -1
? `${results.resultCount}+`
: `${results.resultIndex + 1}/${results.resultCount}`
@@ -147,7 +148,7 @@ export default function TerminalSearch({
type="text"
value={query}
onChange={(e) => setQuery(e.target.value)}
- placeholder={translate('auto.components.TerminalSearch.e07012f26e', 'Search...')}
+ placeholder={t('auto.components.TerminalSearch.e07012f26e', 'Search...')}
className="min-w-0 flex-1 border-none bg-transparent text-sm text-popover-foreground outline-none placeholder:text-muted-foreground"
/>
@@ -158,7 +159,7 @@ export default function TerminalSearch({
aria-pressed={caseSensitive}
onClick={() => setCaseSensitive((v) => !v)}
className="shrink-0"
- title={translate('auto.components.TerminalSearch.90c61387d9', 'Case sensitive')}
+ title={t('auto.components.TerminalSearch.90c61387d9', 'Case sensitive')}
>
@@ -170,7 +171,7 @@ export default function TerminalSearch({
aria-pressed={regex}
onClick={() => setRegex((v) => !v)}
className="shrink-0"
- title={translate('auto.components.TerminalSearch.42e466b9f1', 'Regex')}
+ title={t('auto.components.TerminalSearch.42e466b9f1', 'Regex')}
>
@@ -187,7 +188,7 @@ export default function TerminalSearch({
size="icon-xs"
onClick={findPrevious}
className="shrink-0"
- title={translate('auto.components.TerminalSearch.0f3066256e', 'Previous match')}
+ title={t('auto.components.TerminalSearch.0f3066256e', 'Previous match')}
>
@@ -198,7 +199,7 @@ export default function TerminalSearch({
size="icon-xs"
onClick={findNext}
className="shrink-0"
- title={translate('auto.components.TerminalSearch.7cb40c04eb', 'Next match')}
+ title={t('auto.components.TerminalSearch.7cb40c04eb', 'Next match')}
>
@@ -211,7 +212,7 @@ export default function TerminalSearch({
size="icon-xs"
onClick={onClose}
className="shrink-0"
- title={translate('auto.components.TerminalSearch.db234b7519', 'Close')}
+ title={t('auto.components.TerminalSearch.db234b7519', 'Close')}
>
diff --git a/src/renderer/src/components/TerminalWorkspaceDialogs.tsx b/src/renderer/src/components/TerminalWorkspaceDialogs.tsx
index bb3ffbfd621..52970475766 100644
--- a/src/renderer/src/components/TerminalWorkspaceDialogs.tsx
+++ b/src/renderer/src/components/TerminalWorkspaceDialogs.tsx
@@ -8,7 +8,7 @@ import {
DialogTitle
} from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import type { TerminalController } from './use-terminal-controller'
export function TerminalWorkspaceDialogs({
@@ -16,6 +16,7 @@ export function TerminalWorkspaceDialogs({
}: {
controller: TerminalController
}): React.JSX.Element {
+ const t = useTranslate()
const {
confirmNativeWindowClose,
handleSaveDialogCancel,
@@ -40,30 +41,27 @@ export function TerminalWorkspaceDialogs({
- {translate('auto.components.Terminal.21295c6b8c', 'Unsaved Changes')}
+ {t('auto.components.Terminal.21295c6b8c', 'Unsaved Changes')}
{saveDialogFile
- ? translate(
+ ? t(
'auto.components.Terminal.61ed600d29',
'"{{value0}}" has unsaved changes. Do you want to save before closing?',
{ value0: basename(saveDialogFile.relativePath) }
)
- : translate(
- 'auto.components.Terminal.46e08bc5c8',
- 'This file has unsaved changes.'
- )}
+ : t('auto.components.Terminal.46e08bc5c8', 'This file has unsaved changes.')}
- {translate('auto.components.Terminal.f82e9f02df', 'Cancel')}
+ {t('auto.components.Terminal.f82e9f02df', 'Cancel')}
- {translate('auto.components.Terminal.0037b21794', "Don't Save")}
+ {t('auto.components.Terminal.0037b21794', "Don't Save")}
- {translate('auto.components.Terminal.cd51e28d8b', 'Save')}
+ {t('auto.components.Terminal.cd51e28d8b', 'Save')}
@@ -80,15 +78,15 @@ export function TerminalWorkspaceDialogs({
- {translate('auto.components.Terminal.2fa9c69ff3', 'Close Window?')}
+ {t('auto.components.Terminal.2fa9c69ff3', 'Close Window?')}
{windowCloseDialogKind === 'unverifiable'
- ? translate(
+ ? t(
'auto.components.Terminal.b7c1f0a934',
'A remote host could not be reached, so Orca cannot tell whether work is still running there. Close the window anyway?'
)
- : translate(
+ : t(
'auto.components.Terminal.7958465754',
'There are terminals with running processes. Close the window anyway?'
)}
@@ -101,7 +99,7 @@ export function TerminalWorkspaceDialogs({
size="sm"
onClick={() => setWindowCloseDialogOpen(false)}
>
- {translate('auto.components.Terminal.f82e9f02df', 'Cancel')}
+ {t('auto.components.Terminal.f82e9f02df', 'Cancel')}
- {translate('auto.components.Terminal.73768427cf', 'Close')}
+ {t('auto.components.Terminal.73768427cf', 'Close')}
diff --git a/src/renderer/src/components/UnexpectedSignoutCard.tsx b/src/renderer/src/components/UnexpectedSignoutCard.tsx
index 317059b0c4c..6526bbab29b 100644
--- a/src/renderer/src/components/UnexpectedSignoutCard.tsx
+++ b/src/renderer/src/components/UnexpectedSignoutCard.tsx
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'
import { BookOpen, ChevronDown, CircleUserRound, Files, Smartphone, X } from 'lucide-react'
import { useAppStore } from '../store'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { cn } from '@/lib/utils'
import { Button } from './ui/button'
import { Card } from './ui/card'
@@ -44,6 +44,7 @@ function FeatureRow({
}
export function UnexpectedSignoutCard(): React.JSX.Element | null {
+ const t = useTranslate()
const authStatus = useAppStore((s) => s.orcaProfileAuthStatus)
const persistedUIReady = useAppStore((s) => s.persistedUIReady)
const persistedDismissedVersion = useAppStore((s) => s.dismissedUnexpectedSignoutVersion)
@@ -159,10 +160,7 @@ export function UnexpectedSignoutCard(): React.JSX.Element | null {
- {translate(
- 'auto.components.UnexpectedSignoutCard.9f2c1a4b7d',
- "You've been signed out"
- )}
+ {t('auto.components.UnexpectedSignoutCard.9f2c1a4b7d', "You've been signed out")}
@@ -178,12 +176,12 @@ export function UnexpectedSignoutCard(): React.JSX.Element | null {
{email
- ? translate(
+ ? t(
'auto.components.UnexpectedSignoutCard.7b4d9e1f2a',
'Sign in again as {{value0}} to restore Artifact sharing, Orca Relay, and skill sharing.',
{ value0: email }
)
- : translate(
+ : t(
'auto.components.UnexpectedSignoutCard.5a1c8d3e6f',
'Sign in again to restore Artifact sharing, Orca Relay, and skill sharing.'
)}
@@ -197,7 +195,7 @@ export function UnexpectedSignoutCard(): React.JSX.Element | null {
className="w-fit gap-1 px-1 text-xs text-muted-foreground"
aria-expanded={expanded}
>
- {translate('auto.components.UnexpectedSignoutCard.1f6b2c9d4e', 'What you get back')}
+ {t('auto.components.UnexpectedSignoutCard.1f6b2c9d4e', 'What you get back')}
@@ -206,30 +204,24 @@ export function UnexpectedSignoutCard(): React.JSX.Element | null {
- {translate('auto.components.UnexpectedSignoutCard.c5b3e8a17d', 'Sign in to Orca')}
+ {t('auto.components.UnexpectedSignoutCard.c5b3e8a17d', 'Sign in to Orca')}
diff --git a/src/renderer/src/components/UpdateCard.tsx b/src/renderer/src/components/UpdateCard.tsx
index 8c74b1dd690..95105a3408b 100644
--- a/src/renderer/src/components/UpdateCard.tsx
+++ b/src/renderer/src/components/UpdateCard.tsx
@@ -5,7 +5,7 @@ import { usePrefersReducedMotion } from '@/hooks/usePrefersReducedMotion'
import { useAppStore } from '../store'
import { Card } from './ui/card'
import { Button } from './ui/button'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { updaterMessageText } from '@/lib/updater-message-copy'
import { UpdateCardStateContent } from './maintenance/update-card/UpdateCardStateContent'
import { buildUpdateCardErrorModel } from './maintenance/update-card/update-card-error-model'
@@ -18,6 +18,7 @@ import {
export { isHttp2ProtocolError }
export function UpdateCard(): React.JSX.Element | null {
+ const t = useTranslate()
const status = useAppStore((state) => state.updateStatus)
const changelog: ChangelogData | null = useAppStore((state) => state.updateChangelog)
const updateUserInitiatedCycle = useAppStore((state) => state.updateUserInitiatedCycle)
@@ -145,7 +146,7 @@ export function UpdateCard(): React.JSX.Element | null {
const message = String((error as Error)?.message ?? error)
console.error('[updates] failed to enable HTTP/1.1 compatibility:', error)
setCompatibilitySetupError(
- translate(
+ t(
'auto.components.UpdateCard.compatibilityModeFailed',
'Could not enable compatibility mode. {{message}}',
{ message }
@@ -154,19 +155,22 @@ export function UpdateCard(): React.JSX.Element | null {
setCompatibilityRelaunching(false)
})
}
- const errorCard = buildUpdateCardErrorModel({
- status,
- isLocalBuild,
- cachedVersion,
- installError,
- compatibilityRelaunching,
- compatibilitySetupError,
- onChooseLocalBuild: () => void window.api.updater.check({ localBuild: true }),
- onEnableHttp1Compatibility: handleEnableHttp1Compatibility,
- onRetryDownload: handleUpdate,
- onRecheck: () => void window.api.updater.check({ includePrerelease: false }),
- onInstallRetry: handleInstallRetry
- })
+ const errorCard = buildUpdateCardErrorModel(
+ {
+ status,
+ isLocalBuild,
+ cachedVersion,
+ installError,
+ compatibilityRelaunching,
+ compatibilitySetupError,
+ onChooseLocalBuild: () => void window.api.updater.check({ localBuild: true }),
+ onEnableHttp1Compatibility: handleEnableHttp1Compatibility,
+ onRetryDownload: handleUpdate,
+ onRecheck: () => void window.api.updater.check({ includePrerelease: false }),
+ onInstallRetry: handleInstallRetry
+ },
+ t
+ )
const linuxPackageRecovery =
status.state === 'error' && status.recovery?.kind === 'linux-package-install'
? { recovery: status.recovery, diagnostic: updaterMessageText(status) }
@@ -251,7 +255,7 @@ export function UpdateCard(): React.JSX.Element | null {
- {translate(
+ {t(
'auto.components.UpdateCard.b1d867f4fb',
"Your terminal sessions won't be interrupted during the update."
)}
@@ -262,7 +266,7 @@ export function UpdateCard(): React.JSX.Element | null {
size="icon"
className="size-7 shrink-0"
onClick={markReassuranceSeen}
- aria-label={translate('auto.components.UpdateCard.7274ef6e59', 'Dismiss tip')}
+ aria-label={t('auto.components.UpdateCard.7274ef6e59', 'Dismiss tip')}
>
@@ -271,7 +275,7 @@ export function UpdateCard(): React.JSX.Element | null {
)}
void }) {
+ const t = useTranslate()
// Lead with the summary; raw diagnostics stay collapsed.
const [showDetails, setShowDetails] = useState(false)
const detailId = useId()
@@ -117,7 +118,7 @@ export function UpdateErrorCardContent({
size="icon"
className="shrink-0 min-w-[44px] min-h-[44px] -m-2"
onClick={onClose}
- aria-label={translate('auto.components.UpdateCard.8acbdd3961', 'Minimize to status bar')}
+ aria-label={t('auto.components.UpdateCard.8acbdd3961', 'Minimize to status bar')}
>
@@ -131,22 +132,22 @@ export function UpdateErrorCardContent({
{blockers && blockers.length > 0 && (
{blockers.map(({ pid, kind }) => (
{kind === 'browser'
- ? translate('updates.installBlock.browserLabel', 'Background browser')
+ ? t('updates.installBlock.browserLabel', 'Background browser')
: kind === 'server'
- ? translate('updates.installBlock.serverLabel', 'Background server')
+ ? t('updates.installBlock.serverLabel', 'Background server')
: kind === 'window'
- ? translate('updates.installBlock.windowLabel', 'Other Orca window')
- : translate('updates.installBlock.instanceLabel', 'Other Orca instance')}
+ ? t('updates.installBlock.windowLabel', 'Other Orca window')
+ : t('updates.installBlock.instanceLabel', 'Other Orca instance')}
- {translate('updates.installBlock.processId', 'PID {{pid}}', { pid })}
+ {t('updates.installBlock.processId', 'PID {{pid}}', { pid })}
))}
@@ -169,13 +170,13 @@ export function UpdateErrorCardContent({
className={`size-3.5 transition-transform motion-reduce:transition-none ${showDetails ? 'rotate-90' : ''}`}
/>
{showDetails
- ? translate('auto.components.UpdateCard.5194358929', 'Hide details')
- : translate('auto.components.UpdateCard.8bc9e17d8f', 'Show details')}
+ ? t('auto.components.UpdateCard.5194358929', 'Hide details')
+ : t('auto.components.UpdateCard.8bc9e17d8f', 'Show details')}
{showDetails ? (
- {translate('auto.components.UpdateCard.3553a8672f', 'Details')}
+ {t('auto.components.UpdateCard.3553a8672f', 'Details')}
{detail}
@@ -211,8 +212,7 @@ export function UpdateErrorCardContent({
}}
className="flex-1"
>
- {manualLabel ??
- translate('auto.components.UpdateCard.47126bcf57', 'Download Manually')}
+ {manualLabel ?? t('auto.components.UpdateCard.47126bcf57', 'Download Manually')}
)}
diff --git a/src/renderer/src/components/WorktreeBaseFallbackDialog.tsx b/src/renderer/src/components/WorktreeBaseFallbackDialog.tsx
index e64e5904511..015ffe173f9 100644
--- a/src/renderer/src/components/WorktreeBaseFallbackDialog.tsx
+++ b/src/renderer/src/components/WorktreeBaseFallbackDialog.tsx
@@ -9,7 +9,7 @@ import {
DialogHeader,
DialogTitle
} from '@/components/ui/dialog'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { useAppStore } from '@/store'
import {
dismissWorktreeBaseFallbackNotice,
@@ -18,6 +18,7 @@ import {
} from './worktree-base-fallback-notice'
export default function WorktreeBaseFallbackDialog(): React.JSX.Element {
+ const t = useTranslate()
const notice = useSyncExternalStore(
subscribeWorktreeBaseFallbackNotice,
getWorktreeBaseFallbackNotice,
@@ -55,14 +56,14 @@ export default function WorktreeBaseFallbackDialog(): React.JSX.Element {
- {translate(
+ {t(
'auto.components.WorktreeBaseFallbackDialog.title',
'Workspace created from a local base'
)}
{displayedNotice ? (
- {translate(
+ {t(
'auto.components.WorktreeBaseFallbackDialog.description',
'The remote-tracking ref "{{value0}}" was unavailable, so Orca used local "{{value1}}" instead. This workspace may not include the latest remote changes.',
{ value0: displayedNotice.requestedRef, value1: displayedNotice.localRef }
@@ -72,7 +73,7 @@ export default function WorktreeBaseFallbackDialog(): React.JSX.Element {
- {translate('auto.components.WorktreeBaseFallbackDialog.dismiss', 'Got it')}
+ {t('auto.components.WorktreeBaseFallbackDialog.dismiss', 'Got it')}
diff --git a/src/renderer/src/components/ZoomOverlay.tsx b/src/renderer/src/components/ZoomOverlay.tsx
index 464a2be5162..6a399b1bec0 100644
--- a/src/renderer/src/components/ZoomOverlay.tsx
+++ b/src/renderer/src/components/ZoomOverlay.tsx
@@ -2,13 +2,14 @@ import { useEffect, useRef, useState } from 'react'
import { Search } from 'lucide-react'
import { ZOOM_LEVEL_CHANGED_EVENT } from '@/lib/zoom-events'
import type { ZoomLevelChangedEventDetail } from '@/lib/zoom-events'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
// Unmount after fading so the fixed overlay cannot interfere with Radix layering, outside clicks or focus.
const DISPLAY_MS = 1500
const FADE_MS = 300
export function ZoomOverlay(): React.JSX.Element | null {
+ const t = useTranslate()
const [visible, setVisible] = useState(false)
const [detail, setDetail] = useState(null)
const hideTimerRef = useRef(undefined)
@@ -46,10 +47,10 @@ export function ZoomOverlay(): React.JSX.Element | null {
const title =
detail.type === 'ui'
- ? translate('auto.components.ZoomOverlay.uiZoom', 'UI Zoom')
+ ? t('auto.components.ZoomOverlay.uiZoom', 'UI Zoom')
: detail.type === 'editor'
- ? translate('auto.components.ZoomOverlay.editorZoom', 'Editor Zoom')
- : translate('auto.components.ZoomOverlay.terminalZoom', 'Terminal Zoom')
+ ? t('auto.components.ZoomOverlay.editorZoom', 'Editor Zoom')
+ : t('auto.components.ZoomOverlay.terminalZoom', 'Terminal Zoom')
return (
{access.length === 0 ? (
- {translate(
+ {t(
'browserExtensions.install.noAccess',
'It does not ask to read or change data on websites.'
)}
@@ -38,7 +40,7 @@ function InstallBody({
) : (
<>
- {translate('browserExtensions.install.canHeading', 'It can:')}
+ {t('browserExtensions.install.canHeading', 'It can:')}
{access.map((message) => (
@@ -52,28 +54,32 @@ function InstallBody({
)
}
-function promptDescription(request: BrowserExtensionInstallPromptRequest): string {
+function promptDescription(
+ request: BrowserExtensionInstallPromptRequest,
+ t: Translate = translate
+): string {
if (request.kind === 'permissions') {
- return translate(
+ return t(
'browserExtensions.permissions.description',
'It is asking for access it did not have when you added it.'
)
}
if (request.kind === 'uninstall') {
// Why the Settings wording: removing from the store page removes it from every profile too.
- return browserExtensionRemovalDescription('webstore')
+ return browserExtensionRemovalDescription('webstore', t)
}
return request.profileLabel
- ? translate(
+ ? t(
'browserExtensions.install.profileDescription',
'It runs in tabs that use the {{profile}} profile.',
{ profile: request.profileLabel }
)
- : translate('browserExtensions.install.description', 'It runs in Orca browser tabs.')
+ : t('browserExtensions.install.description', 'It runs in Orca browser tabs.')
}
/** Orca's confirmation for store installs and store-page removals; main waits on the answer. */
export function BrowserExtensionInstallDialog(): React.JSX.Element {
+ const t = useTranslate()
const [requests, setRequests] = useState([])
const [respondingRequestId, setRespondingRequestId] = useState(null)
const requestsRef = useRef(requests)
@@ -168,19 +174,15 @@ export function BrowserExtensionInstallDialog(): React.JSX.Element {
{isPermissionRequest
- ? translate(
- 'browserExtensions.permissions.title',
- 'Allow {{name}} more access?',
- {
- name
- }
- )
+ ? t('browserExtensions.permissions.title', 'Allow {{name}} more access?', {
+ name
+ })
: isInstall
- ? translate('browserExtensions.install.title', 'Add {{name}}?', { name })
- : translate('browserExtensions.uninstall.title', 'Remove {{name}}?', { name })}
+ ? t('browserExtensions.install.title', 'Add {{name}}?', { name })
+ : t('browserExtensions.uninstall.title', 'Remove {{name}}?', { name })}
- {displayed ? promptDescription(displayed) : null}
+ {displayed ? promptDescription(displayed, t) : null}
@@ -191,14 +193,14 @@ export function BrowserExtensionInstallDialog(): React.JSX.Element {
respond(false)}>
{isPermissionRequest
- ? translate('browserExtensions.permissions.deny', 'Deny')
- : translate('browserExtensions.install.cancel', 'Cancel')}
+ ? t('browserExtensions.permissions.deny', 'Deny')
+ : t('browserExtensions.install.cancel', 'Cancel')}
{isInstall ? (
respond(true)}>
{isPermissionRequest
- ? translate('browserExtensions.permissions.confirm', 'Allow')
- : translate('browserExtensions.install.confirm', 'Add extension')}
+ ? t('browserExtensions.permissions.confirm', 'Allow')
+ : t('browserExtensions.install.confirm', 'Add extension')}
) : (
respond(true)}
>
- {translate('browserExtensions.uninstall.confirm', 'Remove')}
+ {t('browserExtensions.uninstall.confirm', 'Remove')}
)}
diff --git a/src/renderer/src/components/browser-extension-permission-messages.ts b/src/renderer/src/components/browser-extension-permission-messages.ts
index f94396ff876..aa1efd87da5 100644
--- a/src/renderer/src/components/browser-extension-permission-messages.ts
+++ b/src/renderer/src/components/browser-extension-permission-messages.ts
@@ -14,92 +14,79 @@ import {
const MAX_NAMED_HOSTS = 3
-function permissionMessage(warning: BrowserExtensionPermissionWarning): string {
+function permissionMessage(
+ warning: BrowserExtensionPermissionWarning,
+ t: Translate = translate
+): string {
switch (warning) {
case 'history':
- return translate('browserExtensions.permission.history', 'Read your browsing history')
+ return t('browserExtensions.permission.history', 'Read your browsing history')
case 'historyWrite':
- return translate(
- 'browserExtensions.permission.historyWrite',
- 'Read and change your browsing history'
- )
+ return t('browserExtensions.permission.historyWrite', 'Read and change your browsing history')
case 'bookmarks':
- return translate('browserExtensions.permission.bookmarks', 'Read and change your bookmarks')
+ return t('browserExtensions.permission.bookmarks', 'Read and change your bookmarks')
case 'clipboardRead':
- return translate('browserExtensions.permission.clipboardRead', 'Read data you copy and paste')
+ return t('browserExtensions.permission.clipboardRead', 'Read data you copy and paste')
case 'clipboardWrite':
- return translate(
- 'browserExtensions.permission.clipboardWrite',
- 'Modify data you copy and paste'
- )
+ return t('browserExtensions.permission.clipboardWrite', 'Modify data you copy and paste')
case 'downloads':
- return translate('browserExtensions.permission.downloads', 'Manage your downloads')
+ return t('browserExtensions.permission.downloads', 'Manage your downloads')
case 'nativeMessaging':
- return translate(
+ return t(
'browserExtensions.permission.nativeMessaging',
'Communicate with cooperating native applications'
)
case 'notifications':
- return translate('browserExtensions.permission.notifications', 'Display notifications')
+ return t('browserExtensions.permission.notifications', 'Display notifications')
case 'privacy':
- return translate(
- 'browserExtensions.permission.privacy',
- 'Change your privacy-related settings'
- )
+ return t('browserExtensions.permission.privacy', 'Change your privacy-related settings')
case 'management':
- return translate('browserExtensions.permission.management', 'Manage your other extensions')
+ return t('browserExtensions.permission.management', 'Manage your other extensions')
case 'proxy':
- return translate('browserExtensions.permission.proxy', 'Change your proxy settings')
+ return t('browserExtensions.permission.proxy', 'Change your proxy settings')
case 'contentSettings':
- return translate(
+ return t(
'browserExtensions.permission.contentSettings',
'Change which sites can use cookies, JavaScript, your camera, microphone and location'
)
case 'geolocation':
- return translate('browserExtensions.permission.geolocation', 'Detect your physical location')
+ return t('browserExtensions.permission.geolocation', 'Detect your physical location')
case 'topSites':
- return translate(
+ return t(
'browserExtensions.permission.topSites',
'Read a list of your most frequently visited websites'
)
case 'blockContent':
- return translate('browserExtensions.permission.blockContent', 'Block content on any page')
+ return t('browserExtensions.permission.blockContent', 'Block content on any page')
case 'debugger':
- return translate('browserExtensions.permission.debugger', 'Access the page debugger backend')
+ return t('browserExtensions.permission.debugger', 'Access the page debugger backend')
case 'screenCapture':
- return translate(
- 'browserExtensions.permission.screenCapture',
- 'Capture content of your screen'
- )
+ return t('browserExtensions.permission.screenCapture', 'Capture content of your screen')
case 'email':
- return translate('browserExtensions.permission.email', 'Know your email address')
+ return t('browserExtensions.permission.email', 'Know your email address')
}
}
-function hostMessage(hostPermissions: string[]): string | null {
+function hostMessage(hostPermissions: string[], t: Translate = translate): string | null {
const warning = browserExtensionHostWarning(hostPermissions)
if (!warning) {
return null
}
if (warning.kind === 'allSites') {
- return translate(
+ return t(
'browserExtensions.permission.allSites',
'Read and change all your data on all websites'
)
}
const { hosts } = warning
if (hosts.length <= MAX_NAMED_HOSTS) {
- return translate(
- 'browserExtensions.permission.someSites',
- 'Read and change your data on {{hosts}}',
- {
- hosts: hosts.join(', ')
- }
- )
+ return t('browserExtensions.permission.someSites', 'Read and change your data on {{hosts}}', {
+ hosts: hosts.join(', ')
+ })
}
const named = hosts.slice(0, MAX_NAMED_HOSTS).join(', ')
const count = hosts.length - MAX_NAMED_HOSTS
- return translate(
+ return t(
'browserExtensions.permission.manyOtherSites',
'Read and change your data on {{hosts}} and {{count}} other sites',
{
@@ -113,14 +100,15 @@ function hostMessage(hostPermissions: string[]): string | null {
/** Why skip unsupported ones: "It can" must not promise what Orca does not do; they get their own line. */
export function describeBrowserExtensionAccess(
permissions: string[],
- hostPermissions: string[]
+ hostPermissions: string[],
+ t?: Translate
): string[] {
const messages = [
- hostMessage(hostPermissions),
+ hostMessage(hostPermissions, t),
...permissions
.filter((permission) => unsupportedBrowserExtensionFeatures([permission]).length === 0)
.map(browserExtensionPermissionWarning)
- .map((warning) => (warning ? permissionMessage(warning) : null))
+ .map((warning) => (warning ? permissionMessage(warning, t) : null))
]
return [...new Set(messages.filter((message): message is string => message !== null))]
}
diff --git a/src/renderer/src/components/browser-extension-removal-description.ts b/src/renderer/src/components/browser-extension-removal-description.ts
index 1fa3ed811dd..c757cb11fa7 100644
--- a/src/renderer/src/components/browser-extension-removal-description.ts
+++ b/src/renderer/src/components/browser-extension-removal-description.ts
@@ -1,14 +1,18 @@
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import type { BrowserExtensionSource } from '../../../shared/browser/extensions/browser-extension-types'
/** One wording for every remove prompt (Settings, toolbar, store page): Orca removes it everywhere. */
-export function browserExtensionRemovalDescription(source: BrowserExtensionSource): string {
+export function browserExtensionRemovalDescription(
+ source: BrowserExtensionSource,
+ t: Translate = translate
+): string {
return source === 'unpacked'
- ? translate(
+ ? t(
'settings.browser.extensions.removeUnpackedDescription',
'It is removed from every Orca browser profile, with its saved data. The folder on disk stays where it is.'
)
- : translate(
+ : t(
'settings.browser.extensions.removeDescription',
'It is removed from every Orca browser profile, with its saved data.'
)
diff --git a/src/renderer/src/components/browser-webauthn-account-dialog.tsx b/src/renderer/src/components/browser-webauthn-account-dialog.tsx
index cb7bc9ff2c3..8a885d9241c 100644
--- a/src/renderer/src/components/browser-webauthn-account-dialog.tsx
+++ b/src/renderer/src/components/browser-webauthn-account-dialog.tsx
@@ -11,6 +11,7 @@ import {
DialogTitle
} from '@/components/ui/dialog'
import { translate } from '@/i18n/i18n'
+import { useTranslate, type Translate } from '@/i18n/use-translate'
import { useAppStore } from '@/store'
import type {
BrowserWebAuthnAccount,
@@ -19,17 +20,19 @@ import type {
function accountLabels(
account: BrowserWebAuthnAccount,
- index: number
+ index: number,
+ t: Translate = translate
): { primary: string; secondary: string | null } {
const primary =
account.displayName?.trim() ||
account.name?.trim() ||
- `${translate('auto.components.browser.webauthn.account.fallback', 'Passkey')} ${index + 1}`
+ `${t('auto.components.browser.webauthn.account.fallback', 'Passkey')} ${index + 1}`
const secondary = account.name?.trim()
return { primary, secondary: secondary && secondary !== primary ? secondary : null }
}
export function BrowserWebAuthnAccountDialog(): React.JSX.Element {
+ const t = useTranslate()
const [requests, setRequests] = useState([])
const [respondingRequestId, setRespondingRequestId] = useState(null)
const requestsRef = useRef(requests)
@@ -120,10 +123,10 @@ export function BrowserWebAuthnAccountDialog(): React.JSX.Element {
>
- {translate('auto.components.browser.webauthn.account.title', 'Choose a passkey')}
+ {t('auto.components.browser.webauthn.account.title', 'Choose a passkey')}
- {translate(
+ {t(
'auto.components.browser.webauthn.account.description',
'Choose the account to use with this security key.'
)}
@@ -132,7 +135,7 @@ export function BrowserWebAuthnAccountDialog(): React.JSX.Element {
{displayedRequest?.accounts.map((account, index) => {
- const labels = accountLabels(account, index)
+ const labels = accountLabels(account, index, t)
return (
- {translate('auto.components.browser.webauthn.account.site', 'Site')}{' '}
+ {t('auto.components.browser.webauthn.account.site', 'Site')}{' '}
{displayedRequest?.relyingPartyId}
respond(null)}>
- {translate('auto.components.browser.webauthn.account.cancel', 'Cancel')}
+ {t('auto.components.browser.webauthn.account.cancel', 'Cancel')}
diff --git a/src/renderer/src/components/confirmation-dialog.tsx b/src/renderer/src/components/confirmation-dialog.tsx
index b0ae7a4428c..05dc78a514e 100644
--- a/src/renderer/src/components/confirmation-dialog.tsx
+++ b/src/renderer/src/components/confirmation-dialog.tsx
@@ -18,7 +18,7 @@ import {
type ConfirmationDialogOptions
} from '@/components/confirmation-dialog-context'
import { useAppStore } from '@/store'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { cn } from '@/lib/utils'
type ConfirmationDialogRequest = {
@@ -32,6 +32,7 @@ export function ConfirmationDialogProvider({
}: {
children: React.ReactNode
}): React.JSX.Element {
+ const t = useTranslate()
const nextIdRef = useRef(0)
const confirmButtonRef = useRef(null)
const [queue, setQueue] = useState([])
@@ -216,7 +217,7 @@ export function ConfirmationDialogProvider({
className="text-sm font-normal text-foreground/80"
>
{displayedRequest.options.dontAskAgain.label ??
- translate('auto.components.confirmation.dialog.92bac3217e', "Don't ask again")}
+ t('auto.components.confirmation.dialog.92bac3217e', "Don't ask again")}
) : null}
@@ -240,7 +241,7 @@ export function ConfirmationDialogProvider({
}}
>
{displayedRequest?.options.cancelLabel ??
- translate('auto.components.confirmation.dialog.56f5c60e0c', 'Cancel')}
+ t('auto.components.confirmation.dialog.56f5c60e0c', 'Cancel')}
)}
{displayedRequest?.options.confirmLabel ??
- translate('auto.components.confirmation.dialog.8490e5d36a', 'Confirm')}
+ t('auto.components.confirmation.dialog.8490e5d36a', 'Confirm')}
diff --git a/src/renderer/src/components/feature-wall/AgentCapabilitiesSetupAction.tsx b/src/renderer/src/components/feature-wall/AgentCapabilitiesSetupAction.tsx
index 40fef3eeb25..37296243aeb 100644
--- a/src/renderer/src/components/feature-wall/AgentCapabilitiesSetupAction.tsx
+++ b/src/renderer/src/components/feature-wall/AgentCapabilitiesSetupAction.tsx
@@ -271,7 +271,7 @@ function AgentCapabilitySetupControls(props: {
"Replace with Orca's copy"
)
: props.installAction?.kind === 'run' && props.installAction.changes
- ? bundledSkillSetupActionLabel(props.installAction.changes)
+ ? bundledSkillSetupActionLabel(props.installAction.changes, t)
: t(
'auto.components.feature.wall.AgentCapabilitiesSetupAction.installSkills',
'Install skills'
@@ -300,6 +300,7 @@ function AgentCapabilitySetupChecklist(props: {
onChange: (value: OnboardingFeatureSetupSelection) => void
installStatus: Record
}): React.JSX.Element {
+ const t = useTranslate()
return (
@@ -312,7 +313,7 @@ function AgentCapabilitySetupChecklist(props: {
type="button"
role="checkbox"
aria-checked={selected}
- aria-label={capabilityToggleLabel(selected, row.title)}
+ aria-label={capabilityToggleLabel(selected, row.title, t)}
className={cn(
'flex min-h-24 flex-col rounded-lg border px-4 py-3.5 text-left transition-colors',
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
diff --git a/src/renderer/src/components/gitlab-item-dialog-parts.tsx b/src/renderer/src/components/gitlab-item-dialog-parts.tsx
index d9166262aad..ac5ca964159 100644
--- a/src/renderer/src/components/gitlab-item-dialog-parts.tsx
+++ b/src/renderer/src/components/gitlab-item-dialog-parts.tsx
@@ -4,7 +4,8 @@ import { toast } from 'sonner'
import { Button } from '@/components/ui/button'
import CommentMarkdown from '@/components/sidebar/CommentMarkdown'
import { cn } from '@/lib/utils'
-import { getIntlLocale, translate } from '@/i18n/i18n'
+import { translate } from '@/i18n/i18n'
+import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
import type {
GitLabAssignableUser,
GitLabPipelineJob,
@@ -127,6 +128,8 @@ export function CommentCard({
resolving?: boolean
onResolve?: (threadId: string, resolved: boolean) => void
}): React.JSX.Element {
+ const t = useTranslate()
+ const intlLocale = useIntlLocale()
const hasThread = Boolean(comment.threadId)
return (
@@ -145,7 +148,7 @@ export function CommentCard({
{comment.author}
{comment.isResolved ? (
- {translate('auto.components.GitLabItemDialog.f23ea85341', 'resolved')}
+ {t('auto.components.GitLabItemDialog.f23ea85341', 'resolved')}
) : null}
@@ -161,14 +164,12 @@ export function CommentCard({
>
{resolving ?
: null}
{comment.isResolved
- ? translate('auto.components.GitLabItemDialog.65e784c1f1', 'Reopen')
- : translate('auto.components.GitLabItemDialog.4168eb2c51', 'Resolve')}
+ ? t('auto.components.GitLabItemDialog.65e784c1f1', 'Reopen')
+ : t('auto.components.GitLabItemDialog.4168eb2c51', 'Resolve')}
) : null}
- {comment.createdAt
- ? new Date(comment.createdAt).toLocaleDateString(getIntlLocale())
- : ''}
+ {comment.createdAt ? new Date(comment.createdAt).toLocaleDateString(intlLocale) : ''}
@@ -202,6 +203,7 @@ export function PipelineJobRow({
onToggleTrace: (job: GitLabPipelineJob) => void
onRetry: (job: GitLabPipelineJob) => void
}): React.JSX.Element {
+ const t = useTranslate()
const canRetry = ['failed', 'canceled', 'cancelled'].includes(job.status)
return (
@@ -240,7 +242,7 @@ export function PipelineJobRow({
className="h-6"
>
{retrying ?
: null}
- {translate('auto.components.GitLabItemDialog.fa3e042203', 'Retry')}
+ {t('auto.components.GitLabItemDialog.fa3e042203', 'Retry')}
) : null}
{job.webUrl ? (
@@ -249,7 +251,7 @@ export function PipelineJobRow({
variant="ghost"
size="icon-xs"
onClick={(event) => openAppHttpLink(job.webUrl, { event })}
- title={translate('auto.components.GitLabItemDialog.032ae1312b', 'Open job in GitLab')}
+ title={t('auto.components.GitLabItemDialog.032ae1312b', 'Open job in GitLab')}
>
@@ -259,15 +261,15 @@ export function PipelineJobRow({
{expanded ? (
- {translate('auto.components.GitLabItemDialog.2f9b27f838', 'Job log')}
+ {t('auto.components.GitLabItemDialog.2f9b27f838', 'Job log')}
onToggleTrace(job)}>
- {translate('auto.components.GitLabItemDialog.028bde664e', 'Hide')}
+ {t('auto.components.GitLabItemDialog.028bde664e', 'Hide')}
{traceState?.loading ? (
- {translate('auto.components.GitLabItemDialog.d600c2619a', 'Loading log')}
+ {t('auto.components.GitLabItemDialog.d600c2619a', 'Loading log')}
) : traceState?.error ? (
{traceState.error}
@@ -275,7 +277,7 @@ export function PipelineJobRow({
{traceState?.trace?.trim()
? traceState.trace
- : translate('auto.components.GitLabItemDialog.32f8bef818', 'No log output.')}
+ : t('auto.components.GitLabItemDialog.32f8bef818', 'No log output.')}
)}
diff --git a/src/renderer/src/components/host-picker/HostCombobox.tsx b/src/renderer/src/components/host-picker/HostCombobox.tsx
index 1a671f0ffbb..979dca422e9 100644
--- a/src/renderer/src/components/host-picker/HostCombobox.tsx
+++ b/src/renderer/src/components/host-picker/HostCombobox.tsx
@@ -14,6 +14,7 @@ import { cn } from '@/lib/utils'
import { boundHostList } from './bounded-host-list'
import { HostListOverflowNote } from './HostListOverflowNote'
import { noHostsMatchLabel, searchHostsLabel } from './host-picker-copy'
+import { useTranslate } from '@/i18n/use-translate'
export type HostComboboxOption = {
id: string
@@ -64,6 +65,7 @@ export function HostCombobox({
disabled?: boolean
notifyOnReselect?: boolean
}): React.JSX.Element {
+ const t = useTranslate()
const [open, setOpen] = useState(false)
const [query, setQuery] = useState('')
const selected = options.find((option) => option.id === value)
@@ -101,15 +103,15 @@ export function HostCombobox({
-
+
- {noHostsMatchLabel()}
+ {noHostsMatchLabel(t)}
{groupOptions(shown).map((group) => (
{group.options.map((option) => (
diff --git a/src/renderer/src/components/host-picker/HostListSearchField.tsx b/src/renderer/src/components/host-picker/HostListSearchField.tsx
index 0bcb828c2b9..581b28409d9 100644
--- a/src/renderer/src/components/host-picker/HostListSearchField.tsx
+++ b/src/renderer/src/components/host-picker/HostListSearchField.tsx
@@ -2,6 +2,7 @@ import { useRef } from 'react'
import { DropdownMenuItem } from '@/components/ui/dropdown-menu'
import { Input } from '@/components/ui/input'
import { searchHostsLabel } from './host-picker-copy'
+import { useTranslate } from '@/i18n/use-translate'
const MENU_ITEM_SELECTOR = '[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]'
@@ -28,14 +29,15 @@ function HostListSearchInput({
inputRef?: React.RefObject
onKeyDown?: React.KeyboardEventHandler
}): React.JSX.Element {
+ const t = useTranslate()
return (
onChange(event.target.value)}
onKeyDown={onKeyDown}
- placeholder={searchHostsLabel()}
- aria-label={searchHostsLabel()}
+ placeholder={searchHostsLabel(t)}
+ aria-label={searchHostsLabel(t)}
className="h-7"
/>
)
diff --git a/src/renderer/src/components/host-picker/host-picker-copy.ts b/src/renderer/src/components/host-picker/host-picker-copy.ts
index dbf5c581f7c..b154f581ac6 100644
--- a/src/renderer/src/components/host-picker/host-picker-copy.ts
+++ b/src/renderer/src/components/host-picker/host-picker-copy.ts
@@ -5,8 +5,8 @@ export function searchHostsLabel(t: Translate = translate): string {
return t('auto.components.hostPicker.searchHosts', 'Search hosts…')
}
-export function noHostsMatchLabel(): string {
- return translate('auto.components.hostPicker.noHostsMatch', 'No hosts match.')
+export function noHostsMatchLabel(t: Translate = translate): string {
+ return t('auto.components.hostPicker.noHostsMatch', 'No hosts match.')
}
export function moreHostsLabel(count: number): string {
diff --git a/src/renderer/src/components/jira-attachment-image.tsx b/src/renderer/src/components/jira-attachment-image.tsx
index ad3e5d9312c..86ca179f895 100644
--- a/src/renderer/src/components/jira-attachment-image.tsx
+++ b/src/renderer/src/components/jira-attachment-image.tsx
@@ -6,7 +6,7 @@ import {
onJiraImageCacheInvalidated
} from '@/runtime/jira/runtime-jira-image-cache'
import { jiraImageProtocolUrl } from '@/runtime/jira/runtime-jira-image-client'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { ExpandableMarkdownImage } from './sidebar/MarkdownImageLightbox'
type JiraAttachmentImageProps = {
@@ -27,6 +27,7 @@ function ResolvedJiraAttachmentImage({
alt,
compact
}: JiraAttachmentImageProps): React.JSX.Element {
+ const t = useTranslate()
const [resolved, setResolved] = useState(null)
const [failed, setFailed] = useState(false)
const [generation, setGeneration] = useState(0)
@@ -78,11 +79,7 @@ function ResolvedJiraAttachmentImage({
}
}, [generation, localProtocol, reference, target])
if (!src || failed) {
- return (
-
- {alt || translate('auto.components.sidebar.MarkdownImageLightbox.image', 'Image')}
-
- )
+ return {alt || t('auto.components.sidebar.MarkdownImageLightbox.image', 'Image')}
}
return (
{isServerBasic
- ? translate(
+ ? t(
'auto.components.jira.connect.dialog.d8737db691',
'Use your Jira Server or Data Center account username and password.'
)
- : translate(
+ : t(
'auto.components.jira.connect.dialog.ccfb086d3e',
'Create a personal access token in your Jira profile under Personal Access Tokens.'
)}
@@ -30,7 +32,7 @@ export function JiraConnectCredentialGuide({
Atlassian account settings.'
)}
@@ -51,11 +53,11 @@ export function JiraConnectCredentialGuide({
{supportsScopedTokens
- ? translate(
+ ? t(
'jira.connect.scopedTokenGuide',
'Scoped tokens need read:jira-work, write:jira-work, and read:jira-user. Leave email empty to use Bearer authentication.'
)
- : translate(
+ : t(
'jira.connect.oldHostGuide',
'This remote runtime requires an email and an unscoped API token. Update the remote runtime to use scoped tokens.'
)}
diff --git a/src/renderer/src/components/jira-connect-dialog.tsx b/src/renderer/src/components/jira-connect-dialog.tsx
index 19fab7e4290..0b7673ba927 100644
--- a/src/renderer/src/components/jira-connect-dialog.tsx
+++ b/src/renderer/src/components/jira-connect-dialog.tsx
@@ -22,7 +22,7 @@ import {
isEnvironmentRuntimeContextKey
} from '@/lib/provider-runtime-context'
import { preventOutsideDismissWhenDirty } from '@/lib/outside-dismiss-guard'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { JiraConnectCredentialGuide } from './jira-connect-credential-guide'
type JiraConnectDialogProps = {
@@ -45,6 +45,7 @@ export function JiraConnectDialog({
overlayClassName,
contentClassName
}: JiraConnectDialogProps): React.JSX.Element {
+ const t = useTranslate()
const connectJira = useAppStore((s) => s.connectJira)
const settings = useAppStore((s) => s.settings)
const hostSupportsScopedTokens = useAppStore((s) => s.jiraStatus?.supportsScopedTokens === true)
@@ -93,7 +94,7 @@ export function JiraConnectDialog({
(!requiresIdentity || Boolean(email.trim())) &&
Boolean(apiToken.trim()) &&
connectState !== 'connecting'
- const credentialStorageCopy = jiraCredentialStorageCopy(remoteRuntime)
+ const credentialStorageCopy = jiraCredentialStorageCopy(remoteRuntime, t)
const clearErrorOnEdit = (): void => {
if (connectState === 'error') {
@@ -163,7 +164,7 @@ export function JiraConnectDialog({
setConnectError(
error instanceof Error
? taskProviderErrorText(error.message)
- : translate('taskProviders.jira.connectionFailed', 'Connection failed')
+ : t('taskProviders.jira.connectionFailed', 'Connection failed')
)
}
}
@@ -179,25 +180,25 @@ export function JiraConnectDialog({
>
- {translate('auto.components.jira.connect.dialog.8388bdea2b', 'Connect Jira site')}
+ {t('auto.components.jira.connect.dialog.8388bdea2b', 'Connect Jira site')}
{!isServer
? supportsScopedTokens
- ? translate(
+ ? t(
'jira.connect.scopedDescription',
'Use a Jira Cloud site URL and API token to browse issues. Scoped tokens can omit the email.'
)
- : translate(
+ : t(
'auto.components.jira.connect.dialog.d785c42b8b',
'Use a Jira Cloud site URL, Atlassian email, and API token to browse issues.'
)
: isServerBasic
- ? translate(
+ ? t(
'auto.components.jira.connect.dialog.1d947a07ab',
'Use a self-hosted Jira base URL, username, and password to browse issues.'
)
- : translate(
+ : t(
'auto.components.jira.connect.dialog.2e2b69e48e',
'Use a self-hosted Jira base URL and a personal access token to browse issues.'
)}
@@ -224,16 +225,13 @@ export function JiraConnectDialog({
setInstanceType(value as JiraInstanceType)
clearCredentialsOnModeSwitch()
}}
- aria-label={translate(
- 'auto.components.jira.connect.dialog.b67e919bd5',
- 'Jira instance type'
- )}
+ aria-label={t('auto.components.jira.connect.dialog.b67e919bd5', 'Jira instance type')}
>
- {translate('auto.components.jira.connect.dialog.17787d6e4b', 'Atlassian Cloud')}
+ {t('auto.components.jira.connect.dialog.17787d6e4b', 'Atlassian Cloud')}
- {translate('auto.components.jira.connect.dialog.bc7a831773', 'Self-hosted')}
+ {t('auto.components.jira.connect.dialog.bc7a831773', 'Self-hosted')}
{isServer ? (
@@ -249,44 +247,35 @@ export function JiraConnectDialog({
setServerAuthMethod(value as ServerAuthMethod)
clearCredentialsOnModeSwitch()
}}
- aria-label={translate(
+ aria-label={t(
'auto.components.jira.connect.dialog.f49708c369',
'Jira authentication method'
)}
>
- {translate(
- 'auto.components.jira.connect.dialog.730d973bae',
- 'Personal access token'
- )}
+ {t('auto.components.jira.connect.dialog.730d973bae', 'Personal access token')}
- {translate(
- 'auto.components.jira.connect.dialog.84a810dd0e',
- 'Username & password'
- )}
+ {t('auto.components.jira.connect.dialog.84a810dd0e', 'Username & password')}
) : null}
{isServer
- ? translate('auto.components.jira.connect.dialog.3489e186d6', 'Jira site URL')
- : translate(
- 'auto.components.jira.connect.dialog.e176f9d0c5',
- 'Jira Cloud site URL'
- )}
+ ? t('auto.components.jira.connect.dialog.3489e186d6', 'Jira site URL')
+ : t('auto.components.jira.connect.dialog.e176f9d0c5', 'Jira Cloud site URL')}
{isServerBasic
- ? translate('auto.components.jira.connect.dialog.8d1223fa5c', 'Username')
+ ? t('auto.components.jira.connect.dialog.8d1223fa5c', 'Username')
: supportsScopedTokens
- ? translate(
+ ? t(
'jira.connect.optionalEmail',
'Atlassian email (optional for scoped tokens)'
)
- : translate(
- 'auto.components.jira.connect.dialog.2849ddb295',
- 'Atlassian email'
- )}
+ : t('auto.components.jira.connect.dialog.2849ddb295', 'Atlassian email')}
{
@@ -337,32 +320,23 @@ export function JiraConnectDialog({
{isServerBasic
- ? translate('auto.components.jira.connect.dialog.70035652d7', 'Password')
+ ? t('auto.components.jira.connect.dialog.70035652d7', 'Password')
: isServer
- ? translate(
- 'auto.components.jira.connect.dialog.730d973bae',
- 'Personal access token'
- )
- : translate('auto.components.jira.connect.dialog.3d81bf3ab3', 'API token')}
+ ? t('auto.components.jira.connect.dialog.730d973bae', 'Personal access token')
+ : t('auto.components.jira.connect.dialog.3d81bf3ab3', 'API token')}
{
@@ -395,16 +369,16 @@ export function JiraConnectDialog({
onClick={() => onOpenChange(false)}
disabled={connectState === 'connecting'}
>
- {translate('auto.components.jira.connect.dialog.79e7aaed39', 'Cancel')}
+ {t('auto.components.jira.connect.dialog.79e7aaed39', 'Cancel')}
{connectState === 'connecting' ? (
<>
- {translate('auto.components.jira.connect.dialog.4a2ab52781', 'Verifying…')}
+ {t('auto.components.jira.connect.dialog.4a2ab52781', 'Verifying…')}
>
) : (
- translate('auto.components.jira.connect.dialog.63ce735809', 'Connect')
+ t('auto.components.jira.connect.dialog.63ce735809', 'Connect')
)}
diff --git a/src/renderer/src/components/jira-credential-storage-copy.ts b/src/renderer/src/components/jira-credential-storage-copy.ts
index 88fe02cee92..92cfe6ff263 100644
--- a/src/renderer/src/components/jira-credential-storage-copy.ts
+++ b/src/renderer/src/components/jira-credential-storage-copy.ts
@@ -1,12 +1,16 @@
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
-export function jiraCredentialStorageCopy(remoteRuntime: boolean): string {
+export function jiraCredentialStorageCopy(
+ remoteRuntime: boolean,
+ t: Translate = translate
+): string {
return remoteRuntime
- ? translate(
+ ? t(
'taskProviders.jira.remoteTokenStorage',
'Your token is sent to the selected remote runtime and stored there with runtime-supported encryption.'
)
- : translate(
+ : t(
'taskProviders.jira.localTokenStorage',
'Your token is stored locally and encrypted when local runtime storage supports it.'
)
diff --git a/src/renderer/src/components/jira-issue-assignee-control.tsx b/src/renderer/src/components/jira-issue-assignee-control.tsx
index 4bdec2def7a..dbe52ce0564 100644
--- a/src/renderer/src/components/jira-issue-assignee-control.tsx
+++ b/src/renderer/src/components/jira-issue-assignee-control.tsx
@@ -6,7 +6,7 @@ import { useJiraSourceConnection } from '@/components/new-workspace/use-jira-sou
import { useAppStore } from '@/store'
import { compareBaseSensitivityLocaleText } from '../../../shared/locale-text-collators'
import { jiraListAssignableUsersForTarget } from '@/runtime/jira/runtime-jira-user-fields-client'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import {
getTaskSourceCacheScope,
type TaskSourceContext
@@ -33,6 +33,7 @@ export function JiraIssueAssigneeControl({
optimistic?: Partial
) => Promise
}): React.JSX.Element {
+ const t = useTranslate()
const defaultStatus = useAppStore((state) => state.jiraStatus)
const defaultStatusKey = useAppStore((state) => state.jiraStatusContextKey)
const connection = useJiraSourceConnection({
@@ -81,16 +82,16 @@ export function JiraIssueAssigneeControl({
siteId={issue.siteId}
value={
issue.assignee?.accountId ??
- translate('auto.components.JiraIssueWorkspace.0b6b5646ed', 'Unassigned')
+ t('auto.components.JiraIssueWorkspace.0b6b5646ed', 'Unassigned')
}
selectedUser={issue.assignee ?? null}
onSelect={assign}
disabled={disabled}
- label={translate('components.jiraIssueAssigneeField.label', 'Assignee')}
+ label={t('components.jiraIssueAssigneeField.label', 'Assignee')}
fixedOptions={[
{
key: 'unassigned',
- label: translate('auto.components.JiraIssueWorkspace.0b6b5646ed', 'Unassigned'),
+ label: t('auto.components.JiraIssueWorkspace.0b6b5646ed', 'Unassigned'),
onSelect: () => assign(null)
}
]}
@@ -99,7 +100,7 @@ export function JiraIssueAssigneeControl({
{self && issue.assignee?.accountId !== self.accountId ? (
assign(self)}>
- {translate('components.jiraIssueAssigneeField.assignToMe', 'Assign to me ({{name}})', {
+ {t('components.jiraIssueAssigneeField.assignToMe', 'Assign to me ({{name}})', {
name: self.displayName
})}
diff --git a/src/renderer/src/components/jira-issue-transition-control.tsx b/src/renderer/src/components/jira-issue-transition-control.tsx
index e3d4e151545..c43bfcfb515 100644
--- a/src/renderer/src/components/jira-issue-transition-control.tsx
+++ b/src/renderer/src/components/jira-issue-transition-control.tsx
@@ -3,7 +3,7 @@ import { useState } from 'react'
import { ChevronDown, CircleAlert, ExternalLink, Loader2 } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { classifyTransitionRequirements } from '../../../shared/jira/jira-transition-fields'
import { JiraTransitionFieldsForm } from './jira-transition-fields-form'
import type {
@@ -36,6 +36,7 @@ export function JiraIssueTransitionControl({
onRetry,
onTransition
}: Props): React.JSX.Element {
+ const t = useTranslate()
const [open, setOpen] = useState(false)
const [selected, setSelected] = useState
(null)
const [submitError, setSubmitError] = useState(null)
@@ -61,10 +62,7 @@ export function JiraIssueTransitionControl({
setSubmitError(
error instanceof Error
? taskProviderErrorText(error.message)
- : translate(
- 'auto.components.JiraIssueWorkspace.ea21952aa3',
- 'Failed to update Jira issue.'
- )
+ : t('auto.components.JiraIssueWorkspace.ea21952aa3', 'Failed to update Jira issue.')
)
}
}
@@ -95,7 +93,7 @@ export function JiraIssueTransitionControl({
- {translate('jira.transitions.loadError', 'Could not load status changes.')} {error}
+ {t('jira.transitions.loadError', 'Could not load status changes.')} {error}
- {translate('jira.transitions.retry', 'Retry')}
+ {t('jira.transitions.retry', 'Retry')}
>
) : loading ? (
- {translate('jira.transitions.loading', 'Loading status changes…')}
+ {t('jira.transitions.loading', 'Loading status changes…')}
) : null}
{requirement?.kind === 'form' && selected ? (
@@ -137,12 +135,12 @@ export function JiraIssueTransitionControl({
) : error || loading ? null : requirement?.kind === 'unsupported' ? (
<>
- {translate('jira.transitions.completeInJira', 'Complete “{{name}}” in Jira', {
+ {t('jira.transitions.completeInJira', 'Complete “{{name}}” in Jira', {
name: selected?.name
})}
- {translate(
+ {t(
'jira.transitions.unsupported',
'Jira requires fields Orca cannot collect yet: {{fields}}.',
{ fields: requirement.fields.map((field) => field.name).join(', ') }
@@ -151,7 +149,7 @@ export function JiraIssueTransitionControl({
>
) : selected && submitError ? null : transitions.length === 0 ? (
- {translate('jira.transitions.empty', 'No status changes available.')}
+ {t('jira.transitions.empty', 'No status changes available.')}
) : (
@@ -177,7 +175,7 @@ export function JiraIssueTransitionControl({
{requirement?.kind === 'unsupported' || submitError ? (
- {translate('jira.transitions.back', 'Back')}
+ {t('jira.transitions.back', 'Back')}
openAppHttpLink(issue.url, { event })}
>
- {translate('auto.components.JiraIssueWorkspace.69da9a208c', 'Open in Jira')}
+ {t('auto.components.JiraIssueWorkspace.69da9a208c', 'Open in Jira')}
) : null}
diff --git a/src/renderer/src/components/jira-issue-workspace-actions.ts b/src/renderer/src/components/jira-issue-workspace-actions.ts
index c3fd4f691e9..dcf574e9139 100644
--- a/src/renderer/src/components/jira-issue-workspace-actions.ts
+++ b/src/renderer/src/components/jira-issue-workspace-actions.ts
@@ -2,6 +2,7 @@ import { useCallback, useMemo } from 'react'
import { Clipboard, ExternalLink, GitBranch } from 'lucide-react'
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import type {
JiraIssue,
JiraIssueUpdate,
@@ -97,28 +98,28 @@ export async function copyJiraTextToClipboard(
}
}
-export function getJiraIssueWorkspaceActions(issue: JiraIssue): JiraIssueWorkspaceAction[] {
+export function getJiraIssueWorkspaceActions(
+ issue: JiraIssue,
+ t: Translate = translate
+): JiraIssueWorkspaceAction[] {
return [
{
- label: translate('auto.components.JiraIssueWorkspace.69da9a208c', 'Open in Jira'),
+ label: t('auto.components.JiraIssueWorkspace.69da9a208c', 'Open in Jira'),
icon: ExternalLink,
action: () => openAppHttpLink(issue.url)
},
{
- label: translate('auto.components.JiraIssueWorkspace.779bb91ee0', 'Copy URL'),
+ label: t('auto.components.JiraIssueWorkspace.779bb91ee0', 'Copy URL'),
icon: Clipboard,
action: () => void copyJiraTextToClipboard(issue.url, 'url')
},
{
- label: translate('auto.components.JiraIssueWorkspace.38839801e8', 'Copy key'),
+ label: t('auto.components.JiraIssueWorkspace.38839801e8', 'Copy key'),
icon: Clipboard,
action: () => void copyJiraTextToClipboard(issue.key, 'key')
},
{
- label: translate(
- 'auto.components.JiraIssueWorkspace.80efa101c5',
- 'Copy suggested branch name'
- ),
+ label: t('auto.components.JiraIssueWorkspace.80efa101c5', 'Copy suggested branch name'),
icon: GitBranch,
action: () =>
void copyJiraTextToClipboard(
@@ -127,7 +128,7 @@ export function getJiraIssueWorkspaceActions(issue: JiraIssue): JiraIssueWorkspa
)
},
{
- label: translate('auto.components.JiraIssueWorkspace.0cc62bd690', 'Copy prompt'),
+ label: t('auto.components.JiraIssueWorkspace.0cc62bd690', 'Copy prompt'),
icon: Clipboard,
action: () => void copyJiraTextToClipboard(buildJiraIssuePrompt(issue), 'prompt')
}
diff --git a/src/renderer/src/components/jira-issue-workspace-chrome.tsx b/src/renderer/src/components/jira-issue-workspace-chrome.tsx
index f5ce30cea00..1893ef673dd 100644
--- a/src/renderer/src/components/jira-issue-workspace-chrome.tsx
+++ b/src/renderer/src/components/jira-issue-workspace-chrome.tsx
@@ -6,7 +6,7 @@ import { JiraIssueAssigneeControl } from '@/components/jira-issue-assignee-contr
import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { TaskSourceContext } from '../../../shared/task-source-context'
import { JiraIssueTransitionControl } from './jira-issue-transition-control'
-import { translate } from '@/i18n/i18n'
+import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
import { formatUiRelativeTimeFromDate } from '@/i18n/relative-time-format'
import type {
JiraIssue,
@@ -27,6 +27,8 @@ export function JiraIssueWorkspaceHeader({
onUse: (issue: JiraIssue) => void
onClose: () => void
}): React.JSX.Element {
+ const t = useTranslate()
+ const intlLocale = useIntlLocale()
return (
@@ -35,7 +37,7 @@ export function JiraIssueWorkspaceHeader({
{displayed.key}
{displayed.siteName ? {displayed.siteName} : null}
{displayed.project.key}
- {formatUiRelativeTimeFromDate(displayed.updatedAt)}
+ {formatUiRelativeTimeFromDate(displayed.updatedAt, undefined, intlLocale)}
{issueLoading ? : null}
@@ -47,7 +49,7 @@ export function JiraIssueWorkspaceHeader({
className="hidden shrink-0 gap-2 sm:inline-flex"
size="sm"
>
- {translate('auto.components.JiraIssueWorkspace.2441be6f9f', 'Start workspace')}
+ {t('auto.components.JiraIssueWorkspace.2441be6f9f', 'Start workspace')}
@@ -57,7 +59,7 @@ export function JiraIssueWorkspaceHeader({
size="icon-sm"
className="shrink-0"
onClick={onClose}
- aria-label={translate(
+ aria-label={t(
'auto.components.JiraIssueWorkspace.76513c7898',
'Close Jira issue preview'
)}
@@ -66,7 +68,7 @@ export function JiraIssueWorkspaceHeader({
- {translate('auto.components.JiraIssueWorkspace.7a96985ca0', 'Close')}
+ {t('auto.components.JiraIssueWorkspace.7a96985ca0', 'Close')}
@@ -103,6 +105,7 @@ export function JiraIssueMetadataBar({
optimistic?: Partial
) => Promise
}): React.JSX.Element {
+ const t = useTranslate()
return (
{displayed.priority?.name ??
- translate('auto.components.JiraIssueWorkspace.51bed73f88', 'No priority')}
+ t('auto.components.JiraIssueWorkspace.51bed73f88', 'No priority')}
{pendingField === 'priority' ? (
) : null}
@@ -140,7 +143,7 @@ export function JiraIssueMetadataBar({
}
className="flex w-full items-center rounded-sm px-2 py-1.5 text-left text-[12px] hover:bg-accent"
>
- {translate('auto.components.JiraIssueWorkspace.51bed73f88', 'No priority')}
+ {t('auto.components.JiraIssueWorkspace.51bed73f88', 'No priority')}
{priorities.map((priority) => (
void
actionItems: JiraIssueWorkspaceAction[]
}): React.JSX.Element {
+ const t = useTranslate()
+ const intlLocale = useIntlLocale()
return (
- {translate('auto.components.JiraIssueWorkspace.444865b4a8', 'Title')}
+ {t('auto.components.JiraIssueWorkspace.444865b4a8', 'Title')}
- {translate('auto.components.JiraIssueWorkspace.aee97b6913', 'Labels')}
+ {t('auto.components.JiraIssueWorkspace.aee97b6913', 'Labels')}
setLabelsDraft(event.target.value)}
- placeholder={translate(
- 'auto.components.JiraIssueWorkspace.0f3c07a901',
- 'backend, bug'
- )}
+ placeholder={t('auto.components.JiraIssueWorkspace.0f3c07a901', 'backend, bug')}
className="h-8 text-xs"
/>
{displayed.project.key} ·{' '}
{displayed.assignee?.displayName ??
- translate('auto.components.JiraIssueWorkspace.0b6b5646ed', 'Unassigned')}
+ t('auto.components.JiraIssueWorkspace.0b6b5646ed', 'Unassigned')}
{displayed.description?.trim() ? (
@@ -129,10 +128,7 @@ export function JiraIssueWorkspaceContent({
/>
) : (
- {translate(
- 'auto.components.JiraIssueWorkspace.c4889a47e4',
- 'No description provided.'
- )}
+ {t('auto.components.JiraIssueWorkspace.c4889a47e4', 'No description provided.')}
)}
@@ -141,7 +137,7 @@ export function JiraIssueWorkspaceContent({
- {translate('auto.components.JiraIssueWorkspace.9a980b06b9', 'Comments')}
+ {t('auto.components.JiraIssueWorkspace.9a980b06b9', 'Comments')}
{comments.length > 0 ? (
{comments.length}
@@ -160,7 +156,7 @@ export function JiraIssueWorkspaceContent({
) : (
)}
- {translate('auto.components.JiraIssueWorkspace.5cd09beaf9', 'Retry')}
+ {t('auto.components.JiraIssueWorkspace.5cd09beaf9', 'Retry')}
) : null}
@@ -174,7 +170,7 @@ export function JiraIssueWorkspaceContent({
) : comments.length === 0 ? (
- {translate('auto.components.JiraIssueWorkspace.9178090e26', 'No comments yet.')}
+ {t('auto.components.JiraIssueWorkspace.9178090e26', 'No comments yet.')}
) : (
@@ -190,10 +186,10 @@ export function JiraIssueWorkspaceContent({
) : null}
{comment.user?.displayName ??
- translate('auto.components.JiraIssueWorkspace.666cfdd835', 'Unknown')}
+ t('auto.components.JiraIssueWorkspace.666cfdd835', 'Unknown')}
- {formatUiRelativeTimeFromDate(comment.createdAt)}
+ {formatUiRelativeTimeFromDate(comment.createdAt, undefined, intlLocale)}
@@ -216,7 +212,7 @@ export function JiraIssueWorkspaceContent({
onClick={() => onUse(displayed)}
className="mb-3 w-full justify-center gap-2 sm:hidden"
>
- {translate('auto.components.JiraIssueWorkspace.2441be6f9f', 'Start workspace')}
+ {t('auto.components.JiraIssueWorkspace.2441be6f9f', 'Start workspace')}
@@ -259,16 +255,14 @@ export function JiraIssueCommentComposer({
canSubmitComment: boolean
handleSubmitComment: () => void
}): React.JSX.Element {
+ const t = useTranslate()
return (
diff --git a/src/renderer/src/components/jira-list-columns-menu.tsx b/src/renderer/src/components/jira-list-columns-menu.tsx
index 83c54480e40..9b66504eeea 100644
--- a/src/renderer/src/components/jira-list-columns-menu.tsx
+++ b/src/renderer/src/components/jira-list-columns-menu.tsx
@@ -8,7 +8,7 @@ import {
DropdownMenuTrigger
} from '@/components/ui/dropdown-menu'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import {
JIRA_LIST_COLUMNS,
getJiraListColumnLabel,
@@ -22,7 +22,8 @@ export function JiraListColumnsMenu({
ids: ReadonlySet
onToggle: (column: JiraListColumnId) => void
}): React.JSX.Element {
- const label = translate('auto.components.TaskPage.jiraColumnsPicker', 'Columns')
+ const t = useTranslate()
+ const label = t('auto.components.TaskPage.jiraColumnsPicker', 'Columns')
return (
@@ -44,7 +45,7 @@ export function JiraListColumnsMenu({
onSelect={(event) => event.preventDefault()}
onCheckedChange={() => onToggle(column.id)}
>
- {getJiraListColumnLabel(column.id)}
+ {getJiraListColumnLabel(column.id, t)}
))}
diff --git a/src/renderer/src/components/jira-project-picker.tsx b/src/renderer/src/components/jira-project-picker.tsx
index 765858b5850..71bfb62850c 100644
--- a/src/renderer/src/components/jira-project-picker.tsx
+++ b/src/renderer/src/components/jira-project-picker.tsx
@@ -4,7 +4,7 @@ import {
type JiraProjectReference
} from '../../../shared/jira/jira-project-reference'
import { getJiraProjectSelectionKey } from './task-page/jira/task-page-jira-project-selection'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { WorkItemScopePicker, type WorkItemScopeOption } from './work-item-scope-picker'
export function JiraProjectPicker({
@@ -22,6 +22,7 @@ export function JiraProjectPicker({
emptyLabel: string
disabled?: boolean
}): React.JSX.Element {
+ const t = useTranslate()
const options: WorkItemScopeOption[] = projects.flatMap((project) => {
const reference = normalizeJiraProjectReference(project)
return reference
@@ -44,8 +45,8 @@ export function JiraProjectPicker({
onChange={onChange}
label={label}
allLabel={emptyLabel}
- searchPlaceholder={translate('components.jiraProjectPicker.search', 'Search Jira projects')}
- emptyLabel={translate('components.jiraProjectPicker.empty', 'No projects found.')}
+ searchPlaceholder={t('components.jiraProjectPicker.search', 'Search Jira projects')}
+ emptyLabel={t('components.jiraProjectPicker.empty', 'No projects found.')}
disabled={disabled}
/>
)
diff --git a/src/renderer/src/components/jira-prompt-templates.ts b/src/renderer/src/components/jira-prompt-templates.ts
index fcda30d6dd4..ed3fa3dbe82 100644
--- a/src/renderer/src/components/jira-prompt-templates.ts
+++ b/src/renderer/src/components/jira-prompt-templates.ts
@@ -1,30 +1,31 @@
import type { JiraIssue } from '../../../shared/jira/jira-types'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
export function buildJiraIssuePrompt(issue: JiraIssue): string {
return `Complete Jira issue ${issue.key}: ${issue.title}\n\n${issue.url}${issue.description?.trim() ? `\n\n${issue.description.trim()}` : ''}`
}
-export function getJiraPromptTemplates() {
+export function getJiraPromptTemplates(t: Translate = translate) {
return [
{
id: 'implementation',
- label: translate('jira.prompt.implementation', 'Start implementation'),
+ label: t('jira.prompt.implementation', 'Start implementation'),
text: 'Implement the following Jira issue. Inspect the existing code, make the changes, and verify them.\n\n$jira-issue\n\n$other-prompt'
},
{
id: 'bug',
- label: translate('jira.prompt.bug', 'Investigate bug'),
+ label: t('jira.prompt.bug', 'Investigate bug'),
text: 'Investigate this Jira issue. Reproduce the problem, explain the cause, and propose a fix supported by evidence.\n\n$jira-issue\n\n$other-prompt'
},
{
id: 'test-plan',
- label: translate('jira.prompt.testPlan', 'Write test plan'),
+ label: t('jira.prompt.testPlan', 'Write test plan'),
text: 'Write a test plan for this Jira issue, covering normal behavior, edge cases, and regressions.\n\n$jira-issue\n\n$other-prompt'
},
{
id: 'pr-summary',
- label: translate('jira.prompt.prSummary', 'Draft PR summary'),
+ label: t('jira.prompt.prSummary', 'Draft PR summary'),
text: 'Draft a pull request summary for this Jira issue. Describe the problem, changes, validation, and remaining risks. Do not claim unverified work is complete.\n\n$jira-issue\n\n$other-prompt'
}
]
diff --git a/src/renderer/src/components/jira-transition-fields-form.tsx b/src/renderer/src/components/jira-transition-fields-form.tsx
index 522c61232fc..1cbef07b564 100644
--- a/src/renderer/src/components/jira-transition-fields-form.tsx
+++ b/src/renderer/src/components/jira-transition-fields-form.tsx
@@ -9,7 +9,7 @@ import {
SelectValue
} from '@/components/ui/select'
import { Textarea } from '@/components/ui/textarea'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { getCommentBodySubmitState } from '@/lib/comment-body-submit-state'
import {
buildResolutionFieldValue,
@@ -32,6 +32,7 @@ export function JiraTransitionFieldsForm({
onBack,
onSubmit
}: Props): React.JSX.Element | null {
+ const t = useTranslate()
const [resolution, setResolution] = useState('')
const [comment, setComment] = useState('')
const requirement = classifyTransitionRequirements(transition)
@@ -70,7 +71,7 @@ export function JiraTransitionFieldsForm({
@@ -91,7 +92,7 @@ export function JiraTransitionFieldsForm({
{requirement.commentRequired ? (
- {translate('jira.transitions.comment', 'Comment')}
+ {t('jira.transitions.comment', 'Comment')}
diff --git a/src/renderer/src/components/jira-user-picker.tsx b/src/renderer/src/components/jira-user-picker.tsx
index 7dcc0b711da..995a640598e 100644
--- a/src/renderer/src/components/jira-user-picker.tsx
+++ b/src/renderer/src/components/jira-user-picker.tsx
@@ -5,7 +5,7 @@ import { Input } from '@/components/ui/input'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { jiraSearchUsers } from '@/runtime/jira/runtime-jira-user-fields-client'
import type { RowLessSource as RuntimeJiraSettings } from '@/lib/default-creation-host'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision'
import type { JiraUser } from '../../../shared/jira/jira-types'
@@ -69,6 +69,7 @@ export function JiraUserPicker({
searchUsers?: (query: string) => Promise
allowKnownUserId?: boolean
}): React.JSX.Element {
+ const t = useTranslate()
const languageRevision = useUiLanguageRevision()
const [open, setOpen] = useState(false)
const [query, setQuery] = useState('')
@@ -112,12 +113,12 @@ export function JiraUserPicker({
}
return (
value ||
- translate('components.jiraUserPicker.select', 'Select {{value0}}', {
+ t('components.jiraUserPicker.select', 'Select {{value0}}', {
value0: label
})
)
// oxlint-disable-next-line react-hooks/exhaustive-deps -- translate() reads the UI language implicitly.
- }, [label, selectedUser, value, languageRevision])
+ }, [label, selectedUser, value, languageRevision, t])
return (
@@ -138,7 +139,7 @@ export function JiraUserPicker({
setQuery(event.target.value)}
- placeholder={translate('components.jiraUserPicker.search', 'Search users')}
+ placeholder={t('components.jiraUserPicker.search', 'Search users')}
className="mb-1 h-7 text-[12px]"
autoFocus
/>
@@ -157,7 +158,7 @@ export function JiraUserPicker({
))}
{users.length === 0 && !loading ? (
- {translate('components.jiraUserPicker.empty', 'No users found')}
+ {t('components.jiraUserPicker.empty', 'No users found')}
) : (
- {translate('components.jiraUserPicker.useKnownId', 'Use known user ID "{{value0}}"', {
+ {t('components.jiraUserPicker.useKnownId', 'Use known user ID "{{value0}}"', {
value0: knownUserId
})}
diff --git a/src/renderer/src/components/landing-preflight-issues.ts b/src/renderer/src/components/landing-preflight-issues.ts
index 9a7ba5fd7af..a0b09a4b8b7 100644
--- a/src/renderer/src/components/landing-preflight-issues.ts
+++ b/src/renderer/src/components/landing-preflight-issues.ts
@@ -1,4 +1,5 @@
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import { projectHostSetupProjectionFromRepos } from '../../../shared/project-host-setup-projection'
import type { Repo } from '../../../shared/repo-types'
@@ -28,19 +29,20 @@ export function hasGitHubBackedProject(repos: readonly Repo[]): boolean {
export function getLandingPreflightIssues(
status: LandingPreflightStatus,
- options: LandingPreflightIssueOptions
+ options: LandingPreflightIssueOptions,
+ t: Translate = translate
): PreflightIssue[] {
const issues: PreflightIssue[] = []
if (!status.git.installed) {
issues.push({
id: 'git',
- title: translate('auto.components.Landing.e5b7296d9d', 'Git is not installed'),
- description: translate(
+ title: t('auto.components.Landing.e5b7296d9d', 'Git is not installed'),
+ description: t(
'auto.components.Landing.b673e7cf1b',
'Git is required for Git projects, source control, and workspace management.'
),
- fixLabel: translate('auto.components.Landing.installGit', 'Install Git'),
+ fixLabel: t('auto.components.Landing.installGit', 'Install Git'),
fixUrl: 'https://git-scm.com/downloads'
})
}
@@ -53,24 +55,24 @@ export function getLandingPreflightIssues(
if (!status.gh.installed) {
issues.push({
id: 'gh',
- title: translate('auto.components.Landing.5beaef5f9e', 'GitHub CLI is not installed'),
- description: translate(
+ title: t('auto.components.Landing.5beaef5f9e', 'GitHub CLI is not installed'),
+ description: t(
'auto.components.Landing.73e1ad4282',
'Orca uses the GitHub CLI (gh) to show pull requests, issues, and checks.'
),
- fixLabel: translate('auto.components.Landing.installGitHubCli', 'Install GitHub CLI'),
+ fixLabel: t('auto.components.Landing.installGitHubCli', 'Install GitHub CLI'),
fixUrl: 'https://cli.github.com',
dismissible: true
})
} else if (!status.gh.authenticated) {
issues.push({
id: 'gh-auth',
- title: translate('auto.components.Landing.9f96d018b7', 'GitHub CLI is not authenticated'),
- description: translate(
+ title: t('auto.components.Landing.9f96d018b7', 'GitHub CLI is not authenticated'),
+ description: t(
'auto.components.Landing.00cee697c1',
'Run "gh auth login" in a terminal to connect your GitHub account.'
),
- fixLabel: translate('auto.components.Landing.learnMore', 'Learn more'),
+ fixLabel: t('auto.components.Landing.learnMore', 'Learn more'),
fixUrl: 'https://cli.github.com/manual/gh_auth_login',
dismissible: true
})
diff --git a/src/renderer/src/components/linear-api-key-dialog.tsx b/src/renderer/src/components/linear-api-key-dialog.tsx
index b25b2d9f34e..6e00a7947bc 100644
--- a/src/renderer/src/components/linear-api-key-dialog.tsx
+++ b/src/renderer/src/components/linear-api-key-dialog.tsx
@@ -26,7 +26,7 @@ import {
createLinearApiKeyDialogState,
resolveLinearApiKeyDialogState
} from './linear-api-key-dialog-state'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
type LinearApiKeyDialogProps = {
open: boolean
@@ -51,6 +51,7 @@ export function LinearApiKeyDialog({
overlayClassName,
contentClassName
}: LinearApiKeyDialogProps): React.JSX.Element {
+ const t = useTranslate()
const settings = useAppStore((s) => s.settings)
const connectLinear = useAppStore((s) => s.connectLinear)
const mountedRef = useMountedRef()
@@ -65,8 +66,8 @@ export function LinearApiKeyDialog({
const submitLabel =
connectLabel ??
(workspace
- ? translate('taskProviders.linear.updateAccess', 'Update access')
- : translate('taskProviders.linear.connect', 'Connect'))
+ ? t('taskProviders.linear.updateAccess', 'Update access')
+ : t('taskProviders.linear.connect', 'Connect'))
const resolvedDialogState = resolveLinearApiKeyDialogState(dialogState, open)
if (resolvedDialogState !== dialogState) {
// Reset hidden drafts/errors before paint because parent closure can race a connect request.
@@ -114,7 +115,7 @@ export function LinearApiKeyDialog({
connectError:
error instanceof Error
? taskProviderErrorText(error.message)
- : translate('taskProviders.linear.connectionFailed', 'Connection failed')
+ : t('taskProviders.linear.connectionFailed', 'Connection failed')
}))
}
}
@@ -123,31 +124,29 @@ export function LinearApiKeyDialog({
const resolvedTitle =
title ??
(workspace
- ? translate(
- 'taskProviders.linear.updateWorkspaceAccess',
- 'Update Linear access for {{workspace}}',
- { workspace: workspace.organizationName }
- )
- : translate('taskProviders.linear.addAccess', 'Add Linear access'))
+ ? t('taskProviders.linear.updateWorkspaceAccess', 'Update Linear access for {{workspace}}', {
+ workspace: workspace.organizationName
+ })
+ : t('taskProviders.linear.addAccess', 'Add Linear access'))
const resolvedDescription =
description ??
(workspace
- ? translate(
+ ? t(
'taskProviders.linear.workspaceApiKeyHint',
'Paste a Personal API key for {{workspace}}. If this workspace is already connected, Orca replaces its stored key.',
{ workspace: workspace.organizationName }
)
- : translate(
+ : t(
'taskProviders.linear.apiKeyHint',
'Paste a Personal API key for the Linear workspace you want Orca to use. If that workspace is already connected, Orca replaces its stored key.'
))
const storageCopy =
runtimeTarget.kind === 'environment'
- ? translate(
+ ? t(
'taskProviders.linear.remoteKeyStorage',
'This key is stored by the active remote runtime.'
)
- : translate(
+ : t(
'taskProviders.linear.localKeyStorage',
'Local runtime keys are stored on this device using Electron encrypted storage when available.'
)
@@ -173,16 +172,13 @@ export function LinearApiKeyDialog({
- {translate('auto.components.linear.api.key.dialog.7d498f653c', 'Personal API key')}
+ {t('auto.components.linear.api.key.dialog.7d498f653c', 'Personal API key')}
{
const nextDraft = event.target.value
@@ -204,25 +200,25 @@ export function LinearApiKeyDialog({
) : null}
- {translate(
+ {t(
'auto.components.linear.api.key.dialog.af52a6227f',
'Create a Personal API key from Account > Security & Access.'
)}{' '}
{!workspace
- ? translate(
+ ? t(
'auto.components.linear.api.key.dialog.c9889a09f8',
'Use Linear to choose the intended workspace before creating the key.'
)
: null}
- {translate(
+ {t(
'auto.components.linear.api.key.dialog.d56d3629f4',
'Prefer full access when Orca should show every team the account can access in that workspace. Restricted keys only expose permitted teams, and private teams require the key owner to have access.'
)}
- {translate(
+ {t(
'auto.components.linear.api.key.dialog.e3100b36b9',
'If member API keys are blocked, ask a workspace admin to allow them from workspace API settings.'
)}
@@ -234,7 +230,7 @@ export function LinearApiKeyDialog({
onClick={() => window.api.shell.openUrl(personalKeyUrl)}
>
- {translate('auto.components.linear.api.key.dialog.dc7ccb0f7c', 'Personal API keys')}
+ {t('auto.components.linear.api.key.dialog.dc7ccb0f7c', 'Personal API keys')}
|
window.api.shell.openUrl(workspaceApiUrl)}
>
- {translate(
- 'auto.components.linear.api.key.dialog.e603ee9156',
- 'Workspace API settings'
- )}
+ {t('auto.components.linear.api.key.dialog.e603ee9156', 'Workspace API settings')}
@@ -261,7 +254,7 @@ export function LinearApiKeyDialog({
onClick={() => onOpenChange(false)}
disabled={connectState === 'connecting'}
>
- {translate('auto.components.linear.api.key.dialog.f8f704a019', 'Cancel')}
+ {t('auto.components.linear.api.key.dialog.f8f704a019', 'Cancel')}
void handleConnect()}
@@ -270,7 +263,7 @@ export function LinearApiKeyDialog({
{connectState === 'connecting' ? (
<>
- {translate('auto.components.linear.api.key.dialog.834a52c084', 'Verifying...')}
+ {t('auto.components.linear.api.key.dialog.834a52c084', 'Verifying...')}
>
) : (
submitLabel
diff --git a/src/renderer/src/components/linear-custom-view-table-content.tsx b/src/renderer/src/components/linear-custom-view-table-content.tsx
index 7c91d5077d6..c4fe02f7935 100644
--- a/src/renderer/src/components/linear-custom-view-table-content.tsx
+++ b/src/renderer/src/components/linear-custom-view-table-content.tsx
@@ -4,7 +4,7 @@ import { ExternalLink, Layers3 } from 'lucide-react'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
-import { translate } from '@/i18n/i18n'
+import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
import { cn } from '@/lib/utils'
import type { LinearCustomViewSummary } from '../../../shared/linear/project-types'
import {
@@ -44,23 +44,21 @@ function LinearCustomViewTableSkeleton(): React.JSX.Element {
}
function LinearCustomViewTableEmpty({ hasError }: { hasError?: boolean }): React.JSX.Element {
+ const t = useTranslate()
return (
{hasError
- ? translate(
- 'auto.components.linear.project.view.surfaces.c0a50f96a4',
- 'Unable to load views'
- )
- : translate('auto.components.linear.project.view.surfaces.ef90b21366', 'No views found')}
+ ? t('auto.components.linear.project.view.surfaces.c0a50f96a4', 'Unable to load views')
+ : t('auto.components.linear.project.view.surfaces.ef90b21366', 'No views found')}
{hasError
- ? translate(
+ ? t(
'auto.components.linear.project.view.surfaces.f4c79cff5f',
'Review the workspace error below, then refresh.'
)
- : translate(
+ : t(
'auto.components.linear.project.view.surfaces.9f0f51fd9e',
'Create or save views in Linear, then refresh.'
)}
@@ -78,6 +76,8 @@ export function LinearCustomViewTableContent({
onSelectView,
onOpenView
}: LinearCustomViewTableContentProps): React.JSX.Element {
+ const t = useTranslate()
+ const intlLocale = useIntlLocale()
if (loading && views.length === 0) {
return
}
@@ -131,17 +131,17 @@ export function LinearCustomViewTableContent({
{view.shared
- ? translate('auto.components.linear.project.view.surfaces.27d91cb1a6', 'Shared')
- : translate('auto.components.linear.project.view.surfaces.f059181bd9', 'Private')}
+ ? t('auto.components.linear.project.view.surfaces.27d91cb1a6', 'Shared')
+ : t('auto.components.linear.project.view.surfaces.f059181bd9', 'Private')}
{linearProjectUnknownText(view.owner ?? view.creator) ??
- translate('auto.components.linear.project.view.surfaces.20b9d09b7d', 'Unknown')}
+ t('auto.components.linear.project.view.surfaces.20b9d09b7d', 'Unknown')}
{view.updatedAt
- ? linearProjectDateLabel(view.updatedAt)
- : translate('auto.components.linear.project.view.surfaces.20b9d09b7d', 'Unknown')}
+ ? linearProjectDateLabel(view.updatedAt, t, intlLocale)
+ : t('auto.components.linear.project.view.surfaces.20b9d09b7d', 'Unknown')}
@@ -153,7 +153,7 @@ export function LinearCustomViewTableContent({
event.stopPropagation()
onOpenView(view)
}}
- aria-label={translate(
+ aria-label={t(
'auto.components.linear.project.view.surfaces.openInLinear',
'Open {{value0}} in Linear',
{ value0: view.name }
@@ -163,10 +163,7 @@ export function LinearCustomViewTableContent({
- {translate(
- 'auto.components.linear.project.view.surfaces.aac9a4afc6',
- 'Open in Linear'
- )}
+ {t('auto.components.linear.project.view.surfaces.aac9a4afc6', 'Open in Linear')}
diff --git a/src/renderer/src/components/linear-issue-activity.tsx b/src/renderer/src/components/linear-issue-activity.tsx
index f088634fbfb..7c047eab193 100644
--- a/src/renderer/src/components/linear-issue-activity.tsx
+++ b/src/renderer/src/components/linear-issue-activity.tsx
@@ -4,7 +4,7 @@ import { LoaderCircle, RefreshCw } from 'lucide-react'
import { LinearIssueCommentFooter, type LinearLocalComment } from '@/components/LinearItemDrawer'
import CommentMarkdown from '@/components/sidebar/CommentMarkdown'
import { Button } from '@/components/ui/button'
-import { translate } from '@/i18n/i18n'
+import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
import { formatLinearIssueRelativeTime } from '@/components/linear-issue-workspace-text'
import type { LinearComment, LinearIssue } from '../../../shared/linear/issue-types'
import type { TaskSourceContext } from '../../../shared/task-source-context'
@@ -49,11 +49,13 @@ export function LinearIssueActivity({
onCommentAdded: (comment: LinearLocalComment) => void
sourceContext?: TaskSourceContext | null
}): React.JSX.Element {
+ const t = useTranslate()
+ const intlLocale = useIntlLocale()
return (
- {translate('auto.components.LinearIssueWorkspace.543970c87a', 'Activity')}
+ {t('auto.components.LinearIssueWorkspace.543970c87a', 'Activity')}
{issue.assignee?.displayName
- ? translate(
+ ? t(
'auto.components.LinearIssueWorkspace.namedUserUpdatedIssue',
'{{name}} updated the issue · {{time}}',
{
name: issue.assignee.displayName,
- time: formatLinearIssueRelativeTime(issue.updatedAt)
+ time: formatLinearIssueRelativeTime(issue.updatedAt, intlLocale)
}
)
- : translate(
+ : t(
'auto.components.LinearIssueWorkspace.someoneUpdatedIssue',
'Someone updated the issue · {{time}}',
- { time: formatLinearIssueRelativeTime(issue.updatedAt) }
+ { time: formatLinearIssueRelativeTime(issue.updatedAt, intlLocale) }
)}
@@ -103,7 +105,7 @@ export function LinearIssueActivity({
) : (
)}
- {translate('auto.components.LinearIssueWorkspace.b0eac92d85', 'Retry')}
+ {t('auto.components.LinearIssueWorkspace.b0eac92d85', 'Retry')}
) : null}
@@ -125,10 +127,10 @@ export function LinearIssueActivity({
{comment.user?.displayName ??
- translate('auto.components.LinearIssueWorkspace.ca8778c124', 'Unknown')}
+ t('auto.components.LinearIssueWorkspace.ca8778c124', 'Unknown')}
- {formatLinearIssueRelativeTime(comment.createdAt)}
+ {formatLinearIssueRelativeTime(comment.createdAt, intlLocale)}
diff --git a/src/renderer/src/components/linear-issue-attribute-filter-coverage-notice.tsx b/src/renderer/src/components/linear-issue-attribute-filter-coverage-notice.tsx
index 808b2fc9301..723b2f2e285 100644
--- a/src/renderer/src/components/linear-issue-attribute-filter-coverage-notice.tsx
+++ b/src/renderer/src/components/linear-issue-attribute-filter-coverage-notice.tsx
@@ -1,19 +1,25 @@
// A capped row remains checked when any id survives; report the actual per-team coverage.
import React from 'react'
import { translate } from '@/i18n/i18n'
+import { useTranslate, type Translate } from '@/i18n/use-translate'
import { linearMetadataGroupCoverage } from './linear-issue-attribute-filter-team-ids'
type LinearCoverageFacet = 'status' | 'labels'
-function shortfallMessage(facet: LinearCoverageFacet, applied: number, intended: number): string {
+function shortfallMessage(
+ facet: LinearCoverageFacet,
+ applied: number,
+ intended: number,
+ t: Translate = translate
+): string {
const counts = { value0: applied, value1: intended }
return facet === 'status'
- ? translate(
+ ? t(
'auto.components.linear-issue-attribute-filter-coverage-notice.statusPartialTeamCoverage',
'Filtering {{value0}} of {{value1}} team statuses — issues from the remaining teams are not included.',
counts
)
- : translate(
+ : t(
'auto.components.linear-issue-attribute-filter-coverage-notice.labelsPartialTeamCoverage',
'Filtering {{value0}} of {{value1}} team labels — issues from the remaining teams are not included.',
counts
@@ -21,14 +27,14 @@ function shortfallMessage(facet: LinearCoverageFacet, applied: number, intended:
}
/** Why: a row the cap could not fit leaves no trace, so the spent budget is what we can state. */
-function idLimitMessage(facet: LinearCoverageFacet, max: number): string {
+function idLimitMessage(facet: LinearCoverageFacet, max: number, t: Translate = translate): string {
return facet === 'status'
- ? translate(
+ ? t(
'auto.components.linear-issue-attribute-filter-coverage-notice.statusAtIdLimit',
'Filtering the most this can carry: {{value0}} team statuses. Rows picked past that are left out.',
{ value0: max }
)
- : translate(
+ : t(
'auto.components.linear-issue-attribute-filter-coverage-notice.labelsAtIdLimit',
'Filtering the most this can carry: {{value0}} team labels. Rows picked past that are left out.',
{ value0: max }
@@ -49,13 +55,16 @@ export function LinearFacetCoverageNotice({
/** Recorded where the cap ran, not inferred from the ids it left behind (STA-5996). */
truncated: boolean
}): React.JSX.Element | null {
+ const t = useTranslate()
const { applied, intended } = linearMetadataGroupCoverage(options, selectedIds)
if (intended <= applied && !truncated) {
return null
}
return (
- {intended > applied ? shortfallMessage(facet, applied, intended) : idLimitMessage(facet, max)}
+ {intended > applied
+ ? shortfallMessage(facet, applied, intended, t)
+ : idLimitMessage(facet, max, t)}
)
}
diff --git a/src/renderer/src/components/linear-issue-attribute-filter-dropdowns.tsx b/src/renderer/src/components/linear-issue-attribute-filter-dropdowns.tsx
index 5b59b992b39..78d7c09ffbd 100644
--- a/src/renderer/src/components/linear-issue-attribute-filter-dropdowns.tsx
+++ b/src/renderer/src/components/linear-issue-attribute-filter-dropdowns.tsx
@@ -5,7 +5,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { useTeamsLabels, useTeamsMembers, useTeamsStates } from '@/hooks/useIssueMetadata'
import type { RowLessSource as RuntimeLinearSettings } from '@/lib/default-creation-host'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import {
LINEAR_ISSUE_ATTRIBUTE_FILTER_MAX_LABEL_IDS,
LINEAR_ISSUE_ATTRIBUTE_FILTER_MAX_STATE_IDS,
@@ -59,6 +59,7 @@ function ActivePill({
partial: boolean
onClear: () => void
}): React.JSX.Element {
+ const t = useTranslate()
return (
{label}:
@@ -71,14 +72,14 @@ function ActivePill({
type="button"
className="rounded-sm text-muted-foreground underline decoration-dotted underline-offset-2 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
>
- {translate(
+ {t(
'auto.components.linear-issue-attribute-filter-dropdowns.partialCoverage',
'partial'
)}
- {translate(
+ {t(
'auto.components.linear-issue-attribute-filter-dropdowns.partialCoverageTitle',
'Some teams may be left out of this filter. Open Filters for details.'
)}
@@ -87,7 +88,7 @@ function ActivePill({
) : null}
(null)
// Tie truncation records to the surviving ids so pruning, clearing or workspace changes retire stale warnings.
@@ -244,16 +246,19 @@ export default function LinearIssueAttributeFilterDropdowns({
[members.data]
)
- const pills = linearIssueAttributeFilterPillLabels({
- value,
- stateNamesById,
- memberNamesById,
- labelNamesById,
- statusOptions,
- labelOptions,
- statusTruncated,
- labelsTruncated
- })
+ const pills = linearIssueAttributeFilterPillLabels(
+ {
+ value,
+ stateNamesById,
+ memberNamesById,
+ labelNamesById,
+ statusOptions,
+ labelOptions,
+ statusTruncated,
+ labelsTruncated
+ },
+ t
+ )
// Cap expanded ids before IPC rejects them; spread slots across rows so lexical order cannot erase a picked row.
const applyPickedFilter = (next: LinearIssueAttributeFilter): void => {
@@ -287,7 +292,7 @@ export default function LinearIssueAttributeFilterDropdowns({
}
const teamRequiredMessage = !primaryTeam
- ? translate(
+ ? t(
'auto.components.linear-issue-attribute-filter-dropdowns.teamRequired',
'Select a team to load status, assignees, and labels for this workspace.'
)
@@ -310,16 +315,13 @@ export default function LinearIssueAttributeFilterDropdowns({
variant="outline"
size="sm"
className="h-7 gap-1.5 px-2 text-xs"
- aria-label={translate(
+ aria-label={t(
'auto.components.linear-issue-attribute-filter-dropdowns.filters',
'Filters'
)}
>
- {translate(
- 'auto.components.linear-issue-attribute-filter-dropdowns.filters',
- 'Filters'
- )}
+ {t('auto.components.linear-issue-attribute-filter-dropdowns.filters', 'Filters')}
{activeCount > 0 ? (
{activeCount}
@@ -331,13 +333,13 @@ export default function LinearIssueAttributeFilterDropdowns({
{!scopedWorkspaceId ? (
- {translate(
+ {t(
'auto.components.linear-issue-attribute-filter-dropdowns.allWorkspacesTitle',
'Select one workspace'
)}
- {translate(
+ {t(
'auto.components.linear-issue-attribute-filter-dropdowns.allWorkspacesBody',
'Status, assignee, and label filters use ids from a single Linear workspace. Choose one workspace to filter by those attributes.'
)}
@@ -381,7 +383,7 @@ export default function LinearIssueAttributeFilterDropdowns({
className="w-full rounded-md px-2 py-1.5 text-left text-xs text-muted-foreground transition hover:bg-muted/50 hover:text-foreground"
onClick={() => onChange(emptyLinearIssueAttributeFilter())}
>
- {translate(
+ {t(
'auto.components.linear-issue-attribute-filter-dropdowns.clearAll',
'Clear all filters'
)}
diff --git a/src/renderer/src/components/linear-issue-attribute-filter-pills.ts b/src/renderer/src/components/linear-issue-attribute-filter-pills.ts
index 55fbfb5b6c5..e490da23981 100644
--- a/src/renderer/src/components/linear-issue-attribute-filter-pills.ts
+++ b/src/renderer/src/components/linear-issue-attribute-filter-pills.ts
@@ -1,5 +1,6 @@
// Keep coverage visible on pills after the picker’s detailed notice closes.
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import {
canonicalizeLinearIssueAttributeFilter,
type LinearIssueAttributeFilter
@@ -50,23 +51,26 @@ export type LinearIssueFilterPill = {
partial: boolean
}
-export function linearIssueAttributeFilterPillLabels(options: {
- value: LinearIssueAttributeFilter
- stateNamesById: Map
- memberNamesById: Map
- labelNamesById: Map
- statusOptions: readonly LinearIssueFilterGroupedOption[]
- labelOptions: readonly LinearIssueFilterGroupedOption[]
- /** Recorded where the cap ran, not inferred from the ids it left behind (STA-5996). */
- statusTruncated: boolean
- labelsTruncated: boolean
-}): LinearIssueFilterPill[] {
+export function linearIssueAttributeFilterPillLabels(
+ options: {
+ value: LinearIssueAttributeFilter
+ stateNamesById: Map
+ memberNamesById: Map
+ labelNamesById: Map
+ statusOptions: readonly LinearIssueFilterGroupedOption[]
+ labelOptions: readonly LinearIssueFilterGroupedOption[]
+ /** Recorded where the cap ran, not inferred from the ids it left behind (STA-5996). */
+ statusTruncated: boolean
+ labelsTruncated: boolean
+ },
+ t: Translate = translate
+): LinearIssueFilterPill[] {
const canonical = canonicalizeLinearIssueAttributeFilter(options.value)
const pills: LinearIssueFilterPill[] = []
if (canonical.stateIds.length > 0) {
pills.push({
key: 'status',
- label: translate('auto.components.linear-issue-attribute-filter-sections.status', 'Status'),
+ label: t('auto.components.linear-issue-attribute-filter-sections.status', 'Status'),
value: distinctFacetNames(canonical.stateIds, options.stateNamesById).join(', '),
partial: isLinearMetadataGroupSelectionPartial(
options.statusOptions,
@@ -78,10 +82,7 @@ export function linearIssueAttributeFilterPillLabels(options: {
if (canonical.priorities.length > 0) {
pills.push({
key: 'priority',
- label: translate(
- 'auto.components.linear-issue-attribute-filter-sections.priority',
- 'Priority'
- ),
+ label: t('auto.components.linear-issue-attribute-filter-sections.priority', 'Priority'),
value: canonical.priorities.map((p) => getLinearPriorityLabel(p)).join(', '),
partial: false
})
@@ -89,23 +90,14 @@ export function linearIssueAttributeFilterPillLabels(options: {
if (canonical.assignee?.kind === 'unassigned') {
pills.push({
key: 'assignee',
- label: translate(
- 'auto.components.linear-issue-attribute-filter-sections.assignee',
- 'Assignee'
- ),
- value: translate(
- 'auto.components.linear-issue-attribute-filter-sections.unassigned',
- 'Unassigned'
- ),
+ label: t('auto.components.linear-issue-attribute-filter-sections.assignee', 'Assignee'),
+ value: t('auto.components.linear-issue-attribute-filter-sections.unassigned', 'Unassigned'),
partial: false
})
} else if (canonical.assignee?.kind === 'user') {
pills.push({
key: 'assignee',
- label: translate(
- 'auto.components.linear-issue-attribute-filter-sections.assignee',
- 'Assignee'
- ),
+ label: t('auto.components.linear-issue-attribute-filter-sections.assignee', 'Assignee'),
value: options.memberNamesById.get(canonical.assignee.id) ?? canonical.assignee.id,
partial: false
})
@@ -113,7 +105,7 @@ export function linearIssueAttributeFilterPillLabels(options: {
if (canonical.labelIds.length > 0) {
pills.push({
key: 'labels',
- label: translate('auto.components.linear-issue-attribute-filter-sections.labels', 'Labels'),
+ label: t('auto.components.linear-issue-attribute-filter-sections.labels', 'Labels'),
value: distinctFacetNames(canonical.labelIds, options.labelNamesById).join(', '),
partial: isLinearMetadataGroupSelectionPartial(
options.labelOptions,
diff --git a/src/renderer/src/components/linear-issue-attribute-filter-sections.tsx b/src/renderer/src/components/linear-issue-attribute-filter-sections.tsx
index 3d2268be777..bf20c022391 100644
--- a/src/renderer/src/components/linear-issue-attribute-filter-sections.tsx
+++ b/src/renderer/src/components/linear-issue-attribute-filter-sections.tsx
@@ -7,6 +7,7 @@ import {
} from '@/components/github/PRFilterPickers'
import { cn } from '@/lib/utils'
import { translate } from '@/i18n/i18n'
+import { useTranslate, type Translate } from '@/i18n/use-translate'
import {
LINEAR_ISSUE_ATTRIBUTE_FILTER_MAX_LABEL_IDS,
LINEAR_ISSUE_ATTRIBUTE_FILTER_MAX_STATE_IDS,
@@ -38,14 +39,15 @@ type LinearIssueFilterSectionSummary = { text: string; partial: boolean }
function facetSummary(
options: readonly LinearIssueFilterGroupedOption[],
selectedIds: readonly string[],
- truncated: boolean
+ truncated: boolean,
+ t: Translate = translate
): LinearIssueFilterSectionSummary {
const count = selectedLinearMetadataGroupKeys(options, selectedIds).length
if (count === 0) {
return { text: '', partial: false }
}
return {
- text: translate(
+ text: t(
'auto.components.linear-issue-attribute-filter-sections.countSelected',
'{{count}} selected',
{ count }
@@ -73,6 +75,7 @@ export function LinearIssueFilterSectionMenu({
labelsTruncated: boolean
onOpenSection: (section: LinearIssueFilterSectionKey) => void
}): React.JSX.Element {
+ const t = useTranslate()
const sections: {
key: LinearIssueFilterSectionKey
label: string
@@ -80,18 +83,15 @@ export function LinearIssueFilterSectionMenu({
}[] = [
{
key: 'status',
- label: translate('auto.components.linear-issue-attribute-filter-sections.status', 'Status'),
- summary: facetSummary(statusOptions, value.stateIds, statusTruncated)
+ label: t('auto.components.linear-issue-attribute-filter-sections.status', 'Status'),
+ summary: facetSummary(statusOptions, value.stateIds, statusTruncated, t)
},
{
key: 'priority',
- label: translate(
- 'auto.components.linear-issue-attribute-filter-sections.priority',
- 'Priority'
- ),
+ label: t('auto.components.linear-issue-attribute-filter-sections.priority', 'Priority'),
summary: plainSummary(
value.priorities.length > 0
- ? translate(
+ ? t(
'auto.components.linear-issue-attribute-filter-sections.countSelected',
'{{count}} selected',
{ count: value.priorities.length }
@@ -101,28 +101,19 @@ export function LinearIssueFilterSectionMenu({
},
{
key: 'assignee',
- label: translate(
- 'auto.components.linear-issue-attribute-filter-sections.assignee',
- 'Assignee'
- ),
+ label: t('auto.components.linear-issue-attribute-filter-sections.assignee', 'Assignee'),
summary: plainSummary(
value.assignee
? value.assignee.kind === 'unassigned'
- ? translate(
- 'auto.components.linear-issue-attribute-filter-sections.unassigned',
- 'Unassigned'
- )
- : translate(
- 'auto.components.linear-issue-attribute-filter-sections.selected',
- 'selected'
- )
+ ? t('auto.components.linear-issue-attribute-filter-sections.unassigned', 'Unassigned')
+ : t('auto.components.linear-issue-attribute-filter-sections.selected', 'selected')
: ''
)
},
{
key: 'labels',
- label: translate('auto.components.linear-issue-attribute-filter-sections.labels', 'Labels'),
- summary: facetSummary(labelOptions, value.labelIds, labelsTruncated)
+ label: t('auto.components.linear-issue-attribute-filter-sections.labels', 'Labels'),
+ summary: facetSummary(labelOptions, value.labelIds, labelsTruncated, t)
}
]
@@ -143,7 +134,7 @@ export function LinearIssueFilterSectionMenu({
{/* Why: the marker sits outside the truncating span so a long count never clips it. */}
{section.summary.partial ? (
- {translate(
+ {t(
'auto.components.linear-issue-attribute-filter-sections.partialCoverageMarker',
'· partial'
)}
@@ -192,6 +183,7 @@ export function LinearIssueFilterSectionDetail({
teamRequiredMessage: string | null
onBack: () => void
}): React.JSX.Element {
+ const t = useTranslate()
if (section === 'priority') {
return (
@@ -201,7 +193,7 @@ export function LinearIssueFilterSectionDetail({
selected={value.priorities.map(String)}
loading={false}
error={null}
- searchPlaceholder={translate(
+ searchPlaceholder={t(
'auto.components.linear-issue-attribute-filter-sections.searchPriority',
'Filter priority…'
)}
@@ -240,10 +232,7 @@ export function LinearIssueFilterSectionDetail({
})
}
>
- {translate(
- 'auto.components.linear-issue-attribute-filter-sections.unassigned',
- 'Unassigned'
- )}
+ {t('auto.components.linear-issue-attribute-filter-sections.unassigned', 'Unassigned')}
) : null}
@@ -266,11 +255,11 @@ export function LinearIssueFilterSectionDetail({
error={isStatus ? statusError : labelError}
searchPlaceholder={
isStatus
- ? translate(
+ ? t(
'auto.components.linear-issue-attribute-filter-sections.searchStatus',
'Filter status…'
)
- : translate(
+ : t(
'auto.components.linear-issue-attribute-filter-sections.searchLabels',
'Filter labels…'
)
@@ -309,7 +298,7 @@ export function LinearIssueFilterSectionDetail({
options={[
{
key: '__unassigned__',
- primary: translate(
+ primary: t(
'auto.components.linear-issue-attribute-filter-sections.unassigned',
'Unassigned'
)
@@ -319,7 +308,7 @@ export function LinearIssueFilterSectionDetail({
activeValue={activeAssignee}
loading={assigneeLoading}
error={assigneeError}
- searchPlaceholder={translate(
+ searchPlaceholder={t(
'auto.components.linear-issue-attribute-filter-sections.searchAssignee',
'Filter assignee…'
)}
@@ -340,13 +329,14 @@ export function LinearIssueFilterSectionDetail({
}
function SectionBack({ onBack }: { onBack: () => void }): React.JSX.Element {
+ const t = useTranslate()
return (
- {translate('auto.components.linear-issue-attribute-filter-sections.back', 'Back')}
+ {t('auto.components.linear-issue-attribute-filter-sections.back', 'Back')}
)
}
diff --git a/src/renderer/src/components/linear-issue-project-selector.tsx b/src/renderer/src/components/linear-issue-project-selector.tsx
index cd02d04175b..ac0e77b7dea 100644
--- a/src/renderer/src/components/linear-issue-project-selector.tsx
+++ b/src/renderer/src/components/linear-issue-project-selector.tsx
@@ -8,6 +8,7 @@ import { toast } from 'sonner'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { useMountedRef } from '@/hooks/useMountedRef'
import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { getLinearProjectSearchRequestQuery } from '@/components/linear-project-search-query'
import { linearUpdateIssue } from '@/runtime/linear/runtime-linear-issue-client'
import { linearListProjects } from '@/runtime/linear/runtime-linear-project-client'
@@ -24,6 +25,7 @@ export function LinearIssueProjectSelector({
issue: LinearIssue
sourceContext?: TaskSourceContext | null
}): React.JSX.Element {
+ const t = useTranslate()
const settings = useAppStore((state) => state.settings)
const providerSettings = sourceContext ?? defaultScopeSource(settings)
const patchLinearIssue = useAppStore((state) => state.patchLinearIssue)
@@ -121,7 +123,7 @@ export function LinearIssueProjectSelector({
return (
- {translate('auto.components.LinearIssueWorkspace.b51276c8d6', 'Project')}
+ {t('auto.components.LinearIssueWorkspace.b51276c8d6', 'Project')}
@@ -133,7 +135,7 @@ export function LinearIssueProjectSelector({
{issue.project?.name ??
- translate('auto.components.LinearIssueWorkspace.519c3587f3', 'Add to project')}
+ t('auto.components.LinearIssueWorkspace.519c3587f3', 'Add to project')}
@@ -143,17 +145,14 @@ export function LinearIssueProjectSelector({
setQuery(event.target.value)}
- placeholder={translate(
- 'auto.components.LinearIssueWorkspace.db3f269d98',
- 'Search projects'
- )}
+ placeholder={t('auto.components.LinearIssueWorkspace.db3f269d98', 'Search projects')}
className="h-8 w-full rounded-md border border-input bg-background px-2 text-sm outline-none focus-visible:ring-1 focus-visible:ring-ring"
/>
{displayedLoading ? (
- {translate('auto.components.LinearIssueWorkspace.937ba6ad9a', 'Loading projects')}
+ {t('auto.components.LinearIssueWorkspace.937ba6ad9a', 'Loading projects')}
) : displayedProjects.length > 0 ? (
displayedProjects.map((project) => (
@@ -179,11 +178,8 @@ export function LinearIssueProjectSelector({
) : (
{query.trim()
- ? translate(
- 'auto.components.LinearIssueWorkspace.c11b4e3cc2',
- 'No projects found.'
- )
- : translate(
+ ? t('auto.components.LinearIssueWorkspace.c11b4e3cc2', 'No projects found.')
+ : t(
'auto.components.LinearIssueWorkspace.76ffd3c937',
'Search for a project to add.'
)}
diff --git a/src/renderer/src/components/linear-issue-sub-issues.tsx b/src/renderer/src/components/linear-issue-sub-issues.tsx
index 3ad367e7b48..1881dcdfb7e 100644
--- a/src/renderer/src/components/linear-issue-sub-issues.tsx
+++ b/src/renderer/src/components/linear-issue-sub-issues.tsx
@@ -9,6 +9,7 @@ import { Button } from '@/components/ui/button'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { useMountedRef } from '@/hooks/useMountedRef'
import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { linearCreateSubIssue } from '@/runtime/linear/runtime-linear-issue-client'
import { useAppStore } from '@/store'
import type { LinearIssue, LinearIssueChildSummary } from '../../../shared/linear/issue-types'
@@ -36,6 +37,7 @@ export function LinearIssueSubIssues({
onOpenIssue: (issue: LinearIssue) => void
sourceContext?: TaskSourceContext | null
}): React.JSX.Element {
+ const t = useTranslate()
const settings = useAppStore((state) => state.settings)
const providerSettings = sourceContext ?? defaultScopeSource(settings)
const fetchLinearIssue = useAppStore((state) => state.fetchLinearIssue)
@@ -204,9 +206,7 @@ export function LinearIssueSubIssues({
className="flex h-9 items-center gap-2 rounded-md px-1 text-sm font-medium text-muted-foreground transition hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
>
-
- {translate('auto.components.LinearIssueWorkspace.8c55d6696a', 'Add sub-issues')}
-
+
{t('auto.components.LinearIssueWorkspace.8c55d6696a', 'Add sub-issues')}
@@ -220,10 +220,7 @@ export function LinearIssueSubIssues({
void handleCreate()
}
}}
- placeholder={translate(
- 'auto.components.LinearIssueWorkspace.c182e02de5',
- 'Sub-issue title'
- )}
+ placeholder={t('auto.components.LinearIssueWorkspace.c182e02de5', 'Sub-issue title')}
className="h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-1 focus-visible:ring-ring"
/>
@@ -233,7 +230,7 @@ export function LinearIssueSubIssues({
disabled={!title.trim() || submitting}
>
{submitting ? : null}
- {translate('auto.components.LinearIssueWorkspace.42589845bc', 'Create')}
+ {t('auto.components.LinearIssueWorkspace.42589845bc', 'Create')}
diff --git a/src/renderer/src/components/linear-issue-workspace-header.tsx b/src/renderer/src/components/linear-issue-workspace-header.tsx
index 798ea734681..f712d27f9be 100644
--- a/src/renderer/src/components/linear-issue-workspace-header.tsx
+++ b/src/renderer/src/components/linear-issue-workspace-header.tsx
@@ -22,7 +22,7 @@ import {
DropdownMenuTrigger
} from '@/components/ui/dropdown-menu'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import type { LinearIssue } from '../../../shared/linear/issue-types'
import { copyLinearIssueText } from './linear-issue-clipboard'
import { openAppHttpLink } from '@/lib/browser/navigation/app-http-link-open'
@@ -46,6 +46,7 @@ export function LinearIssueWorkspaceHeader({
onOpenOrUseIssue: () => void
onUseIssue: () => void
}): React.JSX.Element {
+ const t = useTranslate()
return (
@@ -64,12 +65,11 @@ export function LinearIssueWorkspaceHeader({
) : null}
- {issue.workspaceName ??
- translate('auto.components.LinearIssueWorkspace.65239a714b', 'Linear')}
+ {issue.workspaceName ?? t('auto.components.LinearIssueWorkspace.65239a714b', 'Linear')}
- {translate('auto.components.LinearIssueWorkspace.f63ef94ea8', 'Issues')}
+ {t('auto.components.LinearIssueWorkspace.f63ef94ea8', 'Issues')}
{issue.identifier}
@@ -85,16 +85,13 @@ export function LinearIssueWorkspaceHeader({
variant="ghost"
size="icon-sm"
onClick={() => void copyLinearIssueText(issue.url, 'url')}
- aria-label={translate(
- 'auto.components.LinearIssueWorkspace.97c19a84f1',
- 'Copy Linear URL'
- )}
+ aria-label={t('auto.components.LinearIssueWorkspace.97c19a84f1', 'Copy Linear URL')}
>
- {translate('auto.components.LinearIssueWorkspace.9a9a884236', 'Copy URL')}
+ {t('auto.components.LinearIssueWorkspace.9a9a884236', 'Copy URL')}
@@ -104,16 +101,13 @@ export function LinearIssueWorkspaceHeader({
variant="ghost"
size="icon-sm"
onClick={(event) => openAppHttpLink(issue.url, { event })}
- aria-label={translate(
- 'auto.components.LinearIssueWorkspace.openOnLinear',
- 'Open on Linear'
- )}
+ aria-label={t('auto.components.LinearIssueWorkspace.openOnLinear', 'Open on Linear')}
>
- {translate('auto.components.LinearIssueWorkspace.openOnLinear', 'Open on Linear')}
+ {t('auto.components.LinearIssueWorkspace.openOnLinear', 'Open on Linear')}
{attachedWorkspace ? (
@@ -124,19 +118,19 @@ export function LinearIssueWorkspaceHeader({
size="sm"
onClick={onOpenOrUseIssue}
className="gap-1.5 whitespace-nowrap"
- aria-label={translate(
+ aria-label={t(
'auto.components.LinearIssueWorkspace.openAttachedWorkspace',
'Open workspace attached to issue'
)}
>
- {translate('auto.components.LinearIssueWorkspace.openWorkspace', 'Open workspace')}
+ {t('auto.components.LinearIssueWorkspace.openWorkspace', 'Open workspace')}
- {translate(
- 'auto.components.LinearIssueWorkspace.startNewWorkspace',
- 'Start new workspace'
- )}
+ {t('auto.components.LinearIssueWorkspace.startNewWorkspace', 'Start new workspace')}
@@ -161,12 +152,12 @@ export function LinearIssueWorkspaceHeader({
size="sm"
onClick={onOpenOrUseIssue}
className="gap-1.5 whitespace-nowrap"
- aria-label={translate(
+ aria-label={t(
'auto.components.LinearIssueWorkspace.30a7f56c0a',
'Start workspace from issue'
)}
>
- {translate('auto.components.LinearIssueWorkspace.e1e0a9bca9', 'Start workspace')}
+ {t('auto.components.LinearIssueWorkspace.e1e0a9bca9', 'Start workspace')}
)}
@@ -177,7 +168,7 @@ export function LinearIssueWorkspaceHeader({
variant="ghost"
size="icon-sm"
onClick={onClose}
- aria-label={translate(
+ aria-label={t(
'auto.components.LinearIssueWorkspace.7a4997d8bb',
'Close Linear issue preview'
)}
@@ -186,7 +177,7 @@ export function LinearIssueWorkspaceHeader({
- {translate('auto.components.LinearIssueWorkspace.df4c86ed12', 'Close')}
+ {t('auto.components.LinearIssueWorkspace.df4c86ed12', 'Close')}
) : null}
diff --git a/src/renderer/src/components/linear-issue-workspace-sidebar.tsx b/src/renderer/src/components/linear-issue-workspace-sidebar.tsx
index 5d848942853..50695873c19 100644
--- a/src/renderer/src/components/linear-issue-workspace-sidebar.tsx
+++ b/src/renderer/src/components/linear-issue-workspace-sidebar.tsx
@@ -5,7 +5,7 @@ import { LinearIssueEditSection, type LinearEditState } from '@/components/Linea
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { buildLinearIssueContextSnapshot } from '@/lib/work-items/linear/linear-issue-context-snapshot'
import { buildContainedLinkedContextBlock } from '@/lib/linked-work-item-context'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { buildLinearIssueBranchName } from '@/components/linear-issue-workspace-text'
import type { LinearComment, LinearIssue } from '../../../shared/linear/issue-types'
import type { TaskSourceContext } from '../../../shared/task-source-context'
@@ -19,19 +19,18 @@ function LinearIssueWorkspaceAttachmentCard({
label: string | null
onOpen: () => void
}): React.JSX.Element {
+ const t = useTranslate()
return (
-
- {translate('auto.components.LinearIssueWorkspace.workspaceSection', 'Workspace')}
-
+ {t('auto.components.LinearIssueWorkspace.workspaceSection', 'Workspace')}
{label ? (
) : (
- {translate('auto.components.LinearIssueWorkspace.noWorkspaceYet', 'None yet')}
+ {t('auto.components.LinearIssueWorkspace.noWorkspaceYet', 'None yet')}
)}
@@ -57,27 +56,25 @@ function LinearIssueActionsCard({
issue: LinearIssue
comments: LinearComment[]
}): React.JSX.Element {
+ const t = useTranslate()
const actionItems = [
{
- label: translate('auto.components.LinearIssueWorkspace.9a9a884236', 'Copy URL'),
+ label: t('auto.components.LinearIssueWorkspace.9a9a884236', 'Copy URL'),
icon: Clipboard,
action: () => void copyLinearIssueText(issue.url, 'url')
},
{
- label: translate('auto.components.LinearIssueWorkspace.30c1242f3a', 'Copy identifier'),
+ label: t('auto.components.LinearIssueWorkspace.30c1242f3a', 'Copy identifier'),
icon: Clipboard,
action: () => void copyLinearIssueText(issue.identifier, 'identifier')
},
{
- label: translate(
- 'auto.components.LinearIssueWorkspace.5d670ec8dc',
- 'Copy suggested branch name'
- ),
+ label: t('auto.components.LinearIssueWorkspace.5d670ec8dc', 'Copy suggested branch name'),
icon: GitBranch,
action: () => void copyLinearIssueText(buildLinearIssueBranchName(issue), 'branchName')
},
{
- label: translate('auto.components.LinearIssueWorkspace.f6c6381593', 'Copy prompt'),
+ label: t('auto.components.LinearIssueWorkspace.f6c6381593', 'Copy prompt'),
icon: Clipboard,
action: () => {
const renderedText = buildLinearIssueContextSnapshot(issue, comments)
@@ -94,7 +91,7 @@ function LinearIssueActionsCard({
return (
- {translate('auto.components.LinearIssueWorkspace.c23e79e5c0', 'Actions')}
+ {t('auto.components.LinearIssueWorkspace.c23e79e5c0', 'Actions')}
diff --git a/src/renderer/src/components/linear-issue-workspace-text.ts b/src/renderer/src/components/linear-issue-workspace-text.ts
index 57f7aae1945..62db4e901cf 100644
--- a/src/renderer/src/components/linear-issue-workspace-text.ts
+++ b/src/renderer/src/components/linear-issue-workspace-text.ts
@@ -3,8 +3,8 @@ import type { LinearIssue } from '../../../shared/linear/issue-types'
import { getUsableLinearBranchName } from '../../../shared/new-workspace/workspace-source'
import { formatUiRelativeTimeFromDate } from '@/i18n/relative-time-format'
-export function formatLinearIssueRelativeTime(input: string): string {
- return formatUiRelativeTimeFromDate(input)
+export function formatLinearIssueRelativeTime(input: string, intlLocale?: string): string {
+ return formatUiRelativeTimeFromDate(input, undefined, intlLocale)
}
export function buildLinearIssueBranchName(issue: LinearIssue): string {
diff --git a/src/renderer/src/components/linear-item-drawer-comment-footer.tsx b/src/renderer/src/components/linear-item-drawer-comment-footer.tsx
index 34b4397982c..546889dc4a8 100644
--- a/src/renderer/src/components/linear-item-drawer-comment-footer.tsx
+++ b/src/renderer/src/components/linear-item-drawer-comment-footer.tsx
@@ -14,6 +14,7 @@ import { createNonSecureContextUuid as createBrowserUuid } from '../../../shared
import { useAppStore } from '@/store'
import { linearAddIssueComment } from '@/runtime/linear/runtime-linear-issue-client'
import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import type { TaskSourceContext } from '../../../shared/task-source-context'
import type { LinearLocalComment } from '@/components/linear-item-drawer-types'
import { defaultScopeSource } from '@/lib/default-creation-host'
@@ -31,6 +32,7 @@ export function LinearIssueCommentFooter({
variant?: 'compact' | 'linear-page'
sourceContext?: TaskSourceContext | null
}): React.JSX.Element {
+ const t = useTranslate()
const settings = useAppStore((s) => s.settings)
const providerSettings = sourceContext ?? defaultScopeSource(settings)
const submitShortcutLabel = getScreenSubmitShortcutLabel()
@@ -133,17 +135,14 @@ export function LinearIssueCommentFooter({
autoGrow()
}}
onKeyDown={handleKeyDown}
- placeholder={translate(
- 'auto.components.LinearItemDrawer.2820f0f0f0',
- 'Leave a comment...'
- )}
+ placeholder={t('auto.components.LinearItemDrawer.2820f0f0f0', 'Leave a comment...')}
rows={3}
className="scrollbar-sleek min-h-24 max-h-40 w-full resize-none overflow-y-auto rounded-t-xl bg-transparent px-5 py-4 text-sm placeholder:text-muted-foreground focus-visible:outline-none"
/>
{submitShortcutLabel !== 'Unassigned'
- ? translate('auto.components.LinearItemDrawer.fda549766e', '{{value0}} to comment', {
+ ? t('auto.components.LinearItemDrawer.fda549766e', '{{value0}} to comment', {
value0: submitShortcutLabel
})
: ''}
@@ -152,7 +151,7 @@ export function LinearIssueCommentFooter({
size="icon-sm"
onClick={handleSubmit}
disabled={!canSubmitComment || submitting}
- aria-label={translate('auto.components.LinearItemDrawer.d369841269', 'Send comment')}
+ aria-label={t('auto.components.LinearItemDrawer.d369841269', 'Send comment')}
>
{submitting ? (
@@ -178,7 +177,7 @@ export function LinearIssueCommentFooter({
autoGrow()
}}
onKeyDown={handleKeyDown}
- placeholder={translate('auto.components.LinearItemDrawer.2fcff829a8', 'Add a comment…')}
+ placeholder={t('auto.components.LinearItemDrawer.2fcff829a8', 'Add a comment…')}
rows={1}
className="scrollbar-sleek min-h-[32px] max-h-[96px] flex-1 resize-none overflow-y-auto rounded-md border border-input bg-transparent px-3 py-2 text-[13px] placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
/>
@@ -187,7 +186,7 @@ export function LinearIssueCommentFooter({
onClick={handleSubmit}
disabled={!canSubmitComment || submitting}
className="size-8 shrink-0"
- aria-label={translate('auto.components.LinearItemDrawer.d369841269', 'Send comment')}
+ aria-label={t('auto.components.LinearItemDrawer.d369841269', 'Send comment')}
>
{submitting ? (
diff --git a/src/renderer/src/components/linear-item-drawer-edit-chips-layout.tsx b/src/renderer/src/components/linear-item-drawer-edit-chips-layout.tsx
index a328c5f137e..ead2c9e4076 100644
--- a/src/renderer/src/components/linear-item-drawer-edit-chips-layout.tsx
+++ b/src/renderer/src/components/linear-item-drawer-edit-chips-layout.tsx
@@ -12,6 +12,7 @@ import {
import { LinearPriorityIcon } from '@/components/linear-priority-icon'
import { getLinearPriorityLabel } from '@/components/task-page/task-page-localized-options'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import {
LINEAR_EDIT_CHIP_CLASS,
LINEAR_EDIT_MENU_ITEM_CLASS,
@@ -23,7 +24,8 @@ import {
import type { LinearIssueEditController } from '@/components/linear-item-drawer-edit-controller'
export function renderLinearIssueChipsLayout(
- controller: LinearIssueEditController
+ controller: LinearIssueEditController,
+ t: Translate = translate
): React.JSX.Element {
const {
statePending,
@@ -82,7 +84,7 @@ export function renderLinearIssueChipsLayout(
) : states.loading ? (
- {translate('auto.components.LinearItemDrawer.59b6cd3706', 'Loading states')}
+ {t('auto.components.LinearItemDrawer.59b6cd3706', 'Loading states')}
) : states.data.length > 0 ? (
@@ -106,7 +108,7 @@ export function renderLinearIssueChipsLayout(
) : (
- {translate('auto.components.LinearItemDrawer.780ea6ed89', 'No states found')}
+ {t('auto.components.LinearItemDrawer.780ea6ed89', 'No states found')}
)}
@@ -151,7 +153,7 @@ export function renderLinearIssueChipsLayout(
className={LINEAR_EDIT_CHIP_CLASS}
aria-busy={estimatePending}
>
- {formatLinearEstimateLabel(localEstimate)}
+ {formatLinearEstimateLabel(localEstimate, t)}
@@ -182,10 +184,7 @@ export function renderLinearIssueChipsLayout(
}
}}
inputMode="numeric"
- placeholder={translate(
- 'auto.components.LinearItemDrawer.fbb90300e2',
- 'Custom estimate'
- )}
+ placeholder={t('auto.components.LinearItemDrawer.fbb90300e2', 'Custom estimate')}
className="h-8 text-sm"
/>
@@ -195,7 +194,7 @@ export function renderLinearIssueChipsLayout(
size="sm"
onClick={() => handleEstimateChange(null)}
>
- {translate('auto.components.LinearItemDrawer.ceeb8c6153', 'Clear')}
+ {t('auto.components.LinearItemDrawer.ceeb8c6153', 'Clear')}
{estimatePending ? : null}
- {translate('auto.components.LinearItemDrawer.b5675b0694', 'Save')}
+ {t('auto.components.LinearItemDrawer.b5675b0694', 'Save')}
@@ -222,7 +221,7 @@ export function renderLinearIssueChipsLayout(
{localAssignee
? localAssignee.displayName
- : translate('auto.components.LinearItemDrawer.d71cd3003e', '+ Assignee')}
+ : t('auto.components.LinearItemDrawer.d71cd3003e', '+ Assignee')}
@@ -234,7 +233,7 @@ export function renderLinearIssueChipsLayout(
onClick={() => handleAssigneeChange('__unassign__')}
className={cn(LINEAR_EDIT_MENU_ITEM_CLASS, !localAssignee && 'bg-accent/50')}
>
- {translate('auto.components.LinearItemDrawer.866316f22c', 'Unassigned')}
+ {t('auto.components.LinearItemDrawer.866316f22c', 'Unassigned')}
{members.error ? (
@@ -243,7 +242,7 @@ export function renderLinearIssueChipsLayout(
) : members.loading ? (
- {translate('auto.components.LinearItemDrawer.b2376d0179', 'Loading members')}
+ {t('auto.components.LinearItemDrawer.b2376d0179', 'Loading members')}
) : (
members.data.map((m) => (
@@ -272,10 +271,10 @@ export function renderLinearIssueChipsLayout(
className={LINEAR_EDIT_CHIP_CLASS}
aria-label={
localLabels.length
- ? translate('auto.components.LinearItemDrawer.7f7b89b631', 'Labels: {{value0}}', {
+ ? t('auto.components.LinearItemDrawer.7f7b89b631', 'Labels: {{value0}}', {
value0: localLabels.join(', ')
})
- : translate('auto.components.LinearItemDrawer.23886c7eec', 'Add label')
+ : t('auto.components.LinearItemDrawer.23886c7eec', 'Add label')
}
aria-busy={labelsPending || labels.loading}
>
@@ -289,7 +288,7 @@ export function renderLinearIssueChipsLayout(
) : labels.loading ? (
- {translate('auto.components.LinearItemDrawer.cddd9b04a7', 'Loading labels')}
+ {t('auto.components.LinearItemDrawer.cddd9b04a7', 'Loading labels')}
) : labels.data.length > 0 ? (
@@ -320,7 +319,7 @@ export function renderLinearIssueChipsLayout(
) : (
- {translate('auto.components.LinearItemDrawer.367f828482', 'No labels found')}
+ {t('auto.components.LinearItemDrawer.367f828482', 'No labels found')}
)}
diff --git a/src/renderer/src/components/linear-item-drawer-edit-controls.tsx b/src/renderer/src/components/linear-item-drawer-edit-controls.tsx
index 8f5bfba3193..1f362d86b1c 100644
--- a/src/renderer/src/components/linear-item-drawer-edit-controls.tsx
+++ b/src/renderer/src/components/linear-item-drawer-edit-controls.tsx
@@ -1,6 +1,7 @@
import React from 'react'
import { ChevronDown, LoaderCircle } from 'lucide-react'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
export const LINEAR_EDIT_CHIP_CLASS =
'inline-flex h-6 min-w-0 max-w-[14rem] cursor-pointer items-center gap-1.5 rounded-full border border-border/70 bg-background/70 px-2.5 text-[11px] font-medium leading-none text-muted-foreground shadow-xs transition-[background-color,border-color,color,box-shadow] hover:border-border hover:bg-accent hover:text-accent-foreground hover:[--linear-state-pill-current-background:var(--linear-state-pill-hover-background)] hover:[--linear-state-pill-current-border:var(--linear-state-pill-hover-border)] hover:[--linear-state-pill-current-foreground:var(--linear-state-pill-hover-foreground)] focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-80'
@@ -13,10 +14,13 @@ export const LINEAR_EDIT_MENU_ITEM_WITH_ICON_CLASS =
export const LINEAR_ESTIMATE_PRESETS = [1, 2, 3, 5, 8] as const
-export function formatLinearEstimateLabel(estimate: number | null | undefined): string {
+export function formatLinearEstimateLabel(
+ estimate: number | null | undefined,
+ t: Translate = translate
+): string {
return estimate === null || estimate === undefined
- ? translate('auto.components.LinearItemDrawer.setEstimate', 'Set estimate')
- : translate('auto.components.LinearItemDrawer.estimateValue', 'Estimate {{estimate}}', {
+ ? t('auto.components.LinearItemDrawer.setEstimate', 'Set estimate')
+ : t('auto.components.LinearItemDrawer.estimateValue', 'Estimate {{estimate}}', {
estimate
})
}
diff --git a/src/renderer/src/components/linear-item-drawer-edit-properties-layout.tsx b/src/renderer/src/components/linear-item-drawer-edit-properties-layout.tsx
index 6ab74823926..e9528e7a163 100644
--- a/src/renderer/src/components/linear-item-drawer-edit-properties-layout.tsx
+++ b/src/renderer/src/components/linear-item-drawer-edit-properties-layout.tsx
@@ -9,6 +9,7 @@ import { getLinearStateMarkerStyle } from '@/components/linear-state-pill-style'
import { LinearPriorityIcon } from '@/components/linear-priority-icon'
import { getLinearPriorityLabel } from '@/components/task-page/task-page-localized-options'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import {
LINEAR_EDIT_MENU_ITEM_CLASS,
LINEAR_EDIT_MENU_ITEM_WITH_ICON_CLASS,
@@ -19,7 +20,8 @@ import {
import type { LinearIssueEditController } from '@/components/linear-item-drawer-edit-controller'
export function renderLinearIssuePropertiesLayout(
- controller: LinearIssueEditController
+ controller: LinearIssueEditController,
+ t: Translate = translate
): React.JSX.Element {
const {
statePending,
@@ -61,7 +63,7 @@ export function renderLinearIssuePropertiesLayout(
- {translate('auto.components.LinearItemDrawer.dd304de85a', 'Properties')}
+ {t('auto.components.LinearItemDrawer.dd304de85a', 'Properties')}
@@ -92,7 +94,7 @@ export function renderLinearIssuePropertiesLayout(
) : states.loading ? (
- {translate('auto.components.LinearItemDrawer.59b6cd3706', 'Loading states')}
+ {t('auto.components.LinearItemDrawer.59b6cd3706', 'Loading states')}
) : states.data.length > 0 ? (
@@ -116,7 +118,7 @@ export function renderLinearIssuePropertiesLayout(
) : (
- {translate('auto.components.LinearItemDrawer.780ea6ed89', 'No states found')}
+ {t('auto.components.LinearItemDrawer.780ea6ed89', 'No states found')}
)}
@@ -175,7 +177,7 @@ export function renderLinearIssuePropertiesLayout(
{localAssignee
? localAssignee.displayName
- : translate('auto.components.LinearItemDrawer.866316f22c', 'Unassigned')}
+ : t('auto.components.LinearItemDrawer.866316f22c', 'Unassigned')}
@@ -190,7 +192,7 @@ export function renderLinearIssuePropertiesLayout(
onClick={() => handleAssigneeChange('__unassign__')}
className={cn(LINEAR_EDIT_MENU_ITEM_CLASS, !localAssignee && 'bg-accent/50')}
>
- {translate('auto.components.LinearItemDrawer.866316f22c', 'Unassigned')}
+ {t('auto.components.LinearItemDrawer.866316f22c', 'Unassigned')}
{members.error ? (
@@ -199,7 +201,7 @@ export function renderLinearIssuePropertiesLayout(
) : members.loading ? (
- {translate('auto.components.LinearItemDrawer.b2376d0179', 'Loading members')}
+ {t('auto.components.LinearItemDrawer.b2376d0179', 'Loading members')}
) : (
members.data.map((m) => (
@@ -230,7 +232,7 @@ export function renderLinearIssuePropertiesLayout(
>
- {formatLinearEstimateLabel(localEstimate)}
+ {formatLinearEstimateLabel(localEstimate, t)}
@@ -262,10 +264,7 @@ export function renderLinearIssuePropertiesLayout(
}
}}
inputMode="numeric"
- placeholder={translate(
- 'auto.components.LinearItemDrawer.fbb90300e2',
- 'Custom estimate'
- )}
+ placeholder={t('auto.components.LinearItemDrawer.fbb90300e2', 'Custom estimate')}
className="h-8 text-sm"
/>
@@ -275,7 +274,7 @@ export function renderLinearIssuePropertiesLayout(
size="sm"
onClick={() => handleEstimateChange(null)}
>
- {translate('auto.components.LinearItemDrawer.ceeb8c6153', 'Clear')}
+ {t('auto.components.LinearItemDrawer.ceeb8c6153', 'Clear')}
{estimatePending ? : null}
- {translate('auto.components.LinearItemDrawer.b5675b0694', 'Save')}
+ {t('auto.components.LinearItemDrawer.b5675b0694', 'Save')}
@@ -295,7 +294,7 @@ export function renderLinearIssuePropertiesLayout(
- {translate('auto.components.LinearItemDrawer.64bfffc4dd', 'Labels')}
+ {t('auto.components.LinearItemDrawer.64bfffc4dd', 'Labels')}
@@ -307,12 +306,10 @@ export function renderLinearIssuePropertiesLayout(
className={propertyRowClass}
aria-label={
localLabels.length
- ? translate(
- 'auto.components.LinearItemDrawer.7f7b89b631',
- 'Labels: {{value0}}',
- { value0: localLabels.join(', ') }
- )
- : translate('auto.components.LinearItemDrawer.23886c7eec', 'Add label')
+ ? t('auto.components.LinearItemDrawer.7f7b89b631', 'Labels: {{value0}}', {
+ value0: localLabels.join(', ')
+ })
+ : t('auto.components.LinearItemDrawer.23886c7eec', 'Add label')
}
aria-busy={labelsPending || labels.loading}
>
@@ -320,7 +317,7 @@ export function renderLinearIssuePropertiesLayout(
{localLabels.length
? labelSummary
- : translate('auto.components.LinearItemDrawer.23886c7eec', 'Add label')}
+ : t('auto.components.LinearItemDrawer.23886c7eec', 'Add label')}
@@ -336,7 +333,7 @@ export function renderLinearIssuePropertiesLayout(
) : labels.loading ? (
- {translate('auto.components.LinearItemDrawer.cddd9b04a7', 'Loading labels')}
+ {t('auto.components.LinearItemDrawer.cddd9b04a7', 'Loading labels')}
) : labels.data.length > 0 ? (
@@ -367,7 +364,7 @@ export function renderLinearIssuePropertiesLayout(
) : (
- {translate('auto.components.LinearItemDrawer.367f828482', 'No labels found')}
+ {t('auto.components.LinearItemDrawer.367f828482', 'No labels found')}
)}
diff --git a/src/renderer/src/components/linear-item-drawer-edit-section.tsx b/src/renderer/src/components/linear-item-drawer-edit-section.tsx
index 5591c8e0033..2cbccdaa6f4 100644
--- a/src/renderer/src/components/linear-item-drawer-edit-section.tsx
+++ b/src/renderer/src/components/linear-item-drawer-edit-section.tsx
@@ -4,10 +4,12 @@ import { useLinearIssueEditController } from '@/components/linear-item-drawer-ed
import { renderLinearIssueChipsLayout } from '@/components/linear-item-drawer-edit-chips-layout'
import { renderLinearIssuePropertiesLayout } from '@/components/linear-item-drawer-edit-properties-layout'
import type { LinearIssueEditSectionProps } from '@/components/linear-item-drawer-types'
+import { useTranslate } from '@/i18n/use-translate'
export function LinearIssueEditSection(props: LinearIssueEditSectionProps): React.JSX.Element {
+ const t = useTranslate()
const controller = useLinearIssueEditController(props)
return controller.layout === 'properties'
- ? renderLinearIssuePropertiesLayout(controller)
- : renderLinearIssueChipsLayout(controller)
+ ? renderLinearIssuePropertiesLayout(controller, t)
+ : renderLinearIssueChipsLayout(controller, t)
}
diff --git a/src/renderer/src/components/linear-item-drawer-sheet.tsx b/src/renderer/src/components/linear-item-drawer-sheet.tsx
index 74ca3b1fc5a..6f6b9e19a6a 100644
--- a/src/renderer/src/components/linear-item-drawer-sheet.tsx
+++ b/src/renderer/src/components/linear-item-drawer-sheet.tsx
@@ -25,6 +25,7 @@ import CommentMarkdown from '@/components/sidebar/CommentMarkdown'
import { LinearIssueEditSection } from '@/components/linear-item-drawer-edit-section'
import { LinearIssueCommentFooter } from '@/components/linear-item-drawer-comment-footer'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import { formatUiRelativeTimeFromDate } from '@/i18n/relative-time-format'
import type { LinearComment, LinearIssue } from '../../../shared/linear/issue-types'
import type { TaskSourceContext } from '../../../shared/task-source-context'
@@ -40,8 +41,8 @@ function LinearIcon({ className }: { className?: string }): React.JSX.Element {
)
}
-function formatRelativeTime(input: string): string {
- return formatUiRelativeTimeFromDate(input)
+function formatRelativeTime(input: string, intlLocale?: string): string {
+ return formatUiRelativeTimeFromDate(input, undefined, intlLocale)
}
type LinearItemDrawerSheetProps = {
@@ -59,20 +60,24 @@ type LinearItemDrawerSheetProps = {
onUse: (issue: LinearIssue) => void
}
-export function renderLinearItemDrawerSheet({
- issue,
- onClose,
- displayed,
- sourceContext,
- editState,
- commentsLoading,
- comments,
- handleCommentAdded,
- attachedWorkspaceLabel,
- attachedWorkspace,
- handleOpenOrUseIssue,
- onUse
-}: LinearItemDrawerSheetProps): React.JSX.Element {
+export function renderLinearItemDrawerSheet(
+ {
+ issue,
+ onClose,
+ displayed,
+ sourceContext,
+ editState,
+ commentsLoading,
+ comments,
+ handleCommentAdded,
+ attachedWorkspaceLabel,
+ attachedWorkspace,
+ handleOpenOrUseIssue,
+ onUse
+ }: LinearItemDrawerSheetProps,
+ t: Translate = translate,
+ intlLocale?: string
+): React.JSX.Element {
return (
!open && onClose()}>
- {displayed?.title ??
- translate('auto.components.LinearItemDrawer.39883467f4', 'Linear issue')}
+ {displayed?.title ?? t('auto.components.LinearItemDrawer.39883467f4', 'Linear issue')}
- {translate(
+ {t(
'auto.components.LinearItemDrawer.04a442f796',
'Preview and edit the selected Linear issue.'
)}
@@ -118,7 +122,7 @@ export function renderLinearItemDrawerSheet({
{displayed.workspaceName && {displayed.workspaceName} }
{displayed.team?.name && {displayed.team.name} }
- · {formatRelativeTime(displayed.updatedAt)}
+ · {formatRelativeTime(displayed.updatedAt, intlLocale)}
@@ -129,7 +133,7 @@ export function renderLinearItemDrawerSheet({
size="icon"
className="size-7"
onClick={(event) => openAppHttpLink(displayed.url, { event })}
- aria-label={translate(
+ aria-label={t(
'auto.components.LinearItemDrawer.0190b760c1',
'Open on Linear'
)}
@@ -138,7 +142,7 @@ export function renderLinearItemDrawerSheet({
- {translate('auto.components.LinearItemDrawer.0190b760c1', 'Open on Linear')}
+ {t('auto.components.LinearItemDrawer.0190b760c1', 'Open on Linear')}
@@ -148,7 +152,7 @@ export function renderLinearItemDrawerSheet({
size="icon"
className="size-7"
onClick={onClose}
- aria-label={translate(
+ aria-label={t(
'auto.components.LinearItemDrawer.858d0630da',
'Close preview'
)}
@@ -157,7 +161,7 @@ export function renderLinearItemDrawerSheet({
- {translate('auto.components.LinearItemDrawer.9dc54172db', 'Close · Esc')}
+ {t('auto.components.LinearItemDrawer.9dc54172db', 'Close · Esc')}
@@ -185,7 +189,7 @@ export function renderLinearItemDrawerSheet({
- {translate('auto.components.LinearItemDrawer.fde849b2b6', 'Comments')}
+ {t('auto.components.LinearItemDrawer.fde849b2b6', 'Comments')}
{comments.length > 0 && (
{comments.length}
@@ -197,7 +201,7 @@ export function renderLinearItemDrawerSheet({
) : comments.length === 0 ? (
- {translate('auto.components.LinearItemDrawer.a4fcc57522', 'No comments yet.')}
+ {t('auto.components.LinearItemDrawer.a4fcc57522', 'No comments yet.')}
) : (
@@ -216,10 +220,10 @@ export function renderLinearItemDrawerSheet({
)}
{comment.user?.displayName ??
- translate('auto.components.LinearItemDrawer.48e17e8cbd', 'Unknown')}
+ t('auto.components.LinearItemDrawer.48e17e8cbd', 'Unknown')}
- · {formatRelativeTime(comment.createdAt)}
+ · {formatRelativeTime(comment.createdAt, intlLocale)}
@@ -254,21 +258,18 @@ export function renderLinearItemDrawerSheet({
- {translate(
- 'auto.components.LinearItemDrawer.openWorkspace',
- 'Open workspace'
- )}
+ {t('auto.components.LinearItemDrawer.openWorkspace', 'Open workspace')}
onUse(displayed)}>
- {translate(
+ {t(
'auto.components.LinearItemDrawer.startNewWorkspace',
'Start new workspace'
)}
@@ -291,15 +292,12 @@ export function renderLinearItemDrawerSheet({
- {translate(
- 'auto.components.LinearItemDrawer.04008e6c46',
- 'Start workspace from issue'
- )}
+ {t('auto.components.LinearItemDrawer.04008e6c46', 'Start workspace from issue')}
)}
diff --git a/src/renderer/src/components/linear-priority-icon.tsx b/src/renderer/src/components/linear-priority-icon.tsx
index f38c6181e9e..5642b9570be 100644
--- a/src/renderer/src/components/linear-priority-icon.tsx
+++ b/src/renderer/src/components/linear-priority-icon.tsx
@@ -1,7 +1,7 @@
import React from 'react'
import { cn } from '@/lib/utils'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { getLinearPriorityLabel } from '@/components/task-page/task-page-localized-options'
// Use Linear’s brand priority fills instead of generic Orca state colors.
@@ -34,6 +34,7 @@ export function LinearPriorityIcon({
className?: string
label?: string
}): React.JSX.Element {
+ const t = useTranslate()
if (priority === 1) {
return (
!
- {translate('auto.components.linear.priority.icon.priorityValue', 'Priority: {{label}}', {
+ {t('auto.components.linear.priority.icon.priorityValue', 'Priority: {{label}}', {
label
})}
@@ -65,7 +66,7 @@ export function LinearPriorityIcon({
className="size-3 rounded-full border border-muted-foreground/55"
/>
- {translate('auto.components.linear.priority.icon.priorityValue', 'Priority: {{label}}', {
+ {t('auto.components.linear.priority.icon.priorityValue', 'Priority: {{label}}', {
label
})}
@@ -104,7 +105,7 @@ export function LinearPriorityIcon({
})}
- {translate('auto.components.linear.priority.icon.priorityValue', 'Priority: {{label}}', {
+ {t('auto.components.linear.priority.icon.priorityValue', 'Priority: {{label}}', {
label
})}
diff --git a/src/renderer/src/components/linear-project-overview-content.tsx b/src/renderer/src/components/linear-project-overview-content.tsx
index 0ace318a161..3bd72488cd8 100644
--- a/src/renderer/src/components/linear-project-overview-content.tsx
+++ b/src/renderer/src/components/linear-project-overview-content.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import { CalendarDays, FileText, FolderKanban, RefreshCw, UserRound } from 'lucide-react'
import { Progress } from '@/components/ui/progress'
-import { translate } from '@/i18n/i18n'
+import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
import type {
LinearProjectDetail,
LinearProjectSummary
@@ -34,6 +34,8 @@ export function LinearProjectOverviewContent({
loading,
error
}: LinearProjectOverviewContentProps): React.JSX.Element {
+ const t = useTranslate()
+ const intlLocale = useIntlLocale()
const presentation = project as LinearProjectPresentation | null
const progress = presentation ? linearProjectProgressPercent(presentation) : null
const teams = linearProjectMetadataLabels(presentation?.teams, 4)
@@ -75,7 +77,7 @@ export function LinearProjectOverviewContent({
) : (
- {translate(
+ {t(
'auto.components.linear.project.view.surfaces.bb5664d456',
'No project description.'
)}
@@ -87,17 +89,14 @@ export function LinearProjectOverviewContent({
- {translate(
- 'auto.components.linear.project.view.surfaces.563501f191',
- 'Progress'
- )}
+ {t('auto.components.linear.project.view.surfaces.563501f191', 'Progress')}
{progress}%
{typeof presentation.scope === 'number' ? (
- {translate(
+ {t(
'auto.components.linear.project.view.surfaces.scopedIssueCount',
'{{count}} scoped issues',
{ count: presentation.scope, defaultValue_one: '{{count}} scoped issue' }
@@ -110,12 +109,12 @@ export function LinearProjectOverviewContent({
{milestones.length > 0 || resources.length > 0 || latestUpdate ? (
- {translate('auto.components.linear.project.view.surfaces.5d99315fb8', 'Planning')}
+ {t('auto.components.linear.project.view.surfaces.5d99315fb8', 'Planning')}
}
- label={translate(
+ label={t(
'auto.components.linear.project.view.surfaces.bb1405eff8',
'Milestones'
)}
@@ -123,7 +122,7 @@ export function LinearProjectOverviewContent({
/>
}
- label={translate(
+ label={t(
'auto.components.linear.project.view.surfaces.c8db98b73b',
'Resources'
)}
@@ -131,7 +130,7 @@ export function LinearProjectOverviewContent({
/>
}
- label={translate(
+ label={t(
'auto.components.linear.project.view.surfaces.0a6a5a7dd6',
'Latest update'
)}
@@ -144,55 +143,53 @@ export function LinearProjectOverviewContent({
) : (
- {translate(
+ {t(
'auto.components.linear.project.view.surfaces.e1fa97d21d',
'Select a project to view its overview.'
)}
diff --git a/src/renderer/src/components/linear-project-overview-metadata.tsx b/src/renderer/src/components/linear-project-overview-metadata.tsx
index b2ed38e0ab8..fd26284e0a9 100644
--- a/src/renderer/src/components/linear-project-overview-metadata.tsx
+++ b/src/renderer/src/components/linear-project-overview-metadata.tsx
@@ -1,7 +1,7 @@
import React from 'react'
import { Badge } from '@/components/ui/badge'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
export function LinearProjectPropertyRow({
label,
@@ -32,6 +32,7 @@ export function LinearProjectMetadataList({
label: string
items: string[]
}): React.JSX.Element {
+ const t = useTranslate()
return (
@@ -48,7 +49,7 @@ export function LinearProjectMetadataList({
) : (
- {translate('auto.components.linear.project.view.surfaces.8bbecb2510', 'None')}
+ {t('auto.components.linear.project.view.surfaces.8bbecb2510', 'None')}
)}
diff --git a/src/renderer/src/components/linear-project-presentation.ts b/src/renderer/src/components/linear-project-presentation.ts
index 370d4ad71d0..098dfcfdd74 100644
--- a/src/renderer/src/components/linear-project-presentation.ts
+++ b/src/renderer/src/components/linear-project-presentation.ts
@@ -1,4 +1,5 @@
import { getIntlLocale, translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import type {
LinearProjectDetail,
LinearProjectSummary
@@ -34,31 +35,39 @@ export function linearProjectUnknownText(value: unknown): string | null {
return null
}
-export function linearProjectDateLabel(value: string | null | undefined): string {
+export function linearProjectDateLabel(
+ value: string | null | undefined,
+ t?: Translate,
+ intlLocale: string = getIntlLocale()
+): string {
if (!value) {
- return linearProjectNoneLabel()
+ return linearProjectNoneLabel(t)
}
const date = new Date(value)
- return Number.isNaN(date.getTime()) ? value : date.toLocaleDateString(getIntlLocale())
+ return Number.isNaN(date.getTime()) ? value : date.toLocaleDateString(intlLocale)
}
-export function linearProjectPriorityLabel(priority: unknown, fallback: unknown): string {
+export function linearProjectPriorityLabel(
+ priority: unknown,
+ fallback: unknown,
+ t?: Translate
+): string {
const fromFallback = linearProjectUnknownText(fallback)
if (fromFallback) {
return fromFallback
}
if (typeof priority === 'number') {
- return priority === 0 ? linearProjectNoneLabel() : `P${priority}`
+ return priority === 0 ? linearProjectNoneLabel(t) : `P${priority}`
}
- return linearProjectUnknownText(priority) ?? linearProjectNoneLabel()
+ return linearProjectUnknownText(priority) ?? linearProjectNoneLabel(t)
}
-export function linearProjectNoneLabel(): string {
- return translate('auto.components.linear.project.view.surfaces.8bbecb2510', 'None')
+export function linearProjectNoneLabel(t: Translate = translate): string {
+ return t('auto.components.linear.project.view.surfaces.8bbecb2510', 'None')
}
-export function linearProjectBacklogLabel(): string {
- return translate('auto.components.linear.project.view.surfaces.backlog', 'Backlog')
+export function linearProjectBacklogLabel(t: Translate = translate): string {
+ return t('auto.components.linear.project.view.surfaces.backlog', 'Backlog')
}
export function linearProjectProgressPercent(project: LinearProjectPresentation): number | null {
diff --git a/src/renderer/src/components/linear-project-table-content.tsx b/src/renderer/src/components/linear-project-table-content.tsx
index 426175df89a..f39f8e97db5 100644
--- a/src/renderer/src/components/linear-project-table-content.tsx
+++ b/src/renderer/src/components/linear-project-table-content.tsx
@@ -4,7 +4,7 @@ import { ArrowRight, ExternalLink } from 'lucide-react'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
-import { translate } from '@/i18n/i18n'
+import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
import { cn } from '@/lib/utils'
import type { LinearProjectSummary } from '../../../shared/linear/project-types'
import {
@@ -48,7 +48,8 @@ function LinearProjectStatusBadge({
}: {
project: LinearProjectPresentation
}): React.JSX.Element {
- const label = linearProjectUnknownText(project.status) ?? linearProjectBacklogLabel()
+ const t = useTranslate()
+ const label = linearProjectUnknownText(project.status) ?? linearProjectBacklogLabel(t)
return (
{label}
@@ -79,29 +80,27 @@ function LinearProjectTableSkeleton(): React.JSX.Element {
}
function LinearProjectTableEmpty({ hasError }: { hasError?: boolean }): React.JSX.Element {
+ const t = useTranslate()
return (
{hasError
- ? translate(
+ ? t(
'auto.components.linear.project.view.surfaces.c9b6e9f90d',
'Unable to load Linear projects'
)
- : translate(
+ : t(
'auto.components.linear.project.view.surfaces.a2f31c4cd6',
'No Linear projects found'
)}
{hasError
- ? translate(
+ ? t(
'auto.components.linear.project.view.surfaces.f4c79cff5f',
'Review the workspace error below, then refresh.'
)
- : translate(
- 'auto.components.linear.project.view.surfaces.30402d2c6e',
- 'Try search or refresh.'
- )}
+ : t('auto.components.linear.project.view.surfaces.30402d2c6e', 'Try search or refresh.')}
)
@@ -117,6 +116,8 @@ export function LinearProjectTableContent({
onOpenProject,
onUseProjectIssues
}: LinearProjectTableContentProps): React.JSX.Element {
+ const t = useTranslate()
+ const intlLocale = useIntlLocale()
if (loading && projects.length === 0) {
return
}
@@ -175,17 +176,17 @@ export function LinearProjectTableContent({
{linearProjectUnknownText(presentation.health) ??
- translate('auto.components.linear.project.view.surfaces.8bbecb2510', 'None')}
+ t('auto.components.linear.project.view.surfaces.8bbecb2510', 'None')}
- {linearProjectPriorityLabel(presentation.priority, presentation.priorityLabel)}
+ {linearProjectPriorityLabel(presentation.priority, presentation.priorityLabel, t)}
{linearProjectUnknownText(presentation.lead) ??
- translate('auto.components.linear.project.view.surfaces.df4bd63c1d', 'Unassigned')}
+ t('auto.components.linear.project.view.surfaces.df4bd63c1d', 'Unassigned')}
- {linearProjectDateLabel(project.targetDate)}
+ {linearProjectDateLabel(project.targetDate, t, intlLocale)}
{typeof project.issueCount === 'number'
@@ -207,7 +208,7 @@ export function LinearProjectTableContent({
event.stopPropagation()
onUseProjectIssues(project)
}}
- aria-label={translate(
+ aria-label={t(
'auto.components.linear.project.view.surfaces.7616c986c6',
'Open {{value0}} issues',
{ value0: project.name }
@@ -217,7 +218,7 @@ export function LinearProjectTableContent({
- {translate('auto.components.linear.project.view.surfaces.ee3d2caabd', 'Issues')}
+ {t('auto.components.linear.project.view.surfaces.ee3d2caabd', 'Issues')}
) : null}
@@ -230,7 +231,7 @@ export function LinearProjectTableContent({
event.stopPropagation()
onOpenProject(project)
}}
- aria-label={translate(
+ aria-label={t(
'auto.components.linear.project.view.surfaces.openInLinear',
'Open {{value0}} in Linear',
{ value0: project.name }
@@ -240,10 +241,7 @@ export function LinearProjectTableContent({
- {translate(
- 'auto.components.linear.project.view.surfaces.aac9a4afc6',
- 'Open in Linear'
- )}
+ {t('auto.components.linear.project.view.surfaces.aac9a4afc6', 'Open in Linear')}
diff --git a/src/renderer/src/components/linear-project-view-surfaces.tsx b/src/renderer/src/components/linear-project-view-surfaces.tsx
index 041868984c1..b437e0d8562 100644
--- a/src/renderer/src/components/linear-project-view-surfaces.tsx
+++ b/src/renderer/src/components/linear-project-view-surfaces.tsx
@@ -6,6 +6,7 @@ import { ArrowLeft, ArrowRight, ExternalLink, Layers3, LoaderCircle, RefreshCw }
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { translate } from '@/i18n/i18n'
+import { useTranslate, type Translate } from '@/i18n/use-translate'
import { cn } from '@/lib/utils'
import type {
LinearProjectDetail,
@@ -35,10 +36,14 @@ type LinearProjectOverviewProps = {
type LinearCollectionKind = 'views' | 'projects' | 'projectIssues' | 'viewIssues' | 'issues'
-function linearCollectionTruncatedText(kind: LinearCollectionKind, count: number): string {
+function linearCollectionTruncatedText(
+ kind: LinearCollectionKind,
+ count: number,
+ t: Translate = translate
+): string {
switch (kind) {
case 'views':
- return translate(
+ return t(
'taskProviders.linear.truncated.views',
'Showing the first {{count}} views. Search or open Linear for the full set.',
{
@@ -48,7 +53,7 @@ function linearCollectionTruncatedText(kind: LinearCollectionKind, count: number
}
)
case 'projects':
- return translate(
+ return t(
'taskProviders.linear.truncated.projects',
'Showing the first {{count}} projects. Search or open Linear for the full set.',
{
@@ -58,7 +63,7 @@ function linearCollectionTruncatedText(kind: LinearCollectionKind, count: number
}
)
case 'projectIssues':
- return translate(
+ return t(
'taskProviders.linear.truncated.projectIssues',
'Showing the first {{count}} project issues. Search or open Linear for the full set.',
{
@@ -68,7 +73,7 @@ function linearCollectionTruncatedText(kind: LinearCollectionKind, count: number
}
)
case 'viewIssues':
- return translate(
+ return t(
'taskProviders.linear.truncated.viewIssues',
'Showing the first {{count}} view issues. Search or open Linear for the full set.',
{
@@ -78,7 +83,7 @@ function linearCollectionTruncatedText(kind: LinearCollectionKind, count: number
}
)
case 'issues':
- return translate(
+ return t(
'taskProviders.linear.truncated.issues',
'Showing the first {{count}} issues. Search or open Linear for the full set.',
{
@@ -109,6 +114,7 @@ export function LinearCollectionNotice({
loading = false,
loadMoreLabel = 'Load more'
}: LinearCollectionNoticeProps): React.JSX.Element | null {
+ const t = useTranslate()
if (!hasMore && (!errors || errors.length === 0)) {
return null
}
@@ -120,19 +126,21 @@ export function LinearCollectionNotice({
{errors.map((error) => (
{error.workspaceName ?? error.workspaceId}:{' '}
- {isIntegrationCredentialDecryptionError(taskProviderErrorText(error.message))
- ? translate(
+ {isIntegrationCredentialDecryptionError(
+ taskProviderErrorText(error.message, undefined, t)
+ )
+ ? t(
'auto.components.linear.project.view.surfaces.linearLoginUnreadable',
'Unable to read saved Linear login. Reconnect it in Settings.'
)
- : taskProviderErrorText(linearIssueReadError(error.message))}
+ : taskProviderErrorText(linearIssueReadError(error.message, t), undefined, t)}
))}
) : null}
{hasMore ? (
- {onLoadMore ? null :
{linearCollectionTruncatedText(kind, count)} }
+ {onLoadMore ? null :
{linearCollectionTruncatedText(kind, count, t)} }
{onLoadMore ? (
- {translate('auto.components.linear.project.view.surfaces.93e1f6bfca', 'Loading')}
+ {t('auto.components.linear.project.view.surfaces.93e1f6bfca', 'Loading')}
>
) : (
<>
@@ -178,6 +186,7 @@ export function LinearProjectOverview({
onRefresh,
onOpenIssues
}: LinearProjectOverviewProps): React.JSX.Element {
+ const t = useTranslate()
return (
@@ -186,7 +195,7 @@ export function LinearProjectOverview({
variant="ghost"
size="icon-xs"
onClick={onBack}
- aria-label={translate(
+ aria-label={t(
'auto.components.linear.project.view.surfaces.5f79bc76b0',
'Back to projects'
)}
@@ -196,19 +205,16 @@ export function LinearProjectOverview({
{project?.name ??
- translate('auto.components.linear.project.view.surfaces.85607ff793', 'Project')}
+ t('auto.components.linear.project.view.surfaces.85607ff793', 'Project')}
{project?.workspaceName
- ? translate(
+ ? t(
'auto.components.linear.project.view.surfaces.906b5e4cb8',
'Linear / Projects / {{value0}}',
{ value0: project.workspaceName }
)
- : translate(
- 'auto.components.linear.project.view.surfaces.f2cc1e0ff6',
- 'Linear / Projects'
- )}
+ : t('auto.components.linear.project.view.surfaces.f2cc1e0ff6', 'Linear / Projects')}
@@ -221,7 +227,7 @@ export function LinearProjectOverview({
className="gap-1 border-border/50 bg-background/70"
>
- {translate('auto.components.linear.project.view.surfaces.ee3d2caabd', 'Issues')}
+ {t('auto.components.linear.project.view.surfaces.ee3d2caabd', 'Issues')}
) : null}
- {translate('auto.components.linear.project.view.surfaces.a9785c7158', 'Refresh')}
+ {t('auto.components.linear.project.view.surfaces.a9785c7158', 'Refresh')}
{project ? (
- {translate('auto.components.linear.project.view.surfaces.7b147907dc', 'Linear')}
+ {t('auto.components.linear.project.view.surfaces.7b147907dc', 'Linear')}
) : null}
diff --git a/src/renderer/src/components/linear-scope-selector.tsx b/src/renderer/src/components/linear-scope-selector.tsx
index 5f1ddfb76b0..f6d6dc7ff0a 100644
--- a/src/renderer/src/components/linear-scope-selector.tsx
+++ b/src/renderer/src/components/linear-scope-selector.tsx
@@ -11,6 +11,7 @@ import { Button } from '@/components/ui/button'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { cn } from '@/lib/utils'
import { translate } from '@/i18n/i18n'
+import { useTranslate, type Translate } from '@/i18n/use-translate'
type LinearScopeSelectorProps = {
workspaces: LinearWorkspace[]
@@ -102,7 +103,8 @@ export function normalizeLinearScopeTeamSelection({
function summarizeTeamKeys(
teams: LinearTeam[],
selectedTeamIds: ReadonlySet,
- options: { activeAllWorkspaces: boolean; multipleWorkspaces: boolean }
+ options: { activeAllWorkspaces: boolean; multipleWorkspaces: boolean },
+ t: Translate = translate
): string {
const selectedTeams = teams.filter((team) => selectedTeamIds.has(team.id))
@@ -111,7 +113,7 @@ function summarizeTeamKeys(
const keys = selectedTeams.map((team) => team.key)
const keyCount = new Set(keys).size
if (workspaceIds.size > 1 || keyCount < keys.length) {
- return translate('auto.components.linear.scope.selector.teamCount', '{{count}} teams', {
+ return t('auto.components.linear.scope.selector.teamCount', '{{count}} teams', {
count: selectedTeams.length,
defaultValue_one: '{{count}} team'
})
@@ -123,13 +125,16 @@ function summarizeTeamKeys(
return `${labels.join(', ')}${rest.length > 0 ? ` +${rest.length}` : ''}`
}
-export function getLinearScopeTriggerLabel({
- workspaces,
- selectedWorkspaceId,
- teams,
- selectedTeamIds,
- teamSelectionIsStickyAll
-}: LinearScopeLabelInput): string {
+export function getLinearScopeTriggerLabel(
+ {
+ workspaces,
+ selectedWorkspaceId,
+ teams,
+ selectedTeamIds,
+ teamSelectionIsStickyAll
+ }: LinearScopeLabelInput,
+ t: Translate = translate
+): string {
const multipleWorkspaces = workspaces.length > 1
const activeAllWorkspaces = selectedWorkspaceId === 'all'
const selectedWorkspace =
@@ -143,17 +148,14 @@ export function getLinearScopeTriggerLabel({
allVisibleTeamsSelected ||
!teams.some((team) => selectedTeamIds.has(team.id))
const teamLabel = allTeams
- ? translate('auto.components.linear.scope.selector.7783361266', 'All teams')
- : summarizeTeamKeys(teams, selectedTeamIds, { activeAllWorkspaces, multipleWorkspaces })
+ ? t('auto.components.linear.scope.selector.7783361266', 'All teams')
+ : summarizeTeamKeys(teams, selectedTeamIds, { activeAllWorkspaces, multipleWorkspaces }, t)
if (!multipleWorkspaces) {
return teamLabel
}
if (activeAllWorkspaces) {
- const allWorkspaces = translate(
- 'auto.components.linear.scope.selector.a14ce4df2b',
- 'All workspaces'
- )
+ const allWorkspaces = t('auto.components.linear.scope.selector.a14ce4df2b', 'All workspaces')
return allTeams ? allWorkspaces : `${allWorkspaces} / ${teamLabel}`
}
return `${selectedWorkspace?.organizationName ?? 'Linear'} / ${teamLabel}`
@@ -171,6 +173,7 @@ export function LinearScopeSelector({
onOpen,
className
}: LinearScopeSelectorProps): React.JSX.Element {
+ const t = useTranslate()
const [open, setOpen] = useState(false)
const [query, setQuery] = useState('')
const [commandValue, setCommandValue] = useState('')
@@ -178,13 +181,16 @@ export function LinearScopeSelector({
() => new Map(workspaces.map((workspace) => [workspace.id, workspace])),
[workspaces]
)
- const triggerLabel = getLinearScopeTriggerLabel({
- workspaces,
- selectedWorkspaceId,
- teams,
- selectedTeamIds,
- teamSelectionIsStickyAll
- })
+ const triggerLabel = getLinearScopeTriggerLabel(
+ {
+ workspaces,
+ selectedWorkspaceId,
+ teams,
+ selectedTeamIds,
+ teamSelectionIsStickyAll
+ },
+ t
+ )
const showWorkspaceNames = selectedWorkspaceId === 'all' || workspaces.length > 1
const allTeamsSelected = teams.length > 0 && teams.every((team) => selectedTeamIds.has(team.id))
const filteredTeams = useMemo(
@@ -261,10 +267,7 @@ export function LinearScopeSelector({
1 ? (
- {translate('auto.components.linear.scope.selector.05baa5ae90', 'Workspace')}
+ {t('auto.components.linear.scope.selector.05baa5ae90', 'Workspace')}
- {translate(
- 'auto.components.linear.scope.selector.a14ce4df2b',
- 'All workspaces'
- )}
+ {t('auto.components.linear.scope.selector.a14ce4df2b', 'All workspaces')}
{workspaces.map((workspace) => (
@@ -319,7 +319,7 @@ export function LinearScopeSelector({
) : null}
- {translate('auto.components.linear.scope.selector.e1ae6bebb0', 'Teams')}
+ {t('auto.components.linear.scope.selector.e1ae6bebb0', 'Teams')}
-
- {translate('auto.components.linear.scope.selector.7783361266', 'All teams')}
-
+
{t('auto.components.linear.scope.selector.7783361266', 'All teams')}
{filteredTeams.length > 0 ? (
@@ -375,11 +373,11 @@ export function LinearScopeSelector({
) : (
{query.trim()
- ? translate(
+ ? t(
'auto.components.linear.scope.selector.405b33c378',
'No fetched teams match your search.'
)
- : translate(
+ : t(
'auto.components.linear.scope.selector.b3488fad3c',
'No teams were fetched. Access can depend on key scope, private-team membership, archived teams, permissions, or a fetch failure.'
)}
@@ -397,9 +395,7 @@ export function LinearScopeSelector({
className="flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition hover:bg-accent hover:text-accent-foreground"
>
-
- {translate('auto.components.linear.scope.selector.91c8871dad', 'Add team access')}
-
+ {t('auto.components.linear.scope.selector.91c8871dad', 'Add team access')}
diff --git a/src/renderer/src/components/linear-workspace-picker.tsx b/src/renderer/src/components/linear-workspace-picker.tsx
index 296098273e1..a5a135c1de1 100644
--- a/src/renderer/src/components/linear-workspace-picker.tsx
+++ b/src/renderer/src/components/linear-workspace-picker.tsx
@@ -1,5 +1,5 @@
import type { LinearWorkspace } from '../../../shared/linear/workspace-types'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { WorkItemScopePicker } from './work-item-scope-picker'
export function LinearWorkspacePicker({
@@ -13,6 +13,7 @@ export function LinearWorkspacePicker({
onChange: (workspaceId: string) => void
disabled?: boolean
}): React.JSX.Element {
+ const t = useTranslate()
const selected = workspaces.find((workspace) => workspace.id === value)
return (
onChange(workspaceId ?? 'all')}
- label={translate('components.linearWorkspacePicker.label', 'Linear workspace')}
- allLabel={translate('components.linearWorkspacePicker.all', 'All Linear workspaces')}
- searchPlaceholder={translate(
- 'components.linearWorkspacePicker.search',
- 'Search Linear workspaces'
- )}
- emptyLabel={translate('components.linearWorkspacePicker.empty', 'No workspaces found.')}
+ label={t('components.linearWorkspacePicker.label', 'Linear workspace')}
+ allLabel={t('components.linearWorkspacePicker.all', 'All Linear workspaces')}
+ searchPlaceholder={t('components.linearWorkspacePicker.search', 'Search Linear workspaces')}
+ emptyLabel={t('components.linearWorkspacePicker.empty', 'No workspaces found.')}
disabled={disabled}
/>
)
diff --git a/src/renderer/src/components/link-routing-preference-dialog.tsx b/src/renderer/src/components/link-routing-preference-dialog.tsx
index edb93379b87..1bddd75feb4 100644
--- a/src/renderer/src/components/link-routing-preference-dialog.tsx
+++ b/src/renderer/src/components/link-routing-preference-dialog.tsx
@@ -13,7 +13,7 @@ import {
import { Badge } from '@/components/ui/badge'
import { ShortcutKeyCombo } from '@/components/ShortcutKeyCombo'
import { useAppStore } from '@/store'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import {
LinkRoutingPreferenceDialogContext,
type LinkRoutingPreferenceDialogContextValue,
@@ -45,6 +45,7 @@ export function LinkRoutingPreferenceDialogProvider({
}: {
children: React.ReactNode
}): React.JSX.Element {
+ const t = useTranslate()
const nextIdRef = useRef(0)
const [queue, setQueue] = useState([])
const activeRequest = queue[0] ?? null
@@ -128,36 +129,33 @@ export function LinkRoutingPreferenceDialogProvider({
- {translate(
- 'auto.components.link.routing.preference.dialog.badge',
- 'Terminal link'
- )}
+ {t('auto.components.link.routing.preference.dialog.badge', 'Terminal link')}
{displayedRequest?.options.preview ? (
- {translate('auto.components.link.routing.preference.dialog.preview', 'Preview')}
+ {t('auto.components.link.routing.preference.dialog.preview', 'Preview')}
) : null}
{openLinksInAppDefault
- ? translate(
+ ? t(
'auto.components.link.routing.preference.dialog.keep.title',
"Keep terminal links in Orca's browser?"
)
- : translate(
+ : t(
'auto.components.link.routing.preference.dialog.title',
"Open terminal links in Orca's browser?"
)}
{openLinksInAppDefault
- ? translate(
+ ? t(
'auto.components.link.routing.preference.dialog.keep.description',
'Or use your system browser by default.'
)
- : translate(
+ : t(
'auto.components.link.routing.preference.dialog.description',
"Use Orca's browser for terminal links, or keep your system browser."
)}
@@ -170,7 +168,7 @@ export function LinkRoutingPreferenceDialogProvider({
{displayHost ? (
- {translate('auto.components.link.routing.preference.dialog.link.label', 'Link')}
+ {t('auto.components.link.routing.preference.dialog.link.label', 'Link')}
{displayHost}
@@ -182,20 +180,20 @@ export function LinkRoutingPreferenceDialogProvider({
- {translate(
+ {t(
'auto.components.link.routing.preference.dialog.orca.note',
'Orca can use imported cookies for logged-in sites.'
)}
- {translate(
+ {t(
'auto.components.link.routing.preference.dialog.settings.note',
'Change this later in Settings → Browser.'
)}
- {translate(
+ {t(
'auto.components.link.routing.preference.dialog.shortcut.note.prefix',
'When links open in Orca,'
)}
@@ -206,7 +204,7 @@ export function LinkRoutingPreferenceDialogProvider({
separatorClassName="text-[10px] text-muted-foreground"
/>
- {translate(
+ {t(
'auto.components.link.routing.preference.dialog.shortcut.note.suffix',
'click opens system browser once.'
)}
@@ -219,21 +217,15 @@ export function LinkRoutingPreferenceDialogProvider({
settleActiveRequest(false)}>
- {translate(
+ {t(
'auto.components.link.routing.preference.dialog.system.button',
'Use system browser'
)}
settleActiveRequest(true)}>
{openLinksInAppDefault
- ? translate(
- 'auto.components.link.routing.preference.dialog.keep.orca.button',
- 'Keep Orca'
- )
- : translate(
- 'auto.components.link.routing.preference.dialog.orca.button',
- 'Open in Orca'
- )}
+ ? t('auto.components.link.routing.preference.dialog.keep.orca.button', 'Keep Orca')
+ : t('auto.components.link.routing.preference.dialog.orca.button', 'Open in Orca')}
diff --git a/src/renderer/src/components/local-only-menu-hint.tsx b/src/renderer/src/components/local-only-menu-hint.tsx
index 1143277cf0c..c061c16e675 100644
--- a/src/renderer/src/components/local-only-menu-hint.tsx
+++ b/src/renderer/src/components/local-only-menu-hint.tsx
@@ -1,11 +1,12 @@
import React from 'react'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
/** Trailing reason on a menu item disabled because its target lives on another host. */
export function LocalOnlyMenuHint(): React.JSX.Element {
+ const t = useTranslate()
return (
- {translate('auto.components.sidebar.WorktreeOpenInMenu.localOnly', 'Local only')}
+ {t('auto.components.sidebar.WorktreeOpenInMenu.localOnly', 'Local only')}
)
}
diff --git a/src/renderer/src/components/maintenance/update-card/update-card-error-model.ts b/src/renderer/src/components/maintenance/update-card/update-card-error-model.ts
index c6657aa9a78..5df21bd97c9 100644
--- a/src/renderer/src/components/maintenance/update-card/update-card-error-model.ts
+++ b/src/renderer/src/components/maintenance/update-card/update-card-error-model.ts
@@ -8,46 +8,50 @@ import {
} from '../../../../../shared/updater-windows-signature-check'
import { getReleaseNotesUrlForVersion } from '../../../../../shared/release-channel'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import { updaterMessageText } from '@/lib/updater-message-copy'
import { isHttp2ProtocolError } from './update-card-visibility'
-export function buildUpdateCardErrorModel({
- status,
- isLocalBuild,
- cachedVersion,
- installError,
- compatibilityRelaunching,
- compatibilitySetupError,
- onChooseLocalBuild,
- onEnableHttp1Compatibility,
- onRetryDownload,
- onRecheck,
- onInstallRetry
-}: {
- status: UpdateStatus
- isLocalBuild: boolean
- cachedVersion: string | null
- installError: string | null
- compatibilityRelaunching: boolean
- compatibilitySetupError: string | null
- onChooseLocalBuild: () => void
- onEnableHttp1Compatibility: () => void
- onRetryDownload: () => void
- onRecheck: () => void
- onInstallRetry: () => void
-}): UpdateErrorCardModel | null {
+export function buildUpdateCardErrorModel(
+ {
+ status,
+ isLocalBuild,
+ cachedVersion,
+ installError,
+ compatibilityRelaunching,
+ compatibilitySetupError,
+ onChooseLocalBuild,
+ onEnableHttp1Compatibility,
+ onRetryDownload,
+ onRecheck,
+ onInstallRetry
+ }: {
+ status: UpdateStatus
+ isLocalBuild: boolean
+ cachedVersion: string | null
+ installError: string | null
+ compatibilityRelaunching: boolean
+ compatibilitySetupError: string | null
+ onChooseLocalBuild: () => void
+ onEnableHttp1Compatibility: () => void
+ onRetryDownload: () => void
+ onRecheck: () => void
+ onInstallRetry: () => void
+ },
+ t: Translate = translate
+): UpdateErrorCardModel | null {
if (status.state !== 'error') {
return installError
? {
- title: translate('auto.components.UpdateCard.4cf109845a', 'Update Error'),
- summary: translate(
+ title: t('auto.components.UpdateCard.4cf109845a', 'Update Error'),
+ summary: t(
'auto.components.UpdateCard.restartToInstallFailed',
'Could not restart to install the update.'
),
detail: installError,
releaseUrl: getReleaseNotesUrlForVersion(cachedVersion),
primaryAction: {
- label: translate('auto.components.UpdateCard.2c2d3e03ca', 'Try Again'),
+ label: t('auto.components.UpdateCard.2c2d3e03ca', 'Try Again'),
onClick: onInstallRetry
}
}
@@ -58,30 +62,30 @@ export function buildUpdateCardErrorModel({
if (status.installBlock && status.retryAction === 'install' && status.retryable !== false) {
return {
variant: 'waiting',
- ...getUpdateInstallBlockGuidance(status.installBlock),
+ ...getUpdateInstallBlockGuidance(status.installBlock, t),
blockers: status.installBlock.instances,
detail: message,
- deferLabel: translate('updates.installBlock.later', 'Later'),
+ deferLabel: t('updates.installBlock.later', 'Later'),
footnote: {
- text: translate(
+ text: t(
'updates.installBlock.retainedDownload',
'Orca stays open. No need to download again.'
)
},
primaryAction: {
- label: translate('updates.installBlock.retryInstallation', 'Retry installation'),
+ label: t('updates.installBlock.retryInstallation', 'Retry installation'),
onClick: onInstallRetry
}
}
}
if (status.retryAction === 'install' && status.retryable !== false) {
return {
- title: translate('auto.components.UpdateCard.4cf109845a', 'Update Error'),
+ title: t('auto.components.UpdateCard.4cf109845a', 'Update Error'),
summary: message,
detail: message,
releaseUrl: getReleaseNotesUrlForVersion(cachedVersion),
primaryAction: {
- label: translate('auto.components.UpdateCard.2c2d3e03ca', 'Try Again'),
+ label: t('auto.components.UpdateCard.2c2d3e03ca', 'Try Again'),
onClick: onInstallRetry
}
}
@@ -89,20 +93,14 @@ export function buildUpdateCardErrorModel({
if (isLocalBuild) {
return {
title: cachedVersion
- ? translate('auto.components.UpdateCard.8cf17b10af', 'Local Build Error')
- : translate('auto.components.UpdateCard.a4650b0dc4', 'Could Not Use Local Build'),
+ ? t('auto.components.UpdateCard.8cf17b10af', 'Local Build Error')
+ : t('auto.components.UpdateCard.a4650b0dc4', 'Could Not Use Local Build'),
summary: cachedVersion
- ? translate(
- 'auto.components.UpdateCard.b1e390250d',
- 'Could not complete the local build switch.'
- )
- : translate(
- 'auto.components.UpdateCard.d29740d175',
- 'The selected build could not be used.'
- ),
+ ? t('auto.components.UpdateCard.b1e390250d', 'Could not complete the local build switch.')
+ : t('auto.components.UpdateCard.d29740d175', 'The selected build could not be used.'),
detail: message,
primaryAction: {
- label: translate('auto.components.UpdateCard.37d45c9ec1', 'Choose Another Build'),
+ label: t('auto.components.UpdateCard.37d45c9ec1', 'Choose Another Build'),
onClick: onChooseLocalBuild
}
}
@@ -110,20 +108,20 @@ export function buildUpdateCardErrorModel({
if (isHttp2ProtocolError(status.message)) {
return {
variant: 'http1Compatibility',
- title: translate('auto.components.UpdateCard.1339b82cee', 'HTTP/2 Download Blocked'),
- summary: translate(
+ title: t('auto.components.UpdateCard.1339b82cee', 'HTTP/2 Download Blocked'),
+ summary: t(
'auto.components.UpdateCard.http1RetryAvailable',
'Orca can retry through HTTP/1.1 compatibility mode.'
),
- explainer: translate(
+ explainer: t(
'auto.components.UpdateCard.90559b14e3',
'This turns on a process-wide Electron networking switch after restart. Use it for corporate VPNs or proxies that reject HTTP/2 update downloads.'
),
detail: compatibilitySetupError ?? message,
releaseUrl: getReleaseNotesUrlForVersion(cachedVersion),
primaryAction: {
- label: translate('auto.components.UpdateCard.933c6fdf5b', 'Enable & Restart'),
- pendingLabel: translate('auto.components.UpdateCard.restarting', 'Restarting...'),
+ label: t('auto.components.UpdateCard.933c6fdf5b', 'Enable & Restart'),
+ pendingLabel: t('auto.components.UpdateCard.restarting', 'Restarting...'),
isPending: compatibilityRelaunching,
onClick: onEnableHttp1Compatibility
}
@@ -132,55 +130,52 @@ export function buildUpdateCardErrorModel({
if (isWindowsSignatureMismatchFailure(status.message)) {
return {
variant: 'security',
- title: translate('auto.components.UpdateCard.5b309b19f3', "Update Wasn't Installed"),
- summary: translate(
+ title: t('auto.components.UpdateCard.5b309b19f3', "Update Wasn't Installed"),
+ summary: t(
'auto.components.UpdateCard.092f09fc14',
"The installer's publisher doesn't match Orca, so we stopped the update. Don't install this download; check official releases for a corrected version."
),
detail: message,
releaseUrl: getReleaseNotesUrlForVersion(null),
- manualLabel: translate('auto.components.UpdateCard.c9ff9b9ec2', 'Check official releases')
+ manualLabel: t('auto.components.UpdateCard.c9ff9b9ec2', 'Check official releases')
}
}
if (isWindowsSignatureCheckUnavailableFailure(status.message)) {
return {
- title: translate('auto.components.UpdateCard.e944c2de43', 'Update Verification Blocked'),
- summary: translate(
+ title: t('auto.components.UpdateCard.e944c2de43', 'Update Verification Blocked'),
+ summary: t(
'auto.components.UpdateCard.a05992a26b',
"The signature check couldn't run — usually because antivirus software blocked it. Retry the download, or get the installer from our official releases."
),
detail: message,
releaseUrl: getReleaseNotesUrlForVersion(cachedVersion),
primaryAction: {
- label: translate('auto.components.UpdateCard.48565a32bc', 'Retry Download'),
+ label: t('auto.components.UpdateCard.48565a32bc', 'Retry Download'),
onClick: onRetryDownload
}
}
}
return {
title: cachedVersion
- ? translate('auto.components.UpdateCard.4cf109845a', 'Update Error')
- : translate('auto.components.UpdateCard.updateCheckFailed', 'Update Check Failed'),
+ ? t('auto.components.UpdateCard.4cf109845a', 'Update Error')
+ : t('auto.components.UpdateCard.updateCheckFailed', 'Update Check Failed'),
summary:
cachedVersion && status.retryable === false
? message
: cachedVersion
- ? translate(
- 'auto.components.UpdateCard.updateIncomplete',
- 'Could not complete the update.'
- )
- : translate('auto.components.UpdateCard.checkFailed', 'Could not check for updates.'),
+ ? t('auto.components.UpdateCard.updateIncomplete', 'Could not complete the update.')
+ : t('auto.components.UpdateCard.checkFailed', 'Could not check for updates.'),
detail: message,
releaseUrl: getReleaseNotesUrlForVersion(cachedVersion),
primaryAction:
cachedVersion && status.retryable !== false
? {
- label: translate('auto.components.UpdateCard.48565a32bc', 'Retry Download'),
+ label: t('auto.components.UpdateCard.48565a32bc', 'Retry Download'),
onClick: onRetryDownload
}
: !cachedVersion
? {
- label: translate('auto.components.UpdateCard.6b0085010d', 'Re-check'),
+ label: t('auto.components.UpdateCard.6b0085010d', 'Re-check'),
onClick: onRecheck
}
: undefined
diff --git a/src/renderer/src/components/maintenance/update-card/update-card-visibility.ts b/src/renderer/src/components/maintenance/update-card/update-card-visibility.ts
index 1b124e23bf1..a10d4866ed1 100644
--- a/src/renderer/src/components/maintenance/update-card/update-card-visibility.ts
+++ b/src/renderer/src/components/maintenance/update-card/update-card-visibility.ts
@@ -1,4 +1,5 @@
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import type { UpdateStatus } from '../../../../../shared/update-status-types'
export function isUpdateCardVisible({
@@ -38,30 +39,24 @@ export function isUpdateCardVisible({
)
}
-export function getUpdateCardAriaLabel(status: UpdateStatus): string {
+export function getUpdateCardAriaLabel(status: UpdateStatus, t: Translate = translate): string {
switch (status.state) {
case 'idle':
- return translate('auto.components.UpdateCard.aria.statusIdle', 'Update status')
+ return t('auto.components.UpdateCard.aria.statusIdle', 'Update status')
case 'checking':
- return translate('auto.components.UpdateCard.aria.statusChecking', 'Checking for updates')
+ return t('auto.components.UpdateCard.aria.statusChecking', 'Checking for updates')
case 'not-available':
- return translate(
- 'auto.components.UpdateCard.aria.statusLatest',
- "You're on the latest version"
- )
+ return t('auto.components.UpdateCard.aria.statusLatest', "You're on the latest version")
case 'available':
- return translate('auto.components.UpdateCard.aria.statusAvailable', 'Update available')
+ return t('auto.components.UpdateCard.aria.statusAvailable', 'Update available')
case 'downloading':
- return translate('auto.components.UpdateCard.aria.statusDownloading', 'Downloading update')
+ return t('auto.components.UpdateCard.aria.statusDownloading', 'Downloading update')
case 'downloaded':
- return translate(
- 'auto.components.UpdateCard.aria.statusDownloaded',
- 'Update ready to install'
- )
+ return t('auto.components.UpdateCard.aria.statusDownloaded', 'Update ready to install')
case 'error':
return status.installBlock
- ? translate('updates.installBlock.waitingLabel', 'Update waiting')
- : translate('auto.components.UpdateCard.aria.statusError', 'Update error')
+ ? t('updates.installBlock.waitingLabel', 'Update waiting')
+ : t('auto.components.UpdateCard.aria.statusError', 'Update error')
}
}
diff --git a/src/renderer/src/components/native-chat-resume-activity-label.ts b/src/renderer/src/components/native-chat-resume-activity-label.ts
index b86ecf04022..b6d60a5a408 100644
--- a/src/renderer/src/components/native-chat-resume-activity-label.ts
+++ b/src/renderer/src/components/native-chat-resume-activity-label.ts
@@ -1,4 +1,5 @@
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import type { AgentSessionRestartActivity } from '../../../shared/agent-session/lifecycle/agent-session-restart-activity'
export type ResumeActivityLabel = {
@@ -8,15 +9,14 @@ export type ResumeActivityLabel = {
detail: string
}
-function named(label: string): string {
- return (
- label || translate('auto.components.NativeChatResumeOnRestartModal.activityUnnamed', 'unnamed')
- )
+function named(label: string, t: Translate = translate): string {
+ return label || t('auto.components.NativeChatResumeOnRestartModal.activityUnnamed', 'unnamed')
}
/** Read the host’s stop-time snapshot; older hosts/offers may omit it, so return null for caller fallback copy. */
export function resumeActivityLabel(
- activity: AgentSessionRestartActivity | undefined
+ activity: AgentSessionRestartActivity | undefined,
+ t: Translate = translate
): ResumeActivityLabel | null {
if (!activity) {
return null
@@ -27,20 +27,20 @@ export function resumeActivityLabel(
if (activity.state === 'blocked' && prompt) {
parts.push(
prompt.kind === 'approval'
- ? translate(
+ ? t(
'auto.components.NativeChatResumeOnRestartModal.activityApproval',
'Waiting for your approval: {{value0}}',
- { value0: named(prompt.label) }
+ { value0: named(prompt.label, t) }
)
- : translate(
+ : t(
'auto.components.NativeChatResumeOnRestartModal.activityQuestion',
'Waiting for your answer: {{value0}}',
- { value0: named(prompt.label) }
+ { value0: named(prompt.label, t) }
)
)
} else if (activity.state === 'working') {
parts.push(
- translate('auto.components.NativeChatResumeOnRestartModal.activityMidReply', 'Was mid-reply')
+ t('auto.components.NativeChatResumeOnRestartModal.activityMidReply', 'Was mid-reply')
)
}
const agents = activity.tasks.filter((task) => task.kind === 'agent')
@@ -51,15 +51,15 @@ export function resumeActivityLabel(
const [onlyWatch] = watches
if (agents.length === 1 && onlyAgent) {
parts.push(
- translate(
+ t(
'auto.components.NativeChatResumeOnRestartModal.activitySubagentOne',
'Subagent running: {{value0}}',
- { value0: named(onlyAgent.label) }
+ { value0: named(onlyAgent.label, t) }
)
)
} else if (agents.length > 1) {
parts.push(
- translate(
+ t(
'auto.components.NativeChatResumeOnRestartModal.activitySubagentCount',
'{{count}} subagents running',
{ count: agents.length, defaultValue_one: '{{count}} subagent running' }
@@ -68,15 +68,15 @@ export function resumeActivityLabel(
}
if (watches.length === 1 && onlyWatch) {
parts.push(
- translate(
+ t(
'auto.components.NativeChatResumeOnRestartModal.activityMonitorOne',
'Monitoring: {{value0}}',
- { value0: named(onlyWatch.label) }
+ { value0: named(onlyWatch.label, t) }
)
)
} else if (watches.length > 1) {
parts.push(
- translate(
+ t(
'auto.components.NativeChatResumeOnRestartModal.activityMonitorCount',
'Monitoring {{count}} background tasks',
{ count: watches.length, defaultValue_one: 'Monitoring {{count}} background task' }
diff --git a/src/renderer/src/components/native-chat-resume-failure-guidance.ts b/src/renderer/src/components/native-chat-resume-failure-guidance.ts
index 6e3c0e3eb11..a51552c1ea9 100644
--- a/src/renderer/src/components/native-chat-resume-failure-guidance.ts
+++ b/src/renderer/src/components/native-chat-resume-failure-guidance.ts
@@ -1,4 +1,5 @@
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import type { ResumeFailure } from './native-chat-resume-on-restart-grouping'
/** Offer retry only for recoverable refusals; newer chat work or a standing provider refusal requires continuing in the chat. */
@@ -27,27 +28,31 @@ export function resumeFailureSelectable(failure: Pick
+ failure: Pick,
+ t?: Translate
): ResumeFailureGuidance {
- const guidance = reasonGuidance(failure)
+ const guidance = reasonGuidance(failure, t)
// The host already knows a retry would not run, whatever the reason suggests.
return !resumeFailureSelectable(failure) &&
(guidance.primary === 'retry' || guidance.secondary === 'retry')
- ? { text: manualContinuationText(), primary: 'open', secondary: 'dismiss' }
+ ? { text: manualContinuationText(t), primary: 'open', secondary: 'dismiss' }
: guidance
}
-function manualContinuationText(): string {
- return translate(
+function manualContinuationText(t: Translate = translate): string {
+ return t(
'auto.components.NativeChatResumeFailureGuidance.fallback',
'Orca couldn’t resume this chat. Open it to continue manually.'
)
}
-function reasonGuidance(failure: Pick): ResumeFailureGuidance {
+function reasonGuidance(
+ failure: Pick,
+ t: Translate = translate
+): ResumeFailureGuidance {
if (failure.outcome === 'unconfirmed') {
return {
- text: translate(
+ text: t(
'auto.components.NativeChatResumeFailureGuidance.unconfirmed',
'Orca couldn’t confirm the “continue” message was delivered. Open the chat and check before sending another.'
),
@@ -58,7 +63,7 @@ function reasonGuidance(failure: Pick): Res
const reason = failure.reason
if (reason === 'agent_session_restart_work_superseded') {
return {
- text: translate(
+ text: t(
'auto.components.NativeChatResumeFailureGuidance.superseded',
'Open the chat and reply. New work arrived in it right after the restart, so Orca didn’t send its “continue” message.'
),
@@ -68,7 +73,7 @@ function reasonGuidance(failure: Pick): Res
}
if (reason === 'agent_session_conflict') {
return {
- text: translate(
+ text: t(
'auto.components.NativeChatResumeFailureGuidance.conflict',
'This chat is open in another Orca window or terminal. Close it there, then retry.'
),
@@ -78,7 +83,7 @@ function reasonGuidance(failure: Pick): Res
}
if (RETRYABLE_OWNERSHIP.has(reason)) {
return {
- text: translate(
+ text: t(
'auto.components.NativeChatResumeFailureGuidance.ownershipUnknown',
'This chat isn’t ready to resume yet. Wait a moment, then retry.'
),
@@ -88,7 +93,7 @@ function reasonGuidance(failure: Pick): Res
}
if (RETRYABLE_DELIVERY.has(reason)) {
return {
- text: translate(
+ text: t(
'auto.components.NativeChatResumeFailureGuidance.notAttached',
'The chat didn’t reconnect. Retry, or open it to start a fresh turn.'
),
@@ -98,7 +103,7 @@ function reasonGuidance(failure: Pick): Res
}
if (reason === 'agent_session_dispatch_rejected') {
return {
- text: translate(
+ text: t(
'auto.components.NativeChatResumeFailureGuidance.dispatchRejected',
'The agent refused the “continue” message. Open the chat and send one yourself.'
),
@@ -108,7 +113,7 @@ function reasonGuidance(failure: Pick): Res
}
if (NOT_RESUMABLE.has(reason)) {
return {
- text: translate(
+ text: t(
'auto.components.NativeChatResumeFailureGuidance.unsupported',
'This chat can’t be resumed by Orca. Open it to see where it stopped.'
),
@@ -116,5 +121,5 @@ function reasonGuidance(failure: Pick): Res
secondary: 'dismiss'
}
}
- return { text: manualContinuationText(), primary: 'open', secondary: 'retry' }
+ return { text: manualContinuationText(t), primary: 'open', secondary: 'retry' }
}
diff --git a/src/renderer/src/components/pr-check-empty-details.tsx b/src/renderer/src/components/pr-check-empty-details.tsx
index c2be1016ed8..5b1618d35e8 100644
--- a/src/renderer/src/components/pr-check-empty-details.tsx
+++ b/src/renderer/src/components/pr-check-empty-details.tsx
@@ -1,7 +1,7 @@
import type React from 'react'
import { CircleDashed } from 'lucide-react'
import { cn } from '@/lib/utils'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { isCompletePRCheckOwner } from '../../../shared/github/complete-pr-check-owner'
import type { ProviderCheckSummary } from '../../../shared/github/pull-request-types'
@@ -24,13 +24,14 @@ export function PRCheckEmptyDetails({
summaryColor: string
summaryLabel: string
}): React.JSX.Element {
+ const t = useTranslate()
const complete = owner && isCompletePRCheckOwner(owner)
const noChecks = !complete || owner.checksSummary?.total === 0
const detailLabel = noChecks
? dialog
- ? translate('auto.components.GitHubItemDialog.e52bed9264', 'No checks reported yet')
- : translate('auto.components.PullRequestPage.a18d01cda3', 'No checks reported yet')
- : translate('auto.components.prCheckCounts.noCheckDetails', 'No check details available')
+ ? t('auto.components.GitHubItemDialog.e52bed9264', 'No checks reported yet')
+ : t('auto.components.PullRequestPage.a18d01cda3', 'No checks reported yet')
+ : t('auto.components.prCheckCounts.noCheckDetails', 'No check details available')
if (variant === 'compact') {
return (
<>
@@ -50,18 +51,18 @@ export function PRCheckEmptyDetails({
{noChecks
? dialog
- ? translate('auto.components.GitHubItemDialog.ecffebc251', 'No checks found')
- : translate('auto.components.PullRequestPage.45877f5089', 'No checks found')
+ ? t('auto.components.GitHubItemDialog.ecffebc251', 'No checks found')
+ : t('auto.components.PullRequestPage.45877f5089', 'No checks found')
: summaryLabel}
{noChecks
? dialog
- ? translate(
+ ? t(
'auto.components.GitHubItemDialog.90020cc1f3',
'This pull request has no reported checks yet.'
)
- : translate(
+ : t(
'auto.components.PullRequestPage.3912daf310',
'This pull request has no reported checks yet.'
)
diff --git a/src/renderer/src/components/quick-open-install-rg-guidance.tsx b/src/renderer/src/components/quick-open-install-rg-guidance.tsx
index c7509b00cc4..4d41b4df5c7 100644
--- a/src/renderer/src/components/quick-open-install-rg-guidance.tsx
+++ b/src/renderer/src/components/quick-open-install-rg-guidance.tsx
@@ -2,7 +2,8 @@ import type React from 'react'
import { useCallback, useRef, useState } from 'react'
import { AlertTriangle, Check, Copy } from 'lucide-react'
import { Trans } from 'react-i18next'
-import { i18n, translate } from '@/i18n/i18n'
+import { i18n } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
export type QuickOpenInstallRgGuidanceParts = {
reason: string
@@ -37,6 +38,7 @@ export function QuickOpenInstallRgGuidance({
command,
guidance
}: QuickOpenInstallRgGuidanceParts): React.JSX.Element {
+ const t = useTranslate()
const [copied, setCopied] = useState(false)
const copiedResetTimerRef = useRef(null)
// Late clipboard completion must not start timers after unmount.
@@ -88,7 +90,7 @@ export function QuickOpenInstallRgGuidance({
>
- {translate('quickOpen.scanTooLarge', 'Quick Open scan too large ({{reason}}).', {
+ {t('quickOpen.scanTooLarge', 'Quick Open scan too large ({{reason}}).', {
reason
})}
@@ -96,7 +98,7 @@ export function QuickOpenInstallRgGuidance({
ripgrep on the remote to enable fast, gitignore-aware listing:'
)}
@@ -113,12 +115,12 @@ export function QuickOpenInstallRgGuidance({
type="button"
onClick={handleCopy}
className="flex items-center gap-1 rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
- aria-label={translate('auto.components.QuickOpen.73b44e7bde', 'Copy install command')}
+ aria-label={t('auto.components.QuickOpen.73b44e7bde', 'Copy install command')}
>
{copied ? : }
{copied
- ? translate('auto.components.QuickOpen.cf144856dc', 'Copied')
- : translate('auto.components.QuickOpen.995be8ea22', 'Copy')}
+ ? t('auto.components.QuickOpen.cf144856dc', 'Copied')
+ : t('auto.components.QuickOpen.995be8ea22', 'Copy')}
) : guidance ? (
diff --git a/src/renderer/src/components/settings/chat/chat-behavior-search.ts b/src/renderer/src/components/settings/chat/chat-behavior-search.ts
index 92daf504894..802d82eecf5 100644
--- a/src/renderer/src/components/settings/chat/chat-behavior-search.ts
+++ b/src/renderer/src/components/settings/chat/chat-behavior-search.ts
@@ -108,6 +108,6 @@ export const getChatBehaviorEntriesByKey = createLocalizedCatalog(() => ({
}
}))
-export function getChatBehaviorSearchEntries(): SettingsSearchEntry[] {
- return [{ title: getChatBehaviorTitle() }, ...Object.values(getChatBehaviorEntriesByKey())]
+export function getChatBehaviorSearchEntries(t?: Translate): SettingsSearchEntry[] {
+ return [{ title: getChatBehaviorTitle(t) }, ...Object.values(getChatBehaviorEntriesByKey())]
}
diff --git a/src/renderer/src/components/settings/chat/chat-launch-search.ts b/src/renderer/src/components/settings/chat/chat-launch-search.ts
index d3e98430b20..28a0082a4d0 100644
--- a/src/renderer/src/components/settings/chat/chat-launch-search.ts
+++ b/src/renderer/src/components/settings/chat/chat-launch-search.ts
@@ -43,6 +43,6 @@ export function getChatLaunchEntriesByKey(t: Translate = translate) {
} satisfies Record
}
-export function getChatLaunchSearchEntries(): SettingsSearchEntry[] {
- return Object.values(getChatLaunchEntriesByKey())
+export function getChatLaunchSearchEntries(t?: Translate): SettingsSearchEntry[] {
+ return Object.values(getChatLaunchEntriesByKey(t))
}
diff --git a/src/renderer/src/components/settings/chat/chat-turn-activity-search.ts b/src/renderer/src/components/settings/chat/chat-turn-activity-search.ts
index 4c84d18970b..7fe8ef8cecd 100644
--- a/src/renderer/src/components/settings/chat/chat-turn-activity-search.ts
+++ b/src/renderer/src/components/settings/chat/chat-turn-activity-search.ts
@@ -57,9 +57,9 @@ export const getChatTurnActivityEntriesByKey = createLocalizedCatalog(
}) satisfies Record
)
-export function getChatTurnActivitySearchEntries(): SettingsSearchEntry[] {
+export function getChatTurnActivitySearchEntries(t?: Translate): SettingsSearchEntry[] {
return [
- { title: getChatTurnActivityTitle() },
+ { title: getChatTurnActivityTitle(t) },
...Object.values(getChatTurnActivityEntriesByKey())
]
}
diff --git a/src/renderer/src/components/settings/terminal/terminal-search.ts b/src/renderer/src/components/settings/terminal/terminal-search.ts
index 76dac3209db..47b56a98152 100644
--- a/src/renderer/src/components/settings/terminal/terminal-search.ts
+++ b/src/renderer/src/components/settings/terminal/terminal-search.ts
@@ -34,6 +34,7 @@ import {
} from './terminal-window-setup-search'
import { createLocalizedCatalog } from '@/i18n/localized-catalog'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import { translateSearchKeyword } from '../search/settings-search-keywords'
type TerminalAppearanceSearchOptions = {
@@ -72,11 +73,14 @@ export function getTerminalAppearanceSearchEntries(
: getTerminalAppearanceSearchEntriesWithoutImports()
}
-export function getTerminalPaneSearchEntries(platform: {
- isWindows: boolean
- isWindowsTerminalHost?: boolean
- isMac: boolean
-}): SettingsSearchEntry[] {
+export function getTerminalPaneSearchEntries(
+ platform: {
+ isWindows: boolean
+ isWindowsTerminalHost?: boolean
+ isMac: boolean
+ },
+ t: Translate = translate
+): SettingsSearchEntry[] {
const isWindowsTerminalHost = platform.isWindowsTerminalHost ?? platform.isWindows
// Mirror visible platform controls so search cannot link to hidden options.
return [
@@ -86,58 +90,77 @@ export function getTerminalPaneSearchEntries(platform: {
...(!isWindowsTerminalHost
? [
{
- title: translate(
- 'auto.components.settings.terminal.search.1733ccd3e9',
- 'Terminal shell'
- ),
- description: translate(
+ title: t('auto.components.settings.terminal.search.1733ccd3e9', 'Terminal shell'),
+ description: t(
'auto.components.settings.terminal.search.3de504994c',
'Shell and arguments used for new local interactive terminal panes'
),
keywords: [
...translateSearchKeyword(
'auto.components.settings.terminal.search.ddd5efe113',
- 'shell'
+ 'shell',
+ undefined,
+ t
),
...translateSearchKeyword(
'auto.components.settings.terminal.search.f66a7cf715',
- 'terminal'
+ 'terminal',
+ undefined,
+ t
),
...translateSearchKeyword(
'auto.components.settings.terminal.search.454df22a5e',
- 'fish'
+ 'fish',
+ undefined,
+ t
),
...translateSearchKeyword(
'auto.components.settings.terminal.search.d26257a80d',
- 'zsh'
+ 'zsh',
+ undefined,
+ t
),
...translateSearchKeyword(
'auto.components.settings.terminal.search.bf09070e31',
- 'bash'
+ 'bash',
+ undefined,
+ t
),
...translateSearchKeyword(
'auto.components.settings.terminal.search.7c3ede6f12',
- 'nushell'
+ 'nushell',
+ undefined,
+ t
),
...translateSearchKeyword(
'auto.components.settings.terminal.search.5304b12d5c',
- 'arguments'
+ 'arguments',
+ undefined,
+ t
),
...translateSearchKeyword(
'auto.components.settings.terminal.search.36ba1a1357',
- 'args'
+ 'args',
+ undefined,
+ t
),
...translateSearchKeyword(
'auto.components.settings.terminal.search.50ba80b6dd',
- 'login'
+ 'login',
+ undefined,
+ t
),
...translateSearchKeyword(
'auto.components.settings.terminal.search.d9e29543a1',
- 'wrapper'
+ 'wrapper',
+ undefined,
+ t
),
...translateSearchKeyword(
'auto.components.settings.terminal.search.d31ed1ac1c',
- 'rcfile'
+ 'rcfile',
+ undefined,
+ t
)
]
}
diff --git a/src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-source-selection.ts b/src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-source-selection.ts
index 3ad9cbb2d77..21d14333ce0 100644
--- a/src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-source-selection.ts
+++ b/src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-source-selection.ts
@@ -12,6 +12,7 @@ import type { FolderWorkspace } from '../../../../../../shared/folder-workspaces
import type { SmartWorkspaceNameSelection } from '@/components/new-workspace/smart-workspace-name-field-model'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import './folder-workspace-source-repos'
export function toFolderWorkspaceLinkedTask(
@@ -43,9 +44,6 @@ export function getLinkedItemDisplayName(item: LinkedWorkItemSummary): string |
return getWorkspaceSourceName(item).displayName || null
}
-export function getFolderWorkspacePrimaryActionLabel(): string {
- return translate(
- 'auto.components.sidebar.FolderWorkspaceComposerDialog.create',
- 'Create workspace'
- )
+export function getFolderWorkspacePrimaryActionLabel(t: Translate = translate): string {
+ return t('auto.components.sidebar.FolderWorkspaceComposerDialog.create', 'Create workspace')
}
diff --git a/src/renderer/src/components/status-bar/SshStatusSegment.tsx b/src/renderer/src/components/status-bar/SshStatusSegment.tsx
index c3bcb50ac10..2858ae6032c 100644
--- a/src/renderer/src/components/status-bar/SshStatusSegment.tsx
+++ b/src/renderer/src/components/status-bar/SshStatusSegment.tsx
@@ -114,7 +114,7 @@ export function SshStatusSegment({
blockedReason,
blocked: blockedReason
? {
- ...runtimeHostBlockedCopy(blockedReason, registryHost?.compatibility, repairRoute),
+ ...runtimeHostBlockedCopy(blockedReason, registryHost?.compatibility, repairRoute, t),
recovery: runtimeHostBlockedRecovery(blockedReason, repairRoute)
}
: null,
@@ -223,13 +223,13 @@ export function SshStatusSegment({
{/* Reserve both localized forms so count changes don't resize the bar. */}
- {connectedHostCountLabel(1)}
+ {connectedHostCountLabel(1, t)}
- {connectedHostCountLabel(Math.max(99, statuses.length))}
+ {connectedHostCountLabel(Math.max(99, statuses.length), t)}
- {connectedHostCountLabel(connectedHostCount)}
+ {connectedHostCountLabel(connectedHostCount, t)}
)}
@@ -257,7 +257,7 @@ export function SshStatusSegment({
key={host.id}
label={host.label}
state={host.state}
- detail={runtimeHostConnectionDetail(host.remoteControl)}
+ detail={runtimeHostConnectionDetail(host.remoteControl, t)}
diagnostics={host.remoteControl}
blocked={host.blocked}
onConnect={() => connectRuntimeHost(host.id)}
@@ -278,7 +278,7 @@ export function SshStatusSegment({
key={host.id}
label={host.label}
state={host.state}
- detail={runtimeHostConnectionDetail(host.remoteControl)}
+ detail={runtimeHostConnectionDetail(host.remoteControl, t)}
diagnostics={host.remoteControl}
blocked={host.blocked}
onConnect={() => connectRuntimeHost(host.id)}
@@ -297,7 +297,7 @@ export function SshStatusSegment({
{hiddenIdleCount > 0 ? (
// Why a search and not a Settings link: web clients connect hosts here but have no SSH pane.
setFindOpen(true)}>
- {moreSshHostsLabel(hiddenIdleCount)}
+ {moreSshHostsLabel(hiddenIdleCount, t)}
) : null}
diff --git a/src/renderer/src/components/tab-bar/EditorFileTab.tsx b/src/renderer/src/components/tab-bar/EditorFileTab.tsx
index 8b3c06aa87b..dafa32cb307 100644
--- a/src/renderer/src/components/tab-bar/EditorFileTab.tsx
+++ b/src/renderer/src/components/tab-bar/EditorFileTab.tsx
@@ -317,7 +317,7 @@ export default function EditorFileTab({
openRenameInput()
}}
>
- {getEditorDisplayLabel(file)}
+ {getEditorDisplayLabel(file, undefined, t)}
{placedElsewhere && repo ? ` · ${repo.displayName}` : ''}
)}
@@ -365,7 +365,7 @@ export default function EditorFileTab({
tabRoot
) : (
+ selected: ReadonlySet,
+ t: Translate = translate
): React.JSX.Element {
if (groups.length === 0) {
return (
- {translate('auto.components.task.project.source.combobox.noProjects', 'No projects')}
+ {t('auto.components.task.project.source.combobox.noProjects', 'No projects')}
)
}
@@ -49,7 +51,7 @@ function renderTriggerLabel(
if (selectedProjectGroups.length === groups.length) {
return (
- {translate('auto.components.task.project.source.combobox.allProjects', 'All projects')}
+ {t('auto.components.task.project.source.combobox.allProjects', 'All projects')}
)
}
@@ -73,12 +75,13 @@ function getProjectDetail(
group: TaskProjectPickerGroup,
selected: ReadonlySet,
showHostLabels: boolean,
- getRepoHostLabel?: (repo: Repo) => string | null | undefined
+ getRepoHostLabel?: (repo: Repo) => string | null | undefined,
+ t?: Translate
): string {
const selectedSource = getSelectedTaskProjectSource(group, selected)
const hostLabel = showHostLabels ? getRepoHostLabel?.(selectedSource)?.trim() : ''
if (hasMultipleTaskProjectHostsInGroup(group)) {
- const hostCount = projectHostCountLabel(group.sources.length)
+ const hostCount = projectHostCountLabel(group.sources.length, t)
return hostLabel ? `${hostLabel} · ${hostCount}` : hostCount
}
return hostLabel ? `${hostLabel} · ${selectedSource.path}` : selectedSource.path
@@ -97,6 +100,7 @@ export default function TaskProjectSourceCombobox({
getRepoSourceStatus,
triggerClassName
}: TaskProjectSourceComboboxProps): React.JSX.Element {
+ const t = useTranslate()
const [open, setOpen] = useState(false)
const [sourceMenuProjectKey, setSourceMenuProjectKey] = useState(null)
const [query, setQuery] = useState('')
@@ -222,7 +226,7 @@ export default function TaskProjectSourceCombobox({
aria-expanded={open}
className={cn('h-8 w-full justify-between px-3 text-xs font-normal', triggerClassName)}
>
- {renderTriggerLabel(groups, selected)}
+ {renderTriggerLabel(groups, selected, t)}
@@ -233,7 +237,7 @@ export default function TaskProjectSourceCombobox({
- {translate(
- 'auto.components.task.project.source.combobox.allProjects',
- 'All projects'
- )}
+ {t('auto.components.task.project.source.combobox.allProjects', 'All projects')}
{filteredGroups.length === 0 ? (
- {translate(
+ {t(
'auto.components.task.project.source.combobox.noMatches',
'No projects match your search.'
)}
@@ -278,7 +279,7 @@ export default function TaskProjectSourceCombobox({
{filteredGroups.map((group) => {
const selectedProject = isTaskProjectGroupSelected(group, selected)
const selectedSource = getSelectedTaskProjectSource(group, selected)
- const detail = getProjectDetail(group, selected, showHostLabels, getRepoHostLabel)
+ const detail = getProjectDetail(group, selected, showHostLabels, getRepoHostLabel, t)
const hasSourceMenu = hasMultipleTaskProjectHostsInGroup(group)
return (
hostQueuesMessages || entry.targetSectionId !== 'chat-queue-follow-ups'
),
...(showDesktopOnlySettings
@@ -62,8 +66,8 @@ export function buildInterfaceSettingsSections({
},
{
id: 'input',
- title: translate('auto.hooks.useSettingsNavigationMetadata.0c6ee88a5f', 'Input & Editing'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.0c6ee88a5f', 'Input & Editing'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.1f452cbd4c',
'Selection and editing behavior.'
),
@@ -75,11 +79,8 @@ export function buildInterfaceSettingsSections({
? [
{
id: 'notifications',
- title: translate(
- 'auto.hooks.useSettingsNavigationMetadata.2eece16ad1',
- 'Notifications'
- ),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.2eece16ad1', 'Notifications'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.7682607591',
'Native desktop notifications for agent and terminal events.'
),
@@ -91,8 +92,8 @@ export function buildInterfaceSettingsSections({
: []),
{
id: 'shortcuts',
- title: translate('auto.hooks.useSettingsNavigationMetadata.94295ebfb3', 'Shortcuts'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.94295ebfb3', 'Shortcuts'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.dcd0d9b74f',
'Keyboard shortcuts for common actions.'
),
@@ -105,8 +106,8 @@ export function buildInterfaceSettingsSections({
},
{
id: 'stats',
- title: translate('auto.hooks.useSettingsNavigationMetadata.d72a58b5b9', 'Stats & Usage'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.d72a58b5b9', 'Stats & Usage'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.b351014180',
'Orca stats plus Claude, Codex, OpenCode, Muse token analytics and Grok subscription usage.'
),
diff --git a/src/renderer/src/hooks/settings-navigation-remote-sections.ts b/src/renderer/src/hooks/settings-navigation-remote-sections.ts
index 5d9080c85eb..6ada3628bc9 100644
--- a/src/renderer/src/hooks/settings-navigation-remote-sections.ts
+++ b/src/renderer/src/hooks/settings-navigation-remote-sections.ts
@@ -10,6 +10,7 @@ import { getRepositoryPaneSearchEntries } from '@/components/settings/repository
import { buildSettingsProjectList } from '@/components/settings/navigation/settings-project-list'
import { getSshPaneSearchEntries } from '@/components/settings/ssh/ssh-search'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import type { SettingsNavSection } from '@/lib/settings-navigation-types'
import { getRepoKindLabel } from '../../../shared/repo-kind'
import type { Repo } from '../../../shared/repo-types'
@@ -36,7 +37,8 @@ export function buildRemoteSettingsSections(
projectGrouping
}: SettingsNavigationBuildOptions,
runtimeEnvironmentsSearchEntry: SettingsNavSection['searchEntries'][number],
- reposById: ReadonlyMap
+ reposById: ReadonlyMap,
+ t: Translate = translate
): SettingsNavSection[] {
const showDesktopOnlySettings = !isWebClient
return [
@@ -44,8 +46,8 @@ export function buildRemoteSettingsSections(
? [
{
id: 'ssh',
- title: translate('auto.hooks.useSettingsNavigationMetadata.94a5afe910', 'SSH Hosts'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.94a5afe910', 'SSH Hosts'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.31e57d1c70',
'Use existing machines over SSH for files, terminals, Git, and workspaces.'
),
@@ -57,10 +59,7 @@ export function buildRemoteSettingsSections(
: []),
{
id: 'servers',
- title: translate(
- 'auto.hooks.useSettingsNavigationMetadata.de0c2907a1',
- 'Remote Orca Servers'
- ),
+ title: t('auto.hooks.useSettingsNavigationMetadata.de0c2907a1', 'Remote Orca Servers'),
description: isWebClient
? 'Connect this browser to a saved Orca server.'
: 'Run Orca on another machine and work on it from here.',
@@ -72,11 +71,8 @@ export function buildRemoteSettingsSections(
? [
{
id: 'developer-permissions',
- title: translate(
- 'auto.hooks.useSettingsNavigationMetadata.d91ae31fbd',
- 'macOS Permissions'
- ),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.d91ae31fbd', 'macOS Permissions'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.65ec7d1968',
'macOS privacy access for terminal-launched developer tools.'
),
@@ -88,11 +84,8 @@ export function buildRemoteSettingsSections(
: []),
{
id: 'privacy',
- title: translate(
- 'auto.hooks.useSettingsNavigationMetadata.3618579df6',
- 'Privacy & Telemetry'
- ),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.3618579df6', 'Privacy & Telemetry'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.8400cfe1c1',
'Anonymous usage data and telemetry controls.'
),
@@ -104,8 +97,8 @@ export function buildRemoteSettingsSections(
? [
{
id: 'advanced',
- title: translate('auto.hooks.useSettingsNavigationMetadata.580a04cd81', 'Advanced'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.580a04cd81', 'Advanced'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.e338c507c1',
'Low-level compatibility settings for troubleshooting.'
),
@@ -120,23 +113,23 @@ export function buildRemoteSettingsSections(
? [
{
id: 'dev',
- title: translate('auto.hooks.useSettingsNavigationMetadata.dev', 'Dev Tools'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.dev', 'Dev Tools'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.devDescription',
'Dev-only tools for exercising UI states.'
),
// Use a distinct icon from sibling Advanced settings so adjacent rows remain distinguishable.
icon: Bug,
- searchEntries: getDevToolsPaneSearchEntries(),
+ searchEntries: getDevToolsPaneSearchEntries(t),
group: 'advanced',
- badge: translate('auto.hooks.useSettingsNavigationMetadata.devBadge', 'Dev')
+ badge: t('auto.hooks.useSettingsNavigationMetadata.devBadge', 'Dev')
}
]
: []),
{
id: 'experimental',
- title: translate('auto.hooks.useSettingsNavigationMetadata.225071c560', 'Experimental'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.225071c560', 'Experimental'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.4a728cd56b',
'New features that are still taking shape. Give them a try.'
),
@@ -148,15 +141,15 @@ export function buildRemoteSettingsSections(
? [
{
id: 'plugins',
- title: translate('auto.hooks.useSettingsNavigationMetadata.pluginsTitle', 'Plugins'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.pluginsTitle', 'Plugins'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.pluginsDescription',
'Install and manage Orca plugins (Alpha).'
),
icon: Blocks,
searchEntries: getPluginsPaneSearchEntries(),
group: 'experimental',
- badge: getPluginsSectionPresentation().badge
+ badge: getPluginsSectionPresentation(t).badge
}
]
: []),
@@ -166,46 +159,47 @@ export function buildRemoteSettingsSections(
const representativeRepo = reposById.get(representativeRepoId) ?? repos[0]
const hostSummary =
setups.length > 1
- ? translate(
- 'auto.hooks.useSettingsNavigationMetadata.projectHostsSummary',
- '{{value0}} hosts',
- { value0: setups.length }
- )
+ ? t('auto.hooks.useSettingsNavigationMetadata.projectHostsSummary', '{{value0}} hosts', {
+ value0: setups.length
+ })
: (setups[0]?.path ?? representativeRepo.path)
return {
id: `repo-${representativeRepoId}`,
title: checkoutLabel ?? project.displayName,
description: `${getRepoKindLabel(project)} • ${hostSummary}`,
icon: SlidersHorizontal,
- searchEntries: getRepositoryPaneSearchEntries(representativeRepo, {
- windowsRuntimeSupported: isWindowsTerminalHost
- }),
+ searchEntries: getRepositoryPaneSearchEntries(
+ representativeRepo,
+ {
+ windowsRuntimeSupported: isWindowsTerminalHost
+ },
+ t
+ ),
group: 'repositories'
}
})
]
}
-function getDevToolsPaneSearchEntries(): SettingsNavSection['searchEntries'] {
+function getDevToolsPaneSearchEntries(
+ t: Translate = translate
+): SettingsNavSection['searchEntries'] {
return [
{
- title: translate(
+ title: t(
'auto.hooks.useSettingsNavigationMetadata.devSearchNotificationPlayground',
'Notification playground'
),
- description: translate(
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.devSearchNotificationPlaygroundDescription',
'Trigger representative toast and notification UI states.'
),
keywords: [
- translate('auto.hooks.useSettingsNavigationMetadata.devSearchKeywordDev', 'dev'),
- translate('auto.hooks.useSettingsNavigationMetadata.devSearchKeywordToast', 'toast'),
- translate('auto.hooks.useSettingsNavigationMetadata.devSearchKeywordSonner', 'sonner'),
- translate('auto.hooks.useSettingsNavigationMetadata.devSearchKeywordError', 'error'),
- translate(
- 'auto.hooks.useSettingsNavigationMetadata.devSearchKeywordNotification',
- 'notification'
- )
+ t('auto.hooks.useSettingsNavigationMetadata.devSearchKeywordDev', 'dev'),
+ t('auto.hooks.useSettingsNavigationMetadata.devSearchKeywordToast', 'toast'),
+ t('auto.hooks.useSettingsNavigationMetadata.devSearchKeywordSonner', 'sonner'),
+ t('auto.hooks.useSettingsNavigationMetadata.devSearchKeywordError', 'error'),
+ t('auto.hooks.useSettingsNavigationMetadata.devSearchKeywordNotification', 'notification')
]
}
]
diff --git a/src/renderer/src/hooks/settings-navigation-workflow-sections.ts b/src/renderer/src/hooks/settings-navigation-workflow-sections.ts
index 1eb055288bd..980ceed7f80 100644
--- a/src/renderer/src/hooks/settings-navigation-workflow-sections.ts
+++ b/src/renderer/src/hooks/settings-navigation-workflow-sections.ts
@@ -10,6 +10,7 @@ import { getQuickCommandsPaneSearchEntries } from '@/components/settings/quick-c
import { getShareSkillsSettingsSearchEntries } from '@/components/settings/skills/sharing/share-skills-settings-search'
import { getTasksPaneSearchEntries } from '@/components/settings/tasks/tasks-search'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import type { SettingsNavSection } from '@/lib/settings-navigation-types'
import {
BookOpen,
@@ -28,14 +29,15 @@ import type { SettingsNavigationBuildOptions } from './settings-navigation-build
export function buildWorkflowSettingsSections(
{ isWebClient }: SettingsNavigationBuildOptions,
- terminalPaneSearchEntries: SettingsNavSection['searchEntries']
+ terminalPaneSearchEntries: SettingsNavSection['searchEntries'],
+ t: Translate = translate
): SettingsNavSection[] {
const showDesktopOnlySettings = !isWebClient
return [
{
id: 'automations',
- title: translate('auto.hooks.useSettingsNavigationMetadata.automationsTitle', 'Automations'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.automationsTitle', 'Automations'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.automationsDescription',
'Schedule agent work and choose whether Automations appears in the sidebar.'
),
@@ -45,20 +47,20 @@ export function buildWorkflowSettingsSections(
},
{
id: 'artifacts',
- title: translate('auto.hooks.useSettingsNavigationMetadata.artifactsTitle', 'Artifacts'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.artifactsTitle', 'Artifacts'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.artifactsDescription',
'Share HTML and Markdown files with your team and manage their public links.'
),
icon: Files,
searchEntries: getArtifactsSettingsSearchEntries(),
group: 'workflows',
- badge: translate('auto.hooks.useSettingsNavigationMetadata.40d80bad8a', 'Beta')
+ badge: t('auto.hooks.useSettingsNavigationMetadata.40d80bad8a', 'Beta')
},
{
id: 'share-skills',
- title: translate('auto.hooks.useSettingsNavigationMetadata.shareSkillsTitle', 'Share Skills'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.shareSkillsTitle', 'Share Skills'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.shareSkillsDescription',
'Share your skills with an unlisted link. Anyone who has it can install them.'
),
@@ -66,20 +68,20 @@ export function buildWorkflowSettingsSections(
icon: BookOpen,
searchEntries: getShareSkillsSettingsSearchEntries(),
group: 'workflows',
- badge: translate('auto.hooks.useSettingsNavigationMetadata.40d80bad8a', 'Beta')
+ badge: t('auto.hooks.useSettingsNavigationMetadata.40d80bad8a', 'Beta')
},
{
id: 'session-history',
- title: translate('sessionHistory.settings.title', 'Agent Session Search'),
- description: translate(
+ title: t('sessionHistory.settings.title', 'Agent Session Search'),
+ description: t(
'sessionHistory.settings.description',
'Search everything your agents have said and done, on this computer and on any paired Orca server.'
),
icon: History,
searchEntries: [
{
- title: translate('sessionHistory.settings.indexComputers', 'Search inside sessions'),
- description: translate(
+ title: t('sessionHistory.settings.indexComputers', 'Search inside sessions'),
+ description: t(
'sessionHistory.settings.searchDescription',
'Turn on session search for this computer and paired servers, or clear search data.'
)
@@ -89,11 +91,8 @@ export function buildWorkflowSettingsSections(
},
{
id: 'git',
- title: translate(
- 'auto.hooks.useSettingsNavigationMetadata.09607cb0fe',
- 'Git & Source Control'
- ),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.09607cb0fe', 'Git & Source Control'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.ab4b21b58e',
'Branch naming, base refs, and Git AI Author.'
),
@@ -108,8 +107,8 @@ export function buildWorkflowSettingsSections(
},
{
id: 'tasks',
- title: translate('auto.hooks.useSettingsNavigationMetadata.85f4fd7710', 'Task Sources'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.85f4fd7710', 'Task Sources'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.tasksDescription',
'Connect providers, install the Linear skill, and choose what appears in Tasks.'
),
@@ -119,8 +118,8 @@ export function buildWorkflowSettingsSections(
},
{
id: 'terminal',
- title: translate('auto.hooks.useSettingsNavigationMetadata.a9fb10afca', 'Terminal'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.a9fb10afca', 'Terminal'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.c33bfd664c',
'Shells, renderer, sessions, and terminal behavior.'
),
@@ -130,8 +129,8 @@ export function buildWorkflowSettingsSections(
},
{
id: 'quick-commands',
- title: translate('auto.hooks.useSettingsNavigationMetadata.3fc3db144f', 'Quick Commands'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.3fc3db144f', 'Quick Commands'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.42ae40842f',
'Saved terminal commands, scoped globally or per project.'
),
@@ -143,8 +142,8 @@ export function buildWorkflowSettingsSections(
? [
{
id: 'browser',
- title: translate('auto.hooks.useSettingsNavigationMetadata.8c197f74a1', 'Browser'),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.8c197f74a1', 'Browser'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.e815fd01bd',
'Home page, link routing, and session cookies.'
),
@@ -158,11 +157,8 @@ export function buildWorkflowSettingsSections(
? [
{
id: 'mobile-emulator',
- title: translate(
- 'auto.hooks.useSettingsNavigationMetadata.1e761cff2b',
- 'Mobile Emulator'
- ),
- description: translate(
+ title: t('auto.hooks.useSettingsNavigationMetadata.1e761cff2b', 'Mobile Emulator'),
+ description: t(
'auto.hooks.useSettingsNavigationMetadata.3d65d3f1b9',
'Configure mobile emulator support for Orca and coding agents.'
),
@@ -174,13 +170,13 @@ export function buildWorkflowSettingsSections(
: []),
{
id: 'floating-workspace',
- title: translate('auto.hooks.useSettingsNavigationMetadata.65b19f5bde', 'Floating Workspace'),
+ title: t('auto.hooks.useSettingsNavigationMetadata.65b19f5bde', 'Floating Workspace'),
description: showDesktopOnlySettings
- ? translate(
+ ? t(
'auto.hooks.useSettingsNavigationMetadata.2d0659f6f0',
'Global terminal, browser, and markdown tabs.'
)
- : translate(
+ : t(
'auto.hooks.useSettingsNavigationMetadata.floatingWorkspaceWebDescription',
'Global terminal and markdown tabs.'
),
diff --git a/src/renderer/src/hooks/useInstalledAgentSkills.ts b/src/renderer/src/hooks/useInstalledAgentSkills.ts
index acb98adf0bb..65506bc4f3d 100644
--- a/src/renderer/src/hooks/useInstalledAgentSkills.ts
+++ b/src/renderer/src/hooks/useInstalledAgentSkills.ts
@@ -26,6 +26,7 @@ import {
} from './installed-agent-skills-change-event'
import { useActiveSkillDiscoveryRuntimeTarget } from './use-active-skill-discovery-runtime-target'
import { useMountedRef } from './useMountedRef'
+import { useTranslate } from '@/i18n/use-translate'
/** Placeholder key while the owning runtime is unknown; nothing is cached under it. */
const UNRESOLVED_RUNTIME_DISCOVERY_KEY = 'runtime:unresolved'
@@ -124,6 +125,7 @@ export function useInstalledAgentSkillNames(
skillNames: readonly string[],
options: InstalledAgentSkillOptions = {}
): InstalledAgentSkillState {
+ const t = useTranslate()
const { enabled = true, discoveryTarget, sourceKinds, agent } = options
const skillNamesKey = skillNames.map(normalizeSkillName).join('\n')
const candidateSkillNames = useMemo(() => skillNamesKey.split('\n'), [skillNamesKey])
@@ -325,7 +327,7 @@ export function useInstalledAgentSkillNames(
installed,
loading: loadingForRender,
settled,
- ...getInstalledAgentSkillVerdict(scan),
+ ...getInstalledAgentSkillVerdict(scan, t),
skills,
sources,
refresh: forceRefresh
diff --git a/src/renderer/src/hooks/useSettingsNavigationMetadata.ts b/src/renderer/src/hooks/useSettingsNavigationMetadata.ts
index f463b871761..042e2054a9c 100644
--- a/src/renderer/src/hooks/useSettingsNavigationMetadata.ts
+++ b/src/renderer/src/hooks/useSettingsNavigationMetadata.ts
@@ -35,43 +35,50 @@ import { buildRemoteSettingsSections } from './settings-navigation-remote-sectio
import { buildWorkflowSettingsSections } from './settings-navigation-workflow-sections'
import { useWindowsTerminalCapabilityOwnerKey } from './useWindowsTerminalCapabilityOwnerKey'
import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision'
+import { useTranslate, type Translate } from '@/i18n/use-translate'
export { isWebClientLocation } from '@/lib/web-client-location'
-export function buildSettingsNavigationMetadata({
- isMac,
- isWindows,
- isLocalWindowsHost = isWindows,
- isWindowsTerminalHost = isWindows,
- isWebClient,
- hostQueuesMessages = false,
- typedChatPermissions = false,
- managedBrowserCreationEnabled = !isWebClient,
- mobileEmulatorCreationEnabled = !isWebClient,
- isDev = import.meta.env.DEV,
- isLinearConnected = false,
- repos,
- projectGrouping
-}: {
- isMac: boolean
- isWindows: boolean
- isLocalWindowsHost?: boolean
- isWindowsTerminalHost?: boolean
- isWebClient: boolean
- hostQueuesMessages?: boolean
- typedChatPermissions?: boolean
- managedBrowserCreationEnabled?: boolean
- mobileEmulatorCreationEnabled?: boolean
- isDev?: boolean
- isLinearConnected?: boolean
- repos: readonly Repo[]
- projectGrouping?: ProjectGroupingModel
-}): SettingsNavSection[] {
- const terminalPaneSearchEntries = getTerminalPaneSearchEntries({
+export function buildSettingsNavigationMetadata(
+ {
+ isMac,
isWindows,
- isWindowsTerminalHost,
- isMac
- })
+ isLocalWindowsHost = isWindows,
+ isWindowsTerminalHost = isWindows,
+ isWebClient,
+ hostQueuesMessages = false,
+ typedChatPermissions = false,
+ managedBrowserCreationEnabled = !isWebClient,
+ mobileEmulatorCreationEnabled = !isWebClient,
+ isDev = import.meta.env.DEV,
+ isLinearConnected = false,
+ repos,
+ projectGrouping
+ }: {
+ isMac: boolean
+ isWindows: boolean
+ isLocalWindowsHost?: boolean
+ isWindowsTerminalHost?: boolean
+ isWebClient: boolean
+ hostQueuesMessages?: boolean
+ typedChatPermissions?: boolean
+ managedBrowserCreationEnabled?: boolean
+ mobileEmulatorCreationEnabled?: boolean
+ isDev?: boolean
+ isLinearConnected?: boolean
+ repos: readonly Repo[]
+ projectGrouping?: ProjectGroupingModel
+ },
+ t?: Translate
+): SettingsNavSection[] {
+ const terminalPaneSearchEntries = getTerminalPaneSearchEntries(
+ {
+ isWindows,
+ isWindowsTerminalHost,
+ isMac
+ },
+ t
+ )
const runtimeEnvironmentsSearchEntry = isWebClient
? getWebRuntimeEnvironmentsSearchEntry()
: getRuntimeEnvironmentsSearchEntry()
@@ -99,15 +106,16 @@ export function buildSettingsNavigationMetadata({
// Match SETTINGS_NAV_GROUPS order so Settings and Cmd+J keep siblings together.
return [
- ...buildCapabilitySettingsSections(options),
- ...buildSetupSettingsSections(options),
- ...buildWorkflowSettingsSections(options, terminalPaneSearchEntries),
- ...buildInterfaceSettingsSections(options),
- ...buildRemoteSettingsSections(options, runtimeEnvironmentsSearchEntry, reposById)
+ ...buildCapabilitySettingsSections(options, t),
+ ...buildSetupSettingsSections(options, t),
+ ...buildWorkflowSettingsSections(options, terminalPaneSearchEntries, t),
+ ...buildInterfaceSettingsSections(options, t),
+ ...buildRemoteSettingsSections(options, runtimeEnvironmentsSearchEntry, reposById, t)
]
}
export function useSettingsNavigationMetadata(): SettingsNavSection[] {
+ const t = useTranslate()
// The locale subscription must also invalidate the memo or labels retain the previous language.
const languageRevision = useUiLanguageRevision()
const repos = useAppStore((state) => state.repos)
@@ -158,24 +166,27 @@ export function useSettingsNavigationMetadata(): SettingsNavSection[] {
return useMemo(
() =>
- buildSettingsNavigationMetadata({
- isMac,
- isWindows,
- isLocalWindowsHost,
- isWindowsTerminalHost,
- isWebClient,
- hostQueuesMessages,
- typedChatPermissions,
- managedBrowserCreationEnabled,
- mobileEmulatorCreationEnabled,
- isDev: import.meta.env.DEV,
- isLinearConnected,
- repos,
- projectGrouping: {
- projects: projectHostSetupProjection.projects,
- projectHostSetups: projectHostSetupProjection.setups
- }
- }),
+ buildSettingsNavigationMetadata(
+ {
+ isMac,
+ isWindows,
+ isLocalWindowsHost,
+ isWindowsTerminalHost,
+ isWebClient,
+ hostQueuesMessages,
+ typedChatPermissions,
+ managedBrowserCreationEnabled,
+ mobileEmulatorCreationEnabled,
+ isDev: import.meta.env.DEV,
+ isLinearConnected,
+ repos,
+ projectGrouping: {
+ projects: projectHostSetupProjection.projects,
+ projectHostSetups: projectHostSetupProjection.setups
+ }
+ },
+ t
+ ),
// oxlint-disable-next-line react-hooks/exhaustive-deps -- translate() inside buildSettingsNavigationMetadata reads the UI language and catalogs implicitly.
[
isMac,
@@ -190,7 +201,8 @@ export function useSettingsNavigationMetadata(): SettingsNavSection[] {
isLinearConnected,
repos,
projectHostSetupProjection,
- languageRevision
+ languageRevision,
+ t
]
)
}
diff --git a/src/renderer/src/lib/project-skill-runtime.ts b/src/renderer/src/lib/project-skill-runtime.ts
index 6cc1f0e4b41..cc064ea49a4 100644
--- a/src/renderer/src/lib/project-skill-runtime.ts
+++ b/src/renderer/src/lib/project-skill-runtime.ts
@@ -4,6 +4,7 @@ import type { SkillDiscoveryTarget } from '../../../shared/skills'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import { resolveWindowsShellStartupFamily } from '../../../shared/windows-terminal-shell'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
export type ProjectAgentSkillRuntime = {
runtime: 'host' | 'wsl'
@@ -19,18 +20,19 @@ export function getProjectSkillDiscoveryTarget(
export function getProjectAgentSkillRuntime(
projectRuntime: ProjectExecutionRuntimeResolution | undefined,
- currentPlatform: NodeJS.Platform
+ currentPlatform: NodeJS.Platform,
+ t?: Translate
): ProjectAgentSkillRuntime | undefined {
if (!projectRuntime) {
return undefined
}
if (projectRuntime.status === 'repair-required') {
- return getWslAgentSkillRuntime(projectRuntime.repair.preferredRuntime.distro)
+ return getWslAgentSkillRuntime(projectRuntime.repair.preferredRuntime.distro, t)
}
if (projectRuntime.runtime.kind === 'wsl') {
- return getWslAgentSkillRuntime(projectRuntime.runtime.distro)
+ return getWslAgentSkillRuntime(projectRuntime.runtime.distro, t)
}
return {
@@ -57,7 +59,8 @@ export function getProjectAgentSkillTerminalShellOverride(
}
export function getProjectSkillInstallDisabledReason(
- projectRuntime: ProjectExecutionRuntimeResolution | undefined
+ projectRuntime: ProjectExecutionRuntimeResolution | undefined,
+ t: Translate = translate
): string | null {
if (projectRuntime?.status !== 'repair-required') {
return null
@@ -65,29 +68,30 @@ export function getProjectSkillInstallDisabledReason(
switch (projectRuntime.repair.reason) {
case 'wsl-unavailable':
- return translate(
+ return t(
'auto.lib.projectSkillRuntime.wslUnavailable',
'Project runtime needs WSL before this skill can be installed.'
)
case 'wsl-distro-required':
- return translate(
+ return t(
'auto.lib.projectSkillRuntime.distroRequired',
'Select a WSL distro for this project before installing this skill.'
)
case 'wsl-distro-missing':
- return translate(
+ return t(
'auto.lib.projectSkillRuntime.distroMissing',
'The selected WSL distro is unavailable. Choose an available distro or switch this project to Windows.'
)
}
}
-function getWslAgentSkillRuntime(distro: string | null): ProjectAgentSkillRuntime {
+function getWslAgentSkillRuntime(
+ distro: string | null,
+ t: Translate = translate
+): ProjectAgentSkillRuntime {
return {
runtime: 'wsl',
wslDistro: distro,
- label: distro
- ? `WSL ${distro}`
- : translate('auto.lib.projectSkillRuntime.wslDefault', 'WSL default')
+ label: distro ? `WSL ${distro}` : t('auto.lib.projectSkillRuntime.wslDefault', 'WSL default')
}
}
diff --git a/src/renderer/src/lib/task-provider-error-copy.ts b/src/renderer/src/lib/task-provider-error-copy.ts
index 0abdcaff955..c9ad383c1c2 100644
--- a/src/renderer/src/lib/task-provider-error-copy.ts
+++ b/src/renderer/src/lib/task-provider-error-copy.ts
@@ -1,5 +1,6 @@
import type { TaskProviderErrorCode } from '../../../shared/task-provider-failure'
import { translate } from '@/i18n/i18n'
+import type { Translate } from '@/i18n/use-translate'
import { displayIpcErrorMessage } from './ipc-error'
const COPY: Record string> = {
@@ -184,9 +185,9 @@ function isTaskProviderErrorCode(code: unknown): code is TaskProviderErrorCode {
return typeof code === 'string' && Object.hasOwn(COPY, code)
}
-export function taskProviderErrorText(error: unknown, errorCode?: unknown): string {
+export function taskProviderErrorText(error: unknown, errorCode?: unknown, t?: Translate): string {
const raw = typeof error === 'string' ? error : ''
- const message = displayIpcErrorMessage(raw) ?? raw
+ const message = displayIpcErrorMessage(raw, t) ?? raw
const code = isTaskProviderErrorCode(errorCode)
? errorCode
: Object.hasOwn(LEGACY_CODES, message)
diff --git a/src/renderer/src/main.tsx b/src/renderer/src/main.tsx
index bc8c5a7f7d7..f57ca3035ab 100644
--- a/src/renderer/src/main.tsx
+++ b/src/renderer/src/main.tsx
@@ -21,7 +21,7 @@ import { installTypingLatencyDiagnostic } from './lib/typing-latency/diagnostic'
import { installAppKeyboardRouter } from './lib/app-keyboard-router'
import { shouldEnableReactGrab } from './lib/react-grab-dev-gate'
import { I18nProvider } from './i18n/I18nProvider'
-import { translate } from './i18n/i18n'
+import { useTranslate } from './i18n/use-translate'
import { getOrCreateRendererRoot } from './lib/react-renderer-root'
import { primeTerminalWebglAddon } from './lib/pane-manager/pane-webgl-renderer'
import { SkillWarningPreviewLauncher } from './components/skills/SkillWarningPreviewLauncher'
@@ -70,13 +70,14 @@ if (!rootElement) {
}
function RendererRoot(): React.JSX.Element {
+ const t = useTranslate()
useTranslation()
return (
{
let names = displayNamesByList.get(plugins)
if (!names) {
@@ -173,7 +175,8 @@ export function installedPluginDisplayNames(
name: plugin.name,
publisher: plugin.publisher || null,
official: plugin.official
- }))
+ })),
+ t
)
displayNamesByList.set(plugins, names)
}
diff --git a/src/renderer/src/store/plugins/status-bar/plugin-status-bar-items.ts b/src/renderer/src/store/plugins/status-bar/plugin-status-bar-items.ts
index a8c09fa1d7a..ce1e32be17e 100644
--- a/src/renderer/src/store/plugins/status-bar/plugin-status-bar-items.ts
+++ b/src/renderer/src/store/plugins/status-bar/plugin-status-bar-items.ts
@@ -11,6 +11,7 @@ import {
ensurePluginPanelsLoaded,
type ActivePluginCommand
} from '../catalog/plugin-contribution-catalog'
+import type { Translate } from '../../../i18n/use-translate'
/** A status bar item of an enabled plugin, with its worker's changes applied. */
export type ActivePluginStatusBarItem = {
@@ -46,7 +47,8 @@ function watchPluginStatusBar(): void {
export function collectPluginStatusBarItems(
plugins: readonly PluginHostListEntry[],
- overrides: PluginStatusBarOverrides
+ overrides: PluginStatusBarOverrides,
+ t?: Translate
): ActivePluginStatusBarItem[] {
return plugins.filter(isLivePlugin).flatMap((plugin) =>
(plugin.statusBarItems ?? []).flatMap((declared) => {
@@ -55,7 +57,7 @@ export function collectPluginStatusBarItems(
return []
}
const command = plugin.commands.find((candidate) => candidate.id === declared.command)
- const names = installedPluginDisplayNames(plugins)
+ const names = installedPluginDisplayNames(plugins, t)
const pluginName = names.get(plugin.pluginKey) ?? plugin.name
return [
{
diff --git a/src/renderer/src/web/WebConnect.tsx b/src/renderer/src/web/WebConnect.tsx
index 325d50f9161..59f7b4c164e 100644
--- a/src/renderer/src/web/WebConnect.tsx
+++ b/src/renderer/src/web/WebConnect.tsx
@@ -14,7 +14,7 @@ import {
import { parseWebPairingInput } from './web-pairing'
import { WebRuntimeClient } from './web-runtime-client'
import type { RuntimeStatus } from '../../../shared/runtime-types'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { readWebDeviceKeySupport } from './web-device-key-support'
import { webSessionPairingGuidance } from './web-pairing-security-guidance'
@@ -30,6 +30,7 @@ export default function WebConnect({
confirmReplacingSavedServer = false,
onConnected
}: WebConnectProps): React.JSX.Element {
+ const t = useTranslate()
const existingEnvironment = readStoredWebRuntimeEnvironment()
const [name, setName] = useState(
(!confirmReplacingSavedServer && existingEnvironment?.name) || 'Orca Server'
@@ -39,7 +40,7 @@ export default function WebConnect({
const [connecting, setConnecting] = useState(false)
const parsedOffer = useMemo(() => parseWebPairingInput(pairingCode), [pairingCode])
const autoConnectAttempted = useRef(false)
- const sessionGuidance = webSessionPairingGuidance(readWebDeviceKeySupport())
+ const sessionGuidance = webSessionPairingGuidance(readWebDeviceKeySupport(), t)
const replacedEnvironment = confirmReplacingSavedServer ? existingEnvironment : null
const connect = async (): Promise => {
@@ -50,7 +51,7 @@ export default function WebConnect({
}
if (parsedOffer.scope === 'mobile') {
setError(
- translate(
+ t(
'auto.web.WebConnect.mobileScopeRejected',
'This QR code grants limited (mobile) access. To use the full web app, open the browser access link from Settings → Runtime Environments → Share this Orca server → New Link.'
)
@@ -79,7 +80,7 @@ export default function WebConnect({
// stamps it onto status.get so those links still fail before app entry.
if ((response.result as RuntimeStatus | null)?.deviceScope === 'mobile') {
setError(
- translate(
+ t(
'auto.web.WebConnect.mobileScopeRejected',
'This QR code grants limited (mobile) access. To use the full web app, open the browser access link from Settings → Runtime Environments → Share this Orca server → New Link.'
)
@@ -131,10 +132,10 @@ export default function WebConnect({
- {translate('auto.web.WebConnect.e3bcd082ac', 'Connect to Orca')}
+ {t('auto.web.WebConnect.e3bcd082ac', 'Connect to Orca')}
- {translate(
+ {t(
'auto.web.WebConnect.3affe7de3a',
'Paste a pairing URL from an Orca server that this browser can reach.'
)}
@@ -144,7 +145,7 @@ export default function WebConnect({
- {translate('auto.web.WebConnect.cb4d287238', 'Server name')}
+ {t('auto.web.WebConnect.cb4d287238', 'Server name')}
- {translate('auto.web.WebConnect.7a566540de', 'Pairing URL or code')}
+ {t('auto.web.WebConnect.7a566540de', 'Pairing URL or code')}
setPairingCode(event.target.value)}
- placeholder={translate('auto.web.WebConnect.27393856e4', 'orca://pair?code=...')}
+ placeholder={t('auto.web.WebConnect.27393856e4', 'orca://pair?code=...')}
autoComplete="off"
spellCheck={false}
/>
@@ -172,7 +173,7 @@ export default function WebConnect({
- {translate(
+ {t(
'auto.web.WebConnect.replaceSavedServer',
'This link connects to a different server than "{{name}}" ({{endpoint}}). Connect only if you trust the endpoint below.',
{
@@ -192,7 +193,7 @@ export default function WebConnect({
{parsedOffer && (
- {translate('auto.web.WebConnect.4a4c017be1', 'Endpoint:')}{' '}
+ {t('auto.web.WebConnect.4a4c017be1', 'Endpoint:')}{' '}
{parsedOffer.endpoint}
)}
@@ -206,12 +207,12 @@ export default function WebConnect({
{replacedEnvironment ? (
- {translate('auto.web.WebConnect.keepSavedServer', 'Keep saved server')}
+ {t('auto.web.WebConnect.keepSavedServer', 'Keep saved server')}
) : (
- {translate('auto.web.WebConnect.2cf9e5a294', 'Clear saved server')}
+ {t('auto.web.WebConnect.2cf9e5a294', 'Clear saved server')}
)}
)}
- {translate('auto.web.WebConnect.b411ec0069', 'Connect')}
+ {t('auto.web.WebConnect.b411ec0069', 'Connect')}
diff --git a/src/renderer/src/web/WebPairingSecurityNotice.tsx b/src/renderer/src/web/WebPairingSecurityNotice.tsx
index abe50d5e5aa..74ba17eaf8a 100644
--- a/src/renderer/src/web/WebPairingSecurityNotice.tsx
+++ b/src/renderer/src/web/WebPairingSecurityNotice.tsx
@@ -1,17 +1,19 @@
import { useState } from 'react'
import { ShieldAlert, X } from 'lucide-react'
import { Button } from '@/components/ui/button'
-import { translate } from '@/i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { readWebDeviceKeySupport } from './web-device-key-support'
import { webPairingSecurityGuidance } from './web-pairing-security-guidance'
import { readStoredWebRuntimeEnvironment } from './web-runtime-environment'
/** A small corner notice while this browser holds its pairing in a weaker form. */
export function WebPairingSecurityNotice(): React.JSX.Element | null {
+ const t = useTranslate()
const [hidden, setHidden] = useState(false)
const guidance = webPairingSecurityGuidance(
readWebDeviceKeySupport(),
- readStoredWebRuntimeEnvironment()
+ readStoredWebRuntimeEnvironment(),
+ t
)
if (hidden || !guidance) {
return null
@@ -28,7 +30,7 @@ export function WebPairingSecurityNotice(): React.JSX.Element | null {
variant="ghost"
size="icon-xs"
onClick={() => setHidden(true)}
- aria-label={translate('auto.web.pairingSecurity.hide', 'Hide')}
+ aria-label={t('auto.web.pairingSecurity.hide', 'Hide')}
>
diff --git a/src/renderer/src/web/main.tsx b/src/renderer/src/web/main.tsx
index 4ee7f8f8afc..73928fa0249 100644
--- a/src/renderer/src/web/main.tsx
+++ b/src/renderer/src/web/main.tsx
@@ -20,7 +20,7 @@ import { installWebPreloadApi } from './web-preload-api'
import { initWebDeviceKeySupport } from './web-device-key-support'
import { WebPairingSecurityNotice } from './WebPairingSecurityNotice'
import { I18nProvider } from '../i18n/I18nProvider'
-import { translate } from '../i18n/i18n'
+import { useTranslate } from '@/i18n/use-translate'
import { installOsFileDropCancellationGuard } from '../lib/os-file-drop-cancellation-guard'
import { installBodyOverlayAttributes } from '../lib/body-overlay-attributes'
import { installAppKeyboardRouter } from '../lib/app-keyboard-router'
@@ -91,13 +91,14 @@ function WebRoot(): React.JSX.Element {
}
function WebRootBoundary(): React.JSX.Element {
+ const t = useTranslate()
useTranslation()
return (
!endpoint.deviceToken.startsWith(MIGRATED_DEVICE_TOKEN_PREFIX)
)
return storesCode
- ? translate(
+ ? t(
'auto.web.pairingSecurity.storedCodeNoEd25519',
'This browser keeps a reusable pairing code, because it cannot create secure sign-in keys (Ed25519). Use a current browser and pair again for a safer pairing.'
)
@@ -31,9 +33,12 @@ export function webPairingSecurityGuidance(
}
/** Shown before and after pairing when this browser can only pair for the current tab. */
-export function webSessionPairingGuidance(support: WebDeviceKeySupport | null): string | null {
+export function webSessionPairingGuidance(
+ support: WebDeviceKeySupport | null,
+ t: Translate = translate
+): string | null {
return needsGuidance(support)
- ? translate(
+ ? t(
'auto.web.pairingSecurity.sessionNoEd25519',
'This pairing lasts only while this tab is open, because this browser cannot create secure sign-in keys (Ed25519). Use a current browser for a pairing it remembers.'
)