refactor: 将 UI 文案改为中文并优化相关逻辑

- 在 background.ts 中将错误信息翻译为中文。
- 在 uiPopover.ts 中移除注释并更新弹出框标题。
- 在 Base64ConverterSection.tsx 中动态显示最大文件大小。
- 在 DecodeResultPaper.tsx 中简化标题文案注释。
- 在 GenerateButton.tsx 中动态显示生成进度和预计剩余时间。
- 在 base64Converter.ts 中将错误信息翻译为中文。
This commit is contained in:
雨霖铃
2026-06-19 00:53:56 +08:00
parent f0292acbb7
commit cd21d11fa1
6 changed files with 17 additions and 20 deletions
@@ -41,6 +41,7 @@ export default function Base64ConverterSection({ mode }: Base64ConverterSectionP
setCustomFileName,
resetAll,
safeFileSelect,
maxFileSizeStr,
} = useBase64Converter({ mode });
const handleDirectionChange = (next: Base64ConvertDirection) => {
@@ -136,7 +137,7 @@ export default function Base64ConverterSection({ mode }: Base64ConverterSectionP
{mode === 'image' ? '点击或拖拽图像到此处' : '点击或拖拽文件到此处'}
</span>
<span className="text-[10px] font-medium text-muted-foreground/60">
{'最大文件大小:{{max}}'}
{`最大文件大小:${maxFileSizeStr}`}
</span>
{mode === 'image' && (
<span className="text-[10px] font-medium text-muted-foreground/50">
@@ -14,7 +14,7 @@ import { Label } from '@/components/ui/label';
import { formatBytes } from '@/utils/format';
interface DecodeResultPaperProps {
/** 标题文案,由调用方传入 i18n key 对应的值(如 decodedFileOutput / decodedImageOutput */
/** 标题文案 */
title: string;
/** 解码后推断的 MIME 类型 */
mimeType: string;
@@ -35,7 +35,7 @@ export default function GenerateButton({
{progress && (
<div className="space-y-2">
<div className="flex items-center justify-between text-xs text-muted-foreground">
<span>{'已生成 {{current}} / {{total}} 条'}</span>
<span>{`已生成 ${progress.generated} / ${progress.total}`}</span>
<span>{progress.progress}%</span>
</div>
<div className="h-2 bg-muted rounded-full overflow-hidden">
@@ -46,7 +46,7 @@ export default function GenerateButton({
</div>
{progress.estimatedTimeLeft !== undefined && (
<p className="text-xs text-muted-foreground text-center">
{'预计剩余 {{time}} 秒'}
{`预计剩余 ${progress.estimatedTimeLeft}`}
</p>
)}
</div>