feat(plex): every card rail in the reader's language; an episode in a poster rail stands as its show (E30 S1b)
The grid served Hungarian titles, but every other card surface (Discover rails, the show page's episodes, search, collections, the person page, playlists, Home's resume rail, hero and comfort shelf) served English. The card serializers now take a required keyword-only lang (a forgotten call site fails instead of going English), and each of those reads takes ?lang=hu, with the language in its query key. A Hungarian search finds an episode by its Hungarian title too. An episode on a poster rail showed its 16:9 still cropped into a poster, titled only with the episode name; it now shows the show's poster and name, with S·E · title under it (option A). Plex's generic season names (Season 1, Specials) are rebuilt from the number in the reader's language; a season with a name of its own keeps it. Home's comfort-shelf move wrote its optimistic order to the key without the language, which nothing read any more; it writes the query's own key.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useLayoutEffect } from "react";
|
||||
import { usePref, useSavePref } from "./usePref";
|
||||
import type { TFunction } from "i18next";
|
||||
import type { PlexCard } from "./api";
|
||||
|
||||
// The non-component half of the shared Plex "detail page" UI (see plexDetailUi): the per-user display
|
||||
@@ -149,3 +150,19 @@ export function epLabel(ep?: PlexCard | null): string | undefined {
|
||||
return `S${ep.season_number} · E${ep.episode_number}`;
|
||||
return ep.title;
|
||||
}
|
||||
|
||||
// Plex names seasons in the library's language ("Season 1", "Specials"), so a Hungarian reader got
|
||||
// English there (E30). A generic name is rebuilt from the number in the reader's language; a season
|
||||
// with a name of its own ("Book One: Water") keeps it.
|
||||
const GENERIC_SEASON = /^(season \d+|specials)$/i;
|
||||
|
||||
export function seasonTitle(
|
||||
se: { title?: string | null; season_number?: number | null },
|
||||
t: TFunction,
|
||||
): string {
|
||||
const n = se.season_number;
|
||||
if (se.title && !GENERIC_SEASON.test(se.title.trim())) return se.title;
|
||||
if (n === 0) return t("plex.specials");
|
||||
if (n != null) return t("plex.seasonTitle", { n });
|
||||
return se.title || t("plex.playlist.seasonUnknown");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user