Skip to content

Commit ffb132b

Browse files
hoangsonwwclaude
andcommitted
fix(i18n): pluralize the collapsed subagent-count badge
The agent-tree "N subagent" badge on the Dashboard rendered t("common:subagent", { count }) — but common:subagent is a flat word, not an i18next plural key (no _one/_other), so the count never selected a plural and it always read "2 subagent", "5 subagent", etc. Use common:subagent_label (which already has _one/_other and embeds the count) — the same key SessionDetail's badge uses — so both surfaces read "1 subagent" / "2 subagents" consistently. Add an i18n test locking the plural forms for common:subagent_label and kanban:session.subagentSummary. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 697cbcd commit ffb132b

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

client/src/i18n/__tests__/i18n.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,17 @@ describe("i18n resources", () => {
3232
expect(i18n.resolvedLanguage?.startsWith("vi")).toBe(true);
3333
expect(i18n.t("nav:dashboard")).toBe("Tổng quan");
3434
});
35+
36+
it("pluralizes the subagent count labels in English", async () => {
37+
await i18n.changeLanguage("en");
38+
// The collapsed agent-tree badge (Dashboard) and SessionDetail both render
39+
// this key with a count. It MUST use i18next plural forms (_one/_other) so
40+
// "2 subagent" never shows — the flat common:subagent word is not a plural
41+
// key and rendering it with a count is the bug this guards against.
42+
expect(i18n.t("common:subagent_label", { count: 1 })).toBe("1 subagent");
43+
expect(i18n.t("common:subagent_label", { count: 2 })).toBe("2 subagents");
44+
// The main-agent card subtitle carries its own kanban plural key.
45+
expect(i18n.t("kanban:session.subagentSummary", { count: 1 })).toBe("1 subagent");
46+
expect(i18n.t("kanban:session.subagentSummary", { count: 3 })).toBe("3 subagents");
47+
});
3548
});

client/src/pages/Dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ export function Dashboard() {
13101310
}
13111311
className="ml-7 mt-1 text-[11px] text-violet-400 hover:text-violet-300 transition-colors"
13121312
>
1313-
{totalDesc} {t("common:subagent", { count: totalDesc })}
1313+
{t("common:subagent_label", { count: totalDesc })}
13141314
{activeDesc > 0 && (
13151315
<span className="text-emerald-400 ml-1">
13161316
({activeDesc} {t("common:active")})

0 commit comments

Comments
 (0)