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
+4 -4
View File
@@ -165,12 +165,12 @@ export function isSupportedImageExtension(fileName: string): boolean {
export function fileToBase64(file: File): Promise<FileToBase64Result> {
return new Promise((resolve, reject) => {
if (!file) {
reject(new Error('No file provided'));
reject(new Error('未提供文件'));
return;
}
if (!isFileSizeValid(file.size)) {
reject(new Error(`File size exceeds the limit (${MAX_FILE_SIZE / 1024 / 1024} MB)`));
reject(new Error(`文件大小超出限制(最大 ${MAX_FILE_SIZE / 1024 / 1024} MB`));
return;
}
@@ -192,7 +192,7 @@ export function fileToBase64(file: File): Promise<FileToBase64Result> {
};
reader.onerror = () => {
reject(new Error('Failed to read file'));
reject(new Error('读取文件失败'));
};
reader.readAsDataURL(file);
@@ -296,7 +296,7 @@ export function base64ToBlob(input: string): Base64ToBlobResult {
const cleaned = prefixMatch ? trimmed.slice(prefixMatch[0].length) : trimmed;
if (!isValidBase64(cleaned)) {
throw new Error('Invalid Base64 string');
throw new Error('无效的 Base64 字符串');
}
const bytes = base64ToBytes(cleaned);