Skip to content

Commit

Permalink
i18n: improve the tranlation of snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
jingsam committed Aug 4, 2024
1 parent b182b15 commit 74f6244
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const DownloadSnippetModal = ({ id, ...props }: DownloadSnippetModalProps) => {
id: 'migration',
label: '迁移文件',
title: '下载为迁移文件',
description: `将代码片段下载到一个新的迁移文件,文件名为 \`${migrationName}\``,
description: `将代码段下载到一个新的迁移文件,文件名为 \`${migrationName}\``,
cli: generateMigrationCliCommand(id, migrationName),
npm: generateMigrationCliCommand(id, migrationName, true),
},
Expand All @@ -44,15 +44,15 @@ const DownloadSnippetModal = ({ id, ...props }: DownloadSnippetModalProps) => {
label: '种子文件',
title: '下载为种子文件',
description:
'如果你的查询包含示例数据,将代码片段追加到 `supabase/seed.sql` 的末尾',
'如果你的查询包含示例数据,将代码段追加到 `supabase/seed.sql` 的末尾',
cli: generateSeedCliCommand(id),
npm: generateSeedCliCommand(id, true),
},
{
id: 'sql',
label: 'SQL 文件',
title: '下载为 SQL 文件',
description: `直接将代码片段下载到一个新的 SQL 文件中,文件名为 \`${migrationName}.sql\``,
description: `直接将代码段下载到一个新的 SQL 文件中,文件名为 \`${migrationName}.sql\``,
cli: generateFileCliCommand(id, migrationName),
npm: generateFileCliCommand(id, migrationName, true),
},
Expand All @@ -63,7 +63,7 @@ const DownloadSnippetModal = ({ id, ...props }: DownloadSnippetModalProps) => {
hideFooter
showCloseButton
size="xlarge"
header={<p>通过 Supabase CLI 将代码片段下载到本地迁移文件</p>}
header={<p>通过 Supabase CLI 将代码段下载到本地迁移文件</p>}
{...props}
>
<div className="flex flex-col items-start justify-between gap-4 relative pt-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const MoveQueryModal = ({ visible, snippets = [], onClose }: MoveQueryMod
}

