import type { DownloadJob } from "./api"; // The i18n keys that explain a failed download, most specific first — the list form `t()` takes, so // the first key a locale has wins. A failure-catalog entry (`error_detail`, e.g. `facebook.login_wall`) // names what went wrong on that site and what to do; the category (`error_code`) is the generic // sentence, and the fallback when an older client meets a detail it has no copy for; a category it has // no copy for falls back to the unknown one, so the row never prints a key. One helper for the queue // row's headline and the failure window, so the two can never explain the same job differently. export function failCopyKeys( job: Pick, part: "short" | "body", ): string[] { const category = (code: string) => `downloads.errors.fail.cat.${code}.${part}`; const code = job.error_code || "unknown"; return [ ...(job.error_detail ? [`downloads.errors.fail.catalog.${job.error_detail}.${part}`] : []), category(code), ...(code === "unknown" ? [] : [category("unknown")]), ]; }