The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { mFallback, msg } from "gt-i18n"; |
| 2 | import type { MFunctionType } from "gt-i18n/types"; |
| 3 | |
| 4 | import type { ZipErrorCode } from "./zipError.ts"; |
| 5 | |
| 6 | /** Translatable text for each `ZipError` code. Keep it out of worker imports. */ |
| 7 | export const ZIP_ERROR_MESSAGES: Record<ZipErrorCode, string> = { |
| 8 | "file-too-large": msg("Preview limited to files under 50 MB."), |
| 9 | "archive-too-many-entries": msg("This archive contains more than 2,048 entries."), |
| 10 | "archive-path-too-long": msg("An archive path is too long to preview."), |
| 11 | "archive-expanded-too-large": msg( |
| 12 | "The expanded archive exceeds the preview size or compression ratio limit.", |
| 13 | ), |
| 14 | "zip-unreadable": msg("This is not a readable ZIP archive."), |
| 15 | "zip64-unsupported": msg("Unsupported ZIP64 directory."), |
| 16 | "zip64-damaged": msg("This ZIP64 directory is too large or damaged."), |
| 17 | "zip-directory-damaged": msg("This ZIP directory is damaged."), |
| 18 | }; |
| 19 | |
| 20 | export function zipErrorText(code: ZipErrorCode, resolve: MFunctionType = mFallback): string { |
| 21 | return resolve(ZIP_ERROR_MESSAGES[code]); |
| 22 | } |