- lib/vocab + the `vocab` locale area: TMDB crew jobs and departments, auto-tags (D1 A: the data
stays English, the catalog is named at its one source, useTags), built-in download profiles,
YouTube topics; held key-for-key to the backend's own lists by backendIds.contract.
- Countries by ISO code: TMDB parse stores {code, name}; rows stored before are coded from TMDB's
own country list in one request (run_enrich); Intl names them, historic codes (YU, SU, XI…)
from the catalog.
- Player tracks named from the language tag, forced/SDH flags and codec tail, not Plex's
server-language displayTitle; no invented "Audio N" on the server.
- Download lifecycle notices (shared / expiring / expired / evicted) named from data; the share
notice carries the title.
- Scheduler: the job result rides along as data and is named per key (dashboard + run notice).
- Invite status named; a render crash's notice no longer shows the engine's English message.
- Fix: YouTube links …/wiki/Humour, the tagger looked for "Humor" — Comedy never came from a topic.
23 lines
1.1 KiB
TypeScript
23 lines
1.1 KiB
TypeScript
import type { TFunction } from "i18next";
|
|
import type { JobResult } from "./api";
|
|
import { formatNumber } from "./format";
|
|
import { vocabKey } from "./vocab";
|
|
|
|
/** A scheduler job's result in the reader's language (E30): "új videó: 3 · sikertelen: 0". The server
|
|
* stored "new=3, failed=0" — English keys, a Python dict repr for a nested phase. A count's key is
|
|
* named from `scheduler.result`, a `skipped` / `reason` word from `scheduler.skip`; an unnamed key or
|
|
* word shows as it is, and an `error` stays the upstream's own text (it is diagnostic). */
|
|
export function jobResultText(t: TFunction, result: JobResult): string {
|
|
return Object.entries(result)
|
|
.map(([key, value]) => {
|
|
const label = t(`scheduler.result.${key}`, { defaultValue: key.replace(/_/g, " ") });
|
|
if (typeof value === "number") return `${label}: ${formatNumber(value)}`;
|
|
if (typeof value === "string")
|
|
return key === "error"
|
|
? `${label}: ${value}`
|
|
: `${label}: ${t(`scheduler.skip.${vocabKey(value)}`, { defaultValue: value })}`;
|
|
return `${label} (${jobResultText(t, value)})`;
|
|
})
|
|
.join(" · ");
|
|
}
|