mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 18:12:52 +00:00
fix: correct function names in overview.ts and add type assertion in translate.ts
This commit is contained in:
committed by
Peter Steinberger
parent
f20bef3d79
commit
075317ab16
@@ -38,7 +38,7 @@ class I18nManager {
|
||||
// Lazy load translations if needed
|
||||
if (!this.translations[locale]) {
|
||||
try {
|
||||
let module;
|
||||
let module: Record<string, TranslationMap>;
|
||||
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;
|
||||
|
||||
@@ -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) {
|
||||
<div class="stat">
|
||||
<div class="stat-label">${t("overview.snapshot.lastChannelsRefresh")}</div>
|
||||
<div class="stat-value">
|
||||
${props.lastChannelsRefresh ? formatAgo(props.lastChannelsRefresh) : t("common.na")}
|
||||
${props.lastChannelsRefresh ? formatRelativeTimestamp(props.lastChannelsRefresh) : t("common.na")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user