diff --git a/apps/studio/src/components/content-tab-overview.tsx b/apps/studio/src/components/content-tab-overview.tsx index e1eda39410..7984a7bf2d 100644 --- a/apps/studio/src/components/content-tab-overview.tsx +++ b/apps/studio/src/components/content-tab-overview.tsx @@ -20,8 +20,8 @@ import { ArrowIcon } from 'src/components/arrow-icon'; import { ButtonsSection, ButtonsSectionProps } from 'src/components/buttons-section'; import { useSiteDetails } from 'src/hooks/use-site-details'; import { useThemeDetails } from 'src/hooks/use-theme-details'; -import { isWindows } from 'src/lib/app-globals'; import { cx } from 'src/lib/cx'; +import { getFileManagerLabel } from 'src/lib/file-manager'; import { getIpcApi } from 'src/lib/get-ipc-api'; import { supportedEditorConfig } from 'src/modules/user-settings/lib/editor'; import { getTerminalName } from 'src/modules/user-settings/lib/terminal'; @@ -140,11 +140,7 @@ function ShortcutsSection( { selectedSite }: Pick< ContentTabOverviewProps, 'sel const buttonsArray: ButtonsSectionProps[ 'buttonsArray' ] = [ { - label: isWindows() - ? // translators: name of app used to navigate files and folders on Windows - __( 'File Explorer' ) - : // translators: name of app used to navigate files and folders on macOS - __( 'Finder' ), + label: getFileManagerLabel(), className: 'text-nowrap', icon: archive, onClick: () => { diff --git a/apps/studio/src/components/site-menu.tsx b/apps/studio/src/components/site-menu.tsx index 08f79f7b06..626d9698cf 100644 --- a/apps/studio/src/components/site-menu.tsx +++ b/apps/studio/src/components/site-menu.tsx @@ -9,8 +9,9 @@ import { useContentTabs } from 'src/hooks/use-content-tabs'; import { useDeleteSite } from 'src/hooks/use-delete-site'; import { useImportExport } from 'src/hooks/use-import-export'; import { useSiteDetails } from 'src/hooks/use-site-details'; -import { isMac, isWindows } from 'src/lib/app-globals'; +import { isMac } from 'src/lib/app-globals'; import { cx } from 'src/lib/cx'; +import { getFileManagerLabel } from 'src/lib/file-manager'; import { getIpcApi } from 'src/lib/get-ipc-api'; import { supportedEditorConfig } from 'src/modules/user-settings/lib/editor'; import { getTerminalName } from 'src/modules/user-settings/lib/terminal'; @@ -188,7 +189,7 @@ function SiteItem( { const isLoading = loadingServer[ site.id ] || false; const isAddingSite = site.isAddingSite || false; const isAnySiteAdding = sites.some( ( s ) => s.isAddingSite ); - const finderLabel = isWindows() ? __( 'File Explorer' ) : __( 'Finder' ); + const finderLabel = getFileManagerLabel(); const editorLabel = editor && supportedEditorConfig[ editor ] ? supportedEditorConfig[ editor ].label : null; const terminalLabel = getTerminalName( terminal ); diff --git a/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx b/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx index 8f6c64b83c..f6164c8130 100644 --- a/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx +++ b/apps/studio/src/components/tests/content-tab-overview-shortcuts-section.test.tsx @@ -18,6 +18,9 @@ vi.mock( 'src/lib/app-globals', () => ( { platform: 'darwin', } ) ), } ) ); +vi.mock( 'src/lib/file-manager', () => ( { + getFileManagerLabel: vi.fn().mockReturnValue( 'Finder' ), +} ) ); const selectedSite: StartedSiteDetails = { name: 'Test Site', diff --git a/apps/studio/src/components/tests/content-tab-overview.test.tsx b/apps/studio/src/components/tests/content-tab-overview.test.tsx index 1489d8e76d..243aae8c67 100644 --- a/apps/studio/src/components/tests/content-tab-overview.test.tsx +++ b/apps/studio/src/components/tests/content-tab-overview.test.tsx @@ -14,6 +14,9 @@ vi.mock( 'src/lib/app-globals', () => ( { isLinux: vi.fn().mockReturnValue( false ), getAppGlobals: vi.fn( () => ( { platform: 'darwin' } ) ), } ) ); +vi.mock( 'src/lib/file-manager', () => ( { + getFileManagerLabel: vi.fn().mockReturnValue( 'Finder' ), +} ) ); vi.mock( 'src/hooks/use-site-details' ); vi.mock( 'src/hooks/use-theme-details' ); vi.mock( 'src/lib/get-ipc-api', () => ( { diff --git a/apps/studio/src/lib/file-manager.ts b/apps/studio/src/lib/file-manager.ts new file mode 100644 index 0000000000..1c671a8b6d --- /dev/null +++ b/apps/studio/src/lib/file-manager.ts @@ -0,0 +1,15 @@ +import { __ } from '@wordpress/i18n'; +import { isLinux, isWindows } from 'src/lib/app-globals'; + +export function getFileManagerLabel(): string { + if ( isWindows() ) { + // translators: name of app used to navigate files and folders on Windows + return __( 'File Explorer' ); + } + if ( isLinux() ) { + // translators: generic name of the app used to navigate files and folders on Linux + return __( 'File Manager' ); + } + // translators: name of app used to navigate files and folders on macOS + return __( 'Finder' ); +}