🙌 OpenHands: AI-Driven Development
refactor: rename top-level nav labels for clearer copy (#578)
Hiep Le3e28cb1bbed7
diff --git a/__tests__/components/features/sidebar/sidebar.test.tsx b/__tests__/components/features/sidebar/sidebar.test.tsxindex 3c0663b61c..711089fd58 100644--- a/__tests__/components/features/sidebar/sidebar.test.tsx+++ b/__tests__/components/features/sidebar/sidebar.test.tsx@@ -6,6 +6,27 @@ import {NavigationProvider,type NavigationContextValue,} from "#/context/navigation-context";+import translations from "#/i18n/translation.json";++// The global `useTranslation` mock in `vitest.setup.ts` returns the key+// as-is. Override it here so `t(...)` resolves keys via the source-of-truth+// `translation.json` (English values), letting the test assert real+// user-facing labels rather than raw keys.+vi.mock("react-i18next", async () => {+ const actual = await vi.importActual("react-i18next");+ return {+ ...(actual as object),+ useTranslation: () => ({+ t: (key: string) => {+ const entry = (+ translations as Record<string, Record<string, string>>+ )[key];+ return entry?.en ?? key;+ },+ i18n: { language: "en", exists: () => false },+ }),+ };+});vi.mock("#/hooks/query/use-config", () => ({useConfig: () => ({ data: { feature_flags: {} } }),@@ -374,4 +395,20 @@ describe("Sidebar", () => {expect(link.querySelector("svg")).not.toBeNull();}});++ it("renders the renamed top-level nav labels", () => {+ // Arrange+ renderSidebar("/conversations");++ // Act + Assert: each top-level nav link surfaces its new user-facing label.+ expect(screen.getByTestId("sidebar-conversations-link")).toHaveTextContent(+ "Code",+ );+ expect(screen.getByTestId("sidebar-skills-link")).toHaveTextContent(+ "Customize",+ );+ expect(screen.getByTestId("sidebar-automations-link")).toHaveTextContent(+ "Automate",+ );+ });});diff --git a/src/components/features/sidebar/sidebar.tsx b/src/components/features/sidebar/sidebar.tsxindex 269dd77d3a..0fe8a658a3 100644--- a/src/components/features/sidebar/sidebar.tsx+++ b/src/components/features/sidebar/sidebar.tsx@@ -272,7 +272,7 @@ export function Sidebar() {<SidebarNavLinkto="/conversations"end- label="New"+ label="Code"testId="sidebar-conversations-link"disabled={linkDisabled}collapsed={collapsed}@@ -280,7 +280,7 @@ export function Sidebar() {/><SidebarNavLinkto="/skills"- label="Extensions"+ label="Customize"testId="sidebar-skills-link"disabled={linkDisabled}collapsed={collapsed}diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex 815aefb3b3..f6b936f141 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -11050,21 +11050,21 @@"ca": "Privat"},"SIDEBAR$AUTOMATIONS": {- "en": "Automations",- "zh-CN": "自动化",- "zh-TW": "自動化",- "de": "Automatisierungen",- "ko-KR": "자동화",- "no": "Automatiseringer",- "it": "Automazioni",- "pt": "Automatizações",- "es": "Automatizaciones",- "ar": "الأتمتة",- "fr": "Automatisations",- "tr": "Otomasyonlar",- "ja": "自動化",- "uk": "Автоматизації",- "ca": "Automatitzacions"+ "en": "Automate",+ "zh-CN": "Automate",+ "zh-TW": "Automate",+ "de": "Automate",+ "ko-KR": "Automate",+ "no": "Automate",+ "it": "Automate",+ "pt": "Automate",+ "es": "Automate",+ "ar": "Automate",+ "fr": "Automate",+ "tr": "Automate",+ "ja": "Automate",+ "uk": "Automate",+ "ca": "Automate"},"AUTOMATIONS$TITLE": {"en": "Automations",