mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 22:02:16 +00:00
chore(i18n): drop dead format.dateShort timeShort dateTime keys across six locales
The runtime never reads the format namespace — every locale-aware formatter routes through Intl.DateTimeFormat directly via src/lib/format-locale.ts. The keys were only verified by their own ordering smoke test, which is also removed.
This commit is contained in:
1 parent
e9a9e79edb
commit
e26e27b5ff
7 files changed
-99
No files matched your search
@@ -33,11 +33,6 @@
|
||||
"showPassword": "Passwort anzeigen",
|
||||
"hidePassword": "Passwort verbergen"
|
||||
},
|
||||
"format": {
|
||||
"dateShort": "{day}.{month}.{year}",
|
||||
"timeShort": "{hour}:{minute}",
|
||||
"dateTime": "{day}.{month}.{year} {hour}:{minute}"
|
||||
},
|
||||
"doctorReport": {
|
||||
"title": "Gesundheitsbericht",
|
||||
"subtitle": "HealthLog — Persönlicher Gesundheitsbericht",
|
||||
|
||||
@@ -33,11 +33,6 @@
|
||||
"showPassword": "Show password",
|
||||
"hidePassword": "Hide password"
|
||||
},
|
||||
"format": {
|
||||
"dateShort": "{month}/{day}/{year}",
|
||||
"timeShort": "{hour}:{minute}",
|
||||
"dateTime": "{month}/{day}/{year} {hour}:{minute}"
|
||||
},
|
||||
"doctorReport": {
|
||||
"title": "Health Report",
|
||||
"subtitle": "HealthLog — Personal Health Report",
|
||||
|
||||
@@ -33,11 +33,6 @@
|
||||
"showPassword": "Mostrar contraseña",
|
||||
"hidePassword": "Ocultar contraseña"
|
||||
},
|
||||
"format": {
|
||||
"dateShort": "{day}/{month}/{year}",
|
||||
"timeShort": "{hour}:{minute}",
|
||||
"dateTime": "{day}/{month}/{year} {hour}:{minute}"
|
||||
},
|
||||
"doctorReport": {
|
||||
"title": "Informe de salud",
|
||||
"subtitle": "HealthLog — Informe personal de salud",
|
||||
|
||||
@@ -33,11 +33,6 @@
|
||||
"showPassword": "Afficher le mot de passe",
|
||||
"hidePassword": "Masquer le mot de passe"
|
||||
},
|
||||
"format": {
|
||||
"dateShort": "{day}/{month}/{year}",
|
||||
"timeShort": "{hour}:{minute}",
|
||||
"dateTime": "{day}/{month}/{year} {hour}:{minute}"
|
||||
},
|
||||
"doctorReport": {
|
||||
"title": "Rapport de santé",
|
||||
"subtitle": "HealthLog — Rapport personnel de santé",
|
||||
|
||||
@@ -33,11 +33,6 @@
|
||||
"showPassword": "Mostra password",
|
||||
"hidePassword": "Nascondi password"
|
||||
},
|
||||
"format": {
|
||||
"dateShort": "{day}/{month}/{year}",
|
||||
"timeShort": "{hour}:{minute}",
|
||||
"dateTime": "{day}/{month}/{year} {hour}:{minute}"
|
||||
},
|
||||
"doctorReport": {
|
||||
"title": "Rapporto sanitario",
|
||||
"subtitle": "HealthLog — Rapporto personale di salute",
|
||||
|
||||
@@ -33,11 +33,6 @@
|
||||
"showPassword": "Pokaż hasło",
|
||||
"hidePassword": "Ukryj hasło"
|
||||
},
|
||||
"format": {
|
||||
"dateShort": "{day}.{month}.{year}",
|
||||
"timeShort": "{hour}:{minute}",
|
||||
"dateTime": "{day}.{month}.{year} {hour}:{minute}"
|
||||
},
|
||||
"doctorReport": {
|
||||
"title": "Raport zdrowotny",
|
||||
"subtitle": "HealthLog — Osobisty raport zdrowotny",
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/**
|
||||
* v1.4.27 B6 — `format.dateShort` / `timeShort` / `dateTime` ordering.
|
||||
*
|
||||
* Each shipped locale carries a `format.*` namespace that documents
|
||||
* its native date-pattern ordering as i18n strings. The actual
|
||||
* formatting still routes through `Intl.*` via
|
||||
* `src/lib/format-locale.ts`; the format keys exist so downstream
|
||||
* surfaces (PDF export, email templates, CSV docstrings) can render
|
||||
* the date hint without a JS context.
|
||||
*
|
||||
* This smoke test pins the ordering per locale so a copy-paste
|
||||
* regression that flips DD/MM to MM/DD on the French bundle would
|
||||
* fail fast.
|
||||
*/
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const MESSAGES = join(__dirname, "../../../../messages");
|
||||
|
||||
function loadFormat(locale: string): {
|
||||
dateShort: string;
|
||||
timeShort: string;
|
||||
dateTime: string;
|
||||
} {
|
||||
const bundle = JSON.parse(
|
||||
readFileSync(join(MESSAGES, `${locale}.json`), "utf8"),
|
||||
);
|
||||
const fmt = bundle.format as
|
||||
| { dateShort?: string; timeShort?: string; dateTime?: string }
|
||||
| undefined;
|
||||
if (!fmt || !fmt.dateShort || !fmt.timeShort || !fmt.dateTime) {
|
||||
throw new Error(`Locale ${locale} is missing the format namespace`);
|
||||
}
|
||||
return fmt as { dateShort: string; timeShort: string; dateTime: string };
|
||||
}
|
||||
|
||||
describe("locale-native format ordering", () => {
|
||||
it("DE renders day-month-year with dot separators", () => {
|
||||
const fmt = loadFormat("de");
|
||||
expect(fmt.dateShort).toBe("{day}.{month}.{year}");
|
||||
expect(fmt.dateTime).toBe("{day}.{month}.{year} {hour}:{minute}");
|
||||
expect(fmt.timeShort).toBe("{hour}:{minute}");
|
||||
});
|
||||
|
||||
it("EN renders month-day-year with slash separators", () => {
|
||||
const fmt = loadFormat("en");
|
||||
expect(fmt.dateShort).toBe("{month}/{day}/{year}");
|
||||
expect(fmt.dateTime).toBe("{month}/{day}/{year} {hour}:{minute}");
|
||||
expect(fmt.timeShort).toBe("{hour}:{minute}");
|
||||
});
|
||||
|
||||
it.each([["fr"], ["es"], ["it"]])(
|
||||
"%s renders day-month-year with slash separators (native ordering)",
|
||||
(locale) => {
|
||||
const fmt = loadFormat(locale);
|
||||
expect(fmt.dateShort).toBe("{day}/{month}/{year}");
|
||||
expect(fmt.dateTime).toBe("{day}/{month}/{year} {hour}:{minute}");
|
||||
expect(fmt.timeShort).toBe("{hour}:{minute}");
|
||||
},
|
||||
);
|
||||
|
||||
it("PL renders day-month-year with dot separators (native ordering)", () => {
|
||||
const fmt = loadFormat("pl");
|
||||
expect(fmt.dateShort).toBe("{day}.{month}.{year}");
|
||||
expect(fmt.dateTime).toBe("{day}.{month}.{year} {hour}:{minute}");
|
||||
expect(fmt.timeShort).toBe("{hour}:{minute}");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user