fix(i18n): numbers, units, dates and order in the UI language, and after a switch (E30 S3)

Every locale formatter takes the language as an argument. Under the React
Compiler a formatter that read the i18n singleton was memoized on its other
arguments, so a card kept "2 hr 4 min" after a switch to Hungarian; plexLang()
had the same flaw and left Plex queries in the old language. Components now
take the language from useTranslation, and the signature makes forgetting it
a type error.

- ratings, file sizes, stream stats: the language's decimal mark ("8,3")
- view and subscriber counts compact in the language ("1,2 E")
- seconds as the language's unit ("6 mp") in the sliders and the stats
- a person's birth and death dates as dates, not ISO strings
- A-Z lists by the shown name in the language's alphabet (compareText),
  the tag catalog re-sorted by its translated names
- lint local/locale-format (was date-format) also refuses Intl.NumberFormat
  outside lib/format.ts, localeCompare, and a component reading the language
  off the i18n singleton
This commit is contained in:
2026-09-29 22:39:57 +02:00
parent 67c9f10153
commit aac79ffa53
105 changed files with 1001 additions and 494 deletions
+9 -11
View File
@@ -46,17 +46,17 @@ describe("applyView", () => {
];
it("returns the stored order untouched with no sort and no grouping", () => {
expect(applyView(rows, columns, null, false)).toBe(rows);
expect(applyView(rows, columns, null, false, "en")).toBe(rows);
});
it("sorts by the named column", () => {
expect(titles(applyView(rows, columns, { key: "title", dir: "asc" }, false))).toEqual([
expect(titles(applyView(rows, columns, { key: "title", dir: "asc" }, false, "en"))).toEqual([
"alpha",
"bravo",
"charlie",
"delta",
]);
expect(titles(applyView(rows, columns, { key: "title", dir: "desc" }, false))).toEqual([
expect(titles(applyView(rows, columns, { key: "title", dir: "desc" }, false, "en"))).toEqual([
"delta",
"charlie",
"bravo",
@@ -65,7 +65,7 @@ describe("applyView", () => {
});
it("groups by channel, ordering the groups by name and sorting within each", () => {
expect(titles(applyView(rows, columns, { key: "title", dir: "asc" }, true))).toEqual([
expect(titles(applyView(rows, columns, { key: "title", dir: "asc" }, true, "en"))).toEqual([
"alpha", // Alpha
"bravo", // Alpha
"charlie", // Beta
@@ -74,7 +74,7 @@ describe("applyView", () => {
});
it("reverses the GROUP order too when the sort is descending", () => {
expect(titles(applyView(rows, columns, { key: "title", dir: "desc" }, true))).toEqual([
expect(titles(applyView(rows, columns, { key: "title", dir: "desc" }, true, "en"))).toEqual([
"delta", // Beta first, because the direction flips the group order as well
"charlie",
"bravo", // then Alpha
@@ -83,7 +83,7 @@ describe("applyView", () => {
});
it("groups without a sort by keeping each group's stored order", () => {
expect(titles(applyView(rows, columns, null, true))).toEqual([
expect(titles(applyView(rows, columns, null, true, "en"))).toEqual([
"alpha",
"bravo",
"delta",
@@ -93,11 +93,9 @@ describe("applyView", () => {
it("parks unknown durations at the end of an ascending sort, not at zero", () => {
const mixed = [v("1", "long", "A", 900), v("2", "live", "A", null), v("3", "short", "A", 30)];
expect(titles(applyView(mixed, columns, { key: "duration", dir: "asc" }, false))).toEqual([
"short",
"long",
"live",
]);
expect(titles(applyView(mixed, columns, { key: "duration", dir: "asc" }, false, "en"))).toEqual(
["short", "long", "live"],
);
});
});