Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

The island in ten languages: views, upload canvas, recap image, Arabic RTL

Claude66c774fd9fae
diff --git a/windows/src/core/fonts.ts b/windows/src/core/fonts.ts
new file mode 100644
index 00000000..6e7e3c89
--- /dev/null
+++ b/windows/src/core/fonts.ts
@@ -0,0 +1,9 @@
+// Fonts that carry the scripts of the ten interface languages, appended to the
+// existing stacks before the generic family. Latin and Cyrillic text keeps
+// rendering in the fonts it always had; these only fill in the characters
+// those lack: Devanagari and Bengali (Nirmala UI), Simplified Chinese
+// (Microsoft YaHei) and Arabic (Segoe UI, already first) on Windows, the Noto
+// families on Linux.
+export const SCRIPT_FONTS =
+ `"Nirmala UI", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans", "Noto Sans Devanagari", ` +
+ `"Noto Sans Bengali", "Noto Sans Arabic", "Noto Sans CJK SC", "Noto Sans SC", "Droid Sans Fallback"`;
diff --git a/windows/src/core/github.ts b/windows/src/core/github.ts
index 4e362dad..866f8f1f 100644
--- a/windows/src/core/github.ts
+++ b/windows/src/core/github.ts
@@ -6,6 +6,8 @@
// Parsing and alert detection happen in Rust (src-tauri/src/github.rs); this
// reads what Rust sends and turns it into what the card shows.
+import { dayMonth, t, tn } from "../i18n/i18n";
+
export type CIState = "pending" | "success" | "failure" | "unknown";
export type ReviewState = "approved" | "changesRequested" | "pending" | "unknown";
export type GitHubSection = "myPRs" | "toReview" | "mainCI" | "activity";
@@ -67,31 +69,31 @@ export type GitHubEvent =
| { kind: "mainFailed"; repo: string }
| { kind: "reviewRequested"; prId: string };
-/** Every word the GitHub card shows, in one place for the translation layer. */
+/** Every word the GitHub card shows, in the current language (src/i18n). */
export const GH_STRINGS = {
title: "GitHub",
- overview: "Overview",
- totalStars: "Total stars",
- repositories: "Repositories",
- myPRs: "My PRs",
- toReview: "To review",
- mainCI: "Default branch CI",
- activity: "Activity",
- nothingHere: "Nothing here",
- loading: "Loading…",
- draft: "Draft",
- failing: "failing",
- running: "running",
- passing: "passing",
- allGreen: "all green",
- noRepos: "no repos",
- unknown: "unknown",
- noContributions: "No contributions",
- oneContribution: "1 contribution",
- contributions: (n: number) => `${n} contributions`,
- pastYear: (total: string) => `${total} past year`,
- repos: (n: number) => `${n} repos`,
-} as const;
+ get overview() { return t("Overview"); },
+ get totalStars() { return t("Total stars"); },
+ get repositories() { return t("Repositories"); },
+ get myPRs() { return t("My PRs"); },
+ get toReview() { return t("To review"); },
+ get mainCI() { return t("Default branch CI"); },
+ get activity() { return t("Activity"); },
+ get nothingHere() { return t("Nothing here"); },
+ get loading() { return t("Loading…"); },
+ get draft() { return t("Draft"); },
+ get failing() { return t("failing"); },
+ get running() { return t("running"); },
+ get passing() { return t("passing"); },
+ get allGreen() { return t("all green"); },
+ get noRepos() { return t("no repos"); },
+ get unknown() { return t("unknown"); },
+ get noContributions() { return t("No contributions"); },
+ get oneContribution() { return tn("{count} contribution", "{count} contributions", 1); },
+ contributions: (n: number) => tn("{count} contribution", "{count} contributions", n),
+ pastYear: (total: string) => t("{total} past year", { total }),
+ repos: (n: number) => tn("{count} repo", "{count} repos", n),
+};
export const CI_COLORS: Record<CIState, string> = {
failure: "#F4505E",
@@ -248,8 +250,6 @@ export function weekColumn(week: ContributionDay[]): (ContributionDay | null)[]
return Array.from({ length: 7 }, (_, dow) => week.find((d) => d.weekday === dow) ?? null);
}
-const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
-
/** "2026-01-05" → "Jan 5"; anything else is returned as is. */
export function dayLabel(date: string): string {
const parts = date.split("-");
@@ -257,7 +257,7 @@ export function dayLabel(date: string): string {
const month = Number(parts[1]);
const day = Number(parts[2]);
if (!Number.isInteger(month) || month < 1 || month > 12 || !Number.isInteger(day)) return date;
- return `${MONTHS[month - 1]} ${day}`;
+ return dayMonth(month - 1, day);
}
export function contributionsLabel(count: number): string {
diff --git a/windows/src/core/pills.ts b/windows/src/core/pills.ts
index 2c992cd6..7a7976de 100644
--- a/windows/src/core/pills.ts
+++ b/windows/src/core/pills.ts
@@ -9,15 +9,16 @@
// nothing at all.
import type { AgentSource } from "./state";
+import { N_ } from "../i18n/i18n";
export type PillCategory = "workspace" | "agent" | "ai" | "service";
-/** Section titles, in display order. */
+/** Section titles (English keys, shown with `t()`), in display order. */
export const PILL_CATEGORIES: { id: PillCategory; title: string }[] = [
- { id: "workspace", title: "Where you code" },
- { id: "agent", title: "Agents" },
- { id: "ai", title: "AI for the chat" },
- { id: "service", title: "Services" },
+ { id: "workspace", title: N_("Where you code") },
+ { id: "agent", title: N_("Agents") },
+ { id: "ai", title: N_("AI for the chat") },
+ { id: "service", title: N_("Services") },
];
/**
@@ -45,7 +46,7 @@ export interface PillDefinition {
name: string;
color: string;
category: PillCategory;
- /** Label next to the pill name in the idle card header. */
+ /** Label next to the pill name in the idle card header (an English key, shown with `t()`). */
subtitle: string;
source: AgentSource;
support: PillSupport;
@@ -71,63 +72,63 @@ const ACCENT = {
export const PILL_CATALOG: readonly PillDefinition[] = [
// ── Where you code ─────────────────────────────────────────────────────────
{ id: "integration_claude", name: "VS Code", color: "#F5F6F8", category: "workspace",
- subtitle: "Integration", source: "claudeCode", support: "yes", connect: hooks },
+ subtitle: N_("Integration"), source: "claudeCode", support: "yes", connect: hooks },
// Claude Code in Cursor's terminal: the same hooks as Claude Code.
{ id: "agent_cursor", name: "Cursor", color: "#C0C4CC", category: "workspace",
- subtitle: "Integration", source: "agent", support: "yes", connect: hooks },
+ subtitle: N_("Integration"), source: "agent", support: "yes", connect: hooks },
{ id: "agent_antigravity", name: "Antigravity", color: "#E879F9", category: "workspace",
- subtitle: "Integration", source: "agent", support: "yes", connect: hooks },
+ subtitle: N_("Integration"), source: "agent", support: "yes", connect: hooks },
{ id: "agent_codex", name: "Codex", color: "#2DD4BF", category: "workspace",
- subtitle: "Integration", source: "agent", support: "yes", connect: hooks },
+ subtitle: N_("Integration"), source: "agent", support: "yes", connect: hooks },
// ── Agents ─────────────────────────────────────────────────────────────────
{ id: "agent_gemini", name: "Gemini CLI", color: "#8AB4F8", category: "agent",
- subtitle: "Agent", source: "agent", support: "yes", connect: hooks },
+ subtitle: N_("Agent"), source: "agent", support: "yes", connect: hooks },
{ id: "agent_copilot", name: "Copilot CLI", color: "#818CF8", category: "agent",
- subtitle: "Agent", source: "agent", support: "yes", connect: hooks },
+ subtitle: N_("Agent"), source: "agent", support: "yes", connect: hooks },
{ id: "agent_muse", name: "Muse Code", color: "#38BDF8", category: "agent",
- subtitle: "Agent", source: "agent", support: "yes", connect: hooks },
+ subtitle: N_("Agent"), source: "agent", support: "yes", connect: hooks },
// A plugin that starts the relay, written from Settings → Agents (agents.rs).
{ id: "agent_opencode", name: "OpenCode", color: "#4ADE80", category: "agent",
- subtitle: "Agent", source: "agent", support: "yes", connect: hooks },
+ subtitle: N_("Agent"), source: "agent", support: "yes", connect: hooks },
{ id: "agent_amp", name: "Amp", color: "#F59E0B", category: "agent",
- subtitle: "Agent", source: "agent", support: "yes", connect: hooks },
+ subtitle: N_("Agent"), source: "agent", support: "yes", connect: hooks },
{ id: "agent_hermes", name: "Hermes", color: "#C084FC", category: "agent",
- subtitle: "Agent", source: "agent", support: "yes", connect: hooks },
+ subtitle: N_("Agent"), source: "agent", support: "yes", connect: hooks },
// Claude Code sessions run from the Claude desktop app: the relay tags them
// from CLAUDE_CODE_ENTRYPOINT, so there is nothing to install. The app has no
// Linux build.
{ id: "agent_claude-desktop", name: "Claude Desktop", color: "#D97757", category: "agent",
- subtitle: "Agent", source: "agent", support: "windows", connect: none },
+ subtitle: N_("Agent"), source: "agent", support: "windows", connect: none },
// ── AI for the chat ────────────────────────────────────────────────────────
{ id: "ai_anthropic", name: "Anthropic", color: ACCENT.anthropic, category: "ai",
- subtitle: "Chat", source: "n8n", support: "yes", connect: key("anthropic-api-key") },
+ subtitle: N_("Chat"), source: "n8n", support: "yes", connect: key("anthropic-api-key") },
// The chat talks to each of them (src-tauri/src/chat.rs): a key for the
// cloud ones, a connected server for the local ones.
{ id: "ai_google", name: "Google AI", color: ACCENT.google, category: "ai",
- subtitle: "Chat", source: "n8n", support: "yes", connect: key("google-api-key") },
+ subtitle: N_("Chat"), source: "n8n", support: "yes", connect: key("google-api-key") },
{ id: "ai_openai", name: "OpenAI", color: ACCENT.openai, category: "ai",
- subtitle: "Chat", source: "n8n", support: "yes", connect: key("openai-api-key") },
+ subtitle: N_("Chat"), source: "n8n", support: "yes", connect: key("openai-api-key") },
{ id: "ai_ollama", name: "Ollama", color: ACCENT.ollama, category: "ai",
- subtitle: "Chat", source: "n8n", support: "yes", connect: server("ollamaUrl") },
+ subtitle: N_("Chat"), source: "n8n", support: "yes", connect: server("ollamaUrl") },
{ id: "ai_lmstudio", name: "LM Studio", color: ACCENT.lmstudio, category: "ai",
- subtitle: "Chat", source: "n8n", support: "yes", connect: server("lmstudioUrl") },
+ subtitle: N_("Chat"), source: "n8n", support: "yes", connect: server("lmstudioUrl") },
// ── Services ───────────────────────────────────────────────────────────────
{ id: "integration_resend", name: "Resend", color: "#22C55E", category: "service",
- subtitle: "Integration", source: "n8n", support: "yes", connect: key("resend-api-key") },
+ subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("resend-api-key") },
{ id: "integration_n8n", name: "n8n", color: "#F29B38", category: "service",
- subtitle: "Integration", source: "n8n", support: "yes", connect: key("n8n-api-key") },
+ subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("n8n-api-key") },
{ id: "integration_vercel", name: "Vercel", color: "#7C5CFF", category: "service",
- subtitle: "Integration", source: "n8n", support: "yes", connect: key("vercel-token") },
+ subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("vercel-token") },
{ id: "integration_github", name: "GitHub", color: "#F4505E", category: "service",
- subtitle: "Integration", source: "n8n", support: "yes", connect: key("github-token") },
+ subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("github-token") },
{ id: "integration_notion", name: "Notion", color: "#8C8C8C", category: "service",
- subtitle: "Integration", source: "n8n", support: "yes", connect: key("notion-api-key") },
+ subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("notion-api-key") },
{ id: "integration_calcom", name: "Cal.com", color: "#C9956A", category: "service",
- subtitle: "Integration", source: "n8n", support: "yes", connect: key("calcom-api-key") },
+ subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("calcom-api-key") },
{ id: "integration_stripe", name: "Stripe", color: "#0570DE", category: "service",
- subtitle: "Integration", source: "n8n", support: "yes", connect: key("stripe-api-key") },
+ subtitle: N_("Integration"), source: "n8n", support: "yes", connect: key("stripe-api-key") },
{ id: "integration_music", name: "Apple Music", color: "#FA2D48", category: "service",
- subtitle: "Integration", source: "n8n", support: "no", connect: none },
+ subtitle: N_("Integration"), source: "n8n", support: "no", connect: none },
];
/** The always-on pill unless the user picks another workspace tool. */
@@ -175,7 +176,7 @@ export function sessionSubtitle(id: string): string {
case "agent_codex": return "Codex";
case "agent_hermes": return "Hermes";
case "agent_claude-desktop": return "Claude Desktop";
- default: return "Agent";
+ default: return N_("Agent");
}
}
diff --git a/windows/src/core/plan.ts b/windows/src/core/plan.ts
index 7b4f85b2..47bac317 100644
--- a/windows/src/core/plan.ts
+++ b/windows/src/core/plan.ts
@@ -31,33 +31,32 @@ export interface CodexPlanUsage extends PlanUsage {
planType?: string;
}
+import { dayMonth, t, weekdayShort } from "../i18n/i18n";
+
const DAY_MS = 86_400_000;
-/** Every user-visible string of the gauges, in one place. */
+/** Every user-visible string of the gauges, in the current language (src/i18n). */
export const PLAN_TEXT = {
- claudeTitle: "Claude plan",
- codexTitle: "Codex plan",
- claudePillTitle: "Claude plan usage",
- codexPillTitle: "Codex plan usage",
- waiting: "Waiting for a response from Claude Code",
- askingCodex: "Asking Codex…",
- justNow: "just now",
- minAgo: (n: number) => `${n} min ago`,
- hAgo: (n: number) => `${n} h ago`,
- fiveHours: "5 hours",
- week: "Week",
- resets: "Resets",
- resetting: "Resetting…",
- inHM: (h: number, m: number) => `in ${h} h ${m}`,
- inM: (m: number) => `in ${m} min`,
- available: (n: number) => `${n} available`,
- until: (date: string) => ` · until ${date}`,
+ get claudeTitle() { return t("Claude plan"); },
+ get codexTitle() { return t("Codex plan"); },
+ get claudePillTitle() { return t("Claude plan usage"); },
+ get codexPillTitle() { return t("Codex plan usage"); },
+ get waiting() { return t("Waiting for a response from Claude Code"); },
+ get askingCodex() { return t("Asking Codex…"); },
+ get justNow() { return t("just now"); },
+ minAgo: (n: number) => t("{n} min ago", { n }),
+ hAgo: (n: number) => t("{n} h ago", { n }),
+ get fiveHours() { return t("5 hours"); },
+ get week() { return t("Week"); },
+ get resets() { return t("Resets"); },
+ get resetting() { return t("Resetting…"); },
+ inHM: (h: number, m: number) => t("in {h} h {m}", { h, m }),
+ inM: (m: number) => t("in {m} min", { m }),
+ available: (n: number) => t("{n} available", { n }),
+ until: (date: string) => t(" · until {date}", { date }),
none: "—",
};
-const WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
-const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
-
const isNum = (v: unknown): v is number => typeof v === "number" && Number.isFinite(v);
const asObj = (v: unknown): Record<string, unknown> | null =>
v && typeof v === "object" && !Array.isArray(v) ? (v as Record<string, unknown>) : null;
@@ -165,7 +164,7 @@ export function resetLabel(w: PlanWindow, weekly: boolean, now = Date.now()): st
if (secs <= 0) return PLAN_TEXT.resetting;
if (weekly) {
const d = new Date(w.resetsAt);
- return `${WEEKDAYS[d.getDay()]} ${d.getHours()}:${String(d.getMinutes()).padStart(2, "0")}`;
+ return `${weekdayShort(d.getDay())} ${d.getHours()}:${String(d.getMinutes()).padStart(2, "0")}`;
}
const hours = Math.floor(secs / 3600);
const mins = Math.floor((secs % 3600) / 60);
@@ -189,7 +188,7 @@ export function codexResetsLabel(u: CodexPlanUsage | null): string {
let text = PLAN_TEXT.available(u.resetCredits);
if (u.resetCredits > 0 && u.resetCreditExpiresAt != null) {
const d = new Date(u.resetCreditExpiresAt);
- text += PLAN_TEXT.until(`${MONTHS[d.getMonth()]} ${d.getDate()}`);
+ text += PLAN_TEXT.until(dayMonth(d.getMonth(), d.getDate()));
}
return text;
}
diff --git a/windows/src/core/providers.ts b/windows/src/core/providers.ts
index 346c32c6..54a57829 100644
--- a/windows/src/core/providers.ts
+++ b/windows/src/core/providers.ts
@@ -3,6 +3,7 @@
// server. Pure data and helpers, so they can be tested without a webview.
import type { Settings } from "./state";
+import { N_ } from "../i18n/i18n";
export type ProviderId =
| "anthropic" | "openai" | "google" | "openrouter"
@@ -29,7 +30,7 @@ export const PROVIDERS: readonly ProviderDef[] = [
{ id: "openrouter", name: "OpenRouter", accent: "#6467F2", key: "openrouter-api-key", urlField: null, defaultModel: "openrouter/auto", prefer: null },
{ id: "ollama", name: "Ollama", accent: "#FACC15", key: null, urlField: "ollamaUrl", defaultModel: "", prefer: null },
{ id: "lmstudio", name: "LM Studio", accent: "#A3E635", key: null, urlField: "lmstudioUrl", defaultModel: "", prefer: null },
- { id: "custom", name: "Custom server", accent: "#C0C4CC", key: null, urlField: "customUrl", defaultModel: "", prefer: null },
+ { id: "custom", name: N_("Custom server"), accent: "#C0C4CC", key: null, urlField: "customUrl", defaultModel: "", prefer: null },
];
/** Credential store entry of the custom server's optional key. */
diff --git a/windows/src/core/shortcuts.ts b/windows/src/core/shortcuts.ts
index 25216f88..545d8000 100644
--- a/windows/src/core/shortcuts.ts
+++ b/windows/src/core/shortcuts.ts
@@ -13,26 +13,30 @@
// Portuguese or Brazilian layouts (ALTGR_CHARACTERS below).
// ── Strings shown to the user ─────────────────────────────────────────────────
+// English keys: Settings shows them through `t()` (src/i18n). Key names
+// (Ctrl, Alt, Space…) are never translated.
+
+import { N_ } from "../i18n/i18n";
export const SHORTCUT_TEXT = {
- toggleIsland: "Open or close the island",
- openChat: "Open the chat",
- goToAlert: "Go to the waiting permission or question",
- jumpToTerminal: "Open the terminal",
- attachFrontWindow: "Attach the front window to the chat",
- nextPill: "Next pill",
- prevPill: "Previous pill",
- muteToggle: "Mute or unmute Mochi",
- desktopToggle: "Send Mochi to the desktop",
- wardrobeToggle: "Open the wardrobe",
+ toggleIsland: N_("Open or close the island"),
+ openChat: N_("Open the chat"),
+ goToAlert: N_("Go to the waiting permission or question"),
+ jumpToTerminal: N_("Open the terminal"),
+ attachFrontWindow: N_("Attach the front window to the chat"),
+ nextPill: N_("Next pill"),
+ prevPill: N_("Previous pill"),
+ muteToggle: N_("Mute or unmute Mochi"),
+ desktopToggle: N_("Send Mochi to the desktop"),
+ wardrobeToggle: N_("Open the wardrobe"),
island: {
- nextPrev: "Next or previous pill",
- byNumber: "Go to pill 1 to 9",
- send: "Send the message",
- newChat: "Start a new chat",
- settings: "Open Settings",
- pin: "Keep the island open",
- close: "Close the island",
+ nextPrev: N_("Next or previous pill"),
+ byNumber: N_("Go to pill 1 to 9"),
+ send: N_("Send the message"),
+ newChat: N_("Start a new chat"),
+ settings: N_("Open Settings"),
+ pin: N_("Keep the island open"),
+ close: N_("Close the island"),
},
} as const;
diff --git a/windows/src/island/hooks.ts b/windows/src/island/hooks.ts
index 76f120bf..63e5cb08 100644
--- a/windows/src/island/hooks.ts
+++ b/windows/src/island/hooks.ts
@@ -14,6 +14,7 @@ import { APPROVAL_AGENTS, agentColor, agentName, validateAgent } from "./agents"
import type { Island } from "./island";
import { parseClaudePlan, restorePlanUsage } from "../core/plan";
import { setClaudePlanUsage, storedClaudePlanUsage } from "../views/usage";
+import { N_, t } from "../i18n/i18n";
const CLAUDE_ID = "integration_claude";
const CURSOR_ID = "agent_cursor";
@@ -86,33 +87,36 @@ function lastPathComponent(p: string): string {
return idx >= 0 ? cleaned.slice(idx + 1) : cleaned;
}
-/** frenchStep() — same labels as the macOS app. */
+/**
+ * localizedStep() — same labels as the macOS app, in English and shown in the
+ * interface language (src/i18n) when the step is recorded.
+ */
const TOOL_LABELS: Record<string, string> = {
- Bash: "Exécute",
- Read: "Lit",
- Write: "Écrit",
- Edit: "Modifie",
- Glob: "Cherche",
- Grep: "Recherche",
- WebSearch: "Recherche web",
- WebFetch: "Récupère",
- TodoWrite: "Tâches",
- Task: "Agent",
- LS: "Liste",
- MultiEdit: "Modifie",
- NotebookEdit: "Notebook",
- PowerShell: "Exécute",
+ Bash: N_("Runs"),
+ Read: N_("Reads"),
+ Write: N_("Writes"),
+ Edit: N_("Edits"),
+ Glob: N_("Searches"),
+ Grep: N_("Searches"),
+ WebSearch: N_("Searches the web"),
+ WebFetch: N_("Fetches"),
+ TodoWrite: N_("Tasks"),
+ Task: N_("Agent"),
+ LS: N_("Lists"),
+ MultiEdit: N_("Edits"),
+ NotebookEdit: N_("Notebook"),
+ PowerShell: N_("Runs"),
// Antigravity's tools (#298).
- run_command: "Exécute",
- view_file: "Lit",
- write_to_file: "Écrit",
- replace_file_content: "Modifie",
- read_url_content: "Récupère",
- search_web: "Recherche web",
+ run_command: N_("Runs"),
+ view_file: N_("Reads"),
+ write_to_file: N_("Writes"),
+ replace_file_content: N_("Edits"),
+ read_url_content: N_("Fetches"),
+ search_web: N_("Searches the web"),
};
function stepLabel(tool: string, input: Record<string, unknown>): string {
- const label = TOOL_LABELS[tool] ?? tool;
+ const label = TOOL_LABELS[tool] ? t(TOOL_LABELS[tool]) : tool;
const str = (k: string) => (typeof input[k] === "string" ? (input[k] as string) : null);
const cmd = str("command");
if (cmd) return `${label} · ${cmd.slice(0, 40)}`;
@@ -209,7 +213,7 @@ function clearFinalLine(id: string) {
* PostToolUse of Edit / MultiEdit / Write → a diff stored for the pill and a
* ticker step with its +N −M counts. Nothing is kept for a pill that does not
* exist, so a stray event cannot grow memory. An edit the relay had to cut
- * would give wrong counts: the PreToolUse step ("Modifie · file") stands alone.
+ * would give wrong counts: the PreToolUse step ("Edits · file") stands alone.
*/
function recordDiff(agentId: string, payload: HookPayload) {
if (payload.coucou_diff_truncated) return;
@@ -363,7 +367,7 @@ function handleHook(island: Island, payload: HookPayload) {
case "PostToolUseFailure":
supersedeStop();
State.updateTask(agentId, "working");
- State.appendStep(agentId, "⚠ failed");
+ State.appendStep(agentId, t("⚠ failed"));
break;
case "Notification": {
@@ -442,11 +446,11 @@ function handleHook(island: Island, payload: HookPayload) {
break;
case "SubagentStart":
- State.appendStep(agentId, "+ subagent");
+ State.appendStep(agentId, t("+ subagent"));
break;
case "SubagentStop":
- State.appendStep(agentId, "• subagent done");
+ State.appendStep(agentId, t("• subagent done"));
break;
case "PermissionRequest": {
diff --git a/windows/src/mochi/outfits.ts b/windows/src/mochi/outfits.ts
index 3087cd53..87acf972 100644
--- a/windows/src/mochi/outfits.ts
+++ b/windows/src/mochi/outfits.ts
@@ -13,6 +13,7 @@
import { Ease } from "../core/anim";
import type { Outfit, OutfitSelection } from "./wardrobe";
+import { SCRIPT_FONTS } from "../core/fonts";
const EXP = 2.7;
const VIEW_TILT = -0.3;
@@ -1143,7 +1144,13 @@ export function drawWardrobeIcon(ctx: Ctx, size: number, selection: OutfitSelect
ctx.fillStyle = "rgba(0,0,0,0.6)";
ctx.fill();
ctx.fillStyle = "#FFFFFF";
- ctx.font = `600 4.2px system-ui, "Segoe UI", sans-serif`;
+ // A longer translation of "AUTO" gets a smaller font rather than overflowing the badge.
+ let fontPx = 4.2;
+ ctx.font = `600 ${fontPx}px system-ui, "Segoe UI", ${SCRIPT_FONTS}, sans-serif`;
+ while (ctx.measureText(autoLabel).width > bw - 2 && fontPx > 2.6) {
+ fontPx -= 0.2;
+ ctx.font = `600 ${fontPx}px system-ui, "Segoe UI", ${SCRIPT_FONTS}, sans-serif`;
+ }
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(autoLabel, 0, 0.2);
diff --git a/windows/src/mochi/wardrobe.ts b/windows/src/mochi/wardrobe.ts
index 976c34e3..28f1923e 100644
--- a/windows/src/mochi/wardrobe.ts
+++ b/windows/src/mochi/wardrobe.ts
@@ -3,6 +3,8 @@
// tray menu) and stored in the preferences as `mochiOutfit`. The drawing lives
// in ./outfits.ts.
+import { N_, labels, t } from "../i18n/i18n";
+
/** Every outfit, plus "auto" (dress for the season) and "none". Order of the wardrobe. */
export const OUTFIT_SELECTIONS = [
"auto", "none", "partyHat", "beanie", "crown", "sunglasses", "roundGlasses",
@@ -19,27 +21,31 @@ export const DEFAULT_OUTFIT: OutfitSelection = "auto";
// ── User-visible strings ──────────────────────────────────────────────────────
-export const OUTFIT_LABELS: Record<OutfitSelection, string> = {
- auto: "Auto (seasons)",
- none: "None",
- partyHat: "Party hat",
- beanie: "Beanie",
- crown: "Crown",
- sunglasses: "Sunglasses",
- roundGlasses: "Round glasses",
- bow: "Bow",
- scarf: "Scarf",
- witchHat: "Witch hat",
- pumpkin: "Pumpkin",
- santaHat: "Santa hat",
- bunnyEars: "Bunny ears",
+/** The English names, the keys of their translations (src/i18n). */
+export const OUTFIT_KEYS: Record<OutfitSelection, string> = {
+ auto: N_("Auto (seasons)"),
+ none: N_("None"),
+ partyHat: N_("Party hat"),
+ beanie: N_("Beanie"),
+ crown: N_("Crown"),
+ sunglasses: N_("Sunglasses"),
+ roundGlasses: N_("Round glasses"),
+ bow: N_("Bow"),
+ scarf: N_("Scarf"),
+ witchHat: N_("Witch hat"),
+ pumpkin: N_("Pumpkin"),
+ santaHat: N_("Santa hat"),
+ bunnyEars: N_("Bunny ears"),
};
+/** In the current language: every read goes through `t()`. */
+export const OUTFIT_LABELS: Record<OutfitSelection, string> = labels(OUTFIT_KEYS);
+
export const WARDROBE_STRINGS = {
- title: "Wardrobe",
- autoBadge: "AUTO",
- autoNow: (current: string) => `Auto · ${current}`,
- autoHover: (current: string) => `Auto · follows the seasons (now: ${current})`,
+ get title() { return t("Wardrobe"); },
+ get autoBadge() { return t("AUTO"); },
+ autoNow: (current: string) => t("Auto · {outfit}", { outfit: current }),
+ autoHover: (current: string) => t("Auto · follows the seasons (now: {outfit})", { outfit: current }),
};
// ── Logic ─────────────────────────────────────────────────────────────────────
diff --git a/windows/src/recap/share.ts b/windows/src/recap/share.ts
index 7086a4cf..0014fd59 100644
--- a/windows/src/recap/share.ts
+++ b/windows/src/recap/share.ts
@@ -4,33 +4,41 @@
import { BotEngine } from "../mochi/engine";
import { formatCount, formatDuration, weekRangeLabel, type WeeklySummary } from "./summary";
+import { t } from "../i18n/i18n";
+import { SCRIPT_FONTS } from "../core/fonts";
export const SHARE_W = 1080;
export const SHARE_H = 1920;
-const FONT = `system-ui, "Segoe UI Variable Display", "Segoe UI", "Cantarell", "Ubuntu", sans-serif`;
+const FONT = `system-ui, "Segoe UI Variable Display", "Segoe UI", "Cantarell", "Ubuntu", ${SCRIPT_FONTS}, sans-serif`;
const MONO = `"Cascadia Mono", "Consolas", "DejaVu Sans Mono", ui-monospace, monospace`;
const INK = "#F1F2F4";
const DIM = "#8E939C";
const INDIGO_TEXT = "#818CF8";
-/** Strings drawn into the image, in one place for the translation layer. */
+/** Strings drawn into the image, in the current language (src/i18n). */
const T = {
- title: "Weekly recap",
- timeCoding: "TIME CODING",
- sessions: "SESSIONS",
- files: "FILES",
- commands: "COMMANDS",
- topAgent: "Top agent",
- topProject: "Top project",
- busiestDay: "Busiest day",
- longestSession: "Longest session",
- approved: "Approved",
- denied: "Denied",
+ get title() { return t("Weekly recap"); },
+ get timeCoding() { return t("TIME CODING"); },
+ get sessions() { return t("SESSIONS"); },
+ get files() { return t("FILES"); },
+ get commands() { return t("COMMANDS"); },
+ get topAgent() { return t("Top agent"); },
+ get topProject() { return t("Top project"); },
+ get busiestDay() { return t("Busiest day"); },
+ get longestSession() { return t("Longest session"); },
+ get approved() { return t("Approved"); },
+ get denied() { return t("Denied"); },
footer: "Coucou · github.com/Louis-CFM/coucou",
};
+/**
+ * Scripts whose letters join or stack (Arabic, Devanagari, Bengali) must be
+ * drawn whole, and CJK has no letter spacing to speak of.
+ */
+const JOINED_SCRIPT = /[\u0590-\u08FF\u0900-\u0DFF\u3000-\u9FFF\uAC00-\uD7AF\uFB1D-\uFEFF]/;
+
type Ctx = CanvasRenderingContext2D;
function font(x: Ctx, weight: number, size: number, family = FONT) {
@@ -47,8 +55,18 @@ function fitFont(x: Ctx, text: string, weight: number, size: number, maxW: numbe
}
}
-/** Text with letter spacing, centred on `cx` — `letterSpacing` is not everywhere yet. */
-function spaced(x: Ctx, text: string, cx: number, y: number, spacing: number) {
+/**
+ * Text with letter spacing, centred on `cx` — `letterSpacing` is not everywhere
+ * yet. A translation wider than `maxW` gets a smaller font first.
+ */
+function spaced(x: Ctx, text: string, cx: number, y: number, spacing: number, maxW = Infinity) {
+ if (JOINED_SCRIPT.test(text)) {
+ shrinkToFit(x, text, maxW);
+ x.textAlign = "center";
+ x.fillText(text, cx, y);
+ return;
+ }
+ shrinkToFit(x, text, maxW, spacing);
const chars = [...text];
const widths = chars.map((c) => x.measureText(c).width);
const total = widths.reduce((a, b) => a + b, 0) + spacing * (chars.length - 1);
@@ -60,6 +78,21 @@ function spaced(x: Ctx, text: string, cx: number, y: number, spacing: number) {
});
}
+/** Lowers the current font's size until `text` (plus its letter spacing) fits `maxW`. */
+function shrinkToFit(x: Ctx, text: string, maxW: number, spacing = 0) {
+ if (!Number.isFinite(maxW)) return;
+ const match = /^(\S+) (\d+(?:\.\d+)?)px (.*)$/.exec(x.font);
+ if (!match) return;
+ const [, weight, sizeText, family] = match;
+ const size = Number(sizeText);
+ const extra = spacing * Math.max(0, [...text].length - 1);
+ let s = size;
+ while (x.measureText(text).width + extra > maxW && s > size * 0.6) {
+ s -= 1;
+ x.font = `${weight} ${s}px ${family}`;
+ }
+}
+
/** Cuts `text` with an ellipsis so it fits `maxW` in the current font. */
function ellipsize(x: Ctx, text: string, maxW: number): string {
if (x.measureText(text).width <= maxW) return text;
@@ -131,7 +164,7 @@ export function renderShareImage(s: WeeklySummary, hideProjects: boolean): HTMLC
const badges: [string, string][] = [];
if (s.topAgent) badges.push([T.topAgent, s.topAgent]);
if (!hideProjects && s.topProject) badges.push([T.topProject, s.topProject]);
- if (s.busiestDay) badges.push([T.busiestDay, s.busiestDay]);
+ if (s.busiestDay) badges.push([T.busiestDay, t(s.busiestDay)]);
if (s.longestSessionMinutes > 1) badges.push([T.longestSession, formatDuration(s.longestSessionMinutes)]);
const decisions = s.permissionsAllowed + s.permissionsDenied > 0;
const badgeRows = badges.length + (decisions ? 1 : 0);
@@ -162,7 +195,7 @@ export function renderShareImage(s: WeeklySummary, hideProjects: boolean): HTMLC
y += 62 + 6;
x.fillStyle = DIM;
- font(x, 500, 30);
+ fitFont(x, T.title, 500, 30, W - 120, 0.6);
x.fillText(T.title, cx, y);
y += 36 + 14;
@@ -180,7 +213,7 @@ export function renderShareImage(s: WeeklySummary, hideProjects: boolean): HTMLC
y += 110 + 6;
x.fillStyle = DIM;
font(x, 600, 22);
- spaced(x, T.timeCoding, cx, y, 3);
+ spaced(x, T.timeCoding, cx, y, 3, W - 120);
y += 26 + 56;
// Sessions | files | commands
@@ -203,7 +236,7 @@ export function renderShareImage(s: WeeklySummary, hideProjects: boolean): HTMLC
x.fillText(value, colCx, y);
x.fillStyle = DIM;
font(x, 600, 18);
- spaced(x, label, colCx, y + 72, 2);
+ spaced(x, label, colCx, y + 72, 2, colW - 24);
});
y += 94;
diff --git a/windows/src/recap/summary.ts b/windows/src/recap/summary.ts
index 94960313..42465023 100644
--- a/windows/src/recap/summary.ts
+++ b/windows/src/recap/summary.ts
@@ -4,6 +4,8 @@
// "Monday 8 am" are local time, and the webview knows the user's time zone.
// No DOM, no Tauri: tests/recap.test.mjs runs it as it is.
+import { N_, dayMonth, t } from "../i18n/i18n";
+
/** One finished turn, as recap.rs stores it. Times are Unix seconds. */
export interface RecapTurn {
agent: string;
@@ -91,7 +93,8 @@ export function shouldAutoShow(now: Date, lastShownWeek: string): boolean {
// ── Aggregation ───────────────────────────────────────────────────────────────
-const DAY_NAMES = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
+/** English names, kept in the summary; shown with `t()` (src/i18n). */
+const DAY_NAMES = [N_("Sunday"), N_("Monday"), N_("Tuesday"), N_("Wednesday"), N_("Thursday"), N_("Friday"), N_("Saturday")];
/** Pill IDs → names, from PillCatalog.swift. Claude Code hooks come from any
* terminal here, so its pill reads "Claude Code" rather than "VS Code". */
@@ -196,10 +199,10 @@ export function summarize(history: RecapHistory, weekStart: Date): WeeklySummary
// ── Formatting ────────────────────────────────────────────────────────────────
export function formatDuration(minutes: number): string {
- if (minutes < 60) return `${minutes}m`;
+ if (minutes < 60) return t("{n}m", { n: minutes });
const h = Math.floor(minutes / 60);
const m = minutes % 60;
- return m === 0 ? `${h}h` : `${h}h ${m}m`;
+ return m === 0 ? t("{n}h", { n: h }) : t("{h}h {m}m", { h, m });
}
/** 1234 → "1,234"; 12345 → "12.3k" — keeps a stat chip narrow. */
@@ -208,11 +211,9 @@ export function formatCount(n: number): string {
return n.toLocaleString("en-US");
}
-const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
-
/** "Sep 28 – Oct 4". */
export function weekRangeLabel(s: Pick<WeeklySummary, "weekStart" | "weekEnd">): string {
- const f = (d: Date) => `${MONTHS[d.getMonth()]} ${d.getDate()}`;
+ const f = (d: Date) => dayMonth(d.getMonth(), d.getDate());
return `${f(s.weekStart)} – ${f(s.weekEnd)}`;
}
diff --git a/windows/src/style.css b/windows/src/style.css
index 941e78dd..da456b00 100644
--- a/windows/src/style.css
+++ b/windows/src/style.css
@@ -4,7 +4,12 @@
:root {
color-scheme: dark;
- --font: system-ui, "Segoe UI Variable Text", "Segoe UI", "Segoe UI Emoji", sans-serif;
+ /* After the Latin fonts: the scripts of the other interface languages —
+ Devanagari and Bengali (Nirmala UI), Simplified Chinese (Microsoft YaHei)
+ on Windows, the Noto families on Linux. Arabic and Cyrillic are in Segoe UI. */
+ --font: system-ui, "Segoe UI Variable Text", "Segoe UI", "Segoe UI Emoji", "Nirmala UI",
+ "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans", "Noto Sans Devanagari", "Noto Sans Bengali",
+ "Noto Sans Arabic", "Noto Sans CJK SC", "Noto Sans SC", "Droid Sans Fallback", sans-serif;
--mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
--ink: #f5f6f8; /* primary text */
@@ -2320,3 +2325,22 @@ input[type="range"]::-webkit-slider-thumb {
height: 28px;
pointer-events: none;
}
+
+/* ── Arabic: right to left ─────────────────────────────────────────────────────
+ i18n.ts sets <html data-dir="rtl">. The text of the cards reads and aligns
+ right to left; Mochi, the pills, the header and the cards themselves keep
+ their places, and code, commands and the contribution grid stay left to
+ right. A chat message follows its own text's direction (an English answer
+ stays left to right). */
+html[data-dir="rtl"] #views :is(.stack, .int-card, .plan-card, .drop-body, .up-card) {
+ direction: rtl;
+}
+
+html[data-dir="rtl"] #views :is(.code, .gh-grid, .diff-card, .md-pre) {
+ direction: ltr;
+}
+
+html[data-dir="rtl"] #views :is(.bubble, .reply .md-p, .reply .md-h, .reply .md-item, .reply .md-quote, .chat-input) {
+ unicode-bidi: plaintext;
+ text-align: start;
+}
diff --git a/windows/src/upload/canvas.ts b/windows/src/upload/canvas.ts
index 64b54f65..4144b4a8 100644
--- a/windows/src/upload/canvas.ts
+++ b/windows/src/upload/canvas.ts
@@ -6,12 +6,22 @@
// exactly as on macOS, because this canvas draws its own.
import { State } from "../core/state";
+import { SCRIPT_FONTS } from "../core/fonts";
+import { N_, isRtl, t } from "../i18n/i18n";
import {
USC, eIn, eInOut, eOut, lerp, progressAt,
type UploadEyeShape, type UploadFrame,
} from "./sequence";
-const FONT = 'system-ui, "Segoe UI Variable Text", "Segoe UI", sans-serif';
+const FONT = `system-ui, "Segoe UI Variable Text", "Segoe UI", ${SCRIPT_FONTS}, sans-serif`;
+
+/** The card's inner right edge: no text runs past it. */
+const TEXT_RIGHT = USC.CARD_X + USC.CARD_W - 16;
+/** The two choose buttons, as drawn and as hit areas. */
+const ASK_BTN = { x: 114, w: 168 };
+const CANCEL_BTN = { x: 290, w: 120 };
+/** Drop-zone chips (English keys, shown with `t()`). */
+const CHIPS = [N_("PDF"), N_("Images"), N_("Code"), N_("Docs")];
/** Mirrors the reference `rr()`: a rounded rect, radius clamped to the box. */
function rr(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, r: number) {
@@ -52,11 +62,50 @@ function text(
ctx.font = font;
ctx.fillStyle = color;
ctx.textAlign = align;
+ // Arabic orders its words right to left; the anchor (left, centre, right) stays put.
+ ctx.direction = isRtl() ? "rtl" : "ltr";
// SwiftUI's .leading / .center / .trailing anchors are vertically centred.
ctx.textBaseline = "middle";
ctx.fillText(s, x, y);
}
+/**
+ * The font that fits `s` in `maxW`: `weight size FONT`, or smaller down to
+ * `minSize` for a longer translation. English was laid out for these widths
+ * and keeps its size (only an overlong file name can make it shrink).
+ */
+export function fitFont(
+ ctx: CanvasRenderingContext2D,
+ s: string,
+ maxW: number,
+ weight: number,
+ size: number,
+ minSize = size * 0.75,
+): string {
+ let px = size;
+ ctx.font = `${weight} ${px}px ${FONT}`;
+ while (ctx.measureText(s).width > maxW && px > minSize) {
+ px = Math.max(minSize, px - 0.5);
+ ctx.font = `${weight} ${px}px ${FONT}`;
+ }
+ return ctx.font;
+}
+
+/** `s` cut with an ellipsis so it fits `maxW` in `font` (a file name that is too long). */
+export function ellipsize(ctx: CanvasRenderingContext2D, s: string, maxW: number, font: string): string {
+ ctx.font = font;
+ if (ctx.measureText(s).width <= maxW) return s;
+ let cut = s;
+ while (cut.length > 1 && ctx.measureText(`${cut}…`).width > maxW) cut = cut.slice(0, -1);
+ return `${cut}…`;
+}
+
+/** A label that fits `maxW`: a smaller font first, then an ellipsis. */
+function fitted(ctx: CanvasRenderingContext2D, s: string, maxW: number, weight: number, size: number) {
+ const font = fitFont(ctx, s, maxW, weight, size);
+ return { font, s: ellipsize(ctx, s, maxW, font) };
+}
+
export interface UploadCanvasActions {
/** Primary button — hand the file to the chat. */
ask(): void;
@@ -91,7 +140,7 @@ export class UploadCanvas {
};
this.overlay = document.createElement("div");
this.overlay.id = "upload-overlay";
- this.overlay.append(mk(114, 168, actions.ask), mk(290, 120, actions.cancel));
+ this.overlay.append(mk(ASK_BTN.x, ASK_BTN.w, actions.ask), mk(CANCEL_BTN.x, CANCEL_BTN.w, actions.cancel));
this.el = document.createElement("div");
this.el.id = "upload-layer";
@@ -174,18 +223,32 @@ export class UploadCanvas {
private drawDropText(ctx: CanvasRenderingContext2D, f: UploadFrame) {
ctx.save();
ctx.globalAlpha = f.textAlpha;
- text(ctx, "Drop your files here", USC.TEXT_X, USC.TEXT_Y - 4, `500 13px ${FONT}`, "#D5D7DB");
-
+ const title = fitted(ctx, t("Drop your files here"), TEXT_RIGHT - USC.TEXT_X, 500, 13);
+ text(ctx, title.s, USC.TEXT_X, USC.TEXT_Y - 4, title.font, "#D5D7DB");
+
+ // The macOS port measures chips the same rough way, so the row lines up; a
+ // translation wider than that estimate gets the room it needs.
+ const labels = CHIPS.map((chip) => t(chip));
+ let chipPx = 11;
+ const widths = () => {
+ ctx.font = `500 ${chipPx}px ${FONT}`;
+ return labels.map((l) => Math.max(l.length * 6.5 + 16, Math.ceil(ctx.measureText(l).width) + 16));
+ };
+ let ws = widths();
+ const rowW = () => ws.reduce((a, b) => a + b, 0) + 6 * (ws.length - 1);
+ while (rowW() > TEXT_RIGHT - USC.TEXT_X && chipPx > 8.5) {
+ chipPx -= 0.5;
+ ws = widths();
+ }
let cx = USC.TEXT_X;
- for (const chip of ["PDF", "Images", "Code", "Docs"]) {
- // The macOS port measures chips the same rough way, so the row lines up.
- const w = chip.length * 6.5 + 16;
+ labels.forEach((chip, i) => {
+ const w = ws[i];
ctx.fillStyle = "rgba(255,255,255,0.07)";
rr(ctx, cx, USC.TEXT_Y + 9, w, 18, 9);
ctx.fill();
- text(ctx, chip, cx + 8, USC.TEXT_Y + 18, `500 11px ${FONT}`, "#B9BDC4");
+ text(ctx, chip, cx + 8, USC.TEXT_Y + 18, `500 ${chipPx}px ${FONT}`, "#B9BDC4");
cx += w + 6;
- }
+ });
ctx.restore();
}
@@ -200,8 +263,10 @@ export class UploadCanvas {
const by = USC.BAR_Y;
const barLen = (x1 - x0) * f.barReveal;
- const name = State.droppedFile?.name ?? "file";
- text(ctx, `Uploading ${name}`, x0, by - 30, `500 12.5px ${FONT}`, "#A9ADB5");
+ // Room up to the percentage (or the check mark) at the bar's right end.
+ const uploading = t("Uploading {name}", { name: State.droppedFile?.name ?? t("file") });
+ const label = fitted(ctx, uploading, x1 - x0 - 56, 500, 12.5);
+ text(ctx, label.s, x0, by - 30, label.font, "#A9ADB5");
if (f.check > 0) {
ctx.save();
@@ -272,19 +337,23 @@ export class UploadCanvas {
ctx.globalAlpha = f.chooseAlpha;
ctx.translate(0, (1 - f.chooseAlpha) * 4);
- const name = State.droppedFile?.name ?? "file";
- text(ctx, `${name} is ready.`, 114, 80, `600 14px ${FONT}`, "#F5F6F8");
- text(ctx, "What do you want to do with it?", 114, 100, `400 12.5px ${FONT}`, "#9398A1");
+ const maxW = TEXT_RIGHT - 114;
+ const ready = fitted(ctx, t("{name} is ready.", { name: State.droppedFile?.name ?? t("file") }), maxW, 600, 14);
+ text(ctx, ready.s, 114, 80, ready.font, "#F5F6F8");
+ const what = fitted(ctx, t("What do you want to do with it?"), maxW, 400, 12.5);
+ text(ctx, what.s, 114, 100, what.font, "#9398A1");
ctx.fillStyle = "#F5F6F8";
- rr(ctx, 114, 113, 168, 26, 13);
+ rr(ctx, ASK_BTN.x, 113, ASK_BTN.w, 26, 13);
ctx.fill();
- text(ctx, "Ask a question about it", 198, 126, `500 12.5px ${FONT}`, "#0B0C0E", "center");
+ const ask = fitted(ctx, t("Ask a question about it"), ASK_BTN.w - 14, 500, 12.5);
+ text(ctx, ask.s, ASK_BTN.x + ASK_BTN.w / 2, 126, ask.font, "#0B0C0E", "center");
ctx.fillStyle = "rgba(255,255,255,0.09)";
- rr(ctx, 290, 113, 120, 26, 13);
+ rr(ctx, CANCEL_BTN.x, 113, CANCEL_BTN.w, 26, 13);
ctx.fill();
- text(ctx, "Cancel", 350, 126, `500 12.5px ${FONT}`, "#F1F2F4", "center");
+ const cancel = fitted(ctx, t("Cancel"), CANCEL_BTN.w - 14, 500, 12.5);
+ text(ctx, cancel.s, CANCEL_BTN.x + CANCEL_BTN.w / 2, 126, cancel.font, "#F1F2F4", "center");
ctx.restore();
}
diff --git a/windows/src/views/chat.ts b/windows/src/views/chat.ts
index 9b46b6e9..f11fea16 100644
--- a/windows/src/views/chat.ts
+++ b/windows/src/views/chat.ts
@@ -16,16 +16,17 @@ import {
import { Sound } from "../core/sound";
import { State, type ChatMessage } from "../core/state";
import type { ViewHost } from "./views";
+import { N_, t, tl } from "../i18n/i18n";
const STRINGS = {
- placeholderFirst: "Ask me anything…",
- placeholderNext: "Continue…",
- send: "Send",
- switchModel: "Switch provider or model",
- noModel: "Choose a model",
- loading: "Loading models…",
- noKey: "No API key — add it in Settings.",
- openSettings: "Open Settings",
+ placeholderFirst: N_("Ask me anything…"),
+ placeholderNext: N_("Continue…"),
+ send: N_("Send"),
+ switchModel: N_("Switch provider or model"),
+ noModel: N_("Choose a model"),
+ loading: N_("Loading models…"),
+ noKey: N_("No API key — add it in Settings."),
+ openSettings: N_("Open Settings"),
};
let nextId = 1;
@@ -90,7 +91,7 @@ function buildPicker(onChange: () => void): Picker {
"button",
{ class: on ? "picker-chip on" : "picker-chip", style: `--accent:${p.accent}` },
h("i", { class: "picker-dot" }),
- h("span", { text: p.name }),
+ h("span", { text: t(p.name) }),
);
chip.addEventListener("click", () => {
if (p.id === State.settings.chatProvider) return;
@@ -112,7 +113,7 @@ function buildPicker(onChange: () => void): Picker {
line.append(
h("button", {
class: "picker-link",
- text: STRINGS.openSettings,
+ text: tl(STRINGS.openSettings),
onclick: () => void Bridge.openSettingsWindow(),
}),
);
@@ -152,11 +153,11 @@ function buildPicker(onChange: () => void): Picker {
}
// Nothing is asked of a provider that has no key yet.
if (p.key && !(await Bridge.secretPresent(p.key))) {
- if (ticket === request) status(STRINGS.noKey, true);
+ if (ticket === request) status(t(STRINGS.noKey), true);
return;
}
if (ticket !== request) return;
- status(STRINGS.loading);
+ status(t(STRINGS.loading));
try {
const models = await Bridge.chatModels(p.id);
if (ticket !== request) return;
@@ -206,17 +207,17 @@ export function buildPrompt(onHeightChange: () => void): ViewHost {
const input = h("input", {
type: "text",
class: "chat-input",
- placeholder: STRINGS.placeholderFirst,
+ placeholder: t(STRINGS.placeholderFirst),
spellcheck: "false",
}) as HTMLInputElement;
- const send = h("button", { class: "send-btn", title: STRINGS.send }, svg(ICONS.arrowUp, 11));
+ const send = h("button", { class: "send-btn", title: tl(STRINGS.send) }, svg(ICONS.arrowUp, 11));
const bar = h("div", { class: "chat-bar" }, input, send);
const modelDot = h("i", { class: "model-dot" });
const modelName = h("span", { class: "model-name" });
const modelBtn = h(
"button",
- { class: "model-btn", title: STRINGS.switchModel },
+ { class: "model-btn", title: tl(STRINGS.switchModel) },
modelDot,
modelName,
svg(ICONS.chevronUpDown, 9, { stroke: 2 }),
@@ -241,7 +242,7 @@ export function buildPrompt(onHeightChange: () => void): ViewHost {
function drawModelButton() {
const p = providerDef(State.settings.chatProvider);
modelDot.style.background = p.accent;
- modelName.textContent = activeModel(State.settings) || STRINGS.noModel;
+ modelName.textContent = activeModel(State.settings) || t(STRINGS.noModel);
modelBtn.classList.toggle("open", picker.isOpen);
modelBtn.disabled = sending;
}
@@ -340,7 +341,7 @@ export function buildPrompt(onHeightChange: () => void): ViewHost {
if (State.view !== "prompt" && picker.isOpen) picker.close();
drawModelButton();
- input.placeholder = State.chatHistory.length === 0 ? STRINGS.placeholderFirst : STRINGS.placeholderNext;
+ input.placeholder = t(State.chatHistory.length === 0 ? STRINGS.placeholderFirst : STRINGS.placeholderNext);
input.disabled = sending;
},
focus() {
diff --git a/windows/src/views/diff.ts b/windows/src/views/diff.ts
index 9fface6e..eef02100 100644
--- a/windows/src/views/diff.ts
+++ b/windows/src/views/diff.ts
@@ -4,12 +4,13 @@
import { h, svg } from "./dom";
import { ICONS } from "./icons";
import { fileName, type DiffKind, type FileDiff } from "../core/diff";
+import { N_, tl } from "../i18n/i18n";
const STRINGS = {
- back: "Back",
- open: "Open in VS Code",
- tooLarge: "Diff too large",
- noChanges: "No changes",
+ back: N_("Back"),
+ open: N_("Open in VS Code"),
+ tooLarge: N_("Diff too large"),
+ noChanges: N_("No changes"),
};
const SYMBOLS: Record<DiffKind, string> = { added: "+", removed: "−", context: " " };
@@ -26,7 +27,7 @@ export function buildDiffCard(diff: FileDiff, hooks: DiffCardHooks): HTMLElement
{ class: "diff-head" },
h(
"button",
- { class: "diff-back", title: STRINGS.back, onclick: () => hooks.dismiss() },
+ { class: "diff-back", title: tl(STRINGS.back), onclick: () => hooks.dismiss() },
svg(ICONS.chevronLeft, 9, { stroke: 2.4 }),
h("b", { text: fileName(diff.path) }),
),
@@ -35,7 +36,7 @@ export function buildDiffCard(diff: FileDiff, hooks: DiffCardHooks): HTMLElement
diff.removed > 0 ? h("span", { class: "tick-count minus", text: `−${diff.removed}` }) : null,
h(
"button",
- { class: "icon-btn", title: STRINGS.open, onclick: () => hooks.open(diff.path) },
+ { class: "icon-btn", title: tl(STRINGS.open), onclick: () => hooks.open(diff.path) },
svg(ICONS.arrowUpRight, 8),
),
);
@@ -43,9 +44,9 @@ export function buildDiffCard(diff: FileDiff, hooks: DiffCardHooks): HTMLElement
const lines = diff.hunks.flatMap((hunk) => hunk.lines);
let content: HTMLElement;
if (diff.tooLarge) {
- content = h("div", { class: "diff-note", text: STRINGS.tooLarge });
+ content = h("div", { class: "diff-note", text: tl(STRINGS.tooLarge) });
} else if (lines.length === 0) {
- content = h("div", { class: "diff-note", text: STRINGS.noChanges });
+ content = h("div", { class: "diff-note", text: tl(STRINGS.noChanges) });
} else {
content = h("div", { class: "diff-lines" });
const rows = document.createDocumentFragment();
diff --git a/windows/src/views/integrations.ts b/windows/src/views/integrations.ts
index 71314da9..2317d9c0 100644
--- a/windows/src/views/integrations.ts
+++ b/windows/src/views/integrations.ts
@@ -12,16 +12,17 @@ import { isComingSoon, pillDefinition } from "../core/pills";
import { refreshHookPills } from "../island/integrations";
import { readActivity, readPulse, readStats } from "../core/github";
import { githubDetail, githubPulseCard } from "./github";
+import { N_, language, t } from "../i18n/i18n";
/** Same shape as the Swift `timeAgo` computed properties. */
export function timeAgo(value: unknown): string {
const date = typeof value === "number" ? new Date(value) : new Date(String(value));
const diff = (Date.now() - date.getTime()) / 1000;
if (!Number.isFinite(diff)) return "";
- if (diff < 60) return "just now";
- if (diff < 3600) return `${Math.floor(diff / 60)}m`;
- if (diff < 86400) return `${Math.floor(diff / 3600)}h`;
- return `${Math.floor(diff / 86400)}d`;
+ if (diff < 60) return t("just now");
+ if (diff < 3600) return t("{n}m", { n: Math.floor(diff / 60) });
+ if (diff < 86400) return t("{n}h", { n: Math.floor(diff / 3600) });
+ return t("{n}d", { n: Math.floor(diff / 86400) });
}
function header(color: string, name: string, kind: string, extra?: Node): HTMLElement {
@@ -63,7 +64,7 @@ export function idleStatus(
info: { configured: boolean; error: string | null } | undefined,
chatModel: string,
): { label: string; color: string } {
- if (isComingSoon(id)) return { label: "Coming soon", color: "#6B7079" };
+ if (isComingSoon(id)) return { label: t("Coming soon"), color: "#6B7079" };
if (info?.error) return { label: info.error, color: "#F4505E" };
const configured = info?.configured ?? false;
const def = pillDefinition(id);
@@ -71,14 +72,14 @@ export function idleStatus(
const missing = (label: string) => ({ label, color: "#F4505E" });
// Pills driven by hooks never have a key: they are connected once the hooks
// are in place (Mac #183). A session replaces this card; nothing is loading.
- if (def?.connect.kind === "hooks") return configured ? ok("Hooks installed") : missing("Hooks not installed");
- if (def?.connect.kind === "none") return ok("Ready · no setup needed");
- if (def?.connect.kind === "server") return configured ? ok("Connected") : missing("Not connected");
+ if (def?.connect.kind === "hooks") return configured ? ok(t("Hooks installed")) : missing(t("Hooks not installed"));
+ if (def?.connect.kind === "none") return ok(t("Ready · no setup needed"));
+ if (def?.connect.kind === "server") return configured ? ok(t("Connected")) : missing(t("Not connected"));
if (def?.category === "ai") {
- if (!configured) return missing("Key not configured");
- return ok(id === "ai_anthropic" ? `Key configured · ${chatModel}` : "Key configured");
+ if (!configured) return missing(t("Key not configured"));
+ return ok(id === "ai_anthropic" ? t("Key configured · {model}", { model: chatModel }) : t("Key configured"));
}
- return configured ? ok("Connected · loading…") : missing("Key not configured");
+ return configured ? ok(t("Connected · loading…")) : missing(t("Key not configured"));
}
function idleCard(task: AgentTask, openSettings: () => void): HTMLElement {
@@ -93,7 +94,7 @@ function idleCard(task: AgentTask, openSettings: () => void): HTMLElement {
h("button", {
class: "link-btn",
style: `color:${task.color}b3`,
- text: "Open Visual Studio Code",
+ text: t("Open Visual Studio Code"),
onclick: () => void Bridge.openInVSCode(task.sessionCwd ?? null),
}),
);
@@ -102,7 +103,7 @@ function idleCard(task: AgentTask, openSettings: () => void): HTMLElement {
h("button", {
class: "link-btn",
style: `color:${task.color}d9`,
- text: "Open Claude",
+ text: t("Open Claude"),
onclick: () => void Bridge.openClaudeDesktop(),
}),
);
@@ -111,7 +112,7 @@ function idleCard(task: AgentTask, openSettings: () => void): HTMLElement {
h("button", {
class: "link-btn",
style: `color:${task.color}d9`,
- text: "Open n8n",
+ text: t("Open {name}", { name: "n8n" }),
onclick: () => void Bridge.openN8n(),
}),
);
@@ -120,7 +121,7 @@ function idleCard(task: AgentTask, openSettings: () => void): HTMLElement {
h("button", {
class: "link-btn",
style: `color:${task.color}d9`,
- text: `Open ${task.name}`,
+ text: t("Open {name}", { name: task.name }),
onclick: () => void Bridge.openUrl(OPEN_URLS[task.id]),
}),
);
@@ -133,14 +134,14 @@ function idleCard(task: AgentTask, openSettings: () => void): HTMLElement {
h("button", {
class: "link-btn",
style: `color:${task.color}d9`,
- text: "Refresh",
+ text: t("Refresh"),
// A hook pill has nothing to poll: look at its hooks again instead.
onclick: () => void (hookPill ? refreshHookPills() : Bridge.refreshIntegration(task.id)),
}),
);
} else if (!configured) {
actions.append(
- h("button", { class: "link-btn", style: "color:#8e939c", text: "Settings…", onclick: openSettings }),
+ h("button", { class: "link-btn", style: "color:#8e939c", text: t("Settings…"), onclick: openSettings }),
);
}
@@ -150,7 +151,7 @@ function idleCard(task: AgentTask, openSettings: () => void): HTMLElement {
header(
task.color,
task.id === "integration_claude" ? "VS Code" : task.name,
- def?.subtitle ?? "Integration",
+ t(def?.subtitle ?? N_("Integration")),
),
h("div", { class: "int-status" }, dot(status.color, 5), h("span", { text: status.label })),
actions,
@@ -169,7 +170,7 @@ function vercelCard(onDetail: () => void): HTMLElement {
if (i === 0) {
const more = h(
"button",
- { class: "int-more", title: "Details", onclick: onDetail },
+ { class: "int-more", title: t("Details"), onclick: onDetail },
svg(ICONS.ellipsis, 8),
);
rows.append(listRow(accent, true, name, ago, more));
@@ -177,19 +178,19 @@ function vercelCard(onDetail: () => void): HTMLElement {
rows.append(listRow(accent, false, name, ago));
}
});
- return h("div", { class: "int-card" }, header("#7C5CFF", "Vercel", "Deployments"), rows);
+ return h("div", { class: "int-card" }, header("#7C5CFF", "Vercel", t("Deployments")), rows);
}
function vercelDetail(onBack: () => void): HTMLElement {
const d = arr("integration_vercel", "deployments")[0] ?? {};
const success = d.state === "READY";
const accent = success ? "#22C55E" : "#F4505E";
- const status = success ? "Ready" : d.state === "CANCELED" ? "Canceled" : "Error";
+ const status = success ? t("Ready") : d.state === "CANCELED" ? t("Canceled") : t("Error");
const body = h("div", { class: "int-detail-body" });
if (d.commitMessage) body.append(h("div", { class: "int-commit", text: String(d.commitMessage) }));
const meta = h("div", { class: "int-meta" });
if (d.branch) meta.append(h("span", { text: String(d.branch) }));
- meta.append(h("span", { text: `${timeAgo(d.createdAt)} ago` }));
+ meta.append(h("span", { text: t("{time} ago", { time: timeAgo(d.createdAt) }) }));
body.append(meta);
if (d.url) {
body.append(
@@ -208,7 +209,7 @@ function vercelDetail(onBack: () => void): HTMLElement {
{ class: "int-detail-head" },
h("button", { class: "int-back", onclick: onBack }, svg(ICONS.chevronLeft, 10, { stroke: 2.4 })),
dot(accent, 6),
- h("b", { text: String(d.projectName ?? "Deployment") }),
+ h("b", { text: String(d.projectName ?? t("Deployment")) }),
h("span", { class: "int-badge", style: `color:${accent};background:${accent}24`, text: status }),
),
body,
@@ -237,7 +238,7 @@ function resendCard(): HTMLElement {
if (i === 0 && e.subject) cells.push(h("span", { class: "int-sub", text: String(e.subject) }));
rows.append(listRow(accent, i === 0, ...cells));
});
- return h("div", { class: "int-card" }, header("#22C55E", "Resend", "Emails", extra), rows);
+ return h("div", { class: "int-card" }, header("#22C55E", "Resend", t("Emails"), extra), rows);
}
// ── GitHub ────────────────────────────────────────────────────────────────────
@@ -260,12 +261,12 @@ function githubCard(): HTMLElement {
return h(
"div",
{ class: "int-card" },
- header("#F4505E", "GitHub", "Overview"),
+ header("#F4505E", "GitHub", t("Overview")),
h(
"div",
{ class: "int-stats" },
- statRow(ICONS.star, "#F5A524", "Total stars", fmt(stars)),
- statRow(ICONS.stack, "#6B7079", "Repositories", String(repos)),
+ statRow(ICONS.star, "#F5A524", t("Total stars"), fmt(stars)),
+ statRow(ICONS.stack, "#6B7079", t("Repositories"), String(repos)),
),
);
}
@@ -285,7 +286,7 @@ function stripeCard(): HTMLElement {
"div",
{ class: "int-row" },
dot(accent, 5),
- h("span", { class: "int-name", text: String(p.description ?? "Payment") }),
+ h("span", { class: "int-name", text: String(p.description ?? t("Payment")) }),
h("span", {
class: "int-amount",
style: "color:#22c55e",
@@ -298,7 +299,7 @@ function stripeCard(): HTMLElement {
return h(
"div",
{ class: "int-card" },
- header("#0570DE", "Stripe", "Payments"),
+ header("#0570DE", "Stripe", t("Payments")),
h("div", { class: "int-balance" }, h("span", { text: balance }), h("i", { text: currency })),
rows,
);
@@ -321,12 +322,12 @@ function notionCard(): HTMLElement {
p.emoji
? h("span", { class: "int-emoji", text: String(p.emoji) })
: h("i", { class: "int-emoji" }, svg(ICONS.doc, 9)),
- h("span", { class: "int-name", text: String(p.title ?? "Untitled") }),
+ h("span", { class: "int-name", text: String(p.title ?? t("Untitled")) }),
h("span", { class: "int-ago", text: timeAgo(p.lastEditedAt) }),
),
);
}
- return h("div", { class: "int-card" }, header("#E8E8E8", "Notion", "Recent"), rows);
+ return h("div", { class: "int-card" }, header("#E8E8E8", "Notion", t("Recent")), rows);
}
// ── Cal.com ───────────────────────────────────────────────────────────────────
@@ -337,23 +338,23 @@ function calcomCard(): HTMLElement {
.sort((a, b) => new Date(String(a.start)).getTime() - new Date(String(b.start)).getTime());
const rows = h("div", { class: "int-rows tight" });
if (bookings.length === 0) {
- rows.append(h("div", { class: "int-empty", text: "No calls scheduled" }));
+ rows.append(h("div", { class: "int-empty", text: t("No calls scheduled") }));
}
for (const b of bookings.slice(0, 3)) {
const when = new Date(String(b.start));
- const day = when.toLocaleDateString(undefined, { day: "2-digit", month: "2-digit" });
- const time = when.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" });
+ const day = when.toLocaleDateString(language(), { day: "2-digit", month: "2-digit" });
+ const time = when.toLocaleTimeString(language(), { hour: "2-digit", minute: "2-digit" });
rows.append(
h(
"div",
{ class: "int-row" },
dot("#C9956A", 4),
h("span", { class: "int-time", text: `${day} ${time}` }),
- h("span", { class: "int-name", text: String(b.title ?? "Meeting") }),
+ h("span", { class: "int-name", text: String(b.title ?? t("Meeting")) }),
),
);
}
- return h("div", { class: "int-card" }, header("#C9956A", "Cal.com", "Schedule"), rows);
+ return h("div", { class: "int-card" }, header("#C9956A", "Cal.com", t("Schedule")), rows);
}
// ── n8n ───────────────────────────────────────────────────────────────────────
@@ -366,7 +367,7 @@ function n8nCard(task: AgentTask, onDetail: () => void, openSettings: () => void
return h(
"div",
{ class: "int-card" },
- header("#F29B38", "n8n", "Workflow"),
+ header("#F29B38", "n8n", t("Workflow")),
h(
"div",
{ class: "int-actions" },
@@ -378,7 +379,7 @@ function n8nCard(task: AgentTask, onDetail: () => void, openSettings: () => void
onclick: onDetail,
},
dot(accent, 5),
- h("span", { class: "int-name", text: task.steps[0] ?? "Workflow" }),
+ h("span", { class: "int-name", text: task.steps[0] ?? t("Workflow") }),
svg(ICONS.ellipsis, 8),
),
),
@@ -397,18 +398,18 @@ function n8nDetail(task: AgentTask, onBack: () => void): HTMLElement {
{ class: "int-detail-head" },
h("button", { class: "int-back", onclick: onBack }, svg(ICONS.chevronLeft, 10, { stroke: 2.4 })),
dot(accent, 6),
- h("b", { text: task.steps[0] ?? "Workflow" }),
+ h("b", { text: task.steps[0] ?? t("Workflow") }),
h("span", {
class: "int-badge",
style: `color:${accent};background:${accent}24`,
- text: success ? "Success" : "Failed",
+ text: success ? t("Success") : t("Failed"),
}),
),
detail
? h("pre", { class: "int-detail-text", text: detail })
: h("div", {
class: "int-status",
- text: success ? "Completed successfully." : "No error details available.",
+ text: success ? t("Completed successfully.") : t("No error details available."),
}),
);
}
diff --git a/windows/src/views/markdown.ts b/windows/src/views/markdown.ts
index 0501af19..5dcbbde6 100644
--- a/windows/src/views/markdown.ts
+++ b/windows/src/views/markdown.ts
@@ -10,10 +10,11 @@
import { Bridge } from "../core/bridge";
import { h, svg } from "./dom";
import { ICONS } from "./icons";
+import { N_, t } from "../i18n/i18n";
const STRINGS = {
- copy: "Copy",
- copied: "Copied",
+ copy: N_("Copy"),
+ copied: N_("Copied"),
};
export type Block =
@@ -212,17 +213,17 @@ async function writeClipboard(text: string) {
/** Puts the code on the clipboard; the check mark shows for a moment. */
function copyButton(text: string): HTMLElement {
- const btn = h("button", { class: "md-copy", title: STRINGS.copy, "aria-label": STRINGS.copy }, svg(ICONS.copy, 11));
+ const btn = h("button", { class: "md-copy", title: t(STRINGS.copy), "aria-label": t(STRINGS.copy) }, svg(ICONS.copy, 11));
btn.addEventListener("click", async (e) => {
e.stopPropagation();
await writeClipboard(text);
btn.replaceChildren(svg(ICONS.check, 11, { stroke: 2.2 }));
btn.classList.add("done");
- btn.title = STRINGS.copied;
+ btn.title = t(STRINGS.copied);
window.setTimeout(() => {
btn.replaceChildren(svg(ICONS.copy, 11));
btn.classList.remove("done");
- btn.title = STRINGS.copy;
+ btn.title = t(STRINGS.copy);
}, 1500);
});
return btn;
diff --git a/windows/src/views/recap.ts b/windows/src/views/recap.ts
index 7f0a8f16..245aadd6 100644
--- a/windows/src/views/recap.ts
+++ b/windows/src/views/recap.ts
@@ -15,41 +15,36 @@ import {
dayKey, formatCount, formatDuration, weekRangeLabel, type WeeklySummary,
} from "../recap/summary";
import type { ViewActions, ViewHost } from "./views";
+import { onLanguageChange, t, tl, type Msg } from "../i18n/i18n";
-/** User-visible strings, in one place for the translation layer. */
+/** User-visible strings, in the current language (src/i18n). */
const T = {
- title: "Weekly recap",
- noActivity: "No activity last week",
- noActivitySub: "Coucou counts your agent sessions as they happen — check back next Monday.",
- coding: "coding",
- session: "session",
- sessions: "sessions",
- file: "file",
- files: "files",
- lines: "lines",
- commands: "commands",
- topAgent: "Top agent",
- topProject: "Top project",
- busiestDay: "Busiest day",
- longest: "Longest session",
- permissions: "Permissions",
- allowedDenied: (a: number, d: number) => `${a} allowed, ${d} denied`,
- questions: "Questions",
- shareImage: "Share image",
- ok: "OK",
- shareTitle: "Share your week",
- hideProjects: "Hide project names",
- save: "Save image",
- copy: "Copy",
- back: "Back",
- saving: "Saving…",
- savedAs: (name: string) => `Saved as ${name}`,
- showInFolder: "Show in folder",
- copied: "Copied — paste it anywhere.",
- copyUnavailable: "Copying images isn't available here — use Save image.",
+ get title() { return t("Weekly recap"); },
+ get noActivity() { return t("No activity last week"); },
+ get noActivitySub() { return t("Coucou counts your agent sessions as they happen — check back next Monday."); },
+ get coding() { return t("coding"); },
+ get session() { return t("session"); },
+ get sessions() { return t("sessions"); },
+ get file() { return t("file"); },
+ get files() { return t("files"); },
+ get lines() { return t("lines"); },
+ get commands() { return t("commands"); },
+ get topAgent() { return t("Top agent"); },
+ get topProject() { return t("Top project"); },
+ get busiestDay() { return t("Busiest day"); },
+ get longest() { return t("Longest session"); },
+ get permissions() { return t("Permissions"); },
+ allowedDenied: (allowed: number, denied: number) => t("{allowed} allowed, {denied} denied", { allowed, denied }),
+ get questions() { return t("Questions"); },
+ get shareImage() { return t("Share image"); },
+ get ok() { return t("OK"); },
+ get saving() { return t("Saving…"); },
+ savedAs: (name: string) => t("Saved as {name}", { name }),
+ get copied() { return t("Copied — paste it anywhere."); },
+ get copyUnavailable() { return t("Copying images isn't available here — use Save image."); },
};
-function btn(label: string, kind: "primary" | "secondary", onClick: () => void): HTMLButtonElement {
+function btn(label: string | Msg, kind: "primary" | "secondary", onClick: () => void): HTMLButtonElement {
return h("button", { class: `btn ${kind}`, onclick: onClick }, h("span", { text: label }));
}
@@ -80,6 +75,16 @@ export function buildRecap(actions: ViewActions): ViewHost {
let built = -1;
let shareCanvas: HTMLCanvasElement | null = null;
+ /** Share mode's redraw, while it is open: a language change redraws the image. */
+ let redrawShare: (() => void) | null = null;
+
+ // In place: the summary is redrawn in the new language, share mode keeps
+ // its state (its labels follow by themselves) and only redraws the image.
+ onLanguageChange(() => {
+ if (built === -1) return;
+ if (redrawShare) redrawShare();
+ else showSummary();
+ });
function summaryBody(s: WeeklySummary): HTMLElement {
const chips = h("div", { class: "recap-chips" },
@@ -95,7 +100,7 @@ export function buildRecap(actions: ViewActions): ViewHost {
const first: [string, string][] = [];
if (s.topAgent) first.push([T.topAgent, s.topAgent]);
if (s.topProject) first.push([T.topProject, s.topProject]);
- if (s.busiestDay) first.push([T.busiestDay, s.busiestDay]);
+ if (s.busiestDay) first.push([T.busiestDay, t(s.busiestDay)]);
const second: [string, string][] = [];
if (s.longestSessionMinutes > 1) second.push([T.longest, formatDuration(s.longestSessionMinutes)]);
if (s.permissionsAllowed + s.permissionsDenied > 0) {
@@ -128,6 +133,7 @@ export function buildRecap(actions: ViewActions): ViewHost {
}
function showSummary() {
+ redrawShare = null;
clear(card);
card.append(Recap.summary ? summaryBody(Recap.summary) : emptyBody());
}
@@ -163,7 +169,7 @@ export function buildRecap(actions: ViewActions): ViewHost {
clear(status);
});
- const save = btn(T.save, "primary", async () => {
+ const save = btn(tl("Save image"), "primary", async () => {
if (!shareCanvas) return;
save.disabled = true;
say(T.saving);
@@ -172,7 +178,7 @@ export function buildRecap(actions: ViewActions): ViewHost {
const name = path.split(/[\\/]/).pop() ?? path;
say(T.savedAs(name), h("button", {
class: "link-btn recap-link",
- text: T.showInFolder,
+ text: tl("Show in folder"),
onclick: () => void Bridge.recapRevealSaved(),
}));
} catch (err) {
@@ -182,7 +188,7 @@ export function buildRecap(actions: ViewActions): ViewHost {
}
});
- const copy = btn(T.copy, "secondary", async () => {
+ const copy = btn(tl("Copy"), "secondary", async () => {
if (!shareCanvas) return;
say(await copyImage(shareCanvas) ? T.copied : T.copyUnavailable);
});
@@ -191,13 +197,14 @@ export function buildRecap(actions: ViewActions): ViewHost {
card.append(h("div", { class: "stack recap-share" },
thumb,
h("div", { class: "recap-share-side" },
- h("div", { class: "recap-title", text: T.shareTitle }),
- h("div", { class: "settings-row" }, sw, h("span", { text: T.hideProjects })),
- h("div", { class: "actions" }, save, copy, btn(T.back, "secondary", showSummary)),
+ h("div", { class: "recap-title", text: tl("Share your week") }),
+ h("div", { class: "settings-row" }, sw, h("span", { text: tl("Hide project names") })),
+ h("div", { class: "actions" }, save, copy, btn(tl("Back"), "secondary", showSummary)),
status,
),
));
draw();
+ redrawShare = draw;
}
return {
diff --git a/windows/src/views/upload.ts b/windows/src/views/upload.ts
index bb8e1fac..79252edb 100644
--- a/windows/src/views/upload.ts
+++ b/windows/src/views/upload.ts
@@ -7,6 +7,7 @@
import { h, clear } from "./dom";
import { State } from "../core/state";
import type { ViewActions, ViewHost } from "./views";
+import { N_, t, tl } from "../i18n/i18n";
/** Dashed rounded rect drawn as SVG so the dashes can march like on macOS. */
function dashedFrame(): SVGSVGElement {
@@ -29,11 +30,11 @@ function dashedFrame(): SVGSVGElement {
export function buildUpload(): ViewHost {
const frame = dashedFrame();
- const title = h("div", { class: "drop-title", text: "Drop your files here" });
+ const title = h("div", { class: "drop-title", text: tl("Drop your files here") });
const tags = h(
"div",
{ class: "drop-tags" },
- ...["PDF", "Images", "Code", "Docs"].map((t) => h("span", { text: t })),
+ ...[N_("PDF"), N_("Images"), N_("Code"), N_("Docs")].map((chip) => h("span", { text: tl(chip) })),
);
const card = h(
"div",
@@ -70,8 +71,8 @@ export function buildUploading(): ViewHost {
const done = State.uploadProgress >= 0.999;
const pct = Math.round(State.uploadProgress * 100);
label.textContent = done
- ? `✓ ${State.droppedFile?.name ?? "File"}`
- : `Uploading ${State.droppedFile?.name ?? "file"}`;
+ ? `✓ ${State.droppedFile?.name ?? t("File")}`
+ : t("Uploading {name}", { name: State.droppedFile?.name ?? t("file") });
label.classList.toggle("done", done);
percent.textContent = done ? "" : `${pct} %`;
const w = State.uploadProgress * 526;
@@ -85,18 +86,18 @@ export function buildUploading(): ViewHost {
export function buildChoose(actions: ViewActions): ViewHost {
const title = h("div", { class: "title" });
- const sub = h("div", { class: "sub", text: "What do you want to do with it?" });
+ const sub = h("div", { class: "sub", text: tl("What do you want to do with it?") });
const row = h(
"div",
{ class: "actions" },
h("button", {
class: "btn primary",
- text: "Ask a question",
+ text: tl("Ask a question"),
onclick: () => actions.setView("prompt"),
}),
h("button", {
class: "btn secondary",
- text: "Cancel",
+ text: tl("Cancel"),
onclick: () => actions.cancelDrop(),
}),
);
@@ -115,8 +116,8 @@ export function buildChoose(actions: ViewActions): ViewHost {
sync() {
clear(title);
title.append(
- h("b", { text: State.droppedFile?.name ?? "file" }),
- document.createTextNode(" is ready."),
+ h("b", { text: State.droppedFile?.name ?? t("file") }),
+ document.createTextNode(t(" is ready.")),
);
},
};
diff --git a/windows/src/views/usage.ts b/windows/src/views/usage.ts
index 1813f98a..9abc2e0b 100644
--- a/windows/src/views/usage.ts
+++ b/windows/src/views/usage.ts
@@ -18,6 +18,7 @@ import {
import { State } from "../core/state";
import { clear, dot, h, svg } from "./dom";
import { ICONS } from "./icons";
+import { language, tl } from "../i18n/i18n";
/** The Claude pill is in the header: overview, turned on, relay in. */
export function claudePillVisible(): boolean {
@@ -118,7 +119,7 @@ export function buildPlanPill(codex: boolean): PlanPill {
const isOpen = () => State.showingPlanDetail && State.planDetailIsCodex === codex;
const el = h("button", {
class: "plan-pill",
- title: codex ? PLAN_TEXT.codexPillTitle : PLAN_TEXT.claudePillTitle,
+ title: codex ? tl("Codex plan usage") : tl("Claude plan usage"),
onclick: () => {
const open = isOpen();
State.planDetailIsCodex = codex;
@@ -179,7 +180,7 @@ export class PlanCard {
sync(now = Date.now()) {
const codex = State.planDetailIsCodex;
const u = codex ? State.codexPlanUsage : State.planUsage;
- const key = `${codex}|${JSON.stringify(u)}|${Math.floor(now / 30_000)}`;
+ const key = `${language()}|${codex}|${JSON.stringify(u)}|${Math.floor(now / 30_000)}`;
if (key === this.key) return;
this.key = key;
clear(this.el);
diff --git a/windows/src/views/views.ts b/windows/src/views/views.ts
index 7f61e57e..ff429eaf 100644
--- a/windows/src/views/views.ts
+++ b/windows/src/views/views.ts
@@ -21,6 +21,7 @@ import { Bridge } from "../core/bridge";
import { buildRecap } from "./recap";
import { buildWardrobe } from "./wardrobe";
import type { Outfit, OutfitSelection } from "../mochi/wardrobe";
+import { language, t, tl, type Msg } from "../i18n/i18n";
export interface ViewActions {
setView(v: IslandViewName): void;
@@ -68,7 +69,7 @@ function card(wash: Wash, ...children: (Node | string)[]): HTMLElement {
}
function btn(
- label: string,
+ label: string | Msg,
kind: "primary" | "secondary",
onClick: () => void,
kbd?: string,
@@ -100,12 +101,12 @@ function stack(padLeft: number, padRight: number, ...children: Node[]): HTMLElem
// ── Header ────────────────────────────────────────────────────────────────────
export function buildHeader(actions: ViewActions): ViewHost {
- const tabHome = h("button", { class: "tab", title: "Overview", onclick: () => go("overview") }, svg(ICONS.house, 13));
- const tabChat = h("button", { class: "tab", title: "Ask", onclick: () => go("prompt") }, svg(ICONS.bubble, 13));
- const tabDrop = h("button", { class: "tab", title: "Drop", onclick: () => go("upload") }, svg(ICONS.plus, 13));
+ const tabHome = h("button", { class: "tab", title: tl("Overview"), onclick: () => go("overview") }, svg(ICONS.house, 13));
+ const tabChat = h("button", { class: "tab", title: tl("Ask"), onclick: () => go("prompt") }, svg(ICONS.bubble, 13));
+ const tabDrop = h("button", { class: "tab", title: tl("Drop"), onclick: () => go("upload") }, svg(ICONS.plus, 13));
- const gearBtn = h("button", { title: "Settings", onclick: () => go("settings") }, svg(ICONS.gear, 14));
- const soundBtn = h("button", { title: "Mute", onclick: () => actions.toggleSound() }, svg(ICONS.speakerOn, 14));
+ const gearBtn = h("button", { title: tl("Settings"), onclick: () => go("settings") }, svg(ICONS.gear, 14));
+ const soundBtn = h("button", { title: tl("Mute"), onclick: () => actions.toggleSound() }, svg(ICONS.speakerOn, 14));
// Plan usage pills (off by default): before the gear, Claude first, as on the Mac.
const claudePill = buildPlanPill(false);
const codexPill = buildPlanPill(true);
@@ -179,7 +180,7 @@ function buildOverview(actions: ViewActions): ViewHost {
const leftBody = h("div", { class: "left-body" });
const jump = h(
"button",
- { class: "icon-btn jump", title: "Open", onclick: () => actions.openTarget() },
+ { class: "icon-btn jump", title: tl("Open"), onclick: () => actions.openTarget() },
svg(ICONS.arrowUpRight, 8),
);
const left = card(null, leftBody, jump);
@@ -314,7 +315,7 @@ function buildOverview(actions: ViewActions): ViewHost {
who.append(
dot(task.color, 7),
h("span", { class: "name", text: task.name }),
- h("span", { class: "tool", text: sessionSubtitle(task.id) }),
+ h("span", { class: "tool", text: t(sessionSubtitle(task.id)) }),
);
if (task.steps.length > 1) {
who.append(h("span", {
@@ -326,7 +327,7 @@ function buildOverview(actions: ViewActions): ViewHost {
} else if (task) {
const info = State.integrations[task.id];
const key = [
- task.id, detailOpen, task.state, task.steps.join("|"),
+ language(), task.id, detailOpen, task.state, task.steps.join("|"),
info?.loaded, info?.error, info?.configured,
JSON.stringify(info?.data ?? {}),
].join("~");
@@ -417,11 +418,11 @@ function buildEmpty(actions: ViewActions): ViewHost {
h(
"div",
{ style: "display:flex;flex-direction:column;gap:5px" },
- h("div", { class: "title", text: "Nothing running right now." }),
- h("div", { class: "sub", text: "Drop a file or window, or ask me anything." }),
+ h("div", { class: "title", text: tl("Nothing running right now.") }),
+ h("div", { class: "sub", text: tl("Drop a file or window, or ask me anything.") }),
),
h("div", { class: "grow" }),
- btn("Ask Claude", "primary", () => actions.setView("prompt")),
+ btn(tl("Ask Claude"), "primary", () => actions.setView("prompt")),
);
return { el: h("div", { class: "view" }, card(null, body)), sync() {} };
}
@@ -439,7 +440,7 @@ const CLICK_GUARD_MS = 600;
function foldButton(actions: ViewActions): HTMLElement {
return h(
"button",
- { class: "icon-btn fold", title: "Later — keep it waiting", onclick: () => actions.foldApproval() },
+ { class: "icon-btn fold", title: tl("Later — keep it waiting"), onclick: () => actions.foldApproval() },
svg(ICONS.chevronUp, 8, { stroke: 2.4 }),
);
}
@@ -469,7 +470,7 @@ function buildApproval(actions: ViewActions): ViewHost {
shownAt = performance.now();
}
clear(who);
- who.append(agentWho(State.focusTask, "needs permission"));
+ who.append(agentWho(State.focusTask, t("needs permission")));
// The whole point of approving here rather than in the terminal: this line
// is the command, the file path or the URL being authorised, not just the
// name of the tool asking.
@@ -481,8 +482,8 @@ function buildApproval(actions: ViewActions): ViewHost {
rowKey = "built";
clear(row);
row.append(
- btn("Deny", "secondary", guarded("deny"), "N"),
- btn("Allow", "primary", guarded("allow"), "Y"),
+ btn(tl("Deny"), "secondary", guarded("deny"), "N"),
+ btn(tl("Allow"), "primary", guarded("allow"), "Y"),
);
},
};
@@ -525,13 +526,13 @@ function buildQuestion(actions: ViewActions): ViewHost {
// A question that arrived as a notification has nothing to pick from.
if (!questions) {
- who.append(agentWho(State.focusTask, "is asking a question"));
+ who.append(agentWho(State.focusTask, t("is asking a question")));
const task = State.focusTask;
- title.textContent = (task && lastTextStep(task.steps)) ?? "Claude needs an answer.";
+ title.textContent = (task && lastTextStep(task.steps)) ?? t("Claude needs an answer.");
if (rowKey !== "terminal") {
rowKey = "terminal";
clear(row);
- row.append(h("div", { class: "sub", text: "Answer it in your terminal." }));
+ row.append(h("div", { class: "sub", text: tl("Answer it in your terminal.") }));
}
return;
}
@@ -543,8 +544,10 @@ function buildQuestion(actions: ViewActions): ViewHost {
picked = new Set();
}
const q = questions[Math.min(index, questions.length - 1)];
- const step = questions.length > 1 ? ` (${index + 1} of ${questions.length})` : "";
- who.append(agentWho(State.focusTask, `is asking${step}`));
+ const asking = questions.length > 1
+ ? t("is asking ({index} of {total})", { index: index + 1, total: questions.length })
+ : t("is asking");
+ who.append(agentWho(State.focusTask, asking));
title.textContent = q.question;
title.title = q.question;
@@ -567,7 +570,7 @@ function buildQuestion(actions: ViewActions): ViewHost {
row.append(button);
}
if (q.multiSelect) {
- const done = btn("Done", "primary", () => {
+ const done = btn(tl("Done"), "primary", () => {
if (picked.size > 0) next(q.question, [...picked], questions.length);
});
if (picked.size === 0) done.classList.add("off");
@@ -577,7 +580,7 @@ function buildQuestion(actions: ViewActions): ViewHost {
h("button", {
class: "link-btn",
style: "color:#8e939c",
- text: "Answer in terminal",
+ text: tl("Answer in terminal"),
onclick: () => actions.answerInTerminal(),
}),
);
@@ -589,11 +592,11 @@ function buildQuestion(actions: ViewActions): ViewHost {
function buildError(actions: ViewActions): ViewHost {
const who = h("div");
- const title = h("div", { class: "title", text: "Workflow stopped." });
+ const title = h("div", { class: "title" });
const detail = h("div", { class: "detail" });
const row = h("div", { class: "actions" },
- btn("Retry", "primary", () => actions.setView(State.defaultView())),
- btn("Open in n8n", "secondary", () => actions.openUrl("")),
+ btn(tl("Retry"), "primary", () => actions.setView(State.defaultView())),
+ btn(tl("Open in n8n"), "secondary", () => actions.openUrl("")),
);
const el = h("div", { class: "view" }, card("red", stack(116, 16, who, title, detail, row)));
return {
@@ -602,10 +605,10 @@ function buildError(actions: ViewActions): ViewHost {
const task = State.focusTask;
clear(who);
// agentWho already shows an agent's name: its label is just the kind.
- const whoLabel = task?.source === "n8n" ? "n8n" : task?.source === "agent" ? "Agent" : "Claude Code";
+ const whoLabel = task?.source === "n8n" ? "n8n" : task?.source === "agent" ? t("Agent") : "Claude Code";
who.append(agentWho(task, whoLabel));
- title.textContent = task?.source === "n8n" ? "Workflow stopped." : "Session stopped on an error.";
- detail.textContent = (task && lastTextStep(task.steps)) ?? "No detail available.";
+ title.textContent = task?.source === "n8n" ? t("Workflow stopped.") : t("Session stopped on an error.");
+ detail.textContent = (task && lastTextStep(task.steps)) ?? t("No detail available.");
},
};
}
@@ -615,10 +618,10 @@ function buildError(actions: ViewActions): ViewHost {
function buildFinished(actions: ViewActions): ViewHost {
const who = h("div");
const title = h("div", { class: "title one-line" });
- const open = btn("Open terminal", "primary", () => actions.openTerminal());
+ const open = btn(tl("Open terminal"), "primary", () => actions.openTerminal());
const row = h("div", { class: "actions" },
open,
- btn("OK", "secondary", () => actions.collapse()),
+ btn(tl("OK"), "secondary", () => actions.collapse()),
);
const el = h("div", { class: "view" }, card("green", stack(116, 16, who, title, row)));
return {
@@ -626,12 +629,12 @@ function buildFinished(actions: ViewActions): ViewHost {
sync() {
clear(who);
const agent = State.focusTask?.source === "agent";
- who.append(agentWho(State.focusTask, agent ? "finished" : "Claude Code finished"));
+ who.append(agentWho(State.focusTask, agent ? t("finished") : t("Claude Code finished")));
// The final message, else the last step that is not a diff (FinishedView).
const task = State.focusTask;
- title.textContent = task?.finalLine || (task && lastTextStep(task.steps)) || "Session finished";
+ title.textContent = task?.finalLine || (task && lastTextStep(task.steps)) || t("Session finished");
// Sessions from the Claude desktop app live there, not in a terminal.
- const label = task?.id === "agent_claude-desktop" ? "Open Claude" : "Open terminal";
+ const label = task?.id === "agent_claude-desktop" ? t("Open Claude") : t("Open terminal");
const span = open.firstElementChild as HTMLElement;
if (span.textContent !== label) span.textContent = label;
},
@@ -644,8 +647,8 @@ function buildConfused(): ViewHost {
const body = h(
"div",
{ class: "stack", style: "padding:0 18px 0 128px" },
- h("div", { class: "title", text: "Too many hits at once." }),
- h("div", { class: "sub", text: "Give me a sec — back to work in three seconds." }),
+ h("div", { class: "title", text: tl("Too many hits at once.") }),
+ h("div", { class: "sub", text: tl("Give me a sec — back to work in three seconds.") }),
);
return { el: h("div", { class: "view" }, card("pink", body)), sync() {} };
}
@@ -681,7 +684,7 @@ function buildSettings(actions: ViewActions): ViewHost {
const rows = h(
"div",
{ class: "settings-rows" },
- h("div", { class: "settings-row" }, soundSwitch, h("span", { text: "Sound" }), volume),
+ h("div", { class: "settings-row" }, soundSwitch, h("span", { text: tl("Sound") }), volume),
h(
"div",
{ class: "settings-row" },
@@ -698,7 +701,7 @@ function buildSettings(actions: ViewActions): ViewHost {
h("button", {
class: "link-btn",
style: "color:#8e939c;font-size:11.5px",
- text: "Settings…",
+ text: tl("Settings…"),
onclick: () => actions.openSettingsWindow(),
}),
),
@@ -714,7 +717,7 @@ function buildSettings(actions: ViewActions): ViewHost {
soundSwitch.classList.toggle("on", s.soundEnabled);
volume.value = String(s.soundVolume);
volume.style.opacity = s.soundEnabled ? "1" : "0.4";
- autoLabel.textContent = `Auto-close · ${Math.round(s.autoCloseInterval)}s`;
+ autoLabel.textContent = t("Auto-close · {seconds}s", { seconds: Math.round(s.autoCloseInterval) });
segButtons.forEach((b, i) => b.classList.toggle("on", s.autoCloseInterval === [10, 15, 30][i]));
clear(claudeBadge);
claudeBadge.append(
@@ -729,7 +732,7 @@ function buildSettings(actions: ViewActions): ViewHost {
// ── Placeholders filled in later stages ───────────────────────────────────────
-function buildPlaceholder(title: string, sub: string): ViewHost {
+function buildPlaceholder(title: Msg, sub: string): ViewHost {
const body = h(
"div",
{ class: "stack", style: "padding:0 18px 0 118px" },
@@ -762,8 +765,8 @@ export function buildViews(
map.set("recap", buildRecap(actions));
map.set("wardrobe", buildWardrobe(actions));
// Not in the Windows v1: sending a file by email, window attach + web result.
- map.set("mail", buildPlaceholder("Sending by email isn't in this version.", ""));
- map.set("searching", buildPlaceholder("Claude is searching…", ""));
- map.set("result", buildPlaceholder("Result", ""));
+ map.set("mail", buildPlaceholder(tl("Sending by email isn't in this version."), ""));
+ map.set("searching", buildPlaceholder(tl("Claude is searching…"), ""));
+ map.set("result", buildPlaceholder(tl("Result"), ""));
return map;
}
diff --git a/windows/src/views/wardrobe.ts b/windows/src/views/wardrobe.ts
index 4c9a61e5..2395804e 100644
--- a/windows/src/views/wardrobe.ts
+++ b/windows/src/views/wardrobe.ts
@@ -6,10 +6,11 @@ import { h } from "./dom";
import { State } from "../core/state";
import { drawWardrobeIcon } from "../mochi/outfits";
import {
- OUTFIT_LABELS, OUTFIT_SELECTIONS, WARDROBE_STRINGS, parseOutfit, resolveOutfit, seasonalOutfit,
+ OUTFIT_KEYS, OUTFIT_SELECTIONS, WARDROBE_STRINGS, parseOutfit, resolveOutfit, seasonalOutfit,
wardrobeHeader, type Outfit, type OutfitSelection,
} from "../mochi/wardrobe";
import type { ViewActions, ViewHost } from "./views";
+import { language, tl } from "../i18n/i18n";
const ICON = 28;
@@ -25,7 +26,7 @@ export function buildWardrobe(actions: ViewActions): ViewHost {
h(
"div",
{ class: "stack wardrobe-stack" },
- h("div", { class: "wardrobe-head" }, h("span", { class: "wardrobe-title", text: WARDROBE_STRINGS.title }), note),
+ h("div", { class: "wardrobe-head" }, h("span", { class: "wardrobe-title", text: tl("Wardrobe") }), note),
grid,
),
),
@@ -33,6 +34,7 @@ export function buildWardrobe(actions: ViewActions): ViewHost {
let hovered: OutfitSelection | null = null;
let drawnSeason: Outfit | null = null;
+ let drawnLanguage = language();
const items = new Map<OutfitSelection, { button: HTMLButtonElement; canvas: HTMLCanvasElement }>();
const updateNote = () => {
@@ -43,7 +45,7 @@ export function buildWardrobe(actions: ViewActions): ViewHost {
const canvas = h("canvas");
const button = h(
"button",
- { class: "wardrobe-item", title: OUTFIT_LABELS[sel], "aria-label": OUTFIT_LABELS[sel] },
+ { class: "wardrobe-item", title: tl(OUTFIT_KEYS[sel]), "aria-label": tl(OUTFIT_KEYS[sel]) },
canvas,
);
button.addEventListener("mouseenter", () => {
@@ -62,12 +64,13 @@ export function buildWardrobe(actions: ViewActions): ViewHost {
grid.append(button);
}
- /** Icons are drawn once; only "auto" changes, with the season. */
+ /** Icons are drawn once; only "auto" changes, with the season and its badge's language. */
const drawIcons = () => {
const season = seasonalOutfit(new Date());
- if (season === drawnSeason) return;
+ if (season === drawnSeason && drawnLanguage === language()) return;
const first = drawnSeason == null;
drawnSeason = season;
+ drawnLanguage = language();
const dpr = Math.min(2, window.devicePixelRatio || 1);
for (const [sel, { canvas }] of items) {
if (!first && sel !== "auto") continue;
diff --git a/windows/tests/diff.test.mjs b/windows/tests/diff.test.mjs
index fc558e1b..05905934 100644
--- a/windows/tests/diff.test.mjs
+++ b/windows/tests/diff.test.mjs
@@ -131,7 +131,7 @@ test("makeDiffStep / parseDiffStep round-trip", () => {
});
test("lastTextStep skips diff markers", () => {
- assert.equal(lastTextStep(["Lit · a.ts", makeDiffStep("a.ts", 1, 0, 1)]), "Lit · a.ts");
+ assert.equal(lastTextStep(["Reads · a.ts", makeDiffStep("a.ts", 1, 0, 1)]), "Reads · a.ts");
assert.equal(lastTextStep([makeDiffStep("a.ts", 1, 0, 1)]), undefined);
assert.equal(lastTextStep([]), undefined);
});
diff --git a/windows/tests/hooks.test.mjs b/windows/tests/hooks.test.mjs
index c4fddb66..ce9f49d1 100644
--- a/windows/tests/hooks.test.mjs
+++ b/windows/tests/hooks.test.mjs
@@ -102,12 +102,12 @@ test("a tool call shows as working, labelled with what it acts on", () => {
hook({ hook_event_name: "PreToolUse", cwd: "/p", tool_name, tool_input });
return task().steps.at(-1);
};
- assert.equal(step("Bash", { command: "npm run build" }), "Exécute · npm run build");
+ assert.equal(step("Bash", { command: "npm run build" }), "Runs · npm run build");
assert.equal(task().state, "working");
- assert.equal(step("Bash", { command: "c".repeat(50) }), `Exécute · ${"c".repeat(40)}`);
- assert.equal(step("Read", { file_path: "C:\\Users\\me\\proj\\.env" }), "Lit · .env");
- assert.equal(step("Grep", { pattern: "x", path: "src/island/" }), "Recherche · island");
- assert.equal(step("WebSearch", { query: "tauri" }), "Recherche web · tauri");
+ assert.equal(step("Bash", { command: "c".repeat(50) }), `Runs · ${"c".repeat(40)}`);
+ assert.equal(step("Read", { file_path: "C:\\Users\\me\\proj\\.env" }), "Reads · .env");
+ assert.equal(step("Grep", { pattern: "x", path: "src/island/" }), "Searches · island");
+ assert.equal(step("WebSearch", { query: "tauri" }), "Searches the web · tauri");
assert.equal(step("Foo", {}), "Foo");
assert.equal(step(undefined, undefined), "Tool");
});
@@ -117,7 +117,7 @@ test("only the last 20 steps are kept", () => {
hook({ hook_event_name: "PreToolUse", cwd: "/p", tool_name: "Bash", tool_input: { command: `c${i}` } });
}
assert.equal(task().steps.length, 20);
- assert.equal(task().steps.at(-1), "Exécute · c24");
+ assert.equal(task().steps.at(-1), "Runs · c24");
assert.equal(task().stepIndex, 19);
});
@@ -214,7 +214,7 @@ test("a tagged agent gets its own pill next to Claude Code's", () => {
assert.equal(agent.name, "Gemini CLI");
assert.equal(agent.source, "agent");
assert.equal(agent.state, "working");
- assert.deepEqual(agent.steps, ["Exécute · ls"]);
+ assert.deepEqual(agent.steps, ["Runs · ls"]);
assert.match(agent.color, /^#[0-9A-F]{6}$/);
// Claude Code's own pill is not the one that moved.
assert.equal(task().name, "VS Code");