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) { public async setLocale(locale: Locale) {
if (this.locale === locale) return; if (this.locale === locale) return;
// Lazy load translations if needed // Lazy load translations if needed
if (!this.translations[locale]) { if (!this.translations[locale]) {
try { try {

View File

@@ -91,7 +91,8 @@ export const en: TranslationMap = {
}, },
auth: { auth: {
required: "This gateway requires auth. Add a token or password, then click Connect.", 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: { insecure: {
hint: "This page is HTTP, so the browser blocks device identity. Use HTTPS (Tailscale Serve) or open {url} on the gateway host.", 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", title: "Notas",
subtitle: "Lembretes rápidos para configurações de controle remoto.", subtitle: "Lembretes rápidos para configurações de controle remoto.",
tailscaleTitle: "Tailscale serve", 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", sessionTitle: "Higiene de sessão",
sessionText: "Use /new ou sessions.patch para redefinir o contexto.", sessionText: "Use /new ou sessions.patch para redefinir o contexto.",
cronTitle: "Lembretes de Cron", cronTitle: "Lembretes de Cron",
cronText: "Use sessões isoladas para execuções recorrentes.", cronText: "Use sessões isoladas para execuções recorrentes.",
}, },
auth: { auth: {
required: "Este gateway requer autenticação. Adicione um token ou senha e clique em Conectar.", required:
failed: "Falha na autenticação. Recopie uma URL com token usando {command}, ou atualize o token e clique em Conectar.", "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: { 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.", 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 () => { 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. // but the logic should fallback to 'en' map which is always there.
await i18n.setLocale("zh-CN"); 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. // but let's assume it falls back to English for now.
expect(t("common.health")).toBeDefined(); 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 { ThemeTransitionContext } from "./theme-transition.ts";
import type { ThemeMode } from "./theme.ts"; import type { ThemeMode } from "./theme.ts";
import type { SessionsListResult } from "./types.ts"; import type { SessionsListResult } from "./types.ts";
import { t } from "../i18n/index.ts";
import { refreshChat } from "./app-chat.ts"; import { refreshChat } from "./app-chat.ts";
import { syncUrlWithSessionKey } from "./app-settings.ts"; import { syncUrlWithSessionKey } from "./app-settings.ts";
import { OpenClawApp } from "./app.ts"; import { OpenClawApp } from "./app.ts";
import { ChatState, loadChatHistory } from "./controllers/chat.ts"; import { ChatState, loadChatHistory } from "./controllers/chat.ts";
import { icons } from "./icons.ts"; import { icons } from "./icons.ts";
import { iconForTab, pathForTab, titleForTab, type Tab } from "./navigation.ts"; import { iconForTab, pathForTab, titleForTab, type Tab } from "./navigation.ts";
import { t } from "../i18n/index.ts";
type SessionDefaultsSnapshot = { type SessionDefaultsSnapshot = {
mainSessionKey?: string; mainSessionKey?: string;
@@ -205,11 +205,7 @@ export function renderChatControls(state: AppViewState) {
}); });
}} }}
aria-pressed=${showThinking} aria-pressed=${showThinking}
title=${ title=${disableThinkingToggle ? t("chat.onboardingDisabled") : t("chat.thinkingToggle")}
disableThinkingToggle
? t("chat.onboardingDisabled")
: t("chat.thinkingToggle")
}
> >
${icons.brain} ${icons.brain}
</button> </button>
@@ -226,11 +222,7 @@ export function renderChatControls(state: AppViewState) {
}); });
}} }}
aria-pressed=${focusActive} aria-pressed=${focusActive}
title=${ title=${disableFocusToggle ? t("chat.onboardingDisabled") : t("chat.focusToggle")}
disableFocusToggle
? t("chat.onboardingDisabled")
: t("chat.focusToggle")
}
> >
${focusIcon} ${focusIcon}
</button> </button>

View File

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

View File

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

View File

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