feat(i18n): translate remaining components (HU/EN/DE)

Feed, VideoCard, Sidebar, PlayerModal, Channels, Stats, SettingsPanel,
OnboardingWizard, NotificationCenter, Toaster, ErrorBoundary and the relativeTime
helper are now fully translated in Hungarian, English and German, each with its own
locale area file (auto-loaded). Key parity verified across all three languages.
This commit is contained in:
npeter83 2026-06-15 00:47:04 +02:00
parent 941fb7d756
commit ea317c0009
45 changed files with 1522 additions and 355 deletions

View file

@ -1,28 +1,30 @@
import i18n from "../i18n";
export function relativeTime(iso: string | null): string {
if (!iso) return "";
const then = new Date(iso).getTime();
const secs = Math.max(0, (Date.now() - then) / 1000);
const units: [number, string][] = [
[60, "s"],
[3600, "min"],
[86400, "h"],
[604800, "d"],
[2592000, "wk"],
[31536000, "mo"],
[60, "time.secondsAgo"],
[3600, "time.minutesAgo"],
[86400, "time.hoursAgo"],
[604800, "time.daysAgo"],
[2592000, "time.weeksAgo"],
[31536000, "time.monthsAgo"],
];
if (secs < 60) return "just now";
if (secs < 60) return i18n.t("time.justNow");
for (let i = 0; i < units.length - 1; i++) {
const [, label] = units[i];
const [, key] = units[i];
const next = units[i + 1][0];
if (secs < next) {
const v = Math.floor(secs / units[i][0]);
return `${v} ${label} ago`;
return i18n.t(key, { count: v });
}
}
const years = Math.floor(secs / 31536000);
if (years >= 1) return `${years} yr ago`;
if (years >= 1) return i18n.t("time.yearsAgo", { count: years });
const months = Math.floor(secs / 2592000);
return `${months} mo ago`;
return i18n.t("time.monthsAgo", { count: months });
}
export function formatDuration(sec: number | null): string {