mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user