From 6c1580aebad6c0bf12637b5c8d45eb5d12fe7e16 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Thu, 10 Sep 2026 21:42:05 -0700 Subject: [PATCH] i18n: Make file reveal labels translatable (#20010) Convert hardcoded "Reveal in Finder", "Reveal in File Explorer", and "Open Containing Folder" labels to use i18n.translate() in three menu components. Add corresponding English locale entries so these platform-specific labels are now part of the translation system instead of untranslated strings. Co-authored-by: m4air --- .../editor/EditorPanelHeaderPath.tsx | 20 +++++++++++----- .../file-explorer-row-context-menu.tsx | 20 +++++++++++----- .../tab-bar/EditorFileTabContextMenu.tsx | 23 ++++++++++++++----- src/renderer/src/i18n/locales/en.json | 15 +++++++++--- 4 files changed, 57 insertions(+), 21 deletions(-) diff --git a/src/renderer/src/components/editor/EditorPanelHeaderPath.tsx b/src/renderer/src/components/editor/EditorPanelHeaderPath.tsx index f1d0ae5e7b6..eaa5db71209 100644 --- a/src/renderer/src/components/editor/EditorPanelHeaderPath.tsx +++ b/src/renderer/src/components/editor/EditorPanelHeaderPath.tsx @@ -20,11 +20,19 @@ const isMac = navigator.userAgent.includes('Mac') const isLinux = navigator.userAgent.includes('Linux') /** Platform-appropriate label: macOS -> Finder, Windows -> File Explorer, Linux -> Files */ -const revealLabel = isMac - ? 'Reveal in Finder' - : isLinux - ? 'Open Containing Folder' - : 'Reveal in File Explorer' +function getRevealLabel(): string { + return isMac + ? translate('auto.components.editor.EditorPanelHeader.revealInFinder', 'Reveal in Finder') + : isLinux + ? translate( + 'auto.components.editor.EditorPanelHeader.openContainingFolder', + 'Open Containing Folder' + ) + : translate( + 'auto.components.editor.EditorPanelHeader.revealInFileExplorer', + 'Reveal in File Explorer' + ) +} type EditorPanelHeaderPathProps = { activeFile: OpenFile @@ -196,7 +204,7 @@ export function EditorPanelHeaderPath({ {!isVirtualEditorTab && ( - {revealLabel} + {getRevealLabel()} )} diff --git a/src/renderer/src/components/right-sidebar/file-explorer-row-context-menu.tsx b/src/renderer/src/components/right-sidebar/file-explorer-row-context-menu.tsx index d669b53bf79..a9be313a436 100644 --- a/src/renderer/src/components/right-sidebar/file-explorer-row-context-menu.tsx +++ b/src/renderer/src/components/right-sidebar/file-explorer-row-context-menu.tsx @@ -43,11 +43,19 @@ const isMac = navigator.userAgent.includes('Mac') const isLinux = navigator.userAgent.includes('Linux') /** Platform-appropriate label: macOS → Finder, Windows → File Explorer, Linux → Files */ -const revealLabel = isMac - ? 'Reveal in Finder' - : isLinux - ? 'Open Containing Folder' - : 'Reveal in File Explorer' +function getRevealLabel(): string { + return isMac + ? translate('auto.components.right.sidebar.FileExplorerRow.revealInFinder', 'Reveal in Finder') + : isLinux + ? translate( + 'auto.components.right.sidebar.FileExplorerRow.openContainingFolder', + 'Open Containing Folder' + ) + : translate( + 'auto.components.right.sidebar.FileExplorerRow.revealInFileExplorer', + 'Reveal in File Explorer' + ) +} function stopRightButtonMenuSelection(event: React.PointerEvent): void { if (event.button !== 2) { @@ -290,7 +298,7 @@ export function FileExplorerRowContextMenu({ }} > - {revealLabel} + {getRevealLabel()} onStartRename(node)}> diff --git a/src/renderer/src/components/tab-bar/EditorFileTabContextMenu.tsx b/src/renderer/src/components/tab-bar/EditorFileTabContextMenu.tsx index 1813265573f..a6df437feac 100644 --- a/src/renderer/src/components/tab-bar/EditorFileTabContextMenu.tsx +++ b/src/renderer/src/components/tab-bar/EditorFileTabContextMenu.tsx @@ -32,11 +32,22 @@ const isMac = navigator.userAgent.includes('Mac') const isLinux = navigator.userAgent.includes('Linux') /** Platform-appropriate label: macOS → Finder, Windows → File Explorer, Linux → Files */ -const revealLabel = isMac - ? 'Reveal in Finder' - : isLinux - ? 'Open Containing Folder' - : 'Reveal in File Explorer' +function getRevealLabel(): string { + return isMac + ? translate( + 'auto.components.tab.bar.EditorFileTabContextMenu.revealInFinder', + 'Reveal in Finder' + ) + : isLinux + ? translate( + 'auto.components.tab.bar.EditorFileTabContextMenu.openContainingFolder', + 'Open Containing Folder' + ) + : translate( + 'auto.components.tab.bar.EditorFileTabContextMenu.revealInFileExplorer', + 'Reveal in File Explorer' + ) +} type EditorFileTabContextMenuProps = { open: boolean @@ -251,7 +262,7 @@ export function EditorFileTabContextMenu({ }} > - {revealLabel} + {getRevealLabel()} diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index 607359d1b71..fb1f37eab9b 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -3368,7 +3368,10 @@ "1d04b1630b": "Split Down", "6b3efb106e": "Split Up", "fdd29eb669": "Pin Tab", - "8e9d603a09": "Unpin Tab" + "8e9d603a09": "Unpin Tab", + "revealInFinder": "Reveal in Finder", + "openContainingFolder": "Open Containing Folder", + "revealInFileExplorer": "Reveal in File Explorer" }, "QuickLaunchButton": { "348a04c1ad": "Agent settings…", @@ -11976,7 +11979,10 @@ "3161c4e425": "folder", "e887fa4b2e": "Open in Terminal", "1d8e182c32": "View File", - "clipboardStagingUnavailable": "Could not copy the file because Orca's temporary storage is unavailable" + "clipboardStagingUnavailable": "Could not copy the file because Orca's temporary storage is unavailable", + "revealInFinder": "Reveal in Finder", + "openContainingFolder": "Open Containing Folder", + "revealInFileExplorer": "Reveal in File Explorer" }, "FileExplorerToolbar": { "d238264654": "Show Git Ignored Files", @@ -14676,7 +14682,10 @@ "f0fd4174b5": "Open file tab to use rich markdown editing", "a10d9b8337": "Open file", "2076ecfc9c": "Previous change", - "631dab0df3": "Next change" + "631dab0df3": "Next change", + "revealInFinder": "Reveal in Finder", + "openContainingFolder": "Open Containing Folder", + "revealInFileExplorer": "Reveal in File Explorer" }, "EditorPanelMarkdownActionsMenu": { "3e0ce48c24": "Export as PDF",