diff --git a/ui/src/i18n/lib/translate.ts b/ui/src/i18n/lib/translate.ts index 74b050e2a63..badd868956e 100644 --- a/ui/src/i18n/lib/translate.ts +++ b/ui/src/i18n/lib/translate.ts @@ -38,7 +38,7 @@ class I18nManager { // Lazy load translations if needed if (!this.translations[locale]) { try { - let module; + let module: Record; if (locale === "zh-CN") { module = await import("../locales/zh-CN.ts"); } else if (locale === "zh-TW") { @@ -48,7 +48,7 @@ class I18nManager { } else { return; } - this.translations[locale] = module[locale.replace("-", "_")]; + this.translations[locale] = module[locale.replace("-", "_")] as TranslationMap; } catch (e) { console.error(`Failed to load locale: ${locale}`, e); return; diff --git a/ui/src/ui/views/overview.ts b/ui/src/ui/views/overview.ts index ac6feca5f36..f21f4b4a3fc 100644 --- a/ui/src/ui/views/overview.ts +++ b/ui/src/ui/views/overview.ts @@ -2,7 +2,7 @@ import { html } from "lit"; import type { GatewayHelloOk } from "../gateway.ts"; import type { UiSettings } from "../storage.ts"; import { t, i18n, type Locale } from "../../i18n/index.ts"; -import { formatAgo, formatDurationMs } from "../format.ts"; +import { formatRelativeTimestamp, formatDurationHuman } from "../format.ts"; import { formatNextRun } from "../presenter.ts"; export type OverviewProps = { @@ -27,7 +27,7 @@ export function renderOverview(props: OverviewProps) { const snapshot = props.hello?.snapshot as | { uptimeMs?: number; policy?: { tickIntervalMs?: number } } | undefined; - const uptime = snapshot?.uptimeMs ? formatDurationMs(snapshot.uptimeMs) : t("common.na"); + const uptime = snapshot?.uptimeMs ? formatDurationHuman(snapshot.uptimeMs) : t("common.na"); const tick = snapshot?.policy?.tickIntervalMs ? `${snapshot.policy.tickIntervalMs}ms` : t("common.na"); @@ -211,7 +211,7 @@ export function renderOverview(props: OverviewProps) {
${t("overview.snapshot.lastChannelsRefresh")}
- ${props.lastChannelsRefresh ? formatAgo(props.lastChannelsRefresh) : t("common.na")} + ${props.lastChannelsRefresh ? formatRelativeTimestamp(props.lastChannelsRefresh) : t("common.na")}