fix(web): keep trajectory toolbar Duration/Turns/Calls/Export untranslated
Show the four toolbar terms in English even in the Simplified Chinese dictionary, including their tooltips, aria labels, and the export failure message, and update the pinned-zh specs to match.
This commit is contained in:
@@ -55,7 +55,7 @@ export function apply(ctx: Context): void {
|
||||
const response = await fetch(url)
|
||||
if (!response.ok) {
|
||||
const detail = await response.text().catch(() => '')
|
||||
throw new Error(`导出失败:HTTP ${response.status}${detail === '' ? '' : ` ${detail}`}`)
|
||||
throw new Error(`Export failed: HTTP ${response.status}${detail === '' ? '' : ` ${detail}`}`)
|
||||
}
|
||||
downloadBlob(await response.blob(), sessionLogZipFilename(sessionId))
|
||||
},
|
||||
|
||||
@@ -35,20 +35,20 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
||||
export const zh: Record<TrajectoryKey, string> = {
|
||||
'view.trajectory': '轨迹',
|
||||
'toolbar.aria': '轨迹工具栏',
|
||||
'toolbar.duration': '时长',
|
||||
'toolbar.useActualDuration': '使用实际时长',
|
||||
'toolbar.useEqualWidth': '使用等宽时长',
|
||||
'toolbar.duration': 'Duration',
|
||||
'toolbar.useActualDuration': 'Use actual duration',
|
||||
'toolbar.useEqualWidth': 'Use equal-width operations',
|
||||
'toolbar.actualTime': '实际时间',
|
||||
'toolbar.turns': '轮次',
|
||||
'toolbar.expandTurns': '展开轮次',
|
||||
'toolbar.collapseTurns': '折叠轮次',
|
||||
'toolbar.calls': '调用',
|
||||
'toolbar.expandCalls': '展开调用',
|
||||
'toolbar.collapseCalls': '折叠调用',
|
||||
'toolbar.export': '导出',
|
||||
'toolbar.exportAria': '导出会话日志',
|
||||
'toolbar.exporting': '导出中…',
|
||||
'toolbar.exportTitle': '导出会话日志(ZIP,含子代理)',
|
||||
'toolbar.turns': 'Turns',
|
||||
'toolbar.expandTurns': 'Expand turns',
|
||||
'toolbar.collapseTurns': 'Collapse turns',
|
||||
'toolbar.calls': 'Calls',
|
||||
'toolbar.expandCalls': 'Expand calls',
|
||||
'toolbar.collapseCalls': 'Collapse calls',
|
||||
'toolbar.export': 'Export',
|
||||
'toolbar.exportAria': 'Export session log',
|
||||
'toolbar.exporting': 'Exporting…',
|
||||
'toolbar.exportTitle': 'Export session log (ZIP, includes subagents)',
|
||||
'toolbar.search': '搜索轨迹',
|
||||
'toolbar.searchPlaceholder': '搜索',
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('TrajectoryToolbar export', () => {
|
||||
it('renders the export button and dispatches the export callback on click', () => {
|
||||
const onExport = vi.fn()
|
||||
render(<TrajectoryToolbar {...baseProps({ onExport })} />)
|
||||
const button = screen.getByRole('button', { name: '导出会话日志' })
|
||||
const button = screen.getByRole('button', { name: 'Export session log' })
|
||||
fireEvent.click(button)
|
||||
expect(onExport).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
@@ -47,15 +47,15 @@ describe('TrajectoryToolbar export', () => {
|
||||
it('disables the button while an export is in flight and blocks dispatch', () => {
|
||||
const onExport = vi.fn()
|
||||
render(<TrajectoryToolbar {...baseProps({ exporting: true, onExport })} />)
|
||||
const button = screen.getByRole('button', { name: '导出会话日志' }) as HTMLButtonElement
|
||||
const button = screen.getByRole('button', { name: 'Export session log' }) as HTMLButtonElement
|
||||
expect(button.disabled).toBe(true)
|
||||
fireEvent.click(button)
|
||||
expect(onExport).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('surfaces an export failure as the button title', () => {
|
||||
render(<TrajectoryToolbar {...baseProps({ exportError: '导出失败:internal boom' })} />)
|
||||
const button = screen.getByRole('button', { name: '导出会话日志' })
|
||||
expect(button.title).toBe('导出失败:internal boom')
|
||||
render(<TrajectoryToolbar {...baseProps({ exportError: 'Export failed: internal boom' })} />)
|
||||
const button = screen.getByRole('button', { name: 'Export session log' })
|
||||
expect(button.title).toBe('Export failed: internal boom')
|
||||
})
|
||||
})
|
||||
@@ -336,9 +336,9 @@ describe('tab switching in ConversationRoot', () => {
|
||||
expect(screen.getByRole('toolbar', { name: '轨迹工具栏' })).toBeTruthy()
|
||||
expect(screen.getByRole('region', { name: 'Trajectory timeline' })).toBeTruthy()
|
||||
expect(view.container.querySelector('[data-conversation-composer-overlay]')).toBeTruthy()
|
||||
fireEvent.click(screen.getByRole('button', { name: '折叠轮次' }))
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Collapse turns' }))
|
||||
expect(view.container.querySelector('[data-collapsed-summary="turn"]')).toBeTruthy()
|
||||
fireEvent.click(screen.getByRole('button', { name: '展开轮次' }))
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Expand turns' }))
|
||||
expect(screen.getByRole('row', { name: /USER/ })).toBeTruthy()
|
||||
expect(screen.queryByTestId('chat-body')).toBeNull()
|
||||
await vi.waitFor(() => {
|
||||
@@ -552,10 +552,10 @@ describe('tab switching in ConversationRoot', () => {
|
||||
expect(screen.getByRole('toolbar', { name: '轨迹工具栏' })).toBeTruthy()
|
||||
expect(screen.getByText('No timing data')).toBeTruthy()
|
||||
expect(screen.getByRole<HTMLButtonElement>('button', {
|
||||
name: '折叠轮次',
|
||||
name: 'Collapse turns',
|
||||
}).disabled).toBe(false)
|
||||
expect(screen.getByRole<HTMLButtonElement>('button', {
|
||||
name: '折叠调用',
|
||||
name: 'Collapse calls',
|
||||
}).disabled).toBe(false)
|
||||
expect(screen.queryByRole('row')).toBeNull()
|
||||
expect(screen.queryByText(/turns ·/)).toBeNull()
|
||||
@@ -1127,7 +1127,7 @@ describe('session log export', () => {
|
||||
const b = await bench(historySnapshot(NODES))
|
||||
mount(b.slots)
|
||||
fireEvent.click(screen.getByRole('tab', { name: 'Trajectory' }))
|
||||
fireEvent.click(screen.getByRole('button', { name: '导出会话日志' }))
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Export session log' }))
|
||||
await vi.waitFor(() => {
|
||||
expect(fetchMock).toHaveBeenCalledOnce()
|
||||
})
|
||||
@@ -1143,7 +1143,7 @@ describe('session log export', () => {
|
||||
const b = await bench(historySnapshot(NODES))
|
||||
mount(b.slots)
|
||||
fireEvent.click(screen.getByRole('tab', { name: 'Trajectory' }))
|
||||
fireEvent.click(screen.getByRole('button', { name: '导出会话日志' }))
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Export session log' }))
|
||||
await vi.waitFor(() => {
|
||||
const alert = screen.queryByRole('alert')
|
||||
expect(alert).not.toBeNull()
|
||||
@@ -1167,7 +1167,7 @@ describe('TrajectoryView branches', () => {
|
||||
setActualDuration={(value) => { firstDuration.set(value) }}
|
||||
/>,
|
||||
)
|
||||
const duration = screen.getByRole('button', { name: '使用实际时长' })
|
||||
const duration = screen.getByRole('button', { name: 'Use actual duration' })
|
||||
|
||||
expect(duration.getAttribute('aria-pressed')).toBe('false')
|
||||
fireEvent.click(duration)
|
||||
@@ -1183,7 +1183,7 @@ describe('TrajectoryView branches', () => {
|
||||
setActualDuration={(value) => { restoredDuration.set(value) }}
|
||||
/>,
|
||||
)
|
||||
expect(screen.getByRole('button', { name: '使用实际时长' }).getAttribute('aria-pressed'))
|
||||
expect(screen.getByRole('button', { name: 'Use actual duration' }).getAttribute('aria-pressed'))
|
||||
.toBe('true')
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user