From e0c45eab4903960be3f0db34c83f4d023731dd0b Mon Sep 17 00:00:00 2001 From: Jadilson Guedes Date: Mon, 16 Feb 2026 16:36:16 -0300 Subject: [PATCH] style: apply oxfmt formatting --- ui/src/i18n/lib/translate.ts | 2 +- ui/src/i18n/locales/en.ts | 3 ++- ui/src/i18n/locales/pt-BR.ts | 9 ++++++--- ui/src/i18n/test/translate.test.ts | 4 ++-- ui/src/ui/app-render.helpers.ts | 14 +++----------- ui/src/ui/app-render.ts | 2 +- ui/src/ui/app.ts | 2 +- ui/src/ui/views/overview.ts | 8 +++++--- 8 files changed, 21 insertions(+), 23 deletions(-) diff --git a/ui/src/i18n/lib/translate.ts b/ui/src/i18n/lib/translate.ts index ee95333d494..a56d7c3a26f 100644 --- a/ui/src/i18n/lib/translate.ts +++ b/ui/src/i18n/lib/translate.ts @@ -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 { diff --git a/ui/src/i18n/locales/en.ts b/ui/src/i18n/locales/en.ts index e8f06232d5c..c4a13871a81 100644 --- a/ui/src/i18n/locales/en.ts +++ b/ui/src/i18n/locales/en.ts @@ -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.", diff --git a/ui/src/i18n/locales/pt-BR.ts b/ui/src/i18n/locales/pt-BR.ts index b0422ee6053..71d272d6ff9 100644 --- a/ui/src/i18n/locales/pt-BR.ts +++ b/ui/src/i18n/locales/pt-BR.ts @@ -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.", diff --git a/ui/src/i18n/test/translate.test.ts b/ui/src/i18n/test/translate.test.ts index c485b2f9413..7a419104c6a 100644 --- a/ui/src/i18n/test/translate.test.ts +++ b/ui/src/i18n/test/translate.test.ts @@ -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(); }); diff --git a/ui/src/ui/app-render.helpers.ts b/ui/src/ui/app-render.helpers.ts index d4537634bb6..a6a82452ea7 100644 --- a/ui/src/ui/app-render.helpers.ts +++ b/ui/src/ui/app-render.helpers.ts @@ -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} @@ -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} diff --git a/ui/src/ui/app-render.ts b/ui/src/ui/app-render.ts index f1560eb138e..a05900c29c8 100644 --- a/ui/src/ui/app-render.ts +++ b/ui/src/ui/app-render.ts @@ -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; diff --git a/ui/src/ui/app.ts b/ui/src/ui/app.ts index bdc6df08240..57cfed9e1eb 100644 --- a/ui/src/ui/app.ts +++ b/ui/src/ui/app.ts @@ -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 { diff --git a/ui/src/ui/views/overview.ts b/ui/src/ui/views/overview.ts index d7089a81798..554a21db5e3 100644 --- a/ui/src/ui/views/overview.ts +++ b/ui/src/ui/views/overview.ts @@ -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();