fix(i18n): a failed RSS poll over one channel reads as one, and keeps its stops
rss_all_failed is a plural pair counted on the raw total (the values are formatted strings, which pick no plural form); both sentences end with a stop. The Hungarian 'show N more' uses the house's megjelenítése.
This commit is contained in:
@@ -81,13 +81,24 @@ describe("a failed run", () => {
|
||||
const t = i18n.getFixedT("hu");
|
||||
expect(jobRunText(t, run, "hu").body).toBe(
|
||||
"Az RSS-hírcsatorna egyik csatornánál sem válaszolt (1399) — az első: UCx, HTTP 404. " +
|
||||
"Az API-n át beolvasva helyette: 0",
|
||||
"Az API-n át beolvasva helyette: 0.",
|
||||
);
|
||||
expect(jobFailureText(t, { ...run.result, cause: "transport" }, "hu")).toContain(
|
||||
"UCx, nem érhető el.",
|
||||
);
|
||||
});
|
||||
|
||||
// E31 S5: the server raises it for an instance with one subscription too ("none of the 1 channels").
|
||||
it("reads one channel as one, and keeps its stop", () => {
|
||||
const t = i18n.getFixedT("en");
|
||||
expect(jobFailureText(t, { ...run.result, total: 1 }, "en")).toBe(
|
||||
"The RSS feed did not answer for the one channel, UCx: HTTP 404. Read through the API instead: 0.",
|
||||
);
|
||||
expect(jobFailureText(t, run.result, "en")).toMatch(
|
||||
/^The RSS feed answered for none of the 1,399 channels .*: 0\.$/,
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps any other failure's own text", () => {
|
||||
const t = i18n.getFixedT("hu");
|
||||
expect(jobRunText(t, { ...run, summary: "Plex returned 500", result: null }, "hu").body).toBe(
|
||||
|
||||
@@ -48,7 +48,10 @@ export function jobFailureText(t: TFunction, result: unknown, lang: string): str
|
||||
for (const [k, v] of Object.entries(params))
|
||||
values[k] = typeof v === "number" ? formatNumber(v, lang) : String(v);
|
||||
if (typeof params.cause === "string") values.cause = rssCause(t, params.cause);
|
||||
return t(`scheduler.failure.${failure}`, { ...values, defaultValue: "" }) || null;
|
||||
// A failure counted over `total` reads as a plural pair: i18next picks the form from a NUMERIC
|
||||
// count, and the formatted values above are strings ("1 399" would pick none).
|
||||
const count = typeof params.total === "number" ? params.total : undefined;
|
||||
return t(`scheduler.failure.${failure}`, { ...values, count, defaultValue: "" }) || null;
|
||||
}
|
||||
|
||||
/** Why a feed did not answer, from the poll's reason code (`http_404`, `transport`, …). */
|
||||
|
||||
Reference in New Issue
Block a user