if (snippetContent === undefined) {
return toast.error('保存代码片段失败:无法获取代码片段的内容')
return toast.error('保存代码段失败:无法获取代码段的内容')
} else {
moveSnippetAsync({
projectRef: ref,
Expand All @@ -138,7 +138,7 @@ export const MoveQueryModal = ({ visible, snippets = [], onClose }: MoveQueryMod
)

toast.success(
`成功移动了 ${snippets.length === 1 ? `"${snippets[0].name}"` : `${snippets.length} 个代码片段`}${selectedId === 'root' ? '编辑器的根目录' : selectedFolder}`
`成功移动了 ${snippets.length === 1 ? `"${snippets[0].name}"` : `${snippets.length} 个代码段`}${selectedId === 'root' ? '编辑器的根目录' : selectedFolder}`
)
snippets.forEach((snippet) => {
snapV2.updateSnippet({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function getDiffTypeButtonLabel(diffType: DiffType) {
case DiffType.Addition:
return '接受新增'
case DiffType.NewSnippet:
return '创建新代码片段'
return '创建新代码段'
default:
throw new Error(`未知的 diff 类型 '${diffType}'`)
}
Expand All @@ -88,7 +88,7 @@ export function getDiffTypeDropdownLabel(diffType: DiffType) {
case DiffType.Addition:
return '对比为新增'
case DiffType.NewSnippet:
return '对比为新代码片段'
return '对比为新代码段'
default:
throw new Error(`未知的 diff 类型 '${diffType}'`)
}
Expand Down
6 changes: 3 additions & 3 deletions apps/studio/components/layouts/SQLEditorLayout/QueryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const QueryItem = ({

const onConfirmDelete = async () => {
if (!ref) return console.error('未找到项目号')
if (!id) return console.error('未找到代码片段 ID')
if (!id) return console.error('未找到代码段 ID')
deleteContent({ projectRef: ref, ids: [id] })
}

Expand Down Expand Up @@ -193,7 +193,7 @@ const QueryItem = ({
alert={
visibility === 'project'
? {
title: '此 SQL 代码片段会永远丢失',
title: '此 SQL 代码段会永远丢失',
description:
'删除查询也会从项目团队的所有成员中移除此查询。',
}
Expand Down Expand Up @@ -222,7 +222,7 @@ const QueryItem = ({
</li>
<li className="flex gap-3">
<Unlock />
<span>任何人都可以将它复制到个人代码片段收藏中</span>
<span>任何人都可以将它复制到个人代码段收藏中</span>
</li>
</ul>
</ConfirmationModal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const QueryItemActions = ({

const createPersonalCopy = async () => {
if (!ref) return console.error('未找到项目号')
if (!id) return console.error('未找到代码片段 ID')
if (!id) return console.error('未找到代码段 ID')
try {
const snippet = createSqlSnippetSkeleton({
id: uuidv4(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const SQLEditorMenu = ({ onViewOngoingQueries }: { onViewOngoingQueries:
<DropdownMenuContent align="end" side="bottom" className="w-48">
<DropdownMenuItem className="gap-x-2" onClick={() => handleNewQuery()}>
<FilePlus size={14} />
创建新的代码片段
创建新的代码段
</DropdownMenuItem>
<DropdownMenuItem className="gap-x-2" onClick={() => createNewFolder()}>
<FolderPlus size={14} />
Expand Down Expand Up @@ -240,7 +240,7 @@ export const SQLEditorMenu = ({ onViewOngoingQueries }: { onViewOngoingQueries:
variant={'destructive'}
alert={{
title: '本操作无法被撤销',
description: '一旦删除了选中的 SQL 代码片段将不能再恢复',
description: '一旦删除了选中的 SQL 代码段将不能再恢复',
}}
>
<p className="text-sm text-foreground-light">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const SQLEditorNavV1 = ({

{isError && (
<div className="px-4">
<AlertError error={error as ResponseError} subject="载入 SQL 代码片段失败" />
<AlertError error={error as ResponseError} subject="载入 SQL 代码段失败" />
</div>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ export const SQLEditorNav = ({ searchText: _searchText }: SQLEditorNavProps) =>
}

const onConfirmShare = () => {
if (!selectedSnippetToShare) return console.error('未找到代码片段 ID')
if (!selectedSnippetToShare) return console.error('未找到代码段 ID')
snapV2.shareSnippet(selectedSnippetToShare.id, 'project')
setSelectedSnippetToShare(undefined)
setShowSharedSnippets(true)
}

const onConfirmUnshare = () => {
if (!selectedSnippetToUnshare) return console.error('未找到代码片段 ID')
if (!selectedSnippetToUnshare) return console.error('未找到代码段 ID')
snapV2.shareSnippet(selectedSnippetToUnshare.id, 'user')
setSelectedSnippetToUnshare(undefined)
setShowPrivateSnippets(true)
Expand All @@ -201,7 +201,7 @@ export const SQLEditorNav = ({ searchText: _searchText }: SQLEditorNavProps) =>
if (!profile) return console.error('未找到用户资料')
if (!project) return console.error('未找到项目')
if (!projectRef) return console.error('未找到项目号')
if (!id) return console.error('未找到代码片段 ID')
if (!id) return console.error('未找到代码段 ID')

let sql: string = ''
if (!('content' in snippet)) {
Expand Down Expand Up @@ -542,7 +542,7 @@ export const SQLEditorNav = ({ searchText: _searchText }: SQLEditorNavProps) =>
</li>
<li className="flex gap-3">
<Unlock />
<span>任何人都可以将它复制到他们的个人代码片段收藏中</span>
<span>任何人都可以将它复制到他们的个人代码段收藏中</span>
</li>
</ul>
</ConfirmationModal>
Expand Down Expand Up @@ -584,7 +584,7 @@ export const SQLEditorNav = ({ searchText: _searchText }: SQLEditorNavProps) =>
alert={
(selectedSnippets[0]?.visibility as unknown as string) === 'project'
? {
title: '此 SQL 代码片段将永远丢失',
title: '此 SQL 代码段将永远丢失',
description:
'删除此查询也将从项目团队的所有成员中移除。',
}
Expand Down Expand Up @@ -612,7 +612,7 @@ export const SQLEditorNav = ({ searchText: _searchText }: SQLEditorNavProps) =>
alert={{
title: '此操作无法撤销',
description:
'此文件夹中的所有 SQL 代码片段也讲会被久删除,无法恢复。',
'此文件夹中的所有 SQL 代码段也讲会被久删除,无法恢复。',
}}
>
<p className="text-sm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const SQLEditorTreeViewItem = ({
onFocusCapture={(e) => e.stopPropagation()}
>
<Plus size={14} />
创建新的代码片段
创建新的代码段
</ContextMenuItem_Shadcn_>
)}
{onSelectRename !== undefined && isOwner && (
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/pages/project/[ref]/logs/explorer/recent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const LogsSavedPage: NextPageWithLayout = () => {
<Table
head={
<>
<Table.th>代码片段</Table.th>
<Table.th>代码段</Table.th>
<Table.th className="w-24">
<Button size="tiny" type="default" onClick={() => setRecentLogSnippets([])}>
清除历史
Expand Down

0 comments on commit 74f6244

Please sign in to comment.