style: apply oxfmt formatting

This commit is contained in:
Jadilson Guedes
2026-02-16 16:36:16 -03:00
committed by Peter Steinberger
parent 98ed2e7130
commit e0c45eab49
8 changed files with 21 additions and 23 deletions

View File

@@ -34,7 +34,7 @@ class I18nManager {
public async setLocale(locale: Locale) {
if (this.locale === locale) return;
// Lazy load translations if needed
if (!this.translations[locale]) {
try {

View File

@@ -91,7 +91,8 @@ export const en: TranslationMap = {
},
auth: {
required: "This gateway requires auth. Add a token or password, then click Connect.",
failed: "Auth failed. Re-copy a tokenized URL with {command}, or update the token, then click Connect.",
failed:
"Auth failed. Re-copy a tokenized URL with {command}, or update the token, then click Connect.",
},
insecure: {
hint: "This page is HTTP, so the browser blocks device identity. Use HTTPS (Tailscale Serve) or open {url} on the gateway host.",

View File

@@ -83,15 +83,18 @@ export const pt_BR: TranslationMap = {
title: "Notas",
subtitle: "Lembretes rápidos para configurações de controle remoto.",
tailscaleTitle: "Tailscale serve",
tailscaleText: "Prefira o modo serve para manter o gateway em loopback com autenticação tailnet.",
tailscaleText:
"Prefira o modo serve para manter o gateway em loopback com autenticação tailnet.",
sessionTitle: "Higiene de sessão",
sessionText: "Use /new ou sessions.patch para redefinir o contexto.",
cronTitle: "Lembretes de Cron",
cronText: "Use sessões isoladas para execuções recorrentes.",
},
auth: {
required: "Este gateway requer autenticação. Adicione um token ou senha e clique em Conectar.",
failed: "Falha na autenticação. Recopie uma URL com token usando {command}, ou atualize o token e clique em Conectar.",
required:
"Este gateway requer autenticação. Adicione um token ou senha e clique em Conectar.",
failed:
"Falha na autenticação. Recopie uma URL com token usando {command}, ou atualize o token e clique em Conectar.",
},
insecure: {
hint: "Esta página é HTTP, então o navegador bloqueia a identidade do dispositivo. Use HTTPS (Tailscale Serve) ou abra {url} no host do gateway.",

View File

@@ -21,10 +21,10 @@ describe("i18n", () => {
});
it("should fallback to English if key is missing in another locale", async () => {
// We haven't registered other locales in the test environment yet,
// We haven't registered other locales in the test environment yet,
// but the logic should fallback to 'en' map which is always there.
await i18n.setLocale("zh-CN");
// Since we don't mock the import, it might fail to load zh-CN,
// Since we don't mock the import, it might fail to load zh-CN,
// but let's assume it falls back to English for now.
expect(t("common.health")).toBeDefined();
});

View File

@@ -4,13 +4,13 @@ import type { AppViewState } from "./app-view-state.ts";
import type { ThemeTransitionContext } from "./theme-transition.ts";
import type { ThemeMode } from "./theme.ts";
import type { SessionsListResult } from "./types.ts";
import { t } from "../i18n/index.ts";
import { refreshChat } from "./app-chat.ts";
import { syncUrlWithSessionKey } from "./app-settings.ts";
import { OpenClawApp } from "./app.ts";
import { ChatState, loadChatHistory } from "./controllers/chat.ts";
import { icons } from "./icons.ts";
import { iconForTab, pathForTab, titleForTab, type Tab } from "./navigation.ts";
import { t } from "../i18n/index.ts";
type SessionDefaultsSnapshot = {
mainSessionKey?: string;
@@ -205,11 +205,7 @@ export function renderChatControls(state: AppViewState) {
});
}}
aria-pressed=${showThinking}
title=${
disableThinkingToggle
? t("chat.onboardingDisabled")
: t("chat.thinkingToggle")
}
title=${disableThinkingToggle ? t("chat.onboardingDisabled") : t("chat.thinkingToggle")}
>
${icons.brain}
</button>
@@ -226,11 +222,7 @@ export function renderChatControls(state: AppViewState) {
});
}}
aria-pressed=${focusActive}
title=${
disableFocusToggle
? t("chat.onboardingDisabled")
: t("chat.focusToggle")
}
title=${disableFocusToggle ? t("chat.onboardingDisabled") : t("chat.focusToggle")}
>
${focusIcon}
</button>

View File

@@ -1,6 +1,7 @@
import { html, nothing } from "lit";
import type { AppViewState } from "./app-view-state.ts";
import { parseAgentSessionKey } from "../../../src/routing/session-key.js";
import { t, i18n, type Locale } from "../i18n/index.ts";
import { refreshChatAvatar } from "./app-chat.ts";
import { renderUsageTab } from "./app-render-usage-tab.ts";
import { renderChatControls, renderTab, renderThemeToggle } from "./app-render.helpers.ts";
@@ -76,7 +77,6 @@ import { renderNodes } from "./views/nodes.ts";
import { renderOverview } from "./views/overview.ts";
import { renderSessions } from "./views/sessions.ts";
import { renderSkills } from "./views/skills.ts";
import { t, i18n, type Locale } from "../i18n/index.ts";
const AVATAR_DATA_RE = /^data:/i;
const AVATAR_HTTP_RE = /^https?:\/\//i;

View File

@@ -29,6 +29,7 @@ import type {
NostrProfile,
} from "./types.ts";
import type { NostrProfileFormState } from "./views/channels.nostr-profile-form.ts";
import { i18n, I18nController, type Locale } from "../i18n/index.ts";
import {
handleChannelConfigReload as handleChannelConfigReloadInternal,
handleChannelConfigSave as handleChannelConfigSaveInternal,
@@ -80,7 +81,6 @@ import { normalizeAssistantIdentity } from "./assistant-identity.ts";
import { loadAssistantIdentity as loadAssistantIdentityInternal } from "./controllers/assistant-identity.ts";
import { loadSettings, type UiSettings } from "./storage.ts";
import { type ChatAttachment, type ChatQueueItem, type CronFormState } from "./ui-types.ts";
import { i18n, I18nController, type Locale } from "../i18n/index.ts";
declare global {
interface Window {

View File

@@ -1,9 +1,9 @@
import { html } from "lit";
import type { GatewayHelloOk } from "../gateway";
import type { UiSettings } from "../storage";
import { t, i18n, type Locale } from "../../i18n";
import { formatAgo, formatDurationMs } from "../format";
import { formatNextRun } from "../presenter";
import { t, i18n, type Locale } from "../../i18n";
export type OverviewProps = {
connected: boolean;
@@ -28,8 +28,10 @@ export function renderOverview(props: OverviewProps) {
| { uptimeMs?: number; policy?: { tickIntervalMs?: number } }
| undefined;
const uptime = snapshot?.uptimeMs ? formatDurationMs(snapshot.uptimeMs) : t("common.na");
const tick = snapshot?.policy?.tickIntervalMs ? `${snapshot.policy.tickIntervalMs}ms` : t("common.na");
const tick = snapshot?.policy?.tickIntervalMs
? `${snapshot.policy.tickIntervalMs}ms`
: t("common.na");
const authHint = (() => {
if (props.connected || !props.lastError) return null;
const lower = props.lastError.toLowerCase();