fix(web): use i18n translation for hardcoded "Create Session" strings (#259)

Replace hardcoded English strings with translation function calls
in SpawnSession.tsx and router.tsx. Add newSession.title key for
the NewSessionPage header to match the newSession.* namespace.
This commit is contained in:
METO
2026-03-07 14:49:57 +08:00
committed by GitHub
parent 4982e2dbc0
commit 446649576c
4 changed files with 9 additions and 4 deletions
+5 -3
View File
@@ -5,6 +5,7 @@ import { Button } from '@/components/ui/button'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { usePlatform } from '@/hooks/usePlatform'
import { useSpawnSession } from '@/hooks/mutations/useSpawnSession'
import { useTranslation } from '@/lib/use-translation'
type SessionType = 'simple' | 'worktree'
@@ -23,6 +24,7 @@ export function SpawnSession(props: {
onCancel: () => void
}) {
const { haptic } = usePlatform()
const { t } = useTranslation()
const [directory, setDirectory] = useState('')
const [sessionType, setSessionType] = useState<SessionType>('simple')
const [worktreeName, setWorktreeName] = useState('')
@@ -60,7 +62,7 @@ export function SpawnSession(props: {
<div className="p-3">
<Card>
<CardHeader className="pb-2">
<CardTitle>Create Session</CardTitle>
<CardTitle>{t('spawn.title')}</CardTitle>
<CardDescription className="truncate">
{machineTitle}
</CardDescription>
@@ -154,13 +156,13 @@ export function SpawnSession(props: {
onClick={props.onCancel}
disabled={isPending}
>
Cancel
{t('spawn.cancel')}
</Button>
<Button
onClick={spawn}
disabled={isPending || !directory.trim()}
>
{isPending ? 'Creating' : 'Create Session'}
{isPending ? t('spawn.creating') : t('spawn.create')}
</Button>
</div>
</div>