Skip to content

Commit

Permalink
Finish localize SQL Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jingsam committed Jul 13, 2024
1 parent 92f202d commit 0a65bf7
Show file tree
Hide file tree
Showing 23 changed files with 326 additions and 326 deletions.
36 changes: 18 additions & 18 deletions apps/studio/components/interfaces/SQLEditor/OngoingQueriesPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const OngoingQueriesPanel = ({ visible, onClose }: OngoingQueriesPanel) =

const { mutate: abortQuery, isLoading } = useQueryAbortMutation({
onSuccess: () => {
toast.success(`Successfully aborted query (ID: ${selectedId})`)
toast.success(`成功地终止了查询(ID: ${selectedId}`)
setSelectedId(undefined)
},
})
Expand All @@ -72,8 +72,8 @@ export const OngoingQueriesPanel = ({ visible, onClose }: OngoingQueriesPanel) =
<SheetContent size="lg">
<SheetHeader>
<SheetTitle className="flex items-center gap-x-2">
Running queries on{' '}
{database?.identifier === project?.ref ? 'primary database' : 'read replica'}
查询正在运行在
{!database?.identifier || database?.identifier === project?.ref ? '数据库主节点上' : '数据库只读节点上'}
<Button
type="default"
className="px-1.5"
Expand All @@ -83,38 +83,38 @@ export const OngoingQueriesPanel = ({ visible, onClose }: OngoingQueriesPanel) =
/>
</SheetTitle>
<SheetDescription>
There {queries.length === 1 ? 'is' : 'are'}{' '}
<span className="text-foreground-light">{queries.length}</span> quer
{queries.length === 1 ? 'y' : 'ies'} currently running{' '}
{database?.identifier !== project?.ref ? `on replica ${database?.identifier}` : ''}
当前{queries.length === 1 ? '' : ''}{' '}
<span className="text-foreground-light">{queries.length}</span> 条查询
{queries.length === 1 ? '' : ''}正在运行在
{database?.identifier && database?.identifier !== project?.ref ? `数据库只读节点 ${database?.identifier}` : '数据库上'}
</SheetDescription>
</SheetHeader>
<div className="max-h-full h-full divide-y overflow-y-auto">
{isError && (
<div className="flex items-center justify-center h-full px-16">
<AlertError
subject="Failed to retrieve ongoing queries"
subject="无法检索到正在运行的查询"
error={error as ResponseError}
/>
</div>
)}
{queries.length === 0 && (
<div className="flex flex-col gap-y-2 items-center justify-center h-full text-foreground-light text-sm">
<span>
No queries are currently running on the{' '}
{database?.identifier !== project?.ref
? `read replica ${database?.identifier}`
当前没有查询运行在
{database?.identifier && database?.identifier !== project?.ref
? `数据只读节点 ${database?.identifier}`
: (databases ?? []).length > 1
? 'primary database'
: 'database'}
? '数据库主节点上'
: '数据库上'}
</span>
<Button
type="default"
loading={isLoadingOngoingQueries || isFetchingOngoingQueries}
icon={<RefreshCw />}
onClick={() => refetch()}
>
Refresh
刷新
</Button>
</div>
)}
Expand All @@ -135,7 +135,7 @@ export const OngoingQueriesPanel = ({ visible, onClose }: OngoingQueriesPanel) =
<p className="text-foreground-light text-xs">PID: {query.pid}</p>
<p className="text-foreground-light text-xs"></p>
<p className="text-foreground-light text-xs">
Started since: {dayjs(query.query_start).format('DD MMM YYYY HH:mm (ZZ)')}
开始于:{dayjs(query.query_start).format('DD MMM YYYY HH:mm (ZZ)')}
</p>
</div>
</div>
Expand All @@ -149,7 +149,7 @@ export const OngoingQueriesPanel = ({ visible, onClose }: OngoingQueriesPanel) =
onClick={() => setSelectedId(query.pid)}
/>
</TooltipTrigger_Shadcn_>
<TooltipContent_Shadcn_ side="bottom">Abort query</TooltipContent_Shadcn_>
<TooltipContent_Shadcn_ side="bottom">终止查询</TooltipContent_Shadcn_>
</Tooltip_Shadcn_>
</SheetSection>
))}
Expand All @@ -160,7 +160,7 @@ export const OngoingQueriesPanel = ({ visible, onClose }: OngoingQueriesPanel) =
<ConfirmationModal
loading={isLoading}
variant="warning"
title={`Confirm to abort this query? (ID: ${selectedId})`}
title={`确定要终止查询?(ID: ${selectedId}`}
visible={selectedId !== undefined}
onCancel={() => setSelectedId(undefined)}
onConfirm={() => {
Expand All @@ -172,7 +172,7 @@ export const OngoingQueriesPanel = ({ visible, onClose }: OngoingQueriesPanel) =
})
}}
>
<p className="text-sm">This will force the query to stop running.</p>
<p className="text-sm">此操作将强行终止查询运行。</p>
</ConfirmationModal>
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const sqlAiDisclaimerComment = `
-- Always verify the output before executing
`.trim()

export const untitledSnippetTitle = 'Untitled query'
export const untitledSnippetTitle = '未命名的查询'

export const destructiveSqlRegex = [/^(.*;)?\s*(drop|delete|truncate)\s/is]

Expand Down
Loading

0 comments on commit 0a65bf7

Please sign in to comment